PageSourceSearch

https://book-ride-boost.vercel.app/assets/mapbox-gl-DpyFTrpZ.js

js book-ride-boost.vercel.app collected 2026-10-03 06:18:13 UTC 1,603,377 bytes, 2,767 lines download raw bytes

vendor: 6,010 bytes, line 1
1import{Z as Eb,o as Ib}from"./index-_uwZnhMi.js";var W0={exports:{}};(function(Y0,Mb){(function(sh,ah){Y0.exports=ah()})(Eb,function(){var sh,ah,lf;function cf(s,Gr){if(!sh)sh=Gr;else if(!ah)ah=Gr;else{var $i="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 = {}; ("+sh+")(sharedChunk); ("+ah+")(sharedChunk); self.onerror = null;",so={};sh(so),lf=Gr(so),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(lf.workerUrl=window.URL.createObjectURL(new Blob([$i],{type:"text/javascript"})))}}cf(["exports"],function(s){var Gr=1e-6,$i=typeof Float32Array<"u"?Float32Array:Array;function so(r,e){var i=e[0],o=e[1],a=e[2],h=e[3],u=i*h-a*o;return u?(r[0]=h*(u=1/u),r[1]=-o*u,r[2]=-a*u,r[3]=i*u,r):null}function Bl(){var r=new $i(9);return $i!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function ls(r,e){var i=e[0],o=e[1],a=e[2],h=e[3],u=e[4],f=e[5],_=e[6],g=e[7],v=e[8];return r[0]=u*v-f*g,r[1]=a*g-o*v,r[2]=o*f-a*u,r[3]=f*_-h*v,r[4]=i*v-a*_,r[5]=a*h-i*f,r[6]=h*g-u*_,r[7]=o*_-i*g,r[8]=i*u-o*h,r}function Kn(r,e,i){var o=e[0],a=e[1],h=e[2],u=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=i[0],I=i[1],A=i[2],P=i[3],R=i[4],O=i[5],U=i[6],V=i[7],G=i[8];return r[0]=w*o+I*u+A*g,r[1]=w*a+I*f+A*v,r[2]=w*h+I*_+A*b,r[3]=P*o+R*u+O*g,r[4]=P*a+R*f+O*v,r[5]=P*h+R*_+O*b,r[6]=U*o+V*u+G*g,r[7]=U*a+V*f+G*v,r[8]=U*h+V*_+G*b,r}function cs(){var r=new $i(16);return $i!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function Bt(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Jr(r,e){var i=e[0],o=e[1],a=e[2],h=e[3],u=e[4],f=e[5],_=e[6],g=e[7],v=e[8],b=e[9],w=e[10],I=e[11],A=e[12],P=e[13],R=e[14],O=e[15],U=i*f-o*u,V=i*_-a*u,G=i*g-h*u,re=o*_-a*f,Q=o*g-h*f,te=a*g-h*_,ae=v*P-b*A,ce=v*R-w*A,Ee=v*O-I*A,de=b*R-w*P,Ae=b*O-I*P,je=w*O-I*R,Ce=U*je-V*Ae+G*de+re*Ee-Q*ce+te*ae;return Ce?(r[0]=(f*je-_*Ae+g*de)*(Ce=1/Ce),r[1]=(a*Ae-o*je-h*de)*Ce,r[2]=(P*te-R*Q+O*re)*Ce,r[3]=(w*Q-b*te-I*re)*Ce,r[4]=(_*Ee-u*je-g*ce)*Ce,r[5]=(i*je-a*Ee+h*ce)*Ce,r[6]=(R*G-A*te-O*V)*Ce,r[7]=(v*te-w*G+I*V)*Ce,r[8]=(u*Ae-f*Ee+g*ae)*Ce,r[9]=(o*Ee-i*Ae-h*ae)*Ce,r[10]=(A*Q-P*G+O*U)*Ce,r[11]=(b*G-v*Q-I*U)*Ce,r[12]=(f*ce-u*de-_*ae)*Ce,r[13]=(i*de-o*ce+a*ae)*Ce,r[14]=(P*V-A*re-R*U)*Ce,r[15]=(v*re-b*V+w*U)*Ce,r):null}function Gi(r,e,i){var o=e[0],a=e[1],h=e[2],u=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],I=e[10],A=e[11],P=e[12],R=e[13],O=e[14],U=e[15],V=i[0],G=i[1],re=i[2],Q=i[3];return r[0]=V*o+G*f+re*b+Q*P,r[1]=V*a+G*_+re*w+Q*R,r[2]=V*h+G*g+re*I+Q*O,r[3]=V*u+G*v+re*A+Q*U,r[4]=(V=i[4])*o+(G=i[5])*f+(re=i[6])*b+(Q=i[7])*P,r[5]=V*a+G*_+re*w+Q*R,r[6]=V*h+G*g+re*I+Q*O,r[7]=V*u+G*v+re*A+Q*U,r[8]=(V=i[8])*o+(G=i[9])*f+(re=i[10])*b+(Q=i[11])*P,r[9]=V*a+G*_+re*w+Q*R,r[10]=V*h+G*g+re*I+Q*O,r[11]=V*u+G*v+re*A+Q*U,r[12]=(V=i[12])*o+(G=i[13])*f+(re=i[14])*b+(Q=i[15])*P,r[13]=V*a+G*_+re*w+Q*R,r[14]=V*h+G*g+re*I+Q*O,r[15]=V*u+G*v+re*A+Q*U,r}function qr(r,e,i){var o,a,h,u,f,_,g,v,b,w,I,A,P=i[0],R=i[1],O=i[2];return e===r?(r[12]=e[0]*P+e[4]*R+e[8]*O+e[12],r[13]=e[1]*P+e[5]*R+e[9]*O+e[13],r[14]=e[2]*P+e[6]*R+e[10]*O+e[14],r[15]=e[3]*P+e[7]*R+e[11]*O+e[15]):(a=e[1],h=e[2],u=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],I=e[10],A=e[11],r[0]=o=e[0],r[1]=a,r[2]=h,r[3]=u,r[4]=f,r[5]=_,r[6]=g,r[7]=v,r[8]=b,r[9]=w,r[10]=I,r[11]=A,r[12]=o*P+f*R+b*O+e[12],r[13]=a*P+_*R+w*O+e[13],r[14]=h*P+g*R+I*O+e[14],r[15]=u*P+v*R+A*O+e[15]),r}function Fr(r,e,i){var o=i[0],a=i[1],h=i[2];return r[0]=e[0]*o,r[1]=e[1]*o,r[2]=e[2]*o,r[3]=e[3]*o,r[4]=e[4]*a,r[5]=e[5]*a,r[6]=e[6]*a,r[7]=e[7]*a,r[8]=e[8]*h,r[9]=e[9]*h,r[10]=e[10]*h,r[11]=e[11]*h,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function Ao(r,e,i){var o=Math.sin(i),a=Math.cos(i),h=e[4],u=e[5],f=e[6],_=e[7],g=e[8],v=e[9],b=e[10],w=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=h*a+g*o,r[5]=u*a+v*o,r[6]=f*a+b*o,r[7]=_*a+w*o,r[8]=g*a-h*o,r[9]=v*a-u*o,r[10]=b*a-f*o,r[11]=w*a-_*o,r}function ao(r,e,i){var o=Math.sin(i),a=Math.cos(i),h=e[0],u=e[1],f=e[2],_=e[3],g=e[8],v=e[9],b=e[10],w=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=h*a-g*o,r[1]=u*a-v*o,r[2]=f*a-b*o,r[3]=_*a-w*o,r[8]=h*o+g*a,r[9]=u*o+v*a,r[10]=f*o+b*a,r[11]=_*o+w*a,r}function Mo(r,e,i){var o=Math.sin(i),a=Math.cos(i),h=e[0],u=e[1],f=e[2],_=e[3],g=e[4],v=e[5],b=e[6],w=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=h*a+g*o,r[1]=u*a+v*o,r[2]=f*a+b*o,r[3]=_*a+w*o,r[4]=g*a-h*o,r[5]=v*a-u*o,r[6]=b*a-f*o,r[7]=w*a-_*o,r}function Ls(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function qn(r,e,i){var o,a,h,u=i[0],f=i[1],_=i[2],g=Math.hypot(u,f,_);return g<Gr?null:(u*=g=1/g,f*=g,_*=g,o=Math.sin(e),a=Math.cos(e),r[0]=u*u*(h=1-a)+a,r[1]=f*u*h+_*o,r[2]=_*u*h-f*o,r[3]=0,r[4]=u*f*h-_*o,r[5]=f*f*h+a,r[6]=_*f*h+u*o,r[7]=0,r[8]=u*_*h+f*o,r[9]=f*_*h-u*o,r[10]=_*_*h+a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function Co(r,e){var i=e[0],o=e[1],a=e[2],h=e[3],u=i+i,f=o+o,_=a+a,g=i*u,v=o*u,b=o*f,w=a*u,I=a*f,A=a*_,P=h*u,R=h*f,O=h*_;return r[0]=1-b-A,r[1]=v+O,r[2]=w-R,r[3]=0,r[4]=v-O,r[5]=1-g-A,r[6]=I+P,r[7]=0,r[8]=w+R,r[9]=I-P,r[10]=1-g-b,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var Nl=Gi;function ui(){var r=new $i(3);return $i!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Fs(r){var e=new $i(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Cr(r){return Math.hypot(r[0],r[1],r[2])}
1function lr(r,e,i){var o=new $i(3);return o[0]=r,o[1]=e,o[2]=i,o}function nr(r,e,i,o){return r[0]=e,r[1]=i,r[2]=o,r}function ki(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function cn(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r}function Da(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r}function lo(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r}function Ln(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r}function Fi(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function Hr(r,e,i,o){return r[0]=e[0]+i[0]*o,r[1]=e[1]+i[1]*o,r[2]=e[2]+i[2]*o,r}function Os(r,e){var i=e[0]-r[0],o=e[1]-r[1],a=e[2]-r[2];return i*i+o*o+a*a}function Vl(r){var e=r[0],i=r[1],o=r[2];return e*e+i*i+o*o}function Po(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function Ri(r,e){var i=e[0],o=e[1],a=e[2],h=i*i+o*o+a*a;return h>0&&(h=1/Math.sqrt(h)),r[0]=e[0]*h,r[1]=e[1]*h,r[2]=e[2]*h,r}function er(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function cr(r,e,i){var o=e[0],a=e[1],h=e[2],u=i[0],f=i[1],_=i[2];return r[0]=a*_-h*f,r[1]=h*u-o*_,r[2]=o*f-a*u,r}function Qr(r,e,i,o){var a=e[0],h=e[1],u=e[2];return r[0]=a+o*(i[0]-a),r[1]=h+o*(i[1]-h),r[2]=u+o*(i[2]-u),r}function tr(r,e,i){var o=e[0],a=e[1],h=e[2],u=i[3]*o+i[7]*a+i[11]*h+i[15];return r[0]=(i[0]*o+i[4]*a+i[8]*h+i[12])/(u=u||1),r[1]=(i[1]*o+i[5]*a+i[9]*h+i[13])/u,r[2]=(i[2]*o+i[6]*a+i[10]*h+i[14])/u,r}function zo(r,e,i){var o=e[0],a=e[1],h=e[2];return r[0]=o*i[0]+a*i[3]+h*i[6],r[1]=o*i[1]+a*i[4]+h*i[7],r[2]=o*i[2]+a*i[5]+h*i[8],r}function Ro(r,e,i){var o=i[0],a=i[1],h=i[2],u=e[0],f=e[1],_=e[2],g=a*_-h*f,v=h*u-o*_,b=o*f-a*u,w=a*b-h*v,I=h*g-o*b,A=o*v-a*g,P=2*i[3];return v*=P,b*=P,I*=2,A*=2,r[0]=u+(g*=P)+(w*=2),r[1]=f+v+I,r[2]=_+b+A,r}function La(r){return r[0]=0,r[1]=0,r[2]=0,r}function Fn(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}var ir=cn,en=Da,Do=Cr;function Fa(){var r=new $i(4);return $i!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function co(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r}function gn(r,e){var i=e[0],o=e[1],a=e[2],h=e[3],u=i*i+o*o+a*a+h*h;return u>0&&(u=1/Math.sqrt(u)),r[0]=i*u,r[1]=o*u,r[2]=a*u,r[3]=h*u,r}function hn(r,e,i){var o=e[0],a=e[1],h=e[2],u=e[3];return r[0]=i[0]*o+i[4]*a+i[8]*h+i[12]*u,r[1]=i[1]*o+i[5]*a+i[9]*h+i[13]*u,r[2]=i[2]*o+i[6]*a+i[10]*h+i[14]*u,r[3]=i[3]*o+i[7]*a+i[11]*h+i[15]*u,r}function ho(){var r=new $i(4);return $i!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function uo(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function hs(r,e,i){i*=.5;var o=e[0],a=e[1],h=e[2],u=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_+u*f,r[1]=a*_+h*f,r[2]=h*_-a*f,r[3]=u*_-o*f,r}function ks(r,e,i){i*=.5;var o=e[0],a=e[1],h=e[2],u=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_-h*f,r[1]=a*_+u*f,r[2]=h*_+o*f,r[3]=u*_-a*f,r}ui(),Fa();var tn,yn,Oa,po=gn,Bs=(tn=ui(),yn=lr(1,0,0),Oa=lr(0,1,0),function(r,e,i){var o=er(e,i);return o<-.999999?(cr(tn,yn,e),Do(tn)<1e-6&&cr(tn,Oa,e),Ri(tn,tn),function(a,h,u){u*=.5;var f=Math.sin(u);a[0]=f*h[0],a[1]=f*h[1],a[2]=f*h[2],a[3]=Math.cos(u)}(r,tn,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(cr(tn,e,i),r[0]=tn[0],r[1]=tn[1],r[2]=tn[2],r[3]=1+o,po(r,r))});function Or(){var r=new $i(2);return $i!=Float32Array&&(r[0]=0,r[1]=0),r}function xn(r,e){var i=new $i(2);return i[0]=r,i[1]=e,i}function Lo(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r}function fo(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r}function Fo(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r}function Oo(r){return Math.hypot(r[0],r[1])}function Ns(r,e){var i=e[0],o=e[1],a=i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r}function Di(r,e){return r[0]*e[0]+r[1]*e[1]}ho(),ho(),Bl();var ka,Ba,vn=fo;function Na(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Or();var lh=function(){if(Ba)return ka;function r(e,i,o,a){this.cx=3*e,this.bx=3*(o-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=o,this.p2y=a}return Ba=1,ka=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var o=e,a=0;a<8;a++){var h=this.sampleCurveX(o)-e;if(Math.abs(h)<i)return o;var u=this.sampleCurveDerivativeX(o);if(Math.abs(u)<1e-6)break;o-=h/u}var f=0,_=1;for(o=e,a=0;a<20&&(h=this.sampleCurveX(o),!(Math.abs(h-e)<i));a++)e>h?f=o:_=o,o=.5*(_-f)+f;return o}
vendor: 2,111 bytes, line 1
1,solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},ka}(),Vs=Na(lh);function ke(r,e){this.x=r,this.y=e}function mo(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!mo(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!mo(r[i],e[i]))return!1;return!0}return r===e}ke.prototype={clone(){return new ke(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},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(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),o=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=o,this},_rotateAround(r,e){const i=Math.cos(r),o=Math.sin(r),a=e.y+o*(this.x-e.x)+i*(this.y-e.y);
vendor: 6,040 bytes, line 1
1return this.x=e.x+i*(this.x-e.x)-o*(this.y-e.y),this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:ke},ke.convert=function(r){if(r instanceof ke)return r;if(Array.isArray(r))return new ke(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new ke(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};const ch=Math.PI/180,Va=180/Math.PI;function ei(r){return r*ch}function ge(r){return r*Va}const k=[[0,0],[1,0],[1,1],[0,1]];function B(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function Z(r,e,i,o){const a=new Vs(r,e,i,o);return function(h){return a.solve(h)}}const ne=Z(.25,.1,.25,1);function W(r,e,i){return Math.min(i,Math.max(e,r))}function le(r,e,i){return(i=W((i-r)/(e-r),0,1))*i*(3-2*i)}function ve(r,e,i){const o=i-e,a=((r-e)%o+o)%o+e;return a===e?i:a}function he(r,e,i){if(!r.length)return i(null,[]);let o=r.length;const a=new Array(r.length);let h=null;r.forEach((u,f)=>{e(u,(_,g)=>{_&&(h=_),a[f]=g,--o==0&&i(h,a)})})}function ye(r,...e){for(const i of e)for(const o in i)r[o]=i[o];return r}let qe=1;function Pe(){return qe++}function pt(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function bt(r,e){r.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function St(r,e,i){const o={};for(const a in r)o[a]=e.call(this,r[a],a,r);return o}function Ut(r,e,i){const o={};for(const a in r)e.call(this,r[a],a,r)&&(o[a]=r[a]);return o}function Ft(r){return Array.isArray(r)?r.map(Ft):typeof r=="object"&&r?St(r,Ft):r}function jt(r,e){for(let i=0;i<r.length;i++)if(e.indexOf(r[i])>=0)return!0;return!1}const bi={};function Gt(r){bi[r]||(typeof console<"u"&&console.warn(r),bi[r]=!0)}function Ki(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function yr(r){let e=0;for(let i,o,a=0,h=r.length,u=h-1;a<h;u=a++)i=r[a],o=r[u],e+=(o.x-i.x)*(i.y+o.y);return e}function dr([r,e,i]){const o=ei(e+90),a=ei(i);return{x:r*Math.cos(o)*Math.sin(a),y:r*Math.sin(o)*Math.sin(a),z:r*Math.cos(a),azimuthal:e,polar:i}}function gi(r){return(typeof self<"u"||r!==void 0)&&typeof WorkerGlobalScope<"u"&&(r!==void 0?r:self)instanceof WorkerGlobalScope}function ri(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,o,a,h)=>{const u=a||h;return e[o]=!u||u.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let Xi=null;function qi(r,e){return[r[4*e],r[4*e+1],r[4*e+2],r[4*e+3]]}function Bi(r,e,i,o){for(;e<i;){const a=e+i>>1;r[a]<o?e=a+1:i=a}return e}function wr(r,e,i,o){for(;e<i;){const a=e+i>>1;r[a]<=o?e=a+1:i=a}return e}function rn(r){return r>0?1/(1.001-r):1+r}function kr(r){return r>0?1-1/(1.001-r):-r}function Ua(r,e,i){return(r-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}const Ar={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Ar.API_URL)return null;try{const r=new URL(Ar.API_URL);return r.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":r.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:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.1.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function ko(r){return Ar.API_URL_REGEX.test(r)}function Ul(r){return Ar.API_SPRITE_REGEX.test(r)}let ja,Ga,jl,Gl,us,qa;function ql(){return ja==null&&(ja=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),ja}const Hn={now:()=>Gl!==void 0?Gl:performance.now(),setNow(r){Gl=r},restoreNow(){Gl=void 0},frame(r){const e=requestAnimationFrame(r);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(r,e=0){const{width:i,height:o}=r;us||(us=document.createElement("canvas"));const a=us.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return(i>us.width||o>us.height)&&(us.width=i,us.height=o),a.clearRect(-e,-e,i+2*e,o+2*e),a.drawImage(r,0,0,i,o),a.getImageData(-e,-e,i+2*e,o+2*e)},resolveURL:r=>(Ga||(Ga=document.createElement("a")),Ga.href=r,Ga.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(jl==null&&(jl=window.matchMedia("(prefers-reduced-motion: reduce)")),jl.matches)},hasCanvasFingerprintNoise(){if(qa!==void 0)return qa;if(!ql())return qa=!1,!1;const r=new OffscreenCanvas(85,1),e=r.getContext("2d",{willReadFrequently:!0});let i=0;for(let a=0;a<r.width;++a)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(a,0,1,1);const o=e.getImageData(0,0,r.width,r.height);i=0;for(let a=0;a<o.data.length;++a)if(a%4!=3&&i++!==o.data[a])return qa=!0,!0;return qa=!1,!1}};function bn(r,e){const i=r.indexOf("?");if(i<0)return`${r}?${new URLSearchParams(e).toString()}`;
1const o=new URLSearchParams(r.slice(i));for(const a in e)o.set(a,e[a]);return`${r.slice(0,i)}?${o.toString()}`}function On(r,e={persistentParams:[]}){const i=r.indexOf("?");if(i<0)return r;const o=new URLSearchParams,a=new URLSearchParams(r.slice(i));for(const u of e.persistentParams){const f=a.get(u);f&&o.set(u,f)}const h=o.toString();return`${r.slice(0,i)}${h.length>0?`?${h}`:""}`}const _o="mapbox-tiles";let $n=500,go=50;const Ha=["language","worldview","jobid"];let Jn,$a;function ds(){try{return caches}catch{}}function Us(){const r=ds();r&&Jn==null&&(Jn=r.open(_o))}let hh=1/0;const uh={supported:!1,testSupport:function(r){!Za&&ps&&(js?cd(r):nn=r)}};let nn,ps,Za=!1,js=!1;const ld=typeof self<"u"?self:{};function cd(r){const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);try{if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,ps),r.isContextLost())return;uh.supported=!0}catch{}r.deleteTexture(e),Za=!0}ld.document&&(ps=ld.document.createElement("img"),ps.onload=function(){nn&&cd(nn),nn=null,js=!0},ps.onerror=function(){Za=!0,nn=null},ps.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Wa={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(Wa);class Xt extends Error{constructor(e,i,o){i===401&&ko(o)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=o}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Hl=gi()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Gs=function(r,e){if(!(/^file:/.test(i=r.url)||/^file:/.test(Hl())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(o,a){const h=new AbortController,u=new Request(o.url,{method:o.method||"GET",body:o.body,credentials:o.credentials,headers:o.headers,referrer:Hl(),referrerPolicy:o.referrerPolicy,signal:h.signal});let f=!1,_=!1;const g=(v=u.url).indexOf("sku=")>0&&ko(v);var v;o.type==="json"&&u.headers.set("Accept","application/json");const b=(I,A,P)=>{if(_)return;if(I&&I.message!=="SecurityError"&&Gt(I.toString()),A&&P)return w(A);const R=Date.now();fetch(u).then(O=>{if(O.ok){const U=g?O.clone():null;return w(O,U,R)}return a(new Xt(O.statusText,O.status,o.url))}).catch(O=>{O.name!=="AbortError"&&a(new Error(`${O.message} ${o.url}`))})},w=(I,A,P)=>{(o.type==="arrayBuffer"?I.arrayBuffer():o.type==="json"?I.json():I.text()).then(R=>{_||(A&&P&&function(O,U,V){if(Us(),Jn==null)return;const G=ri(U.headers.get("Cache-Control")||"");if(G["no-store"])return;const re={status:U.status,statusText:U.statusText,headers:new Headers};U.headers.forEach((ae,ce)=>re.headers.set(ce,ae)),G["max-age"]&&re.headers.set("Expires",new Date(V+1e3*G["max-age"]).toUTCString());const Q=re.headers.get("Expires");if(!Q||new Date(Q).getTime()-V<42e4)return;
1let te=On(O.url,{persistentParams:Ha});if(U.status===206){const ae=O.headers.get("Range");if(!ae)return;re.status=200,te=bn(te,{range:ae})}(function(ae,ce){if($a===void 0)try{new Response(new ReadableStream),$a=!0}catch{$a=!1}$a?ce(ae.body):ae.blob().then(ce).catch(Ee=>Gt(Ee.message))})(U,ae=>{const ce=new Response((Ee=U.status)!==200&&Ee!==404&&[101,103,204,205,304].includes(Ee)?null:ae,re);var Ee;Us(),Jn!=null&&Jn.then(de=>de.put(te,ce)).catch(de=>Gt(de.message))})}(u,A,P),f=!0,a(null,R,I.headers.get("Cache-Control"),I.headers.get("Expires")))}).catch(R=>{_||a(new Error(R.message))})};return g?function(I,A){if(Us(),Jn==null)return A(null);Jn.then(P=>{let R=On(I.url,{persistentParams:Ha});const O=I.headers.get("Range");O&&(R=bn(R,{range:O})),P.match(R).then(U=>{const V=function(G){if(!G)return!1;const re=new Date(G.headers.get("Expires")||0),Q=ri(G.headers.get("Cache-Control")||"");return Number(re)>Date.now()&&!Q["no-cache"]}(U);P.delete(R).catch(A),V&&P.put(R,U.clone()).catch(A),A(null,U,V)}).catch(A)}).catch(A)}(u,b):b(null,null),{cancel:()=>{_=!0,f||h.abort()}}}(r,e);if(gi(self)&&self.worker.actor)return self.worker.actor.send("getResource",r,e,void 0,!0)}var i;return function(o,a){const h=new XMLHttpRequest;h.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(h.responseType="arraybuffer");for(const u in o.headers)h.setRequestHeader(u,o.headers[u]);return o.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=o.credentials==="include",h.onerror=()=>{a(new Error(h.statusText))},h.onload=()=>{if((h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let u=h.response;if(o.type==="json")try{u=JSON.parse(h.response)}catch(f){return a(f)}a(null,u,h.getResponseHeader("Cache-Control"),h.getResponseHeader("Expires"))}else a(new Xt(h.statusText,h.status,o.url))},h.send(o.body),{cancel:()=>h.abort()}}(r,e)},Xa=function(r,e){return Gs(ye(r,{type:"arrayBuffer"}),e)};function hf(r){const e=document.createElement("a");return e.href=r,e.protocol===location.protocol&&e.host===location.host}const Ya="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let fs,Bo;fs=[],Bo=0;const Ka=function(r,e){if(uh.supported&&(r.headers||(r.headers={}),r.headers.accept="image/webp,*/*"),Bo>=Ar.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:r,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return fs.push(h),h}Bo++;let i=!1;const o=()=>{if(!i)for(i=!0,Bo--;fs.length&&Bo<Ar.MAX_PARALLEL_IMAGE_REQUESTS;){const h=fs.shift(),{requestParameters:u,callback:f,cancelled:_}=h;_||(h.cancel=Ka(u,f).cancel)}},a=Xa(r,(h,u,f,_)=>{o(),h?e(h):u&&(self.createImageBitmap?function(g,v){const b=new Blob([new Uint8Array(g)],{type:"image/png"});createImageBitmap(b).then(w=>{v(null,w)}).catch(w=>{v(new Error(`Could not load image because of ${w.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(u,(g,v)=>e(g,v,f,_)):function(g,v){const b=new Image;b.onload=()=>{v(null,b),URL.revokeObjectURL(b.src),b.onload=null,requestAnimationFrame(()=>{b.src=Ya})},b.onerror=()=>v(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const w=new Blob([new Uint8Array(g)],{type:"image/png"});b.src=g.byteLength?URL.createObjectURL(w):Ya}(u,(g,v)=>e(g,v,f,_)))});return{cancel:()=>{a.cancel(),o()}}};var hd,$l,ud,qs={exports:{}},ms={exports:{}},dd={exports:{}},Ja=function(){if(ud)return qs.exports;ud=1;var r=(hd||(hd=1,ms.exports=function(i,o){var a,h,u,f,_,g,v,b;for(h=i.length-(a=3&i.length),u=o,_=3432918353,g=461845907,b=0;b<h;)v=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,u=27492+(65535&(f=5*(65535&(u=(u^=v=(65535&(v=(v=(65535&v)*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<13|u>>>19))+((5*(u>>>16)&65535)<<16)&4294967295))+((58964+(f>>>16)&65535)<<16);switch(v=0,a){case 3:v^=(255&i.charCodeAt(b+2))<<16;
1case 2:v^=(255&i.charCodeAt(b+1))<<8;case 1:u^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(b)))*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295}return u^=i.length,u=2246822507*(65535&(u^=u>>>16))+((2246822507*(u>>>16)&65535)<<16)&4294967295,u=3266489909*(65535&(u^=u>>>13))+((3266489909*(u>>>16)&65535)<<16)&4294967295,(u^=u>>>16)>>>0}),ms.exports),e=($l||($l=1,dd.exports=function(i,o){for(var a,h=i.length,u=o^h,f=0;h>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(a>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),h-=4,++f;switch(h){case 3:u^=(255&i.charCodeAt(f+2))<<16;case 2:u^=(255&i.charCodeAt(f+1))<<8;case 1:u=1540483477*(65535&(u^=255&i.charCodeAt(f)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0}),dd.exports);return qs.exports=r,qs.exports.murmur3=r,qs.exports.murmur2=e,qs.exports}(),Hs=Na(Ja);class yo{constructor(e,...i){ye(this,i[0]||{}),this.type=e}}class wn extends yo{constructor(e,i={}){super("error",ye({error:e},i))}}function dh(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function ph(r,e,i){if(i&&i[r]){const o=i[r].indexOf(e);o!==-1&&i[r].splice(o,1)}}class _s{on(e,i){return this._listeners=this._listeners||{},dh(e,i,this._listeners),this}off(e,i){return ph(e,i,this._listeners),ph(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},dh(e,i,this._oneTimeListeners),this):new Promise(o=>{this.once(e,o)})}fire(e,i){const o=typeof e=="string"?new yo(e,i):e,a=o.type;if(this.listens(a)){o.target=this;const h=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const _ of h)_.call(this,o);const u=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const _ of u)ph(a,_,this._oneTimeListeners),_.call(this,o);const f=this._eventedParent;f&&(ye(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),f.fire(o))}else o instanceof wn&&console.error(o.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,i){return this._eventedParent=e,this._eventedParentData=i,this}}class un{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new un(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,o]=e.split("�");return new un({name:i,iconsetId:o})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return un.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var fh,Zl={},mh=function(){if(fh)return Zl;fh=1;var r={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]};
1function e(h){return(h=Math.round(h))<0?0:h>255?255:h}function i(h){return e(h[h.length-1]==="%"?parseFloat(h)/100*255:parseInt(h))}function o(h){return(u=h[h.length-1]==="%"?parseFloat(h)/100:parseFloat(h))<0?0:u>1?1:u;var u}function a(h,u,f){return f<0?f+=1:f>1&&(f-=1),6*f<1?h+(u-h)*f*6:2*f<1?u:3*f<2?h+(u-h)*(2/3-f)*6:h}try{Zl.parseCSSColor=function(h){var u,f=h.replace(/ /g,"").toLowerCase();if(f in r)return r[f].slice();if(f[0]==="#")return f.length===4?(u=parseInt(f.substr(1),16))>=0&&u<=4095?[(3840&u)>>4|(3840&u)>>8,240&u|(240&u)>>4,15&u|(15&u)<<4,1]:null:f.length===7&&(u=parseInt(f.substr(1),16))>=0&&u<=16777215?[(16711680&u)>>16,(65280&u)>>8,255&u,1]:null;var _=f.indexOf("("),g=f.indexOf(")");if(_!==-1&&g+1===f.length){var v=f.substr(0,_),b=f.substr(_+1,g-(_+1)).split(","),w=1;switch(v){case"rgba":if(b.length!==4)return null;w=o(b.pop());case"rgb":return b.length!==3?null:[i(b[0]),i(b[1]),i(b[2]),w];case"hsla":if(b.length!==4)return null;w=o(b.pop());case"hsl":if(b.length!==3)return null;var I=(parseFloat(b[0])%360+360)%360/360,A=o(b[1]),P=o(b[2]),R=P<=.5?P*(A+1):P+A-P*A,O=2*P-R;return[e(255*a(O,R,I+1/3)),e(255*a(O,R,I)),e(255*a(O,R,I-1/3)),w];default:return null}}return null}}catch{}return Zl}();class li{constructor(e,i,o,a=1){this.r=e,this.g=i,this.b=o,this.a=a}static parse(e){if(!e)return;if(e instanceof li)return e;if(typeof e!="string")return;const i=mh.parseCSSColor(e);return i?new li(i[0]/255,i[1]/255,i[2]/255,i[3]):void 0}toString(){const[e,i,o,a]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*o)},${a})`}toNonPremultipliedRenderColor(e){const{r:i,g:o,b:a,a:h}=this;return new $s(e,i,o,a,h)}toPremultipliedRenderColor(e){const{r:i,g:o,b:a,a:h}=this;return new pd(e,i*h,o*h,a*h,h)}clone(){return new li(this.r,this.g,this.b,this.a)}}class Qa{constructor(e,i,o,a,h,u=!1){if(this.premultiplied=!1,this.premultiplied=u,e){const f=e.image.height,_=f*f;this.premultiplied?(i=h===0?0:i/h*(f-1),o=h===0?0:o/h*(f-1),a=h===0?0:a/h*(f-1)):(i*=f-1,o*=f-1,a*=f-1);const g=Math.floor(i),v=Math.floor(o),b=Math.floor(a),w=Math.ceil(i),I=Math.ceil(o),A=Math.ceil(a),P=i-g,R=o-v,O=a-b,U=e.image.data,V=4*(g+v*_+b*f),G=4*(g+v*_+A*f),re=4*(g+I*_+b*f),Q=4*(g+I*_+A*f),te=4*(w+v*_+b*f),ae=4*(w+v*_+A*f),ce=4*(w+I*_+b*f),Ee=4*(w+I*_+A*f);if(V<0||Ee>=U.length)throw new Error("out of range");this.r=ft(ft(ft(U[V],U[G],O),ft(U[re],U[Q],O),R),ft(ft(U[te],U[ae],O),ft(U[ce],U[Ee],O),R),P)/255*(this.premultiplied?h:1),this.g=ft(ft(ft(U[V+1],U[G+1],O),ft(U[re+1],U[Q+1],O),R),ft(ft(U[te+1],U[ae+1],O),ft(U[ce+1],U[Ee+1],O),R),P)/255*(this.premultiplied?h:1),this.b=ft(ft(ft(U[V+2],U[G+2],O),ft(U[re+2],U[Q+2],O),R),ft(ft(U[te+2],U[ae+2],O),ft(U[ce+2],U[Ee+2],O),R),P)/255*(this.premultiplied?h:1),this.a=h}else this.r=i,this.g=o,this.b=a,this.a=h}toArray(){const{r:e,g:i,b:o,a}=this;return[255*e,255*i,255*o,a]}toHslaArray(){let{r:e,g:i,b:o,a}=this;if(this.premultiplied){if(a===0)return[0,0,0,0];e/=a,i/=a,o/=a}const h=Math.min(Math.max(e,0),1),u=Math.min(Math.max(i,0),1),f=Math.min(Math.max(o,0),1),_=Math.min(h,u,f),g=Math.max(h,u,f),v=(_+g)/2;if(_===g)return[0,0,100*v,a];const b=g-_,w=v>.5?b/(2-g-_):b/(g+_);let I=0;return g===h?I=(u-f)/b+(u<f?6:0):g===u?I=(f-h)/b+2:g===f&&(I=(h-u)/b+4),I*=60,[Math.min(Math.max(I,0),360),Math.min(Math.max(100*w,0),100),Math.min(Math.max(100*v,0),100),a]}toArray01(){const{r:e,g:i,b:o,a}=this;return[e,i,o,a]}toArray01Scaled(e){const{r:i,g:o,b:a}=this;return[i*e,o*e,a*e]}toArray01Linear(){const{r:e,g:i,b:o,a}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(o,2.2),a]}}class $s extends Qa{constructor(e,i,o,a,h){super(e,i,o,a,h,!1)}}class pd extends Qa{constructor(e,i,o,a,h){super(e,i,o,a,h,!0)}}function ft(r,e,i){return r*(1-i)+e*i}function fd(r,e,i){return r.map((o,a)=>ft(o,e[a],i))}li.black=new li(0,0,0,1),li.white=new li(1,1,1,1),li.transparent=new li(0,0,0,0),li.red=new li(1,0,0,1),li.blue=new li(0,0,1,1);var el=Object.freeze({__proto__:null,array:fd,color:function(r,e,i){return new li(ft(r.r,e.r,i),ft(r.g,e.g,i),ft(r.b,e.b,i),ft(r.a,e.a,i))},number:ft});function gs(r,...e){for(const i of e)for(const o in i)r[o]=i[o];return r}
vendor: 10,732 bytes, line 1
1class Tn extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class _h{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[o,a]of i)this.bindings[o]=a}concat(e){return new _h(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 Zs={kind:"null"},ut={kind:"number"},si={kind:"string"},ai={kind:"boolean"},dn={kind:"color"},xo={kind:"object"},ci={kind:"value"},Wl={kind:"collator"},tl={kind:"formatted"},il={kind:"resolvedImage"};function Br(r,e){return{kind:"array",itemType:r,N:e}}function pr(r){if(r.kind==="array"){const e=pr(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const uf=[Zs,ut,si,ai,dn,tl,xo,Br(ci),il];function Ws(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Ws(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of uf)if(!Ws(i,e))return null}}return`Expected ${pr(r)} but found ${pr(e)} instead.`}function No(r,e){return e.some(i=>i.kind===r.kind)}function rl(r,e){return e.some(i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r)}function Xl(r,e){return r.kind==="array"&&e.kind==="array"?r.N===e.N&&Xl(r.itemType,e.itemType):r.kind===e.kind}class nl{constructor(e,i,o){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Yl{constructor(e,i,o,a,h){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=o,this.fontStack=a,this.textColor=h}}class $r{constructor(e){this.sections=e}static fromString(e){return new $r([new Yl(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 $r?e:$r.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){const a=i.image.getPrimary().id.toString();e.push(["image",a]);continue}e.push(i.text);const o={};i.fontStack&&(o["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(o["font-scale"]=i.scale),i.textColor&&(o["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(o)}return e}}class vo{constructor(e,i={}){if(this.id=un.from(e),this.options=Object.assign({},i),i.transform){const{a:o,b:a,c:h,d:u,e:f,f:_}=i.transform;this.options.transform=new DOMMatrix([o,a,h,u,f,_])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){const{a:e,b:i,c:o,d:a,e:h,f:u}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:e,b:i,c:o,d:a,e:h,f:u}})}static parse(e){let i,o,a,h;try{({name:i,iconsetId:o,params:a,transform:h}=JSON.parse(e)||{})}catch{return null}if(!i)return null;const{a:u,b:f,c:_,d:g,e:v,f:b}=h||{};return new vo({name:i,iconsetId:o},{params:a,transform:new DOMMatrix([u,f,_,g,v,b])})}scaleSelf(e,i){return this.options.transform.scaleSelf(e,i),this}}class on{constructor(e,i,o,a,h=!1){this.primaryId=un.from(e),this.primaryOptions=i,o&&(this.secondaryId=un.from(o)),this.secondaryOptions=a,this.available=h}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new vo(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new vo(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?on.build({name:e}):e}static build(e,i,o,a){return!e||typeof e=="object"&&!("name"in e)?null:new on(e,o,i,a)}}function ys(r,e,i,o){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[r,e,i,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[r,e,i,o]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Pt(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof li||r instanceof nl||r instanceof $r||r instanceof on)return!0;if(Array.isArray(r)){for(const e of r)if(!Pt(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!Pt(r[e]))return!1;return!0}return!1}function it(r){if(r===null)return Zs;if(typeof r=="string")return si;if(typeof r=="boolean")return ai;if(typeof r=="number")return ut;if(r instanceof li)return dn;if(r instanceof nl)return Wl;if(r instanceof $r)return tl;if(r instanceof on)return il;if(Array.isArray(r)){const e=r.length;let i;for(const o of r){const a=it(o);if(i){if(i===a)continue;i=ci;break}i=a}return Br(i||ci,e)}return xo}function kn(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof $r||r instanceof on||r instanceof li?r.toString():JSON.stringify(r)}class xt{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Pt(e[1]))return i.error("invalid value");const o=e[1];let a=it(o);const h=i.expectedType;return a.kind!=="array"||a.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(a=h),new xt(a,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof li?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof $r?this.value.serialize():this.value}}class hr{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ol={string:si,number:ut,boolean:ai,object:xo};class mt{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let o,a=1;const h=e[0];if(h==="array"){let f,_;if(e.length>2){const g=e[1];if(typeof g!="string"||!(g in ol)||g==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=ol[g],a++}else f=ci;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);_=e[2],a++}o=Br(f,_)}else o=ol[h];const u=[];for(;a<e.length;a++){const f=i.parse(e[a],a,ci);if(!f)return null;u.push(f)}return new mt(o,u)}evaluate(e){for(let i=0;i<this.args.length;i++){const o=this.args[i].evaluate(e);if(!Ws(this.type,it(o)))return o;if(i===this.args.length-1)throw new hr(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${pr(it(o))} but was expected to be of type ${pr(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const o=e.itemType;if(o.kind==="string"||o.kind==="number"||o.kind==="boolean"){i.push(o.kind);const a=e.N;(typeof a=="number"||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(o=>o.serialize()))}}class Xs{constructor(e){this.type=tl,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return i.error("First argument must be an image or text section.");const a=[];let h=!1;for(let u=1;u<=e.length-1;++u){const f=e[u];if(h&&typeof f=="object"&&!Array.isArray(f)){h=!1;let _=null;if(f["font-scale"]&&(_=i.parseObjectValue(f["font-scale"],u,"font-scale",ut),!_))return null;let g=null;if(f["text-font"]&&(g=i.parseObjectValue(f["text-font"],u,"text-font",Br(si)),!g))return null;let v=null;if(f["text-color"]&&(v=i.parseObjectValue(f["text-color"],u,"text-color",dn),!v))return null;const b=a[a.length-1];b.scale=_,b.font=g,b.textColor=v}else{const _=i.parse(e[u],u,ci);if(!_)return null;const g=_.type.kind;if(g!=="string"&&g!=="value"&&g!=="null"&&g!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,a.push({content:_,scale:null,font:null,textColor:null})}}return new Xs(a)}evaluate(e){return new $r(this.sections.map(i=>{const o=i.content.evaluate(e);return Xl(it(o),il)?new Yl("",o,null,null,null):new Yl(kn(o),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const o={};i.scale&&(o["font-scale"]=i.scale.serialize()),i.font&&(o["text-font"]=i.font.serialize()),i.textColor&&(o["text-color"]=i.textColor.serialize()),e.push(o)}return e}}class Ys{constructor(e,i,o,a){this._imageWarnHistory={},this.type=il,this.namePrimary=e,this.nameSecondary=i,o&&(this.paramsPrimary=o.params,this.iconsetIdPrimary=o.iconset?o.iconset.id:void 0),a&&(this.paramsSecondary=a.params,this.iconsetIdSecondary=a.iconset?a.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let o=1;const a=[];function h(){if(o<e.length){const f=i.parse(e[o],o++,si);return f?(a.push({image:f,options:{}}),!0):(i.error(a.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function u(){if(o<e.length){const _=e[o];if((f=_)===null||typeof f!="object"||Array.isArray(f))return!0;const g=_.params,v=_.iconset,b=i.concat(o);if(!g&&!v)return o++,!0;if(g){if(typeof g!="object"||g.constructor!==Object)return b.error('Image options "params" should be an object'),!1;const w={},I=b.concat(void 0,"params");for(const A in g){if(!A)return I.error("Image parameter name should be non-empty"),!1;const P=I.concat(void 0,A).parse(g[A],void 0,dn,void 0,{typeAnnotation:"coerce"});if(!P)return!1;w[A]=P}a[a.length-1].options.params=w}if(v){if(typeof v!="object"||v.constructor!==Object)return b.error('Image options "iconset" should be an object'),!1;if(!v.id)return b.error('Image options "iconset" should have an "i
1d" property'),!1;a[a.length-1].options.iconset=v}return o++,!0}var f;return!0}for(let f=0;f<2;f++)if(!h()||!u())return;return new Ys(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){const o={};if(i){for(const a in i)if(i[a])try{o[a]=i[a].evaluate(e)}catch{continue}if(Object.keys(o).length!==0)return{params:o}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},o=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,a=on.build(i,o,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(a&&e.availableImages){const h=a.getPrimary().id;if(a.available=e.availableImages.some(u=>un.isEqual(u,h)),a.available){const u=a.getSecondary()?a.getSecondary().id:null;u&&(a.available=e.availableImages.some(f=>un.isEqual(f,u)))}}return a}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){const o={};if(i&&(o.iconset={id:i}),e){o.params={};for(const a in e)e[a]&&(o.params[a]=e[a].serialize())}return Object.keys(o).length>0?o:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function Vo(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}const md={"to-boolean":ai,"to-color":dn,"to-number":ut,"to-string":si};class Bn{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const o=e[0],a=[];let h=Zs;if(o==="to-array"){if(!Array.isArray(e[1]))return null;const u=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);h=Br(i.expectedType.itemType,u)}else{if(!(u>0&&Pt(e[1][0])))return null;h=Br(it(e[1][0]),u)}for(let f=0;f<u;f++){const _=e[1][f];let g;if(Vo(_)==="array")g=i.parse(_,void 0,h.itemType);else{const v=Vo(_);if(v!==h.itemType.kind)return i.error(`Expected ${h.itemType.kind} but found ${v}.`);g=i.registry.literal.parse(["literal",_===void 0?null:_],i)}if(!g)return null;a.push(g)}}else{if((o==="to-boolean"||o==="to-string")&&e.length!==2)return i.error("Expected one argument.");h=md[o];for(let u=1;u<e.length;u++){const f=i.parse(e[u],u,ci);if(!f)return null;a.push(f)}}return new Bn(h,a)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,o;for(const a of this.args){if(i=a.evaluate(e),o=null,i instanceof li)return i;if(typeof i=="string"){const h=e.parseColor(i);if(h)return h}else if(Array.isArray(i)&&(o=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:ys(i[0],i[1],i[2],i[3]),!o))return new li(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new hr(o||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const o of this.args){if(i=o.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new hr(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?$r.fromString(kn(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?on.build(kn(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):kn(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}
vendor: 5,443 bytes, line 1
1serialize(){if(this.type.kind==="formatted")return new Xs([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Ys(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const Zr=["Unknown","Point","LineString","Polygon"];class sl{constructor(e,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Zr[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,i=this.featureDistanceData.scale,{x:o,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(o*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=li.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class Tr{constructor(e,i,o,a,h){this.name=e,this.type=i,this._evaluate=o,this.args=a,this._overloadIndex=h}evaluate(e){if(!this._evaluate){const i=Tr.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.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,i){const o=e[0],a=Tr.definitions[o];if(!a)return i.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(a)?a[0]:a.type,u=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,f=[];let _=null,g=-1;for(const[v,b]of u){if(Array.isArray(v)&&v.length!==e.length-1)continue;f.push(v),g++,_=new cc(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);const w=[];let I=!1;for(let A=1;A<e.length;A++){const P=e[A],R=Array.isArray(v)?v[A-1]:v.type,O=_.parse(P,1+w.length,R);if(!O){I=!0;break}w.push(O)}if(!I)if(Array.isArray(v)&&v.length!==w.length)_.error(`Expected ${v.length} arguments, but found ${w.length} instead.`);else{for(let A=0;A<w.length;A++){const P=Array.isArray(v)?v[A]:v.type,R=w[A];_.concat(A+1).checkSubtype(P,R.type)}if(_.errors.length===0)return new Tr(o,h,b,w,g)}}if(f.length===1)i.errors.push(..._.errors);else{const v=(f.length?f:u.map(([w])=>w)).map(gh).join(" | "),b=[];for(let w=1;w<e.length;w++){const I=i.parse(e[w],1+b.length);if(!I)return null;b.push(pr(I.type))}i.error(`Expected arguments of type ${v}, but found (${b.join(", ")}) instead.`)}return null}static register(e,i){Tr.definitions=i;for(const o in i)e[o]=Tr}}function gh(r){return Array.isArray(r)?`(${r.map(pr).join(", ")})`:`(${pr(r.type)}...)`}class Qn{constructor(e,i,o){this.type=Wl,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return i.error("Collator options argument must be an object.");const a=o["case-sensitive"]===void 0?i.parse(!1,1,ai):i.parseObjectValue(o["case-sensitive"],1,"case-sensitive",ai);if(!a)return null;const h=o["diacritic-sensitive"]===void 0?i.parse(!1,1,ai):i.parseObjectValue(o["diacritic-sensitive"],1,"diacritic-sensitive",ai);if(!h)return null;let u=null;return o.locale&&(u=i.parseObjectValue(o.locale,1,"locale",si),!u)?null:new Qn(a,h,u)}evaluate(e){return new nl(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 Nr(r,e,i=0,o=r.length-1,a=df){for(;o>i;){if(o-i>600){const _=o-i+1,g=e-i+1,v=Math.log(_),b=.5*Math.exp(2*v/3),w=.5*Math.sqrt(v*b*(_-b)/_)*(g-_/2<0?-1:1);Nr(r,e,Math.max(i,Math.floor(e-g*b/_+w)),Math.min(o,Math.floor(e+(_-g)*b/_+w)),a)}const h=r[e];let u=i,f=o;for(al(r,i,e),a(r[o],h)>0&&al(r,i,o);u<f;){for(al(r,u,f),u++,f--;a(r[u],h)<0;)u++;for(;a(r[f],h)>0;)f--}a(r[i],h)===0?al(r,i,f):(f++,al(r,f,o)),f<=e&&(i=f+1),e<=f&&(o=f-1)}}function al(r,e,i){const o=r[e];r[e]=r[i],r[i]=o}function df(r,e){return r<e?-1:r>e?1:0}function pf(r){let e=0;for(let i,o,a=0,h=r.length,u=h-1;a<h;u=a++)i=r[a],o=r[u],e+=(o.x-i.x)*(i.y+o.y);return e}function Uo(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function Ks(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function xs(r,e,i){const o=r[0]-e[0],a=r[1]-e[1],h=r[0]-i[0],u=r[1]-i[1];return o*u-h*a==0&&o*h<=0&&a*u<=0}function Js(r,e,i=!1){let o=!1;for(let f=0,_=e.length;f<_;f++){const g=e[f];for(let v=0,b=g.length,w=b-1;v<b;w=v++){const I=g[w],A=g[v];if(xs(r,I,A))return i;
1(h=I)[1]>(a=r)[1]!=(u=A)[1]>a[1]&&a[0]<(u[0]-h[0])*(a[1]-h[1])/(u[1]-h[1])+h[0]&&(o=!o)}}var a,h,u;return o}function _d(r,e,i,o){const a=o[0]-i[0],h=o[1]-i[1],u=(r[0]-i[0])*h-a*(r[1]-i[1]),f=(e[0]-i[0])*h-a*(e[1]-i[1]);return u>0&&f<0||u<0&&f>0}function Kl(r,e,i,o){return(a=[o[0]-i[0],o[1]-i[1]])[0]*(h=[e[0]-r[0],e[1]-r[1]])[1]-a[1]*h[0]!=0&&!(!_d(r,e,i,o)||!_d(i,o,r,e));var a,h}function yh(r){const e=new ke(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new ke(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const o of r[0])e.x>o.x&&(e.x=o.x),e.y>o.y&&(e.y=o.y),i.x<o.x&&(i.x=o.x),i.y<o.y&&(i.y=o.y);return{min:e,max:i}}const jo=8192;function ff(r,e){const i=(180+r[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,a=Math.pow(2,e.z);return[Math.round(i*a*jo),Math.round(o*a*jo)]}function gd(r,e){for(let i=0;i<e.length;i++)if(Js(r,e[i]))return!0;return!1}function mf(r,e,i){for(const o of i)for(let a=0,h=o.length,u=h-1;a<h;u=a++)if(Kl(r,e,o[u],o[a]))return!0;return!1}function yd(r,e){for(let i=0;i<r.length;++i)if(!Js(r[i],e))return!1;for(let i=0;i<r.length-1;++i)if(mf(r[i],r[i+1],e))return!1;return!0}function xd(r,e){for(let i=0;i<e.length;i++)if(yd(r,e[i]))return!0;return!1}function xh(r,e,i){const o=[];for(let a=0;a<r.length;a++){const h=[];for(let u=0;u<r[a].length;u++){const f=ff(r[a][u],i);Uo(e,f),h.push(f)}o.push(h)}return o}function Go(r,e,i){const o=[];for(let a=0;a<r.length;a++){const h=xh(r[a],e,i);o.push(h)}return o}function vd(r,e,i,o){if(r[0]<i[0]||r[0]>i[2]){const a=.5*o;let h=r[0]-i[0]>a?-o:i[0]-r[0]>a?o:0;h===0&&(h=r[0]-i[2]>a?-o:i[2]-r[0]>a?o:0),r[0]+=h}Uo(e,r)}function bd(r,e,i,o){const a=Math.pow(2,o.z)*jo,h=[o.x*jo,o.y*jo],u=[];if(!r)return u;for(const f of r)for(const _ of f){const g=[_.x+h[0],_.y+h[1]];vd(g,e,i,a),u.push(g)}return u}function Jl(r,e,i,o){const a=Math.pow(2,o.z)*jo,h=[o.x*jo,o.y*jo],u=[];if(!r)return u;for(const _ of r){const g=[];for(const v of _){const b=[v.x+h[0],v.y+h[1]];Uo(e,b),g.push(b)}u.push(g)}if(e[2]-e[0]<=a/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of u)for(const g of _)vd(g,e,i,a)}var f;return u}class qo{constructor(e,i){this.type=ai,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Pt(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let a=0;a<o.features.length;++a){const h=o.features[a].geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new qo(o,o.features[a].geometry)}else if(o.type==="Feature"){const a=o.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new qo(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new qo(o,o)}return i.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(i,o){const a=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(!u)return!1;if(o.type==="Polygon"){const f=xh(o.coordinates,h,u),_=bd(i.geometry(),a,h,u);if(!Ks(a,h))return!1;for(const g of _)if(!Js(g,f))return!1}if(o.type==="MultiPolygon"){const f=Go(o.coordinates,h,u),_=bd(i.geometry(),a,h,u);if(!Ks(a,h))return!1;for(const g of _)if(!gd(g,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(i,o){const a=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(!u)return!1;if(o.type==="Polygon"){const f=xh(o.coordinates,h,u),_=Jl(i.geometry(),a,h,u);if(!Ks(a,h))return!1;for(const g of _)if(!yd(g,f))return!1}if(o.type==="MultiPolygon"){const f=Go(o.coordinates,h,u),_=Jl(i.geometry(),a,h,u);if(!Ks(a,h))return!1;for(const g of _)if(!xd(g,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const ll={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},Nn=1/298.257223563,vh=Nn*(2-Nn),Qs=Math.PI/180;class ea{static fromTile(e,i,o){const a=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),h=Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/Qs;return new ea(h,o)}static get units(){return ll}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!ll[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(ll).join(", ")}`);const o=6378.137*Qs*(i?ll[i]:1),a=Math.cos(e*Qs),h=1/(1-vh*(1-a*a)),u=Math.sqrt(h);this.kx=o*u*a,this.ky=o*u*h*(1-vh)}distance(e,i){const o=Sn(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(o*o+a*a)}bearing(e,i){const o=Sn(i[0]-e[0])*this.kx;return Math.atan2(o,(i[1]-e[1])*this.ky)/Qs}destination(e,i,o){const a=o*Qs;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,o){return[e[0]+i/this.kx,e[1]+o/this.ky]}lineDistance(e){let i=0;for(let o=0;o<e.length-1;o++)i+=this.distance(e[o],e[o+1]);return i}area(e){let i=0;for(let o=0;o<e.length;o++){const a=e[o];for(let h=0,u=a.length,f=u-1;h<u;f=h++)i+=Sn(a[h][0]-a[f][0])*(a[h][1]+a[f][1])*(o?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let o=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){const h=e[a],u=e[a+1],f=this.distance(h,u);if(o+=f,o>i)return Ql(h,u,(i-(o-f))/f)}return e[e.length-1]}pointToSegmentDistance(e,i,o){let[a,h]=i,u=Sn(o[0]-a)*this.kx,f=(o[1]-h)*this.ky;if(u!==0||f!==0){const _=(Sn(e[0]-a)*this.kx*u+(e[1]-h)*this.ky*f)/(u*u+f*f);_>1?(a=o[0],h=o[1]):_>0&&(a+=u/this.kx*_,h+=f/this.ky*_)}return u=Sn(e[0]-a)*this.kx,f=(e[1]-h)*this.ky,Math.sqrt(u*u+f*f)}pointOnLine(e,i){let o=1/0,a=e[0][0],h=e[0][1],u=0,f=0;for(let _=0;_<e.length-1;_++){let g=e[_][0],v=e[_][1],b=Sn(e[_+1][0]-g)*this.kx,w=(e[_+1][1]-v)*this.ky,I=0;b===0&&w===0||(I=(Sn(i[0]-g)*this.kx*b+(i[1]-v)*this.ky*w)/(b*b+w*w),I>
11?(g=e[_+1][0],v=e[_+1][1]):I>0&&(g+=b/this.kx*I,v+=w/this.ky*I)),b=Sn(i[0]-g)*this.kx,w=(i[1]-v)*this.ky;const A=b*b+w*w;A<o&&(o=A,a=g,h=v,u=_,f=I)}return{point:[a,h],index:u,t:Math.max(0,Math.min(1,f))}}lineSlice(e,i,o){let a=this.pointOnLine(o,e),h=this.pointOnLine(o,i);if(a.index>h.index||a.index===h.index&&a.t>h.t){const g=a;a=h,h=g}const u=[a.point],f=a.index+1,_=h.index;!bh(o[f],u[0])&&f<=_&&u.push(o[f]);for(let g=f+1;g<=_;g++)u.push(o[g]);return bh(o[_],h.point)||u.push(h.point),u}lineSliceAlong(e,i,o){let a=0;const h=[];for(let u=0;u<o.length-1;u++){const f=o[u],_=o[u+1],g=this.distance(f,_);if(a+=g,a>e&&h.length===0&&h.push(Ql(f,_,(e-(a-g))/g)),a>=i)return h.push(Ql(f,_,(i-(a-g))/g)),h;a>e&&h.push(_)}return h}bufferPoint(e,i){const o=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-o,e[0]+a,e[1]+o]}bufferBBox(e,i){const o=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-o,e[2]+a,e[3]+o]}insideBBox(e,i){return Sn(e[0]-i[0])>=0&&Sn(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function bh(r,e){return r[0]===e[0]&&r[1]===e[1]}
vendor: 5,092 bytes, line 1
1function Ql(r,e,i){const o=Sn(e[0]-r[0]);return[r[0]+o*i,r[1]+(e[1]-r[1])*i]}function Sn(r){for(;r<-180;)r+=360;for(;r>180;)r-=360;return r}class ec{constructor(e=[],i=(o,a)=>o<a?-1:o>a?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:o}=this,a=i[e];for(;e>0;){const h=e-1>>1,u=i[h];if(o(a,u)>=0)break;i[e]=u,e=h}i[e]=a}_down(e){const{data:i,compare:o}=this,a=this.length>>1,h=i[e];for(;e<a;){let u=1+(e<<1);const f=u+1;if(f<this.length&&o(i[f],i[u])<0&&(u=f),o(i[u],h)>=0)break;i[e]=i[u],e=u}i[e]=h}}var We=8192;function wh(r,e){return e.dist-r.dist}const tc=100,ic=50;function cl(r){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==r.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==r[i])return!1;return!0}function vs(r){return r[1]-r[0]+1}function Vn(r,e){const i=r[1]>=r[0]&&r[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function rc(r,e){if(r[0]>r[1])return[null,null];const i=vs(r);if(e){if(i===2)return[r,null];const o=Math.floor(i/2);return[[r[0],r[0]+o],[r[0]+o,r[1]]]}{if(i===1)return[r,null];const o=Math.floor(i/2)-1;return[[r[0],r[0]+o],[r[0]+o+1,r[1]]]}}function Ho(r,e){const i=[1/0,1/0,-1/0,-1/0];if(!Vn(e,r.length))return i;for(let o=e[0];o<=e[1];++o)Uo(i,r[o]);return i}function hl(r){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<r.length;++i)for(let o=0;o<r[i].length;++o)Uo(e,r[i][o]);return e}function Zn(r,e,i){if(cl(r)||cl(e))return NaN;let o=0,a=0;return r[2]<e[0]&&(o=e[0]-r[2]),r[0]>e[2]&&(o=r[0]-e[2]),r[1]>e[3]&&(a=r[1]-e[3]),r[3]<e[1]&&(a=e[1]-r[3]),i.distance([0,0],[o,a])}function Ht(r){return 360*r-180}function _f(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Th(r,e){const i=Math.pow(2,e.z),o=(r.y/We+e.y)/i;return[Ht((r.x/We+e.x)/i),_f(o)]}function gf(r,e){const i=[];for(let o=0;o<r.length;++o)i.push(Th(r[o],e));return i}function Sh(r,e,i){const o=i.pointOnLine(e,r).point;return i.distance(r,o)}function wd(r,e,i,o,a){const h=i.slice(o[0],o[1]+1);let u=1/0;for(let f=e[0];f<=e[1];++f)if((u=Math.min(u,Sh(r[f],h,a)))===0)return 0;return u}function Oi(r,e,i,o,a){const h=Math.min(a.pointToSegmentDistance(r,i,o),a.pointToSegmentDistance(e,i,o)),u=Math.min(a.pointToSegmentDistance(i,r,e),a.pointToSegmentDistance(o,r,e));return Math.min(h,u)}function yf(r,e,i,o,a){if(!Vn(e,r.length)||!Vn(o,i.length))return NaN;let h=1/0;for(let u=e[0];u<e[1];++u)for(let f=o[0];f<o[1];++f){if(Kl(r[u],r[u+1],i[f],i[f+1]))return 0;h=Math.min(h,Oi(r[u],r[u+1],i[f],i[f+1],a))}return h}function xf(r,e,i,o,a){if(!Vn(e,r.length)||!Vn(o,i.length))return NaN;let h=1/0;for(let u=e[0];u<=e[1];++u)for(let f=o[0];f<=o[1];++f)if((h=Math.min(h,a.distance(r[u],i[f])))===0)return h;return h}function vf(r,e,i){if(Js(r,e,!0))return 0;let o=1/0;for(const a of e){const h=a.length;if(h<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(a[0]!==a[h-1]&&(o=Math.min(o,i.pointToSegmentDistance(r,a[h-1],a[0])))===0||(o=Math.min(o,Sh(r,a,i)))===0)return o}return o}function bf(r,e,i,o){if(!Vn(e,r.length))return NaN;for(let h=e[0];h<=e[1];++h)if(Js(r[h],i,!0))return 0;let a=1/0;for(let h=e[0];h<e[1];++h)for(const u of i)for(let f=0,_=u.length,g=_-1;f<_;g=f++){if(Kl(r[h],r[h+1],u[g],u[f]))return 0;a=Math.min(a,Oi(r[h],r[h+1],u[g],u[f],o))}return a}function Td(r,e){for(const i of r)for(let o=0;o<=i.length-1;++o)if(Js(i[o],e,!0))return!0;return!1}function wf(r,e,i,o=1/0){const a=hl(r),h=hl(e);if(o!==1/0&&Zn(a,h,i)>=o)return o;if(Ks(a,h)){if(Td(r,e))return 0}else if(Td(e,r))return 0;let u=o;for(const f of r)for(let _=0,g=f.length,v=g-1;_<g;v=_++)for(const b of e)for(let w=0,I=b.length,A=I-1;w<I;A=w++){if(Kl(f[v],f[_],b[A],b[w]))return 0;u=Math.min(u,Oi(f[v],f[_],b[A],b[w],i))}return u}function nc(r,e,i,o,a,h,u){if(h===null||u===null)return;const f=Zn(Ho(o,h),Ho(a,u),i);f<e&&r.push({dist:f,range1:h,range2:u})}function Tf(r,e,i,o,a=1/0){let h=Math.min(o.distance(r[0],i[0][0]),a);if(h===0)return h;const u=new ec([{dist:0,range1:[0,r.length-1],range2:[0,0]}],wh),f=e?ic:tc,_=hl(i);for(;u.length;){const g=u.pop();if(g.dist>=h)continue;const v=g.range1;if(vs(v)<=f){if(!Vn(v,r.length))return NaN;if(e){const b=bf(r,v,i,o);if((h=Math.min(h,b))===0)return h}else for(let b=v[0];b<=v[1];++b){const w=vf(r[b],i,o);if((h=Math.min(h,w))===0)return h}}else{const b=rc(v,e);if(b[0]!==null){const w=Zn(Ho(r,b[0]),_,o);w<h&&u.push({dist:w,range1:b[0],range2:[0,0]})}if(b[1]!==null){const w=Zn(Ho(r,b[1]),_,o);w<h&&u.push({dist:w,range1:b[1],range2:[0,0]})}}}return h}function Sd(r,e,i,o,a,h=1/0){let u=Math.min(h,a.distance(r[0],i[0]));if(u===0)return u;const f=new ec([{dist:0,range1:[0,r.length-1],range2:[0,i.length-1]}],wh),_=e?ic:tc,g=o?ic:tc;for(;f.length;){const v=f.pop();if(v.dist>=u)continue;const b=v.range1,w=v.range2;if(vs(b)<=_&&vs(w)<=g){if(!Vn(b,r.length)||!Vn(w,i.length))return NaN;
1if(e&&o?u=Math.min(u,yf(r,b,i,w,a)):e||o?e&&!o?u=Math.min(u,wd(i,w,r,b,a)):!e&&o&&(u=Math.min(u,wd(r,b,i,w,a))):u=Math.min(u,xf(r,b,i,w,a)),u===0)return u}else{const I=rc(b,e),A=rc(w,o);nc(f,u,a,r,i,I[0],A[0]),nc(f,u,a,r,i,I[0],A[1]),nc(f,u,a,r,i,I[1],A[0]),nc(f,u,a,r,i,I[1],A[1])}}return u}function Eh(r,e,i,o,a=1/0){let h=a;const u=Ho(r,[0,r.length-1]);for(const f of i)if(!(h!==1/0&&Zn(u,Ho(f,[0,f.length-1]),o)>=h)&&(h=Math.min(h,Sd(r,e,f,!0,o,h)),h===0))return h;return h}function oc(r,e,i,o,a=1/0){let h=a;const u=Ho(r,[0,r.length-1]);for(const f of i){if(h!==1/0&&Zn(u,hl(f),o)>=h)continue;const _=Tf(r,e,f,o,h);if(isNaN(_))return _;if((h=Math.min(h,_))===0)return h}return h}function Ih(r){return r==="Point"||r==="MultiPoint"||r==="LineString"||r==="MultiLineString"||r==="Polygon"||r==="MultiPolygon"}class bs{constructor(e,i){this.type=ut,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(Pt(e[1])){const o=e[1];if(o.type==="FeatureCollection"){for(let a=0;a<o.features.length;++a)if(Ih(o.features[a].geometry.type))return new bs(o,o.features[a].geometry)}else if(o.type==="Feature"){if(Ih(o.geometry.type))return new bs(o,o.geometry)}else if(Ih(o.type))return new bs(o,o)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),o=e.canonicalID();if(i!=null&&o!=null){if(e.geometryType()==="Point")return function(a,h,u){const f=[];for(const g of a)for(const v of g)f.push(Th(v,h));const _=new ea(f[0][1],"meters");return u.type==="Point"||u.type==="MultiPoint"||u.type==="LineString"?Sd(f,!1,u.type==="Point"?[u.coordinates]:u.coordinates,u.type==="LineString",_):u.type==="MultiLineString"?Eh(f,!1,u.coordinates,_):u.type==="Polygon"||u.type==="MultiPolygon"?oc(f,!1,u.type==="Polygon"?[u.coordinates]:u.coordinates,_):null}(i,o,this.geometries);if(e.geometryType()==="LineString")return function(a,h,u){const f=[];for(const g of a){const v=[];for(const b of g)v.push(Th(b,h));f.push(v)}const _=new ea(f[0][0][1],"meters");if(u.type==="Point"||u.type==="MultiPoint"||u.type==="LineString")return Eh(u.type==="Point"?[u.coordinates]:u.coordinates,u.type==="LineString",f,_);if(u.type==="MultiLineString"){let g=1/0;for(let v=0;v<u.coordinates.length;v++){const b=Eh(u.coordinates[v],!0,f,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}if(u.type==="Polygon"||u.type==="MultiPolygon"){let g=1/0;for(let v=0;v<f.length;v++){const b=oc(f[v],!0,u.type==="Polygon"?[u.coordinates]:u.coordinates,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return null}(i,o,this.geometries);if(e.geometryType()==="Polygon")return function(a,h,u){const f=[];for(const g of function(v,b){const w=v.length;if(w<=1)return[v];const I=[];let A,P;for(let R=0;R<w;R++){const O=pf(v[R]);O!==0&&(v[R].area=Math.abs(O),P===void 0&&(P=O<0),P===O<0?(A&&I.push(A),A=[v[R]]):A.push(v[R]))}return A&&I.push(A),I}(a)){const v=[];for(let b=0;b<g.length;++b)v.push(gf(g[b],h));f.push(v)}const _=new ea(f[0][0][0][1],"meters");if(u.type==="Point"||u.type==="MultiPoint"||u.type==="LineString")return oc(u.type==="Point"?[u.coordinates]:u.coordinates,u.type==="LineString",f,_);if(u.type==="MultiLineString"){let g=1/0;for(let v=0;v<u.coordinates.length;v++){const b=oc(u.coordinates[v],!0,f,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return u.type==="Polygon"||u.type==="MultiPolygon"?function(g,v,b){let w=1/0;for(const I of g)for(const A of v){const P=wf(I,A,b,w);if(isNaN(P))return P;if((w=Math.min(w,P))===0)return w}return w}(u.type==="Polygon"?[u.coordinates]:u.coordinates,f,_):null}(i,o,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function ta(r){if(r instanceof Tr&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof qo||r instanceof bs)return!1;if(r instanceof ra)return r.featureConstant;let e=!0;return r.eachChild(i=>{e&&!ta(i)&&(e=!1)}),e}function sc(r){if(r instanceof Tr&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(i=>{e&&!sc(i)&&(e=!1)}),e}function ac(r){if(r instanceof ra)return new Set([r.key]);let e=new Set;return r.eachChild(i=>{e=new Set([...e,...ac(i)])}),e}function ia(r,e){if(r instanceof Tr&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild(o=>{i&&!ia(o,e)&&(i=!1)}),i}
vendor: 5,704 bytes, line 1
1function Ed(r,e,i){return[r,e,i].filter(Boolean).join("�")}function Ah(r,e){switch(r){case"string":return kn(e);case"number":return+e;case"boolean":return!!e;case"color":return li.parse(e);case"formatted":return $r.fromString(kn(e));case"resolvedImage":return on.build(kn(e))}return e}function Id(r,e,i,o){return o!==void 0&&(r=o*Math.round(r/o)),e!==void 0&&r<e&&(r=e),i!==void 0&&r>i&&(r=i),r}class ra{constructor(e,i,o,a=!1){this.type=e,this.key=i,this.scope=o,this.featureConstant=a}static parse(e,i){let o=i.expectedType;if(o==null&&(o=ci),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const a=i.parse(e[1],1);if(!(a instanceof xt))return i.error("Key name of 'config' expression must be a string literal.");let h,u=!0;const f=kn(a.value);if(e.length>=3){const _=i.parse(e[2],2);if(!(_ instanceof xt))return i.error("Scope of 'config' expression must be a string literal.");h=kn(_.value)}if(i.options){const _=Ed(f,h,i._scope),g=i.options.get(_);g&&(u=ta(g.value||g.default))}return new ra(o,f,h,u)}evaluate(e){const i=Ed(this.key,this.scope,e.scope),o=e.getConfig(i);if(!o)return null;const{type:a,value:h,values:u,minValue:f,maxValue:_,stepValue:g}=o,v=o.default.evaluate(e);let b=v;if(h){const w=e.scope;e.scope=(w||"").split("�").slice(1).join("�"),b=h.evaluate(e),e.scope=w}return a&&(b=Ah(a,b)),b===void 0||f===void 0&&_===void 0&&g===void 0||(typeof b=="number"?b=Id(b,f,_,g):Array.isArray(b)&&(b=b.map(w=>typeof w=="number"?Id(w,f,_,g):w))),h!==void 0&&b!==void 0&&u&&!u.includes(b)&&(b=v,a&&(b=Ah(a,b))),(a&&a!==this.type||b!==void 0&&!Xl(it(b),this.type))&&(b=Ah(this.type.kind,b)),b}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class lc{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const o=e[1];return i.scope.has(o)?new lc(o,i.scope.get(o)):i.error(`Unknown variable "${o}". Make sure "${o}" 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 cc{constructor(e,i=[],o,a=new _h,h=[],u,f){this.registry=e,this.path=i,this.key=i.map(_=>typeof _=="string"?`['${_}']`:`[${_}]`).join(""),this.scope=a,this.errors=h,this.expectedType=o,this._scope=u,this.options=f}parse(e,i,o,a,h={}){return i||o?this.concat(i,null,o,a)._parse(e,h):this._parse(e,h)}parseObjectValue(e,i,o,a,h,u={}){return this.concat(i,o,a,h)._parse(e,u)}_parse(e,i){function o(a,h,u){return u==="assert"?new mt(h,[a]):u==="coerce"?new Bn(h,[a]):a}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 a=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(a){let h=a.parse(e,this);if(!h)return null;if(this.expectedType){const u=this.expectedType,f=h.type;if(u.kind!=="string"&&u.kind!=="number"&&u.kind!=="boolean"&&u.kind!=="object"&&u.kind!=="array"||f.kind!=="value")if(u.kind!=="color"&&u.kind!=="formatted"&&u.kind!=="resolvedImage"||f.kind!=="value"&&f.kind!=="string"){if(this.checkSubtype(u,f))return null}else h=o(h,u,i.typeAnnotation||"coerce");else h=o(h,u,i.typeAnnotation||"assert")}if(!(h instanceof xt)&&h.type.kind!=="resolvedImage"&&Mh(h)){const u=new sl(this._scope,this.options);try{h=new xt(h.type,h.evaluate(u))}catch(f){return this.error(f.message),null}}return h}return Bn.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,i,o,a){let h=typeof e=="number"?this.path.concat(e):this.path;h=typeof i=="string"?h.concat(i):h;const u=a?this.scope.concat(a):this.scope;return new cc(this.registry,h,o||null,u,this.errors,this._scope,this.options)}error(e,...i){const o=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new Tn(o,e))}checkSubtype(e,i){const o=Ws(e,i);return o&&this.error(o),o}}function Mh(r){if(r instanceof lc)return Mh(r.boundExpression);if(r instanceof Tr&&r.name==="error"||r instanceof Qn||r instanceof qo||r instanceof bs||r instanceof ra)return!1;const e=r instanceof Bn||r instanceof mt;let i=!0;return r.eachChild(o=>{i=e?i&&Mh(o):i&&o instanceof xt}),!!i&&ta(r)&&ia(r,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function hc(r,e){const i=r.length-1;let o,a,h=0,u=i,f=0;for(;h<=u;)if(f=Math.floor((h+u)/2),o=r[f],a=r[f+1],o<=e){if(f===i||e<a)return f;h=f+1}else{if(!(o>e))throw new hr("Input is not a number.");u=f-1}return 0}class ul{constructor(e,i,o){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,h]of o)this.labels.push(a),this.outputs.push(h)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const o=i.parse(e[1],1,ut);if(!o)return null;const a=[];let h=null;i.expectedType&&i.expectedType.kind!=="value"&&(h=i.expectedType);for(let u=1;u<e.length;u+=2){const f=u===1?-1/0:e[u],_=e[u+1],g=u,v=u+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',g);if(a.length&&a[a.length-1][0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',g);const b=i.parse(_,v,h);if(!b)return null;h=h||b.type,a.push([f,b])}return new ul(h,o,a)}evaluate(e){const i=this.labels,o=this.outputs;if(i.length===1)return o[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return o[0].evaluate(e);const h=i.length;return a>=i[h-1]?o[h-1].evaluate(e):o[hc(i,a)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const Ad=.95047,Md=1.08883,Cd=4/29,na=6/29,Pd=3*na*na,Ch=na*na*na,Sf=Math.PI/180,zd=180/Math.PI;function Ph(r){return r>Ch?Math.pow(r,1/3):r/Pd+Cd}function zh(r){return r>na?r*r*r:Pd*(r-Cd)}function Rh(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function uc(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Dh(r){const e=uc(r.r),i=uc(r.g),o=uc(r.b),a=Ph((.4124564*e+.3575761*i+.1804375*o)/Ad),h=Ph((.2126729*e+.7151522*i+.072175*o)/1);return{l:116*h-16,a:500*(a-h),b:200*(h-Ph((.0193339*e+.119192*i+.9503041*o)/Md)),alpha:r.a}}function ws(r){let e=(r.l+16)/116,i=isNaN(r.a)?e:e+r.a/500,o=isNaN(r.b)?e:e-r.b/200;return e=1*zh(e),i=Ad*zh(i),o=Md*zh(o),new li(Rh(3.2404542*i-1.5371385*e-.4985314*o),Rh(-.969266*i+1.8760108*e+.041556*o),Rh(.0556434*i-.2040259*e+1.0572252*o),r.alpha)}function Rd(r,e,i){const o=e-r;return r+i*(o>180||o<-180?o-360*Math.round(o/360):o)}const oa={forward:Dh,reverse:ws,interpolate:function(r,e,i){return{l:ft(r.l,e.l,i),a:ft(r.a,e.a,i),b:ft(r.b,e.b,i),alpha:ft(r.alpha,e.alpha,i)}}},dl={forward:function(r){const{l:e,a:i,b:o}=Dh(r),a=Math.atan2(o,i)*zd;return{h:a<0?a+360:a,c:Math.sqrt(i*i+o*o),l:e,alpha:r.a}},reverse:function(r){const e=r.h*Sf,i=r.c;return ws({l:r.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:r.alpha})},interpolate:function(r,e,i){return{h:Rd(r.h,e.h,i),c:ft(r.c,e.c,i),l:ft(r.l,e.l,i),alpha:ft(r.alpha,e.alpha,i)}}};var dc=Object.freeze({__proto__:null,hcl:dl,lab:oa});class sn{constructor(e,i,o,a,h){this.type=e,this.operator=i,this.interpolation=o,this.input=a,this.labels=[],this.outputs=[];for(const[u,f]of h)this.labels.push(u),this.outputs.push(f)}static interpolationFactor(e,i,o,a){let h=0;if(e.name==="exponential")h=Lh(i,e.base,o,a);else if(e.name==="linear")h=Lh(i,1,o,a);else if(e.name==="cubic-bezier"){const u=e.controlPoints;h=new Vs(u[0],u[1],u[2],u[3]).solve(Lh(i,1,o,a))}return h}static parse(e,i){let[o,a,h,...u]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const g=a[1];if(typeof g!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:g}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const g=a.slice(1);if(g.length!==4||g.some(v=>typeof v!="number"||v<0||v>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:g}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(h=i.parse(h,2,ut),!h)return null;const f=[];let _=null;o==="interpolate-hcl"||o==="interpolate-lab"?_=dn:i.expectedType&&i.expectedType.kind!=="value"&&(_=i.expectedType);for(let g=0;g<u.length;g+=2){const v=u[g],b=u[g+1],w=g+3,I=g+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(f.length&&f[f.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',w);const A=i.parse(b,I,_);if(!A)return null;_=_||A.type,f.push([v,A])}return _.kind==="number"||_.kind==="color"||_.kind==="array"&&_.itemType.kind==="number"&&typeof _.N=="number"?new sn(_,o,a,h,f):i.error(`Type ${pr(_)} is not interpolatable.`)}evaluate(e){const i=this.labels,o=this.outputs;if(i.length===1)return o[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return o[0].evaluate(e);const h=i.length;if(a>=i[h-1])return o[h-1].evaluate(e);const u=hc(i,a),f=sn.interpolationFactor(this.interpolation,a,i[u],i[u+1]),_=o[u].evaluate(e),g=o[u+1].evaluate(e);return this.operator==="interpolate"?el[this.type.kind.toLowerCase()](_,g,f):this.operator==="interpolate-hcl"?dl.reverse(dl.interpolate(dl.forward(_),dl.forward(g),f)):oa.reverse(oa.interpolate(oa.forward(_),oa.forward(g),f))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}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 i=[this.operator,e,this.input.serialize()];for(let o=0;o<this.labels.length;o++)i.push(this.labels[o],this.outputs[o].serialize());return i}}function Lh(r,e,i,o){const a=o-i,h=r-i;return a===0?0:e===1?h/a:(Math.pow(e,h)-1)/(Math.pow(e,a)-1)}class pc{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let o=null;const a=i.expectedType;a&&a.kind!=="value"&&(o=a);const h=[];for(const f of e.slice(1)){const _=i.parse(f,1+h.length,o,void 0,{typeAnnotation:"omit"});if(!_)return null;o=o||_.type,h.push(_)}const u=a&&h.some(f=>Ws(a,f.type));return new pc(u?ci:o,h)}evaluate(e){let i,o=null,a=0;for(const h of this.args){if(a++,o=h.evaluate(e),o&&o instanceof on&&!o.available&&(i||(i=o),o=null,a===this.args.length))return i;if(o!==null)break}return o}
1eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class pl{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const o=[];for(let h=1;h<e.length-1;h+=2){const u=e[h];if(typeof u!="string")return i.error(`Expected string, but found ${typeof u} instead.`,h);if(/[^a-zA-Z0-9_]/.test(u))return i.error("Variable names must contain only alphanumeric characters or '_'.",h);const f=i.parse(e[h+1],h+1);if(!f)return null;o.push([u,f])}const a=i.parse(e[e.length-1],e.length-1,i.expectedType,o);return a?new pl(o,a):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,o]of this.bindings)e.push(i,o.serialize());return e.push(this.result.serialize()),e}}class fc{constructor(e,i,o){this.type=e,this.index=i,this.input=o}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,ut),a=i.parse(e[2],2,Br(i.expectedType||ci));return o&&a?new fc(a.type.itemType,o,a):null}evaluate(e){const i=this.index.evaluate(e),o=this.input.evaluate(e);if(i<0)throw new hr(`Array index out of bounds: ${i} < 0.`);if(i>=o.length)throw new hr(`Array index out of bounds: ${i} > ${o.length-1}.`);if(i!==Math.floor(i))throw new hr(`Array index must be an integer, but found ${i} instead. Use at-interpolated to retrieve interpolated result with a fractional index.`);return o[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Fh{constructor(e,i,o){this.type=e,this.index=i,this.input=o}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,ut),a=i.parse(e[2],2,Br(i.expectedType||ci));return o&&a?new Fh(a.type.itemType,o,a):null}evaluate(e){const i=this.index.evaluate(e),o=this.input.evaluate(e);if(i<0)throw new hr(`Array index out of bounds: ${i} < 0.`);if(i>o.length-1)throw new hr(`Array index out of bounds: ${i} > ${o.length-1}.`);if(i===Math.floor(i))return o[i];const a=Math.floor(i),h=Math.ceil(i),u=o[a],f=o[h];if(typeof u!="number"||typeof f!="number")throw new hr(`Cannot interpolate between non-number values at index ${i}.`);const _=i-a;return u*(1-_)+f*_}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Oh{constructor(e,i){this.type=ai,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,ci),a=i.parse(e[2],2,ci);return o&&a?No(o.type,[ai,si,ut,Zs,ci])?new Oh(o,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${pr(o.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(o==null)return!1;if(!rl(i,["boolean","string","number","null"]))throw new hr(`Expected first argument to be of type boolean, string, number or null, but found ${pr(it(i))} instead.`);if(!rl(o,["string","array"]))throw new hr(`Expected second argument to be of type array or string, but found ${pr(it(o))} instead.`);return o.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class mc{constructor(e,i,o){this.type=ut,this.needle=e,this.haystack=i,this.fromIndex=o}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,ci),a=i.parse(e[2],2,ci);if(!o||!a)return null;if(!No(o.type,[ai,si,ut,Zs,ci]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${pr(o.type)} instead`);if(e.length===4){const h=i.parse(e[3],3,ut);return h?new mc(o,a,h):null}return new mc(o,a)}evaluate(e){const i=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!rl(i,["boolean","string","number","null"]))throw new hr(`Expected first argument to be of type boolean, string, number or null, but found ${pr(it(i))} instead.`);if(!rl(o,["string","array"]))throw new hr(`Expected second argument to be of type array or string, but found ${pr(it(o))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return o.indexOf(i,a)}return o.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class _c{constructor(e,i,o,a,h,u){this.inputType=e,this.type=i,this.input=o,this.cases=a,this.outputs=h,this.otherwise=u}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let o,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const h={},u=[];for(let g=2;g<e.length-1;g+=2){let v=e[g];const b=e[g+1];Array.isArray(v)||(v=[v]);const w=i.concat(g);if(v.length===0)return w.error("Expected at least one branch label.");for(const A of v){if(typeof A!="number"&&typeof A!="string")return w.error("Branch labels must be numbers or strings.");if(typeof A=="number"&&Math.abs(A)>Number.MAX_SAFE_INTEGER)return w.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof A=="number"&&Math.floor(A)!==A)return w.error("Numeric branch labels must be integer values.");if(o){if(w.checkSubtype(o,it(A)))return null}else o=it(A);if(h[String(A)]!==void 0)return w.error("Branch labels must be unique.");h[String(A)]=u.length}const I=i.parse(b,g,a);if(!I)return null;a=a||I.type,u.push(I)}const f=i.parse(e[1],1,ci);if(!f)return null;const _=i.parse(e[e.length-1],e.length-1,a);return _?f.type.kind!=="value"&&i.concat(1).checkSubtype(o,f.type)?null:new _c(o,a,f,h,u,_):null}evaluate(e){const i=this.input.evaluate(e);return(Xl(it(i),this.inputType)&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}
vendor: 8,559 bytes, line 1
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()],i=Object.keys(this.cases).sort(),o=[],a={};for(const u of i){const f=a[this.cases[u]];f===void 0?(a[this.cases[u]]=o.length,o.push([this.cases[u],[u]])):o[f][1].push(u)}const h=u=>this.inputType.kind==="number"?Number(u):u;for(const[u,f]of o)e.push(f.length===1?h(f[0]):f.map(h)),e.push(this.outputs[u].serialize());return e.push(this.otherwise.serialize()),e}}class gc{constructor(e,i,o){this.type=e,this.branches=i,this.otherwise=o}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const a=[];for(let u=1;u<e.length-1;u+=2){const f=i.parse(e[u],u,ai);if(!f)return null;const _=i.parse(e[u+1],u+1,o);if(!_)return null;a.push([f,_]),o=o||_.type}const h=i.parse(e[e.length-1],e.length-1,o);return h?new gc(o,a,h):null}evaluate(e){for(const[i,o]of this.branches)if(i.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,o]of this.branches)e(i),e(o);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Ts{constructor(e,i,o,a){this.type=e,this.input=i,this.beginIndex=o,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,ci),a=i.parse(e[2],2,ut);if(!o||!a)return null;if(!No(o.type,[Br(ci),si,ci]))return i.error(`Expected first argument to be of type array or string, but found ${pr(o.type)} instead`);if(e.length===4){const h=i.parse(e[3],3,ut);return h?new Ts(o.type,o,a,h):null}return new Ts(o.type,o,a)}evaluate(e){const i=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!rl(i,["string","array"]))throw new hr(`Expected first argument to be of type array or string, but found ${pr(it(i))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return i.slice(o,a)}return i.slice(o)}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()]}}class kh{constructor(e,i){this.type=Br(si),this.str=e,this.delimiter=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,si),a=i.parse(e[2],2,si);return o&&a?new kh(o,a):void 0}evaluate(e){const i=this.str.evaluate(e),o=this.delimiter.evaluate(e);return i.split(o)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function Bh(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Dd(r,e,i,o){return o.compare(e,i)===0}function sa(r,e,i){const o=r!=="=="&&r!=="!=";return class X0{constructor(h,u,f){this.type=ai,this.lhs=h,this.rhs=u,this.collator=f,this.hasUntypedArgument=h.type.kind==="value"||u.type.kind==="value"}static parse(h,u){if(h.length!==3&&h.length!==4)return u.error("Expected two or three arguments.");const f=h[0];let _=u.parse(h[1],1,ci);if(!_)return null;if(!Bh(f,_.type))return u.concat(1).error(`"${f}" comparisons are not supported for type '${pr(_.type)}'.`);let g=u.parse(h[2],2,ci);if(!g)return null;if(!Bh(f,g.type))return u.concat(2).error(`"${f}" comparisons are not supported for type '${pr(g.type)}'.`);if(_.type.kind!==g.type.kind&&_.type.kind!=="value"&&g.type.kind!=="value")return u.error(`Cannot compare types '${pr(_.type)}' and '${pr(g.type)}'.`);o&&(_.type.kind==="value"&&g.type.kind!=="value"?_=new mt(g.type,[_]):_.type.kind!=="value"&&g.type.kind==="value"&&(g=new mt(_.type,[g])));let v=null;if(h.length===4){if(_.type.kind!=="string"&&g.type.kind!=="string"&&_.type.kind!=="value"&&g.type.kind!=="value")return u.error("Cannot use collator to compare non-string types.");if(v=u.parse(h[3],3,Wl),!v)return null}return new X0(_,g,v)}evaluate(h){const u=this.lhs.evaluate(h),f=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const _=it(u),g=it(f);if(_.kind!==g.kind||_.kind!=="string"&&_.kind!=="number")throw new hr(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${_.kind}, ${g.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const _=it(u),g=it(f);if(_.kind!=="string"||g.kind!=="string")return e(h,u,f)}return this.collator?i(h,u,f,this.collator.evaluate(h)):e(h,u,f)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}serialize(){const h=[r];return this.eachChild(u=>{h.push(u.serialize())}),h}}}const Ld=sa("==",function(r,e,i){return e===i},Dd),Fd=sa("!=",function(r,e,i){return e!==i},function(r,e,i,o){return!Dd(0,e,i,o)}),Ef=sa("<",function(r,e,i){return e<i},function(r,e,i,o){return o.compare(e,i)<0}),If=sa(">",function(r,e,i){return e>i},function(r,e,i,o){return o.compare(e,i)>0}),Af=sa("<=",function(r,e,i){return e<=i},function(r,e,i,o){return o.compare(e,i)<=0}),yc=sa(">=",function(r,e,i){return e>=i},function(r,e,i,o){return o.compare(e,i)>=0});class Nh{constructor(e,i,o,a,h,u){this.type=si,this.number=e,this.locale=i,this.currency=o,this.unit=a,this.minFractionDigits=h,this.maxFractionDigits=u}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const o=i.parse(e[1],1,ut);if(!o)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let h=null;if(a.locale&&(h=i.parseObjectValue(a.locale,2,"locale",si),!h))return null;let u=null;if(a.currency&&(u=i.parseObjectValue(a.currency,2,"currency",si),!u))return null;let f=null;if(a.unit&&(f=i.parseObjectValue(a.unit,2,"unit",si),!f))return null;let _=null;if(a["min-fraction-digits"]&&(_=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",ut),!_))return null;let g=null;return a["max-fraction-digits"]&&(g=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",ut),!g)?null:new Nh(o,h,u,f,_,g)}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 Vh{constructor(e){this.type=ut,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=i.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${pr(o.type)} instead.`):new Vh(o):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new hr(`Expected value to be of type string or array, but found ${pr(it(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function Od(r){return function(){r=1831565813+(r|=0)|0;let e=Math.imul(r^r>>>15,1|r);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const aa={"==":Ld,"!=":Fd,">
1":If,"<":Ef,">=":yc,"<=":Af,array:mt,at:fc,"at-interpolated":Fh,boolean:mt,case:gc,coalesce:pc,collator:Qn,format:Xs,image:Ys,in:Oh,"index-of":mc,interpolate:sn,"interpolate-hcl":sn,"interpolate-lab":sn,length:Vh,let:pl,literal:xt,match:_c,number:mt,"number-format":Nh,object:mt,slice:Ts,step:ul,string:mt,"to-boolean":Bn,"to-color":Bn,"to-number":Bn,"to-string":Bn,var:lc,within:qo,distance:bs,config:ra,split:kh};function Uh(r,[e,i,o,a]){e=e.evaluate(r),i=i.evaluate(r),o=o.evaluate(r);const h=a?a.evaluate(r):1,u=ys(e,i,o,h);if(u)throw new hr(u);return new li(e/255,i/255,o/255,h)}function kd(r,[e,i,o,a]){e=e.evaluate(r),i=i.evaluate(r),o=o.evaluate(r);const h=a?a.evaluate(r):1,u=function(g,v,b,w){return typeof g=="number"&&g>=0&&g<=360?typeof v=="number"&&v>=0&&v<=100&&typeof b=="number"&&b>=0&&b<=100?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid hsla value [${[g,v,b,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof w=="number"?[g,v,b,w]:[g,v,b]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof w=="number"?[g,v,b,w]:[g,v,b]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,o,h);if(u)throw new hr(u);const f=`hsla(${e}, ${i}%, ${o}%, ${h})`,_=li.parse(f);if(!_)throw new hr(`Failed to parse HSLA color: ${f}`);return _}function Bd(r,e){return r in e}function xc(r,e){const i=e[r];return i===void 0?null:i}function $o(r){return{type:r}}function jh(r){return{result:"success",value:r}}function Zo(r){return{result:"error",value:r}}function Wo(r,e){return!!r&&!!r.parameters&&r.parameters.indexOf(e)>-1}function vc(r){return r["property-type"]==="data-driven"}function Nd(r){return Wo(r.expression,"measure-light")}function Vd(r){return Wo(r.expression,"zoom")}function bc(r){return!!r.expression&&r.expression.interpolated}function wc(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Ud(r){return r}function Gh(r,e){const i=e.type==="color",o=r.stops&&typeof r.stops[0][0]=="object",a=o||!(o||r.property!==void 0),h=r.type||(bc(e)?"exponential":"interval");if(i&&((r=gs({},r)).stops&&(r.stops=r.stops.map(g=>[g[0],li.parse(g[1])])),r.default=li.parse(r.default?r.default:e.default)),r.colorSpace&&r.colorSpace!=="rgb"&&!dc[r.colorSpace])throw new Error(`Unknown color space: ${r.colorSpace}`);let u,f,_;if(h==="exponential")u=Gd;else if(h==="interval")u=jd;else if(h==="categorical"){u=qh,f=Object.create(null);for(const g of r.stops)f[g[0]]=g[1];_=typeof r.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);u=Xo}if(o){const g={},v=[];for(let I=0;I<r.stops.length;I++){const A=r.stops[I],P=A[0].zoom;g[P]===void 0&&(g[P]={zoom:P,type:r.type,property:r.property,default:r.default,stops:[]},v.push(P)),g[P].stops.push([A[0].value,A[1]])}const b=[];for(const I of v)b.push([g[I].zoom,Gh(g[I],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:sn.interpolationFactor.bind(void 0,w),zoomStops:b.map(I=>I[0]),evaluate:({zoom:I},A)=>Gd({stops:b,base:r.base},e,I).evaluate(I,A)}}if(a){const g=h==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:g,interpolationFactor:sn.interpolationFactor.bind(void 0,g),zoomStops:r.stops.map(v
vendor: 6,712 bytes, line 1
1=>v[0]),evaluate:({zoom:v})=>u(r,e,v,f,_)}}return{kind:"source",evaluate(g,v){const b=v&&v.properties?v.properties[r.property]:void 0;return b===void 0?Ss(r.default,e.default):u(r,e,b,f,_)}}}function Ss(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function qh(r,e,i,o,a){return Ss(typeof i===a?o[i]:void 0,r.default,e.default)}function jd(r,e,i){if(Vo(i)!=="number")return Ss(r.default,e.default);const o=r.stops.length;if(o===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[o-1][0])return r.stops[o-1][1];const a=hc(r.stops.map(h=>h[0]),i);return r.stops[a][1]}function Gd(r,e,i){const o=r.base!==void 0?r.base:1;if(Vo(i)!=="number")return Ss(r.default,e.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const h=hc(r.stops.map(v=>v[0]),i),u=function(v,b,w,I){const A=I-w,P=v-w;return A===0?0:b===1?P/A:(Math.pow(b,P)-1)/(Math.pow(b,A)-1)}(i,o,r.stops[h][0],r.stops[h+1][0]),f=r.stops[h][1],_=r.stops[h+1][1];let g=el[e.type]||Ud;if(r.colorSpace&&r.colorSpace!=="rgb"){const v=dc[r.colorSpace];g=(b,w)=>v.reverse(v.interpolate(v.forward(b),v.forward(w),u))}return typeof f.evaluate=="function"?{evaluate(...v){const b=f.evaluate.apply(void 0,v),w=_.evaluate.apply(void 0,v);if(b!==void 0&&w!==void 0)return g(b,w,u)}}:g(f,_,u)}function Xo(r,e,i){return e.type==="color"?i=li.parse(i):e.type==="formatted"?i=$r.fromString(i.toString()):e.type==="resolvedImage"?i=on.build(i.toString()):Vo(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),Ss(i,r.default,e.default)}Tr.register(aa,{error:[{kind:"error"},[si],(r,[e])=>{throw new hr(e.evaluate(r))}],typeof:[si,[ci],(r,[e])=>pr(it(e.evaluate(r)))],"to-rgba":[Br(ut,4),[dn],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Br(ut,4),[dn],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[dn,[ut,ut,ut],Uh],rgba:[dn,[ut,ut,ut,ut],Uh],hsl:[dn,[ut,ut,ut],kd],hsla:[dn,[ut,ut,ut,ut],kd],has:{type:ai,overloads:[[[si],(r,[e])=>Bd(e.evaluate(r),r.properties())],[[si,xo],(r,[e,i])=>Bd(e.evaluate(r),i.evaluate(r))]]},get:{type:ci,overloads:[[[si],(r,[e])=>xc(e.evaluate(r),r.properties())],[[si,xo],(r,[e,i])=>xc(e.evaluate(r),i.evaluate(r))]]},"feature-state":[ci,[si],(r,[e])=>xc(e.evaluate(r),r.featureState||{})],properties:[xo,[],r=>r.properties()],"geometry-type":[si,[],r=>r.geometryType()],worldview:[si,[],r=>r.globals.worldview||""],id:[ci,[],r=>r.id()],zoom:[ut,[],r=>r.globals.zoom],pitch:[ut,[],r=>r.globals.pitch||0],"distance-from-center":[ut,[],r=>r.distanceFromCenter()],"measure-light":[ut,[si],(r,[e])=>r.measureLight(e.evaluate(r))],"heatmap-density":[ut,[],r=>r.globals.heatmapDensity||0],"line-progress":[ut,[],r=>r.globals.lineProgress||0],"raster-value":[ut,[],r=>r.globals.rasterValue||0],"raster-particle-speed":[ut,[],r=>r.globals.rasterParticleSpeed||0],"sky-radial-progress":[ut,[],r=>r.globals.skyRadialProgress||0],accumulated:[ci,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[ut,$o(ut),(r,e)=>{let i=0;for(const o of e)i+=o.evaluate(r);return i}],"*":[ut,$o(ut),(r,e)=>{let i=1;for(const o of e)i*=o.evaluate(r);return i}],"-":{type:ut,overloads:[[[ut,ut],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[ut],(r,[e])=>-e.evaluate(r)]]},"/":[ut,[ut,ut],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[ut,[ut,ut],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[ut,[],()=>Math.LN2],pi:[ut,[],()=>Math.PI],e:[ut,[],()=>Math.E],"^":[ut,[ut,ut],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[ut,[ut],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[ut,[ut],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[ut,[ut],(r,[e])=>Math.log(e.evaluate(r))],log2:[ut,[ut],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[ut,[ut],(r,[e])=>Math.sin(e.evaluate(r))],cos:[ut,[ut],(r,[e])=>Math.cos(e.evaluate(r))],tan:[ut,[ut],(r,[e])=>Math.tan(e.evaluate(r))],asin:[ut,[ut],(r,[e])=>Math.asin(e.evaluate(r))],acos:[ut,[ut],(r,[e])=>Math.acos(e.evaluate(r))],atan:[ut,[ut],(r,[e])=>Math.atan(e.evaluate(r))],min:[ut,$o(ut),(r,e)=>Math.min(...e.map(i=>i.evaluate(r)))],max:[ut,$o(ut),(r,e)=>Math.max(...e.map(i=>i.evaluate(r)))],abs:[ut,[ut],(r,[e])=>Math.abs(e.evaluate(r))],round:[ut,[ut],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[ut,[ut],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[ut,[ut],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[ai,[si,ci],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[ai,[ci],(r,[e])=>r.id()===e.value],"filter-type-==":[ai,[si],(r,[e])=>r.geometryType()===e.value],"filter-<":[ai,[si,ci],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o<a}],"filter-id-<":[ai,[ci],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i<o}],"filter->":[ai,[si,ci],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o>a}],"filter-id->":[ai,[ci],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i>o}],"filter-<=":[ai,[si,ci],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o<=a}],"filter-id-<=":[ai,[ci],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i<=o}],"filter->=":[ai,[si,ci],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o>=a}],"filter-id->=":[ai,[ci],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i>=o}],"filter-has":[ai,[ci],(r,[e])=>e.value in r.properties()],"filter-has-id":[ai,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[ai,[Br(si)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[ai,[Br(ci)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[ai,[si,Br(ci)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[ai,[si,Br(ci)],(r,[e,i])=>function(o,a,h,u){for(;h<=u;){const f=h+u>>1;if(a[f]===o)return!0;a[f]>o?u=f-1:h=f+1}return!1}(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:ai,overloads:[[[ai,ai],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[$o(ai),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:ai,overloads:[[[ai,ai],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[$o(ai),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[ai,[ai],(r,[e])=>!e.evaluate(r)],"is-supported-script":[ai,[si],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[si,[si],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[si,[si],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[si,$o(ci),(r,e)=>e.map(i=>kn(i.evaluate(r))).join("")],"resolved-locale":[si,[Wl],(r,[e])=>e.evaluate(r).resolvedLocale()],random:[ut,[ut,ut,ci],(r,e)=>{const[i,o,a]=e.map(u=>u.evaluate(r));if(i>o||i===o)return i;let h;
1if(typeof a=="string")h=function(u){let f=0;if(u.length===0)return f;for(let _=0;_<u.length;_++)f=(f<<5)-f+u.charCodeAt(_),f|=0;return f}(a);else{if(typeof a!="number")throw new hr(`Invalid seed input: ${a}`);h=a}return i+Od(h)()*(o-i)}]});class Hh{constructor(e,i,o,a){this.expression=e,this._warningHistory={},this._evaluator=new sl(o,a),this._defaultValue=i?function(h){return h.type==="color"&&(wc(h.default)||Array.isArray(h.default))?new li(0,0,0,0):h.type==="color"?li.parse(h.default)||null:h.default===void 0?null:h.default}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=ac(e)}evaluateWithoutErrorHandling(e,i,o,a,h,u,f,_){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=o,this._evaluator.canonical=a||null,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=u,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,o,a,h,u,f,_){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=o||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=u||null,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null;try{const g=this.expression.evaluate(this._evaluator);if(g==null||typeof g=="number"&&g!=g)return this._defaultValue;if(this._enumValues&&!(g in this._enumValues))throw new hr(`Expected value to be one of ${Object.keys(this._enumValues).map(v=>JSON.stringify(v)).join(", ")}, but found ${JSON.stringify(g)} instead.`);return g}catch(g){return this._warningHistory[g.message]||(this._warningHistory[g.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${g.message}`)),this._defaultValue}}}function $h(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in aa}function Es(r,e,i,o){const a=new cc(aa,[],e?function(u){const f={color:dn,string:si,number:ut,enum:si,boolean:ai,formatted:tl,resolvedImage:il};return u.type==="array"?Br(f[u.value]||ci,u.length):f[u.type]}(e):void 0,void 0,void 0,i,o),h=a.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?jh(new Hh(h,e,i,o)):Zo(a.errors)}class Tc{constructor(e,i,o,a){this.kind=e,this._styleExpression=i,this.isLightConstant=o,this.isLineProgressConstant=a,this.isStateDependent=e!=="constant"&&!sc(i.expression),this.configDependencies=ac(i.expression)}evaluateWithoutErrorHandling(e,i,o,a,h,u){return this._styleExpression.evaluateWithoutErrorHandling(e,i,o,a,h,u)}evaluate(e,i,o,a,h,u){return this._styleExpression.evaluate(e,i,o,a,h,u)}}class Yo{constructor(e,i,o,a,h,u){this.kind=e,this.zoomStops=o,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!sc(i.expression),this.isLightConstant=h,this.isLineProgressConstant=u,this.configDependencies=ac(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,o,a,h,u){return this._styleExpression.evaluateWithoutErrorHandling(e,i,o,a,h,u)}evaluate(e,i,o,a,h,u){return this._styleExpression.evaluate(e,i,o,a,h,u)}interpolationFactor(e,i,o){return this.interpolationType?sn.interpolationFactor(this.interpolationType,e,i,o):0}}function Zh(r,e,i,o){if((r=Es(r,e,i,o)).result==="error")return r;const a=r.value.expression,h=ta(a);if(!h&&!vc(e))return Zo([new Tn("","data expressions not supported")]);const u=ia(a,["zoom","pitch","distance-from-center"]);if(!u&&!Vd(e))return Zo([new Tn("","zoom expressions not supported")]);const f=ia(a,["measure-light"]);if(!f&&!Nd(e))return Zo([new Tn("","measure-light expression not supported")]);const _=ia(a,["line-progress"]);if(!_&&!function(b){return Wo(b.expression,"line-progress")}(e))return Zo([new Tn("","line-progress expression not supported")]);const g=e.expression&&e.expression.relaxZoomRestriction,v=fl(a);return v||u||g?v instanceof Tn?Zo([v]):v instanceof sn&&!bc(e)?Zo([new Tn("",'"interpolate" expressions cannot be used with this property')]):jh(v?new Yo(h&&_?"camera":"composite",r.value,v.labels,v instanceof sn?v.interpolation:void 0,f,_):new Tc(h&&_?"constant":"source",r.value,f,_)):Zo([new Tn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Is{constructor(e,i){this._parameters=e,this._specification=i,gs(this,Gh(this._parameters,this._specification))}static deserialize(e){return new Is(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function fl(r){let e=null;if(r instanceof pl)e=fl(r.result);else if(r instanceof pc){for(const i of r.args)if(e=fl(i),e)break}else(r instanceof ul||r instanceof sn)&&r.input instanceof Tr&&r.input.name==="zoom"&&(e=r);return e instanceof Tn||r.eachChild(i=>{const o=fl(i);o instanceof Tn?e=o:e&&o&&e!==o&&(e=new Tn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var Wh,qd,Xh=function(){if(qd)return Wh;qd=1,Wh=e;var r=3;function e(i,o,a){var h=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var u=new Int32Array(this.arrayBuffer);i=u[0],this.d=(o=u[1])+2*(a=u[2]);for(var f=0;f<this.d*this.d;f++){var _=u[r+f],g=u[r+f+1];h.push(_===g?null:u.subarray(_,g))}var v=u[r+h.length+1];this.keys=u.subarray(u[r+h.length],v),this.bboxes=u.subarray(v),this.insert=this._insertReadonly}else{this.d=o+2*a;for(var b=0;b<this.d*this.d;b++)h.push([]);this.keys=[],this.bboxes=[]}this.n=o,this.extent=i,this.padding=a,this.scale=o/i,this.uid=0;var w=a/o*i;this.min=-w,this.max=i+w}
1return e.prototype.insert=function(i,o,a,h,u){this._forEachCell(o,a,h,u,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(o),this.bboxes.push(a),this.bboxes.push(h),this.bboxes.push(u)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(i,o,a,h,u,f){this.cells[u].push(f)},e.prototype.query=function(i,o,a,h,u){var f=this.min,_=this.max;if(i<=f&&o<=f&&_<=a&&_<=h&&!u)return Array.prototype.slice.call(this.keys);var g=[];return this._forEachCell(i,o,a,h,this._queryCell,g,{},u),g},e.prototype._queryCell=function(i,o,a,h,u,f,_,g){var v=this.cells[u];if(v!==null)for(var b=this.keys,w=this.bboxes,I=0;I<v.length;I++){var A=v[I];if(_[A]===void 0){var P=4*A;(g?g(w[P+0],w[P+1],w[P+2],w[P+3]):i<=w[P+2]&&o<=w[P+3]&&a>=w[P+0]&&h>=w[P+1])?(_[A]=!0,f.push(b[A])):_[A]=!1}}},e.prototype._forEachCell=function(i,o,a,h,u,f,_,g){for(var v=this._convertToCellCoord(i),b=this._convertToCellCoord(o),w=this._convertToCellCoord(a),I=this._convertToCellCoord(h),A=v;A<=w;A++)for(var P=b;P<=I;P++){var R=this.d*P+A;if((!g||g(this._convertFromCellCoord(A),this._convertFromCellCoord(P),this._convertFromCellCoord(A+1),this._convertFromCellCoord(P+1)))&&u.call(this,i,o,a,h,R,f,_,g))return}},e.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},e.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,o=r+this.cells.length+1+1,a=0,h=0;h<this.cells.length;h++)a+=this.cells[h].length;var u=new Int32Array(o+a+this.keys.length+this.bboxes.length);u[0]=this.extent,u[1]=this.n,u[2]=this.padding;for(var f=o,_=0;_<i.length;_++){var g=i[_];u[r+_]=f,u.set(g,f),f+=g.length}return u[r+i.length]=f,u.set(this.keys,f),u[r+i.length+1]=f+=this.keys.length,u.set(this.bboxes,f),f+=this.bboxes.length,u.buffer},Wh}(),Ko=Na(Xh);const ml={};function rt(r,e,i={}){Object.defineProperty(r,"_classRegistryKey",{value:e,writable:!1}),ml[e]={klass:r,omit:i.omit||[]}}rt(Object,"Object"),Ko.serialize=function(r,e){const i=r.toArrayBuffer();return e&&e.add(i),{buffer:i}},Ko.deserialize=function(r){return new Ko(r.buffer)},Object.defineProperty(Ko,"name",{value:"Grid"}),rt(Ko,"Grid"),delete ke.prototype.constructor,typeof DOMMatrix<"u"&&rt(DOMMatrix,"DOMMatrix"),rt(li,"Color"),rt(Error,"Error"),rt($r,"Formatted"),rt(Yl,"FormattedSection"),rt(Xt,"AJAXError"),rt(on,"ResolvedImage"),rt(Is,"StylePropertyFunction"),rt(Hh,"StyleExpression",{omit:["_evaluator"]}),rt(un,"ImageId"),rt(vo,"ImageVariant"),rt(Yo,"ZoomDependentExpression"),rt(Tc,"ZoomConstantExpression"),rt(Tr,"CompoundExpression",{omit:["_evaluate"]});for(const r in aa)ml[aa[r]._classRegistryKey]||rt(aa[r],`Expression${r}`);function Sc(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function _l(r){return self.ImageBitmap&&r instanceof ImageBitmap}function bo(r,e){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp)return r;if(Sc(r)||_l(r))return e&&e.add(r),r;if(ArrayBuffer.isView(r))return e&&e.add(r.buffer),r;if(r instanceof ImageData)return e&&e.add(r.data.buffer),r;if(Array.isArray(r)){const i=[];for(const o of r)i.push(bo(o,e));return i}if(r instanceof Map){const i={$name:"Map",entries:[]};for(const[o,a]of r.entries())i.entries.push(bo(o),bo(a,e));return i}if(r instanceof Set){const i={$name:"Set"};let o=0;for(const a of r.values())i[++o]=bo(a);return i}if(r instanceof DOMMatrix){const i={$name:"DOMMatrix"},o=["is2D","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","a","b","c","d","e","f"];for(const a of o)i[a]=r[a];return i}if(typeof r=="bigint")return{$name:"BigInt",value:r.toString()};if(typeof r=="object"){const i=r.constructor,o=i._classRegistryKey;if(!o)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const a=i.serialize?i.serialize(r,e):{};if(!i.serialize){for(const h in r)r.hasOwnProperty(h)&&(ml[o].omit.indexOf(h)>=0||(a[h]=bo(r[h],e)));r instanceof Error&&(a.message=r.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(a.$name=o),a}throw new Error("can't serialize object of type "+typeof r)}function an(r){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||Sc(r)||_l(r)||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(an);if(typeof r=="object"){const e=r.$name||"Object";if(e==="Map"){const a=r.entries||[],h=new Map;for(let u=0;u<a.length;u+=2)h.set(an(a[u]),an(a[u+1]));return h}if(e==="Set"){const a=new Set;for(const h of Object.keys(r))h!=="$name"&&a.add(an(r[h]));return a}if(e==="DOMMatrix"){let a;return a=r.is2D?[r.a,r.b,r.c,r.d,r.e,r.f]:[r.m11,r.m12,r.m13,r.m14,r.m21,r.m22,r.m23,r.m24,r.m31,r.m32,r.m33,r.m34,r.m41,r.m42,r.m43,r.m44],new DOMMatrix(a)}if(e==="BigInt")return BigInt(r.value);const{klass:i}=ml[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(r);const o=Object.create(i.prototype);for(const a of Object.keys(r))a!=="$name"&&(o[a]=an(r[a]));return o}throw new Error("can't deserialize object of type "+typeof r)}const gt={"Latin-1 Supplement":r=>r>=128&&r<=255,Arabic:r=>r>=1536&&r<=1791,"Arabic Supplement":r=>r>=1872&&r<=1919,"Arabic Extended-A":r=>r>=2208&&r<=2303,"Hangul Jamo":r=>r>=4352&&r<=4607,"Unified Canadian Aboriginal Syllabics":r=>r>=5120&&r<=5759,Khmer:r=>r>=6016&&r<=6143,"Unified Canadian Aboriginal Syllabics Extended":r=>r>=6320&&r<=6399,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"CJK Radicals Supplement":r=>r>=11904&&r<=12031,"Kangxi Radicals":r=>r>=12032&&r<=12255,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Bopomofo:r=>r>=12544&&r<=12591,"Hangul Compatibility Jamo":r=>r>=12592&&r<=12687,Kanbun:r=>r>=12688&&r<=12703,"Bopomofo Extended":r=>r>=12704&&r<=12735,"CJK Strokes":r=>r>
1=12736&&r<=12783,"Katakana Phonetic Extensions":r=>r>=12784&&r<=12799,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"CJK Unified Ideographs Extension A":r=>r>=13312&&r<=19903,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Yi Syllables":r=>r>=40960&&r<=42127,"Yi Radicals":r=>r>=42128&&r<=42191,"Hangul Jamo Extended-A":r=>r>=43360&&r<=43391,"Hangul Syllables":r=>r>=44032&&r<=55215,"Hangul Jamo Extended-B":r=>r>=55216&&r<=55295,"Private Use Area":r=>r>=57344&&r<=63743,"CJK Compatibility Ideographs":r=>r>=63744&&r<=64255,"Arabic Presentation Forms-A":r=>r>=64336&&r<=65023,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Arabic Presentation Forms-B":r=>r>=65136&&r<=65279,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519,Osage:r=>r>=66736&&r<=66815,"CJK Unified Ideographs Extension B":r=>r>=131072&&r<=173791};function Yh(r){for(const e of r)if(Ec(e.charCodeAt(0)))return!0;return!1}function Mf(r){for(const e of r)if(!Cf(e.charCodeAt(0)))return!1;return!0}function Cf(r){return!(gt.Arabic(r)||gt["Arabic Supplement"](r)||gt["Arabic Extended-A"](r)||gt["Arabic Presentation Forms-A"](r)||gt["Arabic Presentation Forms-B"](r))}function Ec(r){return!(r!==746&&r!==747&&(r<4352||!(gt["Bopomofo Extended"](r)||gt.Bopomofo(r)||gt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||gt["CJK Compatibility Ideographs"](r)||gt["CJK Compatibility"](r)||gt["CJK Radicals Supplement"](r)||gt["CJK Strokes"](r)||!(!gt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||gt["CJK Unified Ideographs Extension A"](r)||gt["CJK Unified Ideographs"](r)||gt["Enclosed CJK Letters and Months"](r)||gt["Hangul Compatibility Jamo"](r)||gt["Hangul Jamo Extended-A"](r)||gt["Hangul Jamo Extended-B"](r)||gt["Hangul Jamo"](r)||gt["Hangul Syllables"](r)||gt.Hiragana(r)||gt["Ideographic Description Characters"](r)||gt.Kanbun(r)||gt["Kangxi Radicals"](r)||gt["Katakana Phonetic Extensions"](r)||gt.Katakana(r)&&r!==12540||!(!gt["Halfwidth and Fullwidth Forms"](r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!gt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||gt["Unified Canadian Aboriginal Syllabics"](r)||gt["Unified Canadian Aboriginal Syllabics Extended"](r)||gt["Vertical Forms"](r)||gt["Yijing Hexagram Symbols"](r)||gt["Yi Syllables"](r)||gt["Yi Radicals"](r))))}function Ic(r){return!(Ec(r)||function(e){return!!(gt["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||gt["General Punctuation"](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)||gt["Letterlike Symbols"](e)||gt["Number Forms"](e)||gt["Miscellaneous Technical"](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)||gt["Control Pictures"](e)&&e!==9251||gt["Optical Character Recognition"](e)||gt["Enclosed Alphanumerics"](e)||gt["Geometric Shapes"](e)||gt["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||gt["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||gt["CJK Symbols and Punctuation"](e)||gt.Katakana(e)||gt["Private Use Area"](e)||gt["CJK Compatibility Forms"](e)||gt["Small Form Variants"](e)||gt["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(r))}function Hd(r){return gt.Arabic(r)||gt["Arabic Supplement"](r)||gt["Arabic Extended-A"](r)||gt["Arabic Presentation Forms-A"](r)||gt["Arabic Presentation Forms-B"](r)}function Ac(r){return r>=1424&&r<=2303||gt["Arabic Presentation Forms-A"](r)||gt["Arabic Presentation Forms-B"](r)}function Pf(r,e){return!(!e&&Ac(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||gt.Khmer(r))}function zf(r){for(const e of r)if(Ac(e.charCodeAt(0)))return!0;return!1}const pn={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let Kh=null,Wr=pn.unavailable,Jo=null;const $d=function(r){r&&typeof r=="string"&&r.indexOf("NetworkError")>-1&&(Wr=pn.error),Kh&&Kh(r)};function Jh(){Qh.fire(new yo("pluginStateChange",{pluginStatus:Wr,pluginURL:Jo}))}const Qh=new _s,eu=function(){return Wr},Zd=function(){if(Wr!==pn.deferred||!Jo)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Wr=pn.loading,Jh(),Jo&&Xa({url:Jo},r=>{r?$d(r):(Wr=pn.loaded,Jh())})},eo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Wr===pn.loaded||eo.applyArabicShaping!=null,isLoading:()=>Wr===pn.loading,setState(r){Wr=r.pluginStatus,Jo=r.pluginURL},isParsing:()=>Wr===pn.parsing,isParsed:()=>Wr===pn.parsed,getPluginURL:()=>Jo};class fi{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness,this.worldview=i.worldview):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(i,o){for(const a of i)if(!Pf(a.charCo
vendor: 10,325 bytes, line 1
1deAt(0),o))return!1;return!0}(e,eo.isLoaded())}}class gl{constructor(e,i,o,a){this.property=e,this.value=i,this.expression=function(h,u,f,_){if(wc(h))return new Is(h,u);if($h(h)||Array.isArray(h)&&h.length>0){const g=Zh(h,u,f,_);if(g.result==="error")throw new Error(g.value.map(v=>`${v.key}: ${v.message}`).join(", "));return g.value}{let g=h;return typeof h=="string"&&u.type==="color"&&(g=li.parse(h)),{kind:"constant",configDependencies:new Set,evaluate:()=>g}}}(i===void 0?e.specification.default:i,e.specification,o,a)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,o){return this.property.possiblyEvaluate(this,e,i,o)}}class Mc{constructor(e,i,o){this.property=e,this.value=new gl(e,void 0,i,o)}transitioned(e,i){return new Wd(this.property,this.value,i,ye({},e.transition,this.transition),e.now)}untransitioned(){return new Wd(this.property,this.value,null,{},0)}}class yl{constructor(e,i,o){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=o,this.configDependencies=new Set}getValue(e){return Ft(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new Mc(this._values[e].property,this._scope,this._options)),this._values[e].value=new gl(this._values[e].property,i===null?void 0:Ft(i),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,i){i&&(this._options=i);const o=this._properties.properties;if(e)for(const a in e){const h=e[a];if(a.endsWith("-transition")){const u=a.slice(0,-11);o[u]&&this.setTransition(u,h)}else o.hasOwnProperty(a)&&this.setValue(a,h)}}getTransition(e){return Ft(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new Mc(this._values[e].property)),this._values[e].transition=Ft(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const o=this.getValue(i);o!==void 0&&(e[i]=o);const a=this.getTransition(i);a!==void 0&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){const o=new Xd(this._properties);for(const a of Object.keys(this._values))o._values[a]=this._values[a].transitioned(e,i._values[a]);return o}untransitioned(){const e=new Xd(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class Wd{constructor(e,i,o,a,h){const u=a.delay||0,f=a.duration||0;h=h||0,this.property=e,this.value=i,this.begin=h+u,this.end=this.begin+f,e.specification.transition&&(a.delay||a.duration)&&(this.prior=o)}possiblyEvaluate(e,i,o){const a=e.now||0,h=this.value.possiblyEvaluate(e,i,o),u=this.prior;if(u){if(a>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(a<this.begin)return u.possiblyEvaluate(e,i,o);{const f=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(u.possiblyEvaluate(e,i,o),h,B(f))}}return h}}class Xd{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,o){const a=new Wn(this._properties);for(const h of Object.keys(this._values))a._values[h]=this._values[h].possiblyEvaluate(e,i,o);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Qo{constructor(e,i,o){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=o,this.configDependencies=new Set}getValue(e){return Ft(this._values[e].value)}setValue(e,i){this._values[e]=new gl(this._values[e].property,i===null?void 0:Ft(i),this._scope,this._options),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]))}serialize(){const e={};for(const i of Object.keys(this._values)){const o=this.getValue(i);o!==void 0&&(e[i]=o)}return e}possiblyEvaluate(e,i,o){const a=new Wn(this._properties);for(const h of Object.keys(this._values))a._values[h]=this._values[h].possiblyEvaluate(e,i,o);return a}}class As{constructor(e,i,o){this.property=e,this.value=i,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,o,a){return this.property.evaluate(this.value,this.parameters,e,i,o,a)}}class Wn{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ge{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,o){const a=el[this.specification.type];return a?a(e,i,o):e}}class Je{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,o,a){return new As(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},o,a)}:e.expression,i)}interpolate(e,i,o){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new As(this,{kind:"constant",value:void 0},e.parameters);const a=el[this.specification.type];return a?new As(this,{kind:"constant",value:a(e.value.value,i.value.value,o)},e.parameters):e}evaluate(e,i,o,a,h,u){return e.kind==="constant"?e.value:e.evaluate(i,o,a,h,u)}}class la{constructor(e){this.specification=e}possiblyEvaluate(e,i,o,a){return!!e.expression.evaluate(i,null,{},o,a)}interpolate(){return!1}}class Yi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new fi(0,{});for(const o in e){const a=e[o];a.specification.overridable&&this.overridableProperties.push(o);const h=this.defaultPropertyValues[o]=new gl(a,void 0),u=this.defaultTransitionablePropertyValues[o]=new Mc(a);this.defaultTransitioningPropertyValues[o]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[o]=h.possiblyEvaluate(i)}}}rt(Je,"DataDrivenProperty"),rt(Ge,"DataConstantProperty"),rt(la,"ColorRampProperty");var ue=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}}
1,"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"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"}}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"expression"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor":{"floorplanFeaturesetId":{"type":"string","expression":{}},"buildingFeaturesetId":{"type":"string","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"ty
1pe":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"int
1erpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function Yd(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function xl(r){if(Array.isArray(r))return r.map(xl);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=xl(r[i]);return e}return Yd(r)}function vl(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!vl(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function ca(r,e="",i=null,o="fill"){if(r==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};vl(r)||(r=Pc(r));const a=r;let h=!0;try{h=function(v){if(!ha(v))return v;let b=xl(v);return Cc(b),b=tu(b),b}(a)}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(a,null,2)}
7        `)}let u=null,f=null;if(o!=="background"&&o!=="sky"&&o!=="slot"){f=ue[`filter_${o}`];const v=Es(h,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));u=(b,w,I)=>v.value.evaluate(b,w,{},I)}let _=null,g=null;if(h!==a){const v=Es(a,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));_=(b,w,I,A,P)=>v.value.evaluate(b,w,{},I,void 0,void 0,A,P),g=!ta(v.value.expression)}return{filter:u,dynamicFilter:_||void 0,needGeometry:iu(h),needFeature:!!g}}function tu(r){if(!Array.isArray(r))return r;const e=function(i){if(to.has(i[0])){for(let o=1;o<i.length;o++)if(ha(i[o]))return!0}return i}(r);return e===!0?e:e.map(i=>tu(i))}function Cc(r){let e=!1;const i=[];if(r[0]==="case"){for(let o=1;o<r.length-1;o+=2)e=e||ha(r[o]),i.push(r[o+1]);i.push(r[r.length-1])}else if(r[0]==="match"){e=e||ha(r[1]);for(let o=2;o<r.length-1;o+=2)i.push(r[o+1]);i.push(r[r.length-1])}else if(r[0]==="step"){e=e||ha(r[1]);for(let o=1;o<r.length-1;o+=2)i.push(r[o+1])}e&&(r.length=0,r.push("any",...i));for(let o=1;o<r.length;o++)Cc(r[o])}function ha(r){if(!Array.isArray(r))return!1;if((e=r[0])==="pitch"||e==="distance-from-center")return!0;var e;
vendor: 20,615 bytes, line 7
7for(let i=1;i<r.length;i++)if(ha(r[i]))return!0;return!1}const to=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Rf(r,e){return r<e?-1:r>e?1:0}function iu(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(iu(r[e]))return!0;return!1}function Pc(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?ru(r[1],r[2],"=="):e==="!="?zc(ru(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?ru(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(Pc))):e==="all"?["all"].concat(r.slice(1).map(Pc)):e==="none"?["all"].concat(r.slice(1).map(Pc).map(zc)):e==="in"?Kd(r[1],r.slice(2)):e==="!in"?zc(Kd(r[1],r.slice(2))):e==="has"?Jd(r[1]):e!=="!has"||zc(Jd(r[1]));var i}function ru(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function Kd(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",r,["literal",e.sort(Rf)]]:["filter-in-small",r,["literal",e]]}}function Jd(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function zc(r){return["!",r]}const bl="�";function ua(r,e){return e?`${r}${bl}${e}`:r}const Qd="-transition",Df=new Set(["fill","line","background","hillshade","raster"]);class Vr extends _s{constructor(e,i,o,a,h){if(super(),this.id=e.id,this.fqid=ua(this.id,o),this.type=e.type,this.scope=o,this.lut=a,this.options=h,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,e.type!=="custom"){if(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;const u=Es(this.filter,ue[`filter_${e.type}`]);u.result!=="error"&&(this.configDependencies=new Set([...this.configDependencies,...u.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new Qo(i.layout,this.scope,h),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint){this._transitionablePaint=new yl(i.paint,this.scope,h);for(const u in e.paint)this.setPaintProperty(u,e.paint[u]);for(const u in e.layout)this.setLayoutProperty(u,e.layout[u]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Wn(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&Df.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const o=this._unevaluatedLayout;o._properties.properties[e]&&(o.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...o.configDependencies]),e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(Qd)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const o=this._transitionablePaint,a=o._properties.properties;if(e.endsWith(Qd)){const b=e.slice(0,-11);return a[b]&&o.setTransition(b,i||void 0),!1}if(!a[e])return!1;const h=o._values[e],u=h.value.isDataDriven(),f=h.value;o.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...o.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const _=o._values[e].value,g=_.isDataDriven(),v=e.endsWith("pattern")||e==="line-dasharray";return g||u||v||this._handleOverridablePaintPropertyUpdate(e,f,_)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,o){return null}_handleOverridablePaintPropertyUpdate(e,i,o){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,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){return Ut({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()},(e,i)=>!(e===void 0||i==="layout"&&!Object.keys(e).length||i==="paint"&&!Object.keys(e).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof As&&vc(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=ca(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,o,a,h,u,f,_,g){}}const Lf={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class wl{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ci{constructor(){this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&i.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_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 $t(r,e=1){let i=0,o=0;return{members:r.map(a=>{const h=Lf[a.type].BYTES_PER_ELEMENT,u=i=nu(i,Math.max(e,h)),f=a.components||1;return o=Math.max(o,h),i+=h*f,{name:a.name,type:a.type,components:f,offset:u}}),size:nu(i,Math.max(o,e)),alignment:e}}function nu(r,e){return Math.ceil(r/e)*e}class ln extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=o,e}}ln.prototype.bytesPerElement=4,rt(ln,"StructArrayLayout2i4");class da extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const h=3*e;return this.int16[h+0]=i,this.int16[h+1]=o,this.int16[h+2]=a,e}}da.prototype.bytesPerElement=6,rt(da,"StructArrayLayout3i6");class pa extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a)}emplace(e,i,o,a,h){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=o,this.int16[u+2]=a,this.int16[u+3]=h,e}}pa.prototype.bytesPerElement=8,rt(pa,"StructArrayLayout4i8");class Ms extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}Ms.prototype.bytesPerElement=4,rt(Ms,"StructArrayLayout1f4");class ou extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const h=4*e,u=2*e;return this.int16[h+0]=i,this.int16[h+1]=o,this.float32[u+1]=a,e}}ou.prototype.bytesPerElement=8,rt(ou,"StructArrayLayout2i1f8");class su extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=o,this.int16[h+2]=a,e}}su.prototype.bytesPerElement=8,rt(su,"StructArrayLayout3i8");class Rc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a,h)}emplace(e,i,o,a,h,u){const f=5*e;return this.int16[f+0]=i,this.int16[f+1]=o,this.int16[f+2]=a,this.int16[f+3]=h,this.int16[f+4]=u,e}}Rc.prototype.bytesPerElement=10,rt(Rc,"StructArrayLayout5i10");class Dc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,h,u,f)}emplace(e,i,o,a,h,u,f,_){const g=6*e,v=12*e,b=3*e;return this.int16[g+0]=i,this.int16[g+1]=o,this.uint8[v+4]=a,this.uint8[v+5]=h,this.uint8[v+6]=u,this.uint8[v+7]=f,this.float32[b+2]=_,e}}Dc.prototype.bytesPerElement=12,rt(Dc,"StructArrayLayout2i4ub1f12");class En extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const h=3*e;return this.float32[h+0]=i,this.float32[h+1]=o,this.float32[h+2]=a,e}}En.prototype.bytesPerElement=12,rt(En,"StructArrayLayout3f12");class es extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a,h)}emplace(e,i,o,a,h,u){const f=6*e,_=3*e;return this.uint16[f+0]=i,this.uint16[f+1]=o,this.uint16[f+2]=a,this.uint16[f+3]=h,this.float32[_+2]=u,e}}es.prototype.bytesPerElement=12,rt(es,"StructArrayLayout4ui1f12");class fa extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a)}emplace(e,i,o,a,h){const u=4*e;return this.uint16[u+0]=i,this.uint16[u+1]=o,this.uint16[u+2]=a,this.uint16[u+3]=h,e}}fa.prototype.bytesPerElement=8,rt(fa,"StructArrayLayout4ui8");class Lc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,h,u)}emplace(e,i,o,a,h,u,f){const _=6*e;return this.int16[_+0]=i,this.int16[_+1]=o,this.int16[_+2]=a,this.int16[_+3]=h,this.int16[_+4]=u,this.int16[_+5]=f,e}}Lc.prototype.bytesPerElement=12,rt(Lc,"StructArrayLayout6i12");class Fc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f,_,g,v,b,w){const I=this.length;return this.resize(I+1),this.emplace(I,e,i,o,a,h,u,f,_,g,v,b,w)}emplace(e,i,o,a,h,u,f,_,g,v,b,w,I){const A=12*e;return this.int16[A+0]=i,this.int16[A+1]=o,this.int16[A+2]=a,this.int16[A+3]=h,this.uint16[A+4]=u,this.uint16[A+5]=f,this.uint16[A+6]=_,this.uint16[A+7]=g,this.int16[A+8]=v,this.int16[A+9]=b,this.int16[A+10]=w,this.int16[A+11]=I,e}}Fc.prototype.bytesPerElement=24,rt(Fc,"StructArrayLayout4i4ui4i24");class ma extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,h,u)}emplace(e,i,o,a,h,u,f){const _=10*e,g=5*e;return this.int16[_+0]=i,this.int16[_+1]=o,this.int16[_+2]=a,this.float32[g+2]=h,this.float32[g+3]=u,this.float32[g+4]=f,e}}ma.prototype.bytesPerElement=20,rt(ma,"StructArrayLayout3i3f20");class ts extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a)}emplace(e,i,o,a,h){const u=4*e;return this.float32[u+0]=i,this.float32[u+1]=o,this.float32[u+2]=a,this.float32[u+3]=h,e}}ts.prototype.bytesPerElement=16,rt(ts,"StructArrayLayout4f16");class au extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}au.prototype.bytesPerElement=4,rt(au,"StructArrayLayout1ul4");class io extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=o,e}}io.prototype.bytesPerElement=4,rt(io,"StructArrayLayout2ui4");class lu extends Ci{_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,i,o,a,h,u,f,_,g,v,b,w,I){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,o,a,h,u,f,_,g,v,b,w,I)}emplace(e,i,o,a,h,u,f,_,g,v,b,w,I,A){const P=20*e,R=10*e;return this.int16[P+0]=i,this.int16[P+1]=o,this.int16[P+2]=a,this.int16[P+3]=h,this.int16[P+4]=u,this.float32[R+3]=f,this.float32[R+4]=_,this.float32[R+5]=g,this.float32[R+6]=v,this.int16[P+14]=b,this.uint32[R+8]=w,this.uint16[P+18]=I,this.uint16[P+19]=A,e}}lu.prototype.bytesPerElement=40,rt(lu,"StructArrayLayout5i4f1i1ul2ui40");class Oc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,h,u,f)}emplace(e,i,o,a,h,u,f,_){const g=8*e;return this.int16[g+0]=i,this.int16[g+1]=o,this.int16[g+2]=a,this.int16[g+4]=h,this.int16[g+5]=u,this.int16[g+6]=f,this.int16[g+7]=_,e}}Oc.prototype.bytesPerElement=16,rt(Oc,"StructArrayLayout3i2i2i16");class _a extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a,h)}emplace(e,i,o,a,h,u){const f=4*e,_=8*e;return this.float32[f+0]=i,this.float32[f+1]=o,this.float32[f+2]=a,this.int16[_+6]=h,this.int16[_+7]=u,e}}_a.prototype.bytesPerElement=16,rt(_a,"StructArrayLayout2f1f2i16");class ga extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,h,u)}emplace(e,i,o,a,h,u,f){const _=20*e,g=5*e;return this.uint8[_+0]=i,this.uint8[_+1]=o,this.float32[g+1]=a,this.float32[g+2]=h,this.float32[g+3]=u,this.float32[g+4]=f,e}}ga.prototype.bytesPerElement=20,rt(ga,"StructArrayLayout2ub4f20");class Li extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const h=3*e;return this.uint16[h+0]=i,this.uint16[h+1]=o,this.uint16[h+2]=a,e}}Li.prototype.bytesPerElement=6,rt(Li,"StructArrayLayout3ui6");class ya extends Ci{_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,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,U,V,G,re){const Q=this.length;return this.resize(Q+1),this.emplace(Q,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,U,V,G,re)}emplace(e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,U,V,G,re,Q){const te=30*e,ae=15*e,ce=60*e;return this.int16[te+0]=i,this.int16[te+1]=o,this.int16[te+2]=a,this.float32[ae+2]=h,this.float32[ae+3]=u,this.uint16[te+8]=f,this.uint16[te+9]=_,this.uint32[ae+5]=g,this.uint32[ae+6]=v,this.uint32[ae+7]=b,this.uint16[te+16]=w,this.uint16[te+17]=I,this.uint16[te+18]=A,this.float32[ae+10]=P,this.float32[ae+11]=R,this.uint8[ce+48]=O,this.uint8[ce+49]=U,this.uint8[ce+50]=V,this.uint32[ae+13]=G,this.int16[te+28]=re,this.uint8[ce+58]=Q,e}}ya.prototype.bytesPerElement=60,rt(ya,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class cu extends Ci{_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,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,U,V,G,re,Q,te,ae,ce,Ee,de,Ae,je,Ce,Fe,Ve,Te){const Oe=this.length;return this.resize(Oe+1),this.emplace(Oe,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,U,V,G,re,Q,te,ae,ce,Ee,de,Ae,je,Ce,Fe,Ve,Te)}emplace(e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,U,V,G,re,Q,te,ae,ce,Ee,de,Ae,je,Ce,Fe,Ve,Te,Oe){const pe=20*e,Se=40*e,He=80*e;return this.float32[pe+0]=i,this.float32[pe+1]=o,this.int16[Se+4]=a,this.int16[Se+5]=h,this.int16[Se+6]=u,this.int16[Se+7]=f,this.int16[Se+8]=_,this.int16[Se+9]=g,this.int16[Se+10]=v,this.int16[Se+11]=b,this.int16[Se+12]=w,this.uint16[Se+13]=I,this.uint16[Se+14]=A,this.uint16[Se+15]=P,this.uint16[Se+16]=R,this.uint16[Se+17]=O,this.uint16[Se+18]=U,this.uint16[Se+19]=V,this.uint16[Se+20]=G,this.uint16[Se+21]=re,this.uint16[Se+22]=Q,this.uint16[Se+23]=te,this.uint16[Se+24]=ae,this.uint16[Se+25]=ce,this.uint16[Se+26]=Ee,this.uint16[Se+27]=de,this.uint32[pe+14]=Ae,this.float32[pe+15]=je,this.float32[pe+16]=Ce,this.float32[pe+17]=Fe,this.float32[pe+18]=Ve,this.uint8[He+76]=Te,this.uint16[Se+39]=Oe,e}}cu.prototype.bytesPerElement=80,rt(cu,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class hu extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,h,u)}emplace(e,i,o,a,h,u,f){const _=6*e;return this.float32[_+0]=i,this.float32[_+1]=o,this.float32[_+2]=a,this.float32[_+3]=h,this.float32[_+4]=u,this.float32[_+5]=f,e}}hu.prototype.bytesPerElement=24,rt(hu,"StructArrayLayout6f24");class Cs extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h){const u=this.length;retu
vendor: 6,187 bytes, line 7
7rn this.resize(u+1),this.emplace(u,e,i,o,a,h)}emplace(e,i,o,a,h,u){const f=5*e;return this.float32[f+0]=i,this.float32[f+1]=o,this.float32[f+2]=a,this.float32[f+3]=h,this.float32[f+4]=u,e}}Cs.prototype.bytesPerElement=20,rt(Cs,"StructArrayLayout5f20");class uu extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,h,u,f)}emplace(e,i,o,a,h,u,f,_){const g=7*e;return this.float32[g+0]=i,this.float32[g+1]=o,this.float32[g+2]=a,this.float32[g+3]=h,this.float32[g+4]=u,this.float32[g+5]=f,this.float32[g+6]=_,e}}uu.prototype.bytesPerElement=28,rt(uu,"StructArrayLayout7f28");class Tl extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f,_,g,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,i,o,a,h,u,f,_,g,v,b)}emplace(e,i,o,a,h,u,f,_,g,v,b,w){const I=11*e;return this.float32[I+0]=i,this.float32[I+1]=o,this.float32[I+2]=a,this.float32[I+3]=h,this.float32[I+4]=u,this.float32[I+5]=f,this.float32[I+6]=_,this.float32[I+7]=g,this.float32[I+8]=v,this.float32[I+9]=b,this.float32[I+10]=w,e}}Tl.prototype.bytesPerElement=44,rt(Tl,"StructArrayLayout11f44");class du extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f,_,g){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,o,a,h,u,f,_,g)}emplace(e,i,o,a,h,u,f,_,g,v){const b=9*e;return this.float32[b+0]=i,this.float32[b+1]=o,this.float32[b+2]=a,this.float32[b+3]=h,this.float32[b+4]=u,this.float32[b+5]=f,this.float32[b+6]=_,this.float32[b+7]=g,this.float32[b+8]=v,e}}du.prototype.bytesPerElement=36,rt(du,"StructArrayLayout9f36");class is extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=o,e}}is.prototype.bytesPerElement=8,rt(is,"StructArrayLayout2f8");class pu extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a)}emplace(e,i,o,a,h){const u=6*e;return this.uint32[3*e+0]=i,this.uint16[u+2]=o,this.uint16[u+3]=a,this.uint16[u+4]=h,e}}pu.prototype.bytesPerElement=12,rt(pu,"StructArrayLayout1ul3ui12");class fu extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}fu.prototype.bytesPerElement=2,rt(fu,"StructArrayLayout1ui2");class kc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R){const O=this.length;return this.resize(O+1),this.emplace(O,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R)}emplace(e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O){const U=16*e;return this.float32[U+0]=i,this.float32[U+1]=o,this.float32[U+2]=a,this.float32[U+3]=h,this.float32[U+4]=u,this.float32[U+5]=f,this.float32[U+6]=_,this.float32[U+7]=g,this.float32[U+8]=v,this.float32[U+9]=b,this.float32[U+10]=w,this.float32[U+11]=I,this.float32[U+12]=A,this.float32[U+13]=P,this.float32[U+14]=R,this.float32[U+15]=O,e}}kc.prototype.bytesPerElement=64,rt(kc,"StructArrayLayout16f64");class xa extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,h,u,f)}emplace(e,i,o,a,h,u,f,_){const g=10*e,v=5*e;return this.uint16[g+0]=i,this.uint16[g+1]=o,this.uint16[g+2]=a,this.uint16[g+3]=h,this.float32[v+2]=u,this.float32[v+3]=f,this.float32[v+4]=_,e}}xa.prototype.bytesPerElement=20,rt(xa,"StructArrayLayout4ui3f20");class mu extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}mu.prototype.bytesPerElement=2,rt(mu,"StructArrayLayout1i2");class Bc extends Ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}Bc.prototype.bytesPerElement=1,rt(Bc,"StructArrayLayout1ub1");class _u extends wl{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]}}_u.prototype.size=40;class ep extends lu{get(e){return new _u(this,e)}}rt(ep,"CollisionBoxArray");class Nc extends wl{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]}
vendor: 22,041 bytes, line 7
7get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(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}}Nc.prototype.size=60;class Sl extends ya{get(e){return new Nc(this,e)}}rt(Sl,"PlacedSymbolArray");class gu extends wl{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(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]}}gu.prototype.size=80;class tp extends cu{get(e){return new gu(this,e)}}rt(tp,"SymbolInstanceArray");class yu extends Ms{getoffsetX(e){return this.float32[1*e+0]}}rt(yu,"GlyphOffsetArray");class ip extends ln{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}rt(ip,"SymbolLineVertexArray");class Vc extends wl{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]}}Vc.prototype.size=12;class rp extends pu{get(e){return new Vc(this,e)}}rt(rp,"FeatureIndexArray");class np extends io{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}rt(np,"FillExtrusionCentroidArray");class op extends wl{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]}}op.prototype.size=6;class sp extends da{get(e){return new op(this,e)}}rt(sp,"FillExtrusionWallArray");const ap=$t([{name:"a_pos",components:2,type:"Int16"}],4),Ff=$t([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),Of=$t([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Ni{constructor(e=[]){this.segments=e}_prepareSegment(e,i,o,a){let h=this.segments[this.segments.length-1];return e>Ni.MAX_VERTEX_ARRAY_LENGTH&&Gt(`Max vertices per segment is ${Ni.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>Ni.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==a)&&(h={vertexOffset:i,primitiveOffset:o,vertexLength:0,primitiveLength:0},a!==void 0&&(h.sortKey=a),this.segments.push(h)),h}prepareSegment(e,i,o,a){return this._prepareSegment(e,i.length,o.length,a)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,o,a){return new Ni([{vertexOffset:e,primitiveOffset:i,vertexLength:o,primitiveLength:a,vaos:{},sortKey:0}])}}function lp(r,e){return 256*(r=W(Math.floor(r),0,255))+W(Math.floor(e),0,255)}Ni.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,rt(Ni,"SegmentVector");const kf=$t([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),xu=$t([{name:"a_pattern_b",components:4,type:"Uint16"}]),Bf=$t([{name:"a_dash",components:4,type:"Uint16"}]);class El{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,o,a){this.ids.push(Il(e)),this.positions.push(i,o,a)}eachPosition(e,i){const o=Il(e);let a=0,h=this.ids.length-1;for(;a<h;){const u=a+h>>1;this.ids[u]>=o?h=u:a=u+1}for(;this.ids[a]===o;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const o=new Float64Array(e.ids),a=new Uint32Array(e.positions);return vu(o,a,0,o.length-1),i&&(i.add(o.buffer),i.add(a.buffer)),{ids:o,positions:a}}static deserialize(e){const i=new El;let o;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==o&&i.uniqueIds.push(a),o=a;return i.indexed=!0,i}}function Il(r){const e=+r;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:Hs(String(r))}function vu(r,e,i,o){for(;i<o;){const a=r[i+o>>1];let h=i-1,u=o+1;for(;;){do h++;while(r[h]<a);do u--;while(r[u]>a);if(h>=u)break;Uc(r,h,u),Uc(e,3*h,3*u),Uc(e,3*h+1,3*u+1),Uc(e,3*h+2,3*u+2)}u-i<o-u?(vu(r,e,i,u),i=u+1):(vu(r,e,u+1,o),o=u)}}function Uc(r,e,i){const o=r[e];r[e]=r[i],r[i]=o}rt(El,"FeaturePositionMap");class Un{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,o){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class jc extends Un{constructor(e){super(e),this.current=0}set(e,i,o){this.fetchUniformLocation(e,i)&&this.current!==o&&(this.current=o,this.gl.uniform1i(this.location,o))}}class or extends Un{constructor(e){super(e),this.current=0}set(e,i,o){this.fetchUniformLocation(e,i)&&this.current!==o&&(this.current=o,this.gl.uniform1f(this.location,o))}}class ro extends Un{constructor(e){super(e),this.current=[0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]||(this.current=o,this.gl.uniform2f(this.location,o[0],o[1])))}}class va extends Un{constructor(e){super(e),this.current=[0,0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]||(this.current=o,this.gl.uniform3f(this.location,o[0],o[1],o[2])))}}class Al extends Un{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]&&o[3]===this.current[3]||(this.current=o,this.gl.uniform4f(this.location,o[0],o[1],o[2],o[3])))}}class bu extends Un{constructor(e){super(e),this.current=li.transparent.toPremultipliedRenderColor(null)}set(e,i,o){this.fetchUniformLocation(e,i)&&(o.r===this.current.r&&o.g===this.current.g&&o.b===this.current.b&&o.a===this.current.a||(this.current=o,this.gl.uniform4f(this.location,o.r,o.g,o.b,o.a)))}}const cp=new Float32Array(16);class Ml extends Un{constructor(e){super(e),this.current=cp}set(e,i,o){if(this.fetchUniformLocation(e,i)){if(o[12]!==this.current[12]||o[0]!==this.current[0])return this.current=o,void this.gl.uniformMatrix4fv(this.location,!1,o);for(let a=1;a<16;a++)if(o[a]!==this.current[a]){this.current=o,this.gl.uniformMatrix4fv(this.location,!1,o);break}}}}const Nf=new Float32Array(9),hp=new Float32Array(4);class wu extends Un{constructor(e){super(e),this.current=hp}set(e,i,o){if(this.fetchUniformLocation(e,i)){for(let a=0;a<4;a++)if(o[a]!==this.current[a]){this.current=o,this.gl.uniformMatrix2fv(this.location,!1,o);break}}}}function Tu(r){return[lp(255*r.r,255*r.g),lp(255*r.b,255*r.a)]}class Cl{constructor(e,i,o,a){this.value=e,this.uniformNames=i.map(h=>`u_${h}`),this.type=o,this.context=a}setUniform(e,i,o,a,h){const u=a.constantOr(this.value);i.set(e,h,u instanceof li?u.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.value==="none"?null:this.context.lut):u)}getBinding(e,i){return this.type==="color"?new bu(e):new or(e)}}class ba{constructor(e,i){this.uniformNames=i.map(o=>`u_${o}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,i){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(e,i,o,a,h){let u=null;h!=="u_pattern"&&h!=="u_dash"||(u=this.pattern),h==="u_pattern_b"&&(u=this.patternTransition),h==="u_pixel_ratio"&&(u=this.pixelRatio),u&&i.set(e,h,u)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new Al(e):new or(e)}}class wo{constructor(e,i,o,a){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=i.map(h=>({name:`a_${h}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,o,a,h,u,f,_){const g=this.paintVertexArray.length,v=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new fi(0,{brightness:u,worldview:_}),i,{},h,a,f):this.expression.kind==="constant"&&this.expression.value,b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new fi(0,{brightness:u,worldview:_}),i,{},h,a,f):this.lutExpression.value)==="none";this.paintVertexArray.resize(e),this._setPaintValue(g,e,v,b?null:this.context.lut)}updatePaintArray(e,i,o,a,h,u,f,_){const g=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:f,worldview:_},o,a,void 0,h):this.expression.kind==="constant"&&this.expression.value,v=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new fi(0,{brightness:f,worldview:_}),o,a,void 0,h):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v?null:this.context.lut)}_setPaintValue(e,i,o,a){if(this.type==="color"){const h=Tu(o.toPremultipliedRenderColor(a));for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,h[0],h[1])}else{for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}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 jn{constructor(e,i,o,a,h,u){this.expression=e,this.uniformNames=i.map(f=>`u_${f}_t`),this.type=o,this.useIntegerZoom=a,this.context=h,this.maxValue=0,this.paintVertexAttributes=i.map(f=>({name:`a_${f}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new u}populatePaintArray(e,i,o,a,h,u,f,_){const g=this.expression.evaluate(new fi(this.context.zoom,{brightness:u,worldview:_}),i,{},h,a,f),v=this.expression.evaluate(new fi(this.context.zoom+1,{brightness:u,worldview:_}),i,{},h,a,f),b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new fi(0,{brightness:u,worldview:_}),i,{},h,a,f):this.lutExpression.value)==="none",w=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(w,e,g,v,b?null:this.context.lut)}updatePaintArray(e,i,o,a,h,u,f,_){const g=this.expression.evaluate({zoom:this.context.zoom,brightness:f,worldview:_},o,a,void 0,h),v=this.expression.evaluate({zoom:this.context.zoom+1,brightness:f,worldview:_},o,a,void 0,h),b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new fi(0,{brightness:f,worldview:_}),o,a,void 0,h):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v,b?null:this.context.lut)}_setPaintValue(e,i,o,a,h){if(this.type==="color"){const u=Tu(o.toPremultipliedRenderColor(h)),f=Tu(o.toPremultipliedRenderColor(h));for(let _=e;_<i;_++)this.paintVertexArray.emplace(_,u[0],u[1],f[0],f[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,o,a);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(a))}}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,i,o,a,h){const u=this.useIntegerZoom?Math.floor(o.zoom):o.zoom,f=W(this.expression.interpolationFactor(u,this.context.zoom,this.context.zoom+1),0,1);i.set(e,h,f)}getBinding(e,i){return new or(e)}}class In{constructor(e,i,o,a,h){this.expression=e,this.layerId=h,this.paintVertexAttributes=(o==="array"?Bf:kf).members;for(let u=0;u<i.length;++u);this.paintVertexArray=new a,this.paintTransitionVertexArray=new fa}populatePaintArray(e,i,o,a){const h=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(h,e,i.patterns&&i.patterns[this.layerId],o)}updatePaintArray(e,i,o,a,h,u,f){this._setPaintValues(e,i,o.patterns&&o.patterns[this.layerId],u)}_setPaintValues(e,i,o,a){if(!a||!o)return;const h=a[o[0]],u=a[o[1]];if(h){if(h){const{tl:f,br:_,pixelRatio:g}=h;for(let v=e;v<i;v++)this.paintVertexArray.emplace(v,f[0],f[1],_[0],_[1],g)}if(u){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:f,br:_}=u;for(let g=e;g<i;g++)this.paintTransitionVertexArray.emplace(g,f[0],f[1],_[0],_[1])}}}upload(e){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,xu.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class Xr{constructor(e,i,o=()=>!0){this.binders={},this._buffers=[],this.context=i;const a=[];for(const h in e.paint._values){const u=e.paint.get(h);if(h.endsWith("-use-theme")||!o(h)||!(u instanceof As&&vc(u.property.specification)))continue;const f=Uf(h,e.type),_=u.value,g=u.property.specification.type,v=!!u.property.useIntegerZoom,b=h==="line-dasharray"||h.endsWith("pattern"),w=e.paint.get(`${h}-use-theme`),I=h==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant"||w&&w.value.kind!=="constant";if(_.kind!=="constant"||I)if(_.kind==="source"||I||b){const A=up(h,g,"source");this.binders[h]=b?new In(_,f,g,A,e.id):new wo(_,f,g,A),a.push(`/a_${h}`)}else{const A=up(h,g,"composite");this.binders[h]=new jn(_,f,g,v,i,A),a.push(`/z_${h}`)}else this.binders[h]=b?new ba(_.value,f):new Cl(_.value,f,g,i),a.push(`/u_${h}`);w&&(this.binders[h].lutExpression=w.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof wo||i instanceof jn?i.maxValue:0}populatePaintArrays(e,i,o,a,h,u,f,_){for(const g in this.binders){const v=this.binders[g];v.context=this.context,(v instanceof wo||v instanceof jn||v instanceof In)&&v.populatePaintArray(e,i,o,a,h,u,f,_)}}setConstantPatternPositions(e,i){for(const o in this.binders){const a=this.binders[o];a instanceof ba&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof In?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,o,a,h,u,f,_,g,v){let b=!1;const w=Object.keys(e),I=w.length!==0&&!_,A=I?w:i.uniqueIds;this.context.lut=h.lut;for(const P in this.binders){const R=this.binders[P];if(R.context=this.context,(R instanceof wo||R instanceof jn||R instanceof In)&&R.expression&&R.expression.kind&&R.expression.kind!=="constant"&&(R.expression.isStateDependent===!0||R.expression.isLightConstant===!1)){const O=h.paint.get(P);R.expression=O.value;for(const U of A){const V=e[U.toString()];i.eachPosition(U,(G,re,Q)=>{const te=a.feature(G);R.updatePaintArray(re,Q,te,V,u,f,g,v)})}if(!I)for(const U of o.uniqueIds){const V=e[U.toString()];o.eachPosition(U,(G,re,Q)=>{const te=a.feature(G);R.updatePaintArray(re,Q,te,V,u,f,g,v)})}b=!0}}return b}defines(){const e=[];for(const i in this.binders){const o=this.binders[i];(o instanceof Cl||o instanceof ba)&&e.push(...o.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const o=this.binders[i];if(o instanceof wo||o instanceof jn||o instanceof In)for(let a=0;a<o.paintVertexAttributes.length;a++)e.push(o.paintVertexAttributes[a].name);if(o instanceof In)for(let a=0;a<xu.members.length;a++)e.push(xu.members[a].name)}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const o=this.binders[i];if(o instanceof Cl||o instanceof ba||o instanceof jn)for(const a of o.uniformNames)e.push(a)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const o in this.binders){const a=this.binders[o];if(a instanceof Cl||a instanceof ba||a instanceof jn)for(const h of a.uniformNames)i.push({name:h,property:o,binding:a.getBinding(e,h)})}return i}setUniforms(e,i,o,a,h){for(const{name:u,property:f,binding:_}of o)this.binders[f].setUniform(e,_,h,a.get(f),u)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof wo||i instanceof jn||i instanceof In)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof In&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const o=this.binders[i];(o instanceof wo||o instanceof jn||o instanceof In)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof wo||i instanceof jn||i instanceof In)&&i.destroy()}}}class An{constructor(e,i,o=()=>!0){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new Xr(a,i,o);this.needsUpload=!1,this._featureMap=new El,this._featureMapWithoutIds=new El,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,o,a,h,u,f,_,g){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(e,i,a,h,u,f,_,g);i.id!==void 0?this._featureMap.add(i.id,o,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,o,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,o,a,h,u,f,_){for(const g of o)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,g,a,h,u,f||0,_)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const Vf={"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 Uf(r,e){return Vf[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const jf={"line-pattern":{source:es,composite:es},"fill-pattern":{source:es,composite:es},"fill-extrusion-pattern":{source:es,composite:es},"line-dasharray":{source:fa,composite:fa}},Gf={color:{source:is,composite:ts},number:{source:Ms,composite:is}};function up(r,e,i){const o=jf[r];return o&&o[i]||Gf[e][i]}rt(Cl,"ConstantBinder"),rt(ba,"PatternConstantBinder"),rt(wo,"SourceExpressionBinder"),rt(In,"PatternCompositeBinder"),rt(jn,"CompositeExpressionBinder"),rt(Xr,"ProgramConfiguration",{omit:["_buffers"]}),rt(An,"ProgramConfigurationSet");const Ur=We/Math.PI/2,dp=5,l=6,t=16383,n=64,c=[n,32,16],d=-Ur,p=Ur;function m(r,e,i,o=Ur){return i=ei(i),[r*Math.sin(i)*o,-e*o,r*Math.cos(i)*o]}function y(r,e,i){return m(Math.cos(ei(r)),Math.sin(ei(r)),e,i)}const x=63710088e-1,T=2*Math.PI*x;class S{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new S(ve(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,o=this.lat*i,a=e.lat*i,h=Math.sin(o)*Math.sin(a)+Math.cos(o)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return x*Math.acos(Math.min(h,1))}
vendor: 5,892 bytes, line 7
7toBounds(e=0){const i=360*e/40075017,o=i/Math.cos(Math.PI/180*this.lat);return new M({lng:this.lng-o,lat:this.lat-i},{lng:this.lng+o,lat:this.lat+i})}toEcef(e){return y(this.lat,this.lng,Ur+e*Ur/x)}static convert(e){if(e instanceof S)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new S(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new S(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 M{constructor(e,i){if(e)if(i)this.setSouthWest(e).setNorthEast(i);else if(e.length===4){const o=e;this.setSouthWest([o[0],o[1]]).setNorthEast([o[2],o[3]])}else{const o=e;this.setSouthWest(o[0]).setNorthEast(o[1])}}setNorthEast(e){return this._ne=e instanceof S?new S(e.lng,e.lat):S.convert(e),this}setSouthWest(e){return this._sw=e instanceof S?new S(e.lng,e.lat):S.convert(e),this}extend(e){const i=this._sw,o=this._ne;let a,h;if(e instanceof S)a=e,h=e;else{if(!(e instanceof M))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(M.convert(e)):this.extend(S.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(S.convert(e)):this;if(a=e._sw,h=e._ne,!a||!h)return this}return i||o?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),o.lng=Math.max(h.lng,o.lng),o.lat=Math.max(h.lat,o.lat)):(this._sw=new S(a.lng,a.lat),this._ne=new S(h.lng,h.lat)),this}getCenter(){return new S((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 S(this.getWest(),this.getNorth())}getSouthEast(){return new S(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:i,lat:o}=S.convert(e);let a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&a}static convert(e){if(e)return e instanceof M?e:new M(e)}}const E=0,C=25.5;function D(r){return T*Math.cos(r*Math.PI/180)}function z(r){return(180+r)/360}function F(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function L(r,e){return r/D(e)}function N(r){return 360*r-180}function j(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function q(r,e){return r*D(j(e))}const X=85.051129;function ee(r){return Math.cos(ei(W(r,-X,X)))}function ie(r,e){const i=W(e,E,C),o=Math.pow(2,i);return ee(r)*T/(512*o)}function Y(r){return 1/Math.cos(r*Math.PI/180)}function K(r,e=0){const i=Math.exp(Math.PI*(1-(r.y+e/We)/(1<<r.z)*2));return 80150034*i/(i*i+1)/We/(1<<r.z)}class J{constructor(e,i,o=0){this.x=+e,this.y=+i,this.z=+o}static fromLngLat(e,i=0){const o=S.convert(e);return new J(z(o.lng),F(o.lat),L(i,o.lat))}toLngLat(){return new S(N(this.x),j(this.y))}toAltitude(){return q(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/T*Y(j(this.y))}}function fe(r,e,i,o,a,h,u,f,_){const g=(e+o)/2,v=(i+a)/2,b=new ke(g,v);f(b),function(w,I,A,P,R,O){const U=A-R,V=P-O;return Math.abs((P-I)*U-(A-w)*V)/Math.hypot(U,V)}(b.x,b.y,h.x,h.y,u.x,u.y)>=_?(fe(r,e,i,g,v,h,b,f,_),fe(r,g,v,o,a,b,u,f,_)):r.push(u)}function se(r,e,i){let o=r[0],a=o.x,h=o.y;e(o);const u=[o];for(let f=1;f<r.length;f++){const _=r[f],{x:g,y:v}=_;e(_),fe(u,a,h,g,v,o,_,e,i),a=g,h=v,o=_}return u}function Ie(r,e,i,o){if(o(e,i)){const a=e.add(i)._mult(.5);Ie(r,e,a,o),Ie(r,a,i,o)}else r.push(i)}function xe(r,e){let i=r[0];const o=[i];for(let a=1;a<r.length;a++){const h=r[a];Ie(o,i,h,e),i=h}return o}const Me=Math.pow(2,14)-1,Ue=-Me-1;function me(r,e){const i=Math.round(r.x*e),o=Math.round(r.y*e);return r.x=W(i,Ue,Me),r.y=W(o,Ue,Me),(i<r.x||i>r.x+1||o<r.y||o>r.y+1)&&Gt("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function oe(r,e,i){const o=r.loadGeometry(),a=r.extent,h=We/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const u=1<<e.z,{scale:f,x:_,y:g,projection:v}=i,b=w=>{const I=N((e.x+w.x/a)/u),A=j((e.y+w.y/a)/u),P=v.project(I,A);w.x=(P.x*f-_)*a,w.y=(P.y*f-g)*a};for(let w=0;w<o.length;w++)if(r.type!==1)o[w]=se(o[w],b,1);else{const I=[];for(const A of o[w])A.x<0||A.x>=a||A.y<0||A.y>=a||(b(A),I.push(A));o[w]=I}}for(const u of o)for(const f of u)me(f,h);return o}function we(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?oe(r):[]}}class _e{constructor(e,i,o,a,h){this.properties={},this.extent=o,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=h,e.readFields(ze,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,o=[];let a,h=1,u=0,f=0,_=0;for(;e.pos<i;){if(u<=0){const g=e.readVarint();h=7&g,u=g>>3}if(u--,h===1||h===2)f+=e.readSVarint(),_+=e.readSVarint(),h===1&&(a&&o.push(a),a=[]),a&&a.push(new ke(f,_));else{if(h!==7)throw new Error(`unknown command ${h}`);a&&a.push(a[0].clone())}}return a&&o.push(a),o}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let o=1,a=0,h=0,u=0,f=1/0,_=-1/0,g=1/0,v=-1/0;for(;e.pos<i;){if(a<=0){const b=e.readVarint();o=7&b,a=b>>3}if(a--,o===1||o===2)h+=e.readSVarint(),u+=e.readSVarint(),h<f&&(f=h),h>_&&(_=h),u<g&&(g=u),u>v&&(v=u);else if(o!==7)throw new Error(`unknown command ${o}`)}return[f,g,_,v]}toGeoJSON(e,i,o){const a=this.extent*Math.pow(2,o),h=this.extent*e,u=this.extent*i,f=this.loadGeometry();function _(w){return[360*(w.x+h)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(w.y+u)/a)*Math.PI))-90]}function g(w){return w.map(_)}let v;
7if(this.type===1){const w=[];for(const A of f)w.push(A[0]);const I=g(w);v=w.length===1?{type:"Point",coordinates:I[0]}:{type:"MultiPoint",coordinates:I}}else if(this.type===2){const w=f.map(g);v=w.length===1?{type:"LineString",coordinates:w[0]}:{type:"MultiLineString",coordinates:w}}else{if(this.type!==3)throw new Error("unknown feature type");{const w=function(A){const P=A.length;if(P<=1)return[A];const R=[];let O,U;for(let V=0;V<P;V++){const G=Re(A[V]);G!==0&&(U===void 0&&(U=G<0),U===G<0?(O&&R.push(O),O=[A[V]]):O&&O.push(A[V]))}return O&&R.push(O),R}(f),I=[];for(const A of w)I.push(A.map(g));v=I.length===1?{type:"Polygon",coordinates:I[0]}:{type:"MultiPolygon",coordinates:I}}}const b={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(b.id=this.id),b}}function ze(r,e,i){r===1?e.id=i.readVarint():r===2?function(o,a){const h=o.readVarint()+o.pos;for(;o.pos<h;){const u=a._keys[o.readVarint()],f=a._values[o.readVarint()];a.properties[u]=f}}(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function Re(r){let e=0;for(let i,o,a=0,h=r.length,u=h-1;a<h;u=a++)i=r[a],o=r[u],e+=(o.x-i.x)*(i.y+o.y);return e}_e.types=["Unknown","Point","LineString","Polygon"];class Le{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Ze,this,i),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 i=this._pbf.readVarint()+this._pbf.pos;return new _e(this._pbf,i,this.extent,this._keys,this._values)}}function Ze(r,e,i){r===15?e.version=i.readVarint():r===1?e.name=i.readString():r===5?e.extent=i.readVarint():r===2?e._features.push(i.pos):r===3?e._keys.push(i.readString()):r===4&&e._values.push(function(o){let a=null;const h=o.readVarint()+o.pos;for(;o.pos<h;){const u=o.readVarint()>>3;a=u===1?o.readString():u===2?o.readFloat():u===3?o.readDouble():u===4?o.readVarint64():u===5?o.readVarint():u===6?o.readSVarint():u===7?o.readBoolean():null}if(a==null)throw new Error("unknown feature value");return a}(i))}class at{constructor(e,i){this.layers=e.readFields(dt,{},i)}}function dt(r,e,i){if(r===3){const o=new Le(i,i.readVarint()+i.pos);o.length&&(e[o.name]=o)}}const Qe="3d_elevation_id",ht="level";class lt{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,i){return this._valid&&e(i(this._geometry)),this}require(e,i,o){return this.get(e,!0,i,o)}optional(e,i,o){return this.get(e,!1,i,o)}success(){return this._valid}get(e,i,o,a){const h=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&h!==void 0&&!Number.isNaN(h)?o(a?a(h):h):i&&(this._valid=!1),this}}class wt{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,o){return this.featureFunc(e,i,o)}parseVertex(e,i,o){return this.vertexFunc(e,i,o)}}const At=new wt((r,e,i)=>r.reset(e).require(Qe,o=>{i.id=o}).optional("fixed_height_relative",o=>{i.constantHeight=o},Yt.decodeRelativeHeight).geometry(o=>{i.bounds=o},yh).success(),(r,e,i)=>r.reset(e).require(Qe,o=>{i.id=o}).require("elevation_idx",o=>{i.idx=o}).require("extent",o=>{i.extent=o}).require("height_relative",o=>{i.height=o},Yt.decodeRelativeHeight).geometry(o=>{i.position=o},Yt.getPoint).success()),Ot=new wt((r,e,i)=>r.reset(e).require(Qe,o=>{i.id=o}).optional("fixed_height",o=>{i.constantHeight=o},Yt.decodeMetricHeight).geometry(o=>{i.bounds=o},yh).success(),(r,e,i)=>r.reset(e).require(Qe,o=>{i.id=o}).require("elevation_idx",o=>{i.idx=o}).require("extent",o=>{i.extent=o}).require("height",o=>{i.height=o},Yt.decodeMetricHeight).geometry(o=>{i.position=o},Yt.getPoint).success());class Yt{static getPoint(e){return xn(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static parse(e){const i=[],o=[],a=e.length,h=new lt;for(let f=0;f<a;f++){const _=e.feature(f),g=_.properties.version,v=(u=g)?u==="1.0.1"?Ot:void 0:At;if(v===void 0){Gt(`Unknown elevation feature version number ${g||"(unknown)"}`);continue}const b=_.properties.hasOwnProperty("type")?_.properties.type:void 0;if(b){if(_e.types[_.type]==="Point"&&b==="curve_point"){const w={};v.parseVertex(h,_,w)&&i.push(w)}else if(_e.types[_.type]==="Polygon"&&b==="curve_meta"){const w={};v.parseFeature(h,_,w)&&o.push(w)}}}var u;return{vertices:i,features:o}}}class Et{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,o){const a=Di(i,this.dir);if(Math.abs(a)<1e-6)return!1;const h=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return o[0]=this.pos[0]+this.dir[0]*h,o[1]=this.pos[1]+this.dir[1]*h,!0}}class Kt{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,o){const a=er(i,this.dir);if(Math.abs(a)<1e-6)return!1;const h=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return o[0]=this.pos[0]+this.dir[0]*h,o[1]=this.pos[1]+this.dir[1]*h,o[2]=this.pos[2]+this.dir[2]*h,!0}closestPointOnSphere(e,i,o){if(function(I,A){var P=I[0],R=I[1],O=I[2],U=A[0],V=A[1],G=A[2];return Math.abs(P-U)<=Gr*Math.max(1,Math.abs(P),Math.abs(U))&&Math.abs(R-V)<=Gr*Math.max(1,Math.abs(R),Math.abs(V))&&Math.abs(O-G)<=Gr*Math.max(1,Math.abs(O),Math.abs(G))}(this.pos,e)||i===0)return o[0]=o[1]=o[2]=0,!1;const[a,h,u]=this.dir,f=this.pos[0]-e[0],_=this.pos[1]-e[1],g=this.pos[2]-e[2],v=a*
vendor: 7,468 bytes, line 7
7a+h*h+u*u,b=2*(f*a+_*h+g*u),w=b*b-4*v*(f*f+_*_+g*g-i*i);if(w<0){const I=Math.max(-b/2,0),A=f+a*I,P=_+h*I,R=g+u*I,O=Math.hypot(A,P,R);return o[0]=A*i/O,o[1]=P*i/O,o[2]=R*i/O,!1}{const I=(-b-Math.sqrt(w))/(2*v);if(I<0){const A=Math.hypot(f,_,g);return o[0]=f*i/A,o[1]=_*i/A,o[2]=g*i/A,!1}return o[0]=f+a*I,o[1]=_+h*I,o[2]=g+u*I,!0}}}class ti{constructor(e,i,o,a,h){this.TL=e,this.TR=i,this.BR=o,this.BL=a,this.horizon=h}static fromInvProjectionMatrix(e,i,o){const a=[-1,1,1],h=[1,1,1],u=[1,-1,1],f=[-1,-1,1],_=tr(a,a,e),g=tr(h,h,e),v=tr(u,u,e),b=tr(f,f,e);return new ti(_,g,v,b,i/o)}}function vi(r,e,i){let o=1/0,a=-1/0;const h=[];for(const u of r){ir(h,u,e);const f=er(h,i);o=Math.min(o,f),a=Math.max(a,f)}return[o,a]}function Dt(r,e){let i=!0;for(let o=0;o<r.planes.length;o++){const a=r.planes[o];let h=0;for(let u=0;u<e.length;u++)h+=er(a,e[u])+a[3]>=0;if(h===0)return 0;h!==e.length&&(i=!1)}return i?2:1}function Jt(r,e){for(const i of r.projections){const o=vi(e,r.points[0],i.axis);if(i.projection[1]<o[0]||i.projection[0]>o[1])return 0}return 1}function Qt(r,e){let i=0;const o=[0,0,0,0];for(let u=0;u<r.length;u++)o[0]=r[u][0],o[1]=r[u][1],o[2]=r[u][2],o[3]=1,(a=o)[0]*(h=e)[0]+a[1]*h[1]+a[2]*h[2]+a[3]*h[3]>=0&&i++;var a,h;return i}class ni{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=kt.fromPoints(this.points),this.projections=[],this.frustumEdges=[ir([],this.points[2],this.points[3]),ir([],this.points[0],this.points[3]),ir([],this.points[4],this.points[0]),ir([],this.points[5],this.points[1]),ir([],this.points[6],this.points[2]),ir([],this.points[7],this.points[3])];for(const o of this.frustumEdges){const a=[0,-o[2],o[1]],h=[o[2],0,-o[0]];this.projections.push({axis:a,projection:vi(this.points,this.points[0],a)}),this.projections.push({axis:h,projection:vi(this.points,this.points[0],h)})}}static fromInvProjectionMatrix(e,i,o,a){const h=Math.pow(2,o),u=[[-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(g=>{const v=hn([],g,e),b=1/v[3]/i*h;return(w=v)[0]=(I=v)[0]*(A=[b,b,a?1/v[3]:b,b])[0],w[1]=I[1]*A[1],w[2]=I[2]*A[2],w[3]=I[3]*A[3],w;var w,I,A}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const v=Ri([],cr([],ir([],u[g[0]],u[g[1]]),ir([],u[g[2]],u[g[1]]))),b=-er(v,u[g[1]]);return v.concat(b)}),_=[];for(let g=0;g<u.length;g++)_.push([u[g][0],u[g][1],u[g][2]]);return new ni(_,f)}intersectsPrecise(e,i,o){for(let a=0;a<i.length;a++)if(!Qt(e,i[a]))return 0;for(let a=0;a<this.planes.length;a++)if(!Qt(e,this.planes[a]))return 0;for(const a of o)for(const h of this.frustumEdges){const u=cr([],a,h),f=Cr(u);if(f===0)continue;Fi(u,u,1/f);const _=vi(this.points,this.points[0],u),g=vi(e,this.points[0],u);if(_[0]>g[1]||g[0]>_[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const o=i[3];if(er([i[0],i[1],i[2]],e)+o<0)return!1}return!0}}class kt{static fromPoints(e){const i=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(const a of e)lo(i,i,a),Ln(o,o,a);return new kt(i,o)}static fromTileIdAndHeight(e,i,o){const a=1<<e.canonical.z,h=e.canonical.x,u=e.canonical.y;return new kt([h/a,u/a,i],[(h+1)/a,(u+1)/a,o])}static applyTransform(e,i){const o=e.getCorners();for(let a=0;a<o.length;++a)tr(o[a],o[a],i);return kt.fromPoints(o)}static applyTransformFast(e,i){const o=[i[12],i[13],i[14]],a=[...o];for(let h=0;h<3;h++)for(let u=0;u<3;u++){const f=i[4*u+h],_=f*e.min[u],g=f*e.max[u];o[h]+=Math.min(_,g),a[h]+=Math.max(_,g)}return new kt(o,a)}static projectAabbCorners(e,i){const o=e.getCorners();for(let a=0;a<o.length;++a)tr(o[a],o[a],i);return o}constructor(e,i){this.min=e,this.max=i,this.center=Fi([],ki([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],o=Fs(this.min),a=Fs(this.max);for(let h=0;h<i.length;h++)o[h]=i[h]?this.min[h]:this.center[h],a[h]=i[h]?this.center[h]:this.max[h];return a[2]=this.max[2],new kt(o,a)}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,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?Dt(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Dt(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,i){return i||this.intersects(e)?Jt(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?Jt(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 i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])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 i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}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])]}}rt(kt,"Aabb");class di{constructor(e,i){this.feature=e,this.metersToTile=i,this.index=0}get(){const e=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,o=i[1],a=-i[0],h=(e.extent+1)*this.metersToTile;return[new ke(Math.trunc(e.position[0]+o*h),Math.trunc(e.position[1]+a*h)),new ke(Math.trunc(e.position[0]-o*h),Math.trunc(e.position[1]-a*h))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class ii{constructor(e,i,o,a,h,u){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=e,this.heightRange={min:o,max:o},this.safeArea=i,this.constantHeight=o,this.constantHeight==null&&(this.constantHeight!=null||a.length!==0)){this.vertices=a,this.edges=h,this.edges=this.edges.filter(f=>{return f.a<this.vertices.length&&f.b<this.vertices.length&&!((_=this.vertices[f.a].position)[0]===(g=this.vertices[f.b].position)[0]&&_[1]===g[1]);var _,g}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const f of this.vertices)this.vertexProps.push({dir:xn(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,f.height),this.heightRange.max=Math.max(this.heightRange.max,f.height);for(const f of this.edges){const _=this.vertices[f.a].position,g=this.vertices[f.b].position,v=fo(Or(),g,_),b=Oo(v),w=Fo(Or(),v,1/b);this.edgeProps.push({vec:v,dir:w,len:b});const I=this.vertexProps[f.a].dir,A=this.vertexProps[f.b].dir;Lo(I,I,w),Lo(A,A,w)}for(const f of this.vertexProps)f.dir[0]===0&&f.dir[1]===0||Ns(f.dir,f.dir);this.tessellate(u)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[o,a]=i;return ft(this.vertices[this.edges[o].a].height,this.vertices[this.edges[o].b].height,a)}computeSlopeNormal(e,i){const o=this.getClosestEdge(e);if(!o)return lr(0,0,1);const a=o[0],h=this.edges[a],u=this.edgeProps[a].vec,f=lr(u[0],u[1],(this.vertices[h.b].height-this.vertices[h.a].height)*i),_=lr(f[1],-f[0],0);cr(_,_,f);
7const g=Cr(_);return g>0?Fi(_,_,1/g):lr(0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,o=Number.POSITIVE_INFINITY,a=0;const h=xn(e.x,e.y);for(let u=0;u<this.edges.length;u++){const f=this.edges[u],_=this.edgeProps[u].dir,g=new Et(h,this.edgeProps[u].dir),v=this.vertices[f.a].position,b=this.vertices[f.b].position,w=Or(),I=Or(),A=g.intersectsPlane(v,this.vertexProps[f.a].dir,w),P=g.intersectsPlane(b,this.vertexProps[f.b].dir,I);if(!A||!P)continue;const R=fo(Or(),I,w),O=fo(Or(),h,w),U=Di(R,R),V=U>0?Di(O,R)/U:0,G=W(V,0,1),re=Math.abs((V-G)*this.edgeProps[u].len),Q=fo(Or(),h,v),te=re+Math.abs(Di(Q,xn(_[1],-_[0])));te<o&&(i=u,o=te,a=G)}return[i,a]}tessellate(e){for(let i=this.edges.length-1;i>=0;--i){const o=this.edges[i].a,a=this.edges[i].b,{position:h,height:u,extent:f}=this.vertices[o],{position:_,height:g,extent:v}=this.vertices[a],b=this.vertexProps[o].dir,w=this.vertexProps[a].dir,I=lr(h[0]/e,h[1]/e,u),A=lr(_[0]/e,_[1]/e,g),P=lr(b[1],-b[0],0);Fi(P,P,f);const R=lr(w[1],-w[0],0);if(Fi(R,R,v),this.distSqLines(lr(I[0]+.5*P[0],I[1]+.5*P[1],I[2]+.5*P[2]),lr(A[0]-.5*R[0],A[1]-.5*R[1],A[2]-.5*R[2]),lr(I[0]-.5*P[0],I[1]-.5*P[1],I[2]-.5*P[2]),lr(A[0]+.5*R[0],A[1]+.5*R[1],A[2]+.5*R[2]))<=.0025000000000000005)continue;const O=this.vertices.length,U=Lo(Or(),h,_);this.vertices.push({position:Fo(U,U,.5),height:.5*(u+g),extent:.5*(f+v)});const V=Lo(Or(),b,w);this.vertexProps.push({dir:Ns(V,V)}),this.edges.splice(i,1),this.edgeProps.splice(i,1),this.edges.push({a:o,b:O}),this.edges.push({a:O,b:a});const G=fo(Or(),this.vertices[O].position,h),re=Oo(G),Q={vec:G,dir:Fo(Or(),G,1/re),len:re};this.edgeProps.push(Q),this.edgeProps.push(Q)}}distSqLines(e,i,o,a){const h=cn(ui(),i,e),u=cn(ui(),a,o),f=cn(ui(),e,o),_=er(h,h),g=er(h,u),v=er(h,f),b=er(u,u),w=er(u,f),I=_*b-g*g;if(I===0){const R=er(f,u)/er(u,u);return Os(Qr(ui(),o,a,R),e)}const A=(g*w-v*b)/I,P=(_*w-g*v)/I;return Os(Qr(ui(),e,i,A),Qr(ui(),o,a,P))}}class Vi{static parseFrom(e,i){const o=Yt.parse(e);if(!o)return[];let{vertices:a,features:h}=o;const u=1/K(i);h.sort((v,b)=>v.id-b.id),a.sort((v,b)=>v.id-b.id||v.idx-b.idx),a=a.filter((v,b,w)=>b===w.findIndex(I=>I.id===v.id&&I.idx===v.idx));const f=new Array;let _=0;const g=a.length;for(const v of h){if(v.constantHeight){f.push(new ii(v.id,v.bounds,v.constantHeight));continue}for(;_!==g&&a[_].id<v.id;)_++;if(_===g||a[_].id!==v.id)continue;const b=new Array,w=new Array,I=_;for(;_!==g&&a[_].id===v.id;){const A=a[_];if(b.push({position:A.position,height:A.height,extent:A.extent}),_!==I&&a[_-1].idx===A.idx-1){const P=_-I;w.push({a:P-1,b:P})}_++}f.push(new ii(v.id,v.bounds,void 0,b,w,u))}return f}static getElevationFeature(e,i){if(!i)return;const o=+e.properties[Qe];return Number.isNaN(o)?void 0:i.find(a=>a.id===o)}}class Wt{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*We,this.yOffset=(e.y*this.zScale-i.y)*We)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,o){const a=this.constantElevation(i,o);return a??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),o))}computeBiasedHeight(e,i){return i<=0?e:e+i*le(0,i,e>=0?e:Math.abs(.5*e))}}rt(ii,"ElevationFeature");class oi{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new ln,this.indexArray=new Li,this.segments=new Ni,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new Ms),this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,o,a){const h=this.layers[0],u=[];let f=null;
vendor: 19,808 bytes, line 7
7h.type==="circle"&&(f=h.layout.get("circle-sort-key"));for(const{feature:g,id:v,index:b,sourceLayerIndex:w}of e){const I=this.layers[0]._featureFilter.needGeometry,A=we(g,I);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom,{worldview:this.worldview}),A,o))continue;const P=f?f.evaluate(A,{},o):void 0,R={id:v,properties:g.properties,type:g.type,sourceLayerIndex:w,index:b,geometry:I?A.geometry:oe(g,o,a),patterns:{},sortKey:P};u.push(R)}f&&u.sort((g,v)=>g.sortKey-v.sortKey);let _=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new Lc,_=a.projection);for(const g of u){const{geometry:v,index:b,sourceLayerIndex:w}=g,I=e[b].feature;this.addFeature(g,v,b,i.availableImages,o,_,i.brightness,i.elevationFeatures),i.featureIndex.insert(I,v,b,w,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,i,o,a,h,u,f){this.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ap.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Of.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Ff.members))),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.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,i,o,a,h,u,f,_){let g;this.elevationMode!=="none"&&(g=Vi.getElevationFeature(e,_));for(const v of i)for(const b of v){const w=b.x,I=b.y;if(w<0||w>=We||I<0||I>=We)continue;if(u){const R=u.projectTilePoint(w,I,h),O=u.upVector(h,w,I);this.addGlobeExtVertex(R,O),this.addGlobeExtVertex(R,O),this.addGlobeExtVertex(R,O),this.addGlobeExtVertex(R,O)}const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),P=A.vertexLength;if(this.addCircleVertex(w,I,-1,-1),this.addCircleVertex(w,I,1,-1),this.addCircleVertex(w,I,1,1),this.addCircleVertex(w,I,-1,1),this.elevationMode!=="none"){const R=g?g.pointElevation(new ke(w,I)):0;this.hasElevation=this.hasElevation||R!==0;for(let O=0;O<4;O++)this.elevatedLayoutVertexArray.emplaceBack(R)}this.indexArray.emplaceBack(P,P+1,P+2),this.indexArray.emplaceBack(P,P+2,P+3),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},a,h,f,void 0,this.worldview)}addCircleVertex(e,i,o,a){this.layoutVertexArray.emplaceBack(2*e+(o+1)/2,2*i+(a+1)/2)}addGlobeExtVertex(e,i){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}}function yi(r,e){for(let i=0;i<r.length;i++)if(zr(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(zr(r,e[i]))return!0;return!!Sr(r,e)}function sr(r,e,i){return!!zr(r,e)||!!Pr(e,r,i)}function rr(r,e){if(r.length===1)return Gn(e,r[0]);for(let i=0;i<e.length;i++){const o=e[i];for(let a=0;a<o.length;a++)if(zr(r,o[a]))return!0}for(let i=0;i<r.length;i++)if(Gn(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Sr(r,e[i]))return!0;return!1}function ar(r,e,i){if(r.length>1){if(Sr(r,e))return!0;for(let o=0;o<e.length;o++)if(Pr(e[o],r,i))return!0}for(let o=0;o<r.length;o++)if(Pr(r[o],e,i))return!0;return!1}function Sr(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const o=r[i],a=r[i+1];for(let h=0;h<e.length-1;h++)if(Xn(o,a,e[h],e[h+1]))return!0}return!1}function Xn(r,e,i,o){return Ki(r,i,o)!==Ki(e,i,o)&&Ki(r,e,i)!==Ki(r,e,o)}function Yr(r,e,i){return(r.x-i.x)*(e.y-i.y)-(r.y-i.y)*(e.x-i.x)}function fn(r,e,i,o){const a=Yr(r,e,o),h=Yr(r,e,i);if(Math.sign(a)===Math.sign(h))return;const u=Yr(i,o,r),f=u+h-a;return Math.sign(u)!==Math.sign(f)?[u/(u-f),h/(h-a)]:void 0}function Pr(r,e,i){const o=i*i;if(e.length===1)return r.distSqr(e[0])<o;for(let a=1;a<e.length;a++)if(Mn(r,e[a-1],e[a])<o)return!0;return!1}function Mn(r,e,i){const o=e.distSqr(i);if(o===0)return r.distSqr(e);const a=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/o;return r.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function Gn(r,e){let i,o,a,h=!1;for(let u=0;u<r.length;u++){i=r[u];for(let f=0,_=i.length-1;f<i.length;_=f++)o=i[f],a=i[_],o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(h=!h)}return h}function zr(r,e){let i=!1;for(let o=0,a=r.length-1;o<r.length;a=o++){const h=r[o],u=r[a];h.y>e.y!=u.y>e.y&&e.x<(u.x-h.x)*(e.y-h.y)/(u.y-h.y)+h.x&&(i=!i)}return i}function Ji(r,e,i,o,a){for(const u of r)if(e<=u.x&&i<=u.y&&o>=u.x&&a>=u.y)return!0;const h=[new ke(e,i),new ke(e,a),new ke(o,a),new ke(o,i)];if(r.length>2){for(const u of h)if(zr(r,u))return!0}for(let u=0;u<r.length-1;u++)if(Zi(r[u],r[u+1],h))return!0;return!1}function Zi(r,e,i){const o=i[0],a=i[2];if(r.x<o.x&&e.x<o.x||r.x>a.x&&e.x>a.x||r.y<o.y&&e.y<o.y||r.y>a.y&&e.y>a.y)return!1;const h=Ki(r,e,i[0]);return h!==Ki(r,e,i[1])||h!==Ki(r,e,i[2])||h!==Ki(r,e,i[3])}function wi(r,e,i,o,a,h){let u=e.y-r.y,f=r.x-e.x;if(h=h||0){const _=u*u+f*f;if(_===0)return!0;const g=Math.sqrt(_);u/=g,f/=g}return!((i.x-r.x)*u+(i.y-r.y)*f-h<0||(o.x-r.x)*u+(o.y-r.y)*f-h<0||(a.x-r.x)*u+(a.y-r.y)*f-h<0)}function fr(r,e,i,o,a,h,u){return!(wi(r,e,o,a,h,u)||wi(e,i,o,a,h,u)||wi(i,r,o,a,h,u)||wi(o,a,r,e,i,u)||wi(a,h,r,e,i,u)||wi(h,o,r,e,i,u))}function Er(r,e,i){const o=e.paint.get(r).value;return o.kind==="constant"?o.value:i.programConfigurations.get(e.id).getMaxValue(r)}function Qi(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Cn(r,e,i,o,a){if(!e[0]&&!e[1])return r;const h=ke.convert(e)._mult(a);i==="viewport"&&h._rotate(-o);const u=[];for(let f=0;f<r.length;f++)u.push(r[f].sub(h));return u}function Ps(r,e,i,o){const a=ke.convert(r)._mult(o);return e==="viewport"&&a._rotate(-i),a}let rs,wa;function Ta(r,e,i){var o=2*Math.PI*6378137/256/Math.pow(2,i);return[r*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}rt(oi,"CircleBucket",{omit:["layers"]});class Pn{constructor(e,i,o){this.z=e,this.x=i,this.y=o,this.key=zn(0,e,e,i,o)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const i=this.z-e.z;return e.z===0||e.z<this.z&&e.x===this.x>>i&&e.y===this.y>>i}url(e,i){const o=function(h,u,f){var _=Ta(256*h,256*(u=Math.pow(2,f)-u-1),f),g=Ta(256*(h+1),256*(u+1),f);return _[0]+","+_[1]+","+g[0]+","+g[1]}(this.x,this.y,this.z),a=function(h,u,f){let _,g="";for(let v=h;v>0;v--)_=1<<v-1,g+=(u&_?1:0)+(f&_?2:0);return g}(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(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",o)}toString(){return`${this.z}/${this.x}/${this.y}`}}class no{constructor(e,i){this.wrap=e,this.canonical=i,this.key=zn(e,i.z,i.z,i.x,i.y)}}class mr{constructor(e,i,o,a,h){this.overscaledZ=e,this.wrap=i,this.canonical=new Pn(o,+a,+h),this.key=i===0&&e===o?this.canonical.key:zn(i,e,o,a,h)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new mr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new mr(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return zn(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const o=this.canonical.z-e;return zn(this.wrap*+i,e,e,this.canonical.x>>o,this.canonical.y>>o)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=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>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new mr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,o=2*this.canonical.x,a=2*this.canonical.y;return[new mr(i,this.wrap,i,o,a),new mr(i,this.wrap,i,o+1,a),new mr(i,this.wrap,i,o,a+1),new mr(i,this.wrap,i,o+1,a+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 mr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new mr(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 no(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function zn(r,e,i,o,a){const h=1<<Math.min(i,22);let u=h*(a%h)+o%h;return r&&i<22&&(u+=h*h*((r<0?-2*r-1:2*r)%(1<<2*(22-i)))),16*(32*u+i)+(e-i)}const zs=[r=>{let e=r.canonical.x-1,i=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,i--),new mr(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>{let e=r.canonical.x+1,i=r.wrap;return e===1<<r.canonical.z&&(e=0,i++),new mr(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>new mr(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new mr(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];rt(Pn,"CanonicalTileID"),rt(mr,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const J0=$t([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:pp}=J0,Q0=$t([{name:"a_pos_3",components:3,type:"Int16"}]);var o_=$t([{name:"a_pos",type:"Int16",components:2}]);function fp(r){return r*Ur/x}const ex=[new kt([d,d,d],[p,p,p]),new kt([d,d,d],[0,0,p]),new kt([0,d,d],[p,0,p]),new kt([d,0,d],[0,p,p]),new kt([0,0,d],[p,p,p])];function s_(r,e,i,o=!0){const a=Fi([],r._camera.position,r.worldSize),h=[e,i,1,1];hn(h,h,r.pixelMatrixInverse),co(h,h,1/h[3]);const u=Ri([],ir([],h,a)),f=r.globeMatrix,_=[f[12],f[13],f[14]],g=ir([],_,a),v=Cr(g),b=Ri([],g),w=r.worldSize/(2*Math.PI),I=er(b,u),A=Math.asin(w/v);if(A<Math.acos(I)){if(!o)return null;const Ee=[],de=[];Fi(Ee,u,v/I),Ri(de,ir(de,Ee,g)),Ri(u,ki(u,g,Fi(u,de,Math.tan(A)*v)))}const P=[];new Kt(a,u).closestPointOnSphere(_,w,P);const R=Ri([],qi(f,0)),O=Ri([],qi(f,1)),U=Ri([],qi(f,2)),V=er(R,P),G=er(O,P),re=er(U,P),Q=ge(Math.asin(-G/w));let te=ge(Math.atan2(V,re));te=r.center.lng+function(Ee,de){const Ae=(de-Ee+180)%360-180;return Ae<-180?Ae+360:Ae}(r.center.lng,te);const ae=z(te),ce=W(F(Q),0,1);return new J(ae,ce)}class tx{constructor(e,i,o){this.a=ir([],e,o),this.b=ir([],i,o),this.center=o;const a=Ri([],this.a),h=Ri([],this.b);this.angle=Math.acos(er(a,h))}}function qf(r,e){if(r.angle===0)return null;let i;return i=r.a[e]===0?1/r.angle*.5*Math.PI:1/r.angle*Math.atan(r.b[e]/r.a[e]/Math.sin(r.angle)-1/Math.tan(r.angle)),i<0||i>1?null:function(o,a,h,u){const f=Math.sin(h);return o*(Math.sin((1-u)*h)/f)+a*(Math.sin(u*h)/f)}(r.a[e],r.b[e],r.angle,W(i,0,1))+r.center[e]}function ns(r){if(r.z<=1)return ex[r.z+2*r.y+r.x];const e=Hf(mp(r));return kt.fromPoints(e)}function Rs(r,e,i){return Fi(r,r,1-i),Hr(r,r,e,i)}function a_(r,e,i){for(const o of r)tr(o,o,e),Fi(o,o,i)}function l_(r,e,i,o){const a=e/r.worldSize,h=r.globeMatrix;if(i.z<=1){const ce=ns(i).getCorners();return a_(ce,h,a),kt.fromPoints(ce)}const u=mp(i,o),f=Hf(u,Ur+fp(r._tileCoverLift));a_(f,h,a);const _=Number.MAX_VALUE,g=[-_,-_,-_],v=[_,_,_];if(u.contains(r.center)){for(const de of f)lo(v,v,de),Ln(g,g,de);g[2]=0;const ce=r.point,Ee=[ce.x*a,ce.y*a,0];return lo(v,v,Ee),Ln(g,g,Ee),new kt(v,g)}if(r._tileCoverLift>0){for(const ce of f)lo(v,v,ce),Ln(g,g,ce);return new kt(v,g)}const b=[h[12]*a,h[13]*a,h[14]*a],w=u.getCenter(),I=W(r.center.lat,-X,X),A=W(w.lat,-X,X),P=z(r.center.lng),R=F(I);let O=P-z(w.lng);const U=R-F(A);O>.5?O-=1:O<-.5&&(O+=1);let V=0;Math.abs(O)>Math.abs(U)?V=O>=0?1:3:(V=U>=0?0:2,Hr(b,b,[h[4]*a,h[5]*a,h[6]*a],-Math.sin(ei(U>=0?u.getSouth():u.getNorth()))*Ur));const G=f[V],re=f[(V+1)%4],Q=new tx(G,re,b),te=[qf(Q,0)||G[0],qf(Q,1)||G[1],qf(Q,2)||G[2]],ae=Sa(r.zoom);if(ae>0){const ce=function({x:de,y:Ae,z:je},Ce,Fe,Ve,Te){const Oe=1/(1<<je);let pe=de*Oe,Se=pe+Oe,He=Ae*Oe,Be=He+Oe,ct=0;const nt=(pe+Se)/2-Ve;return nt>.5?ct=-1:nt<-.5&&(ct=1),pe=((pe+ct)*Ce-(Ve*=Ce))*Fe+Ve,Se=((Se+ct)*Ce-Ve)*Fe+Ve,He=(He*Ce-(Te*=Ce))*Fe+Te,Be=(Be*Ce-Te)*Fe+Te,[[pe,Be,0],[Se,Be,0],[Se,He,0],[pe,He,0]]}(i,e,r._pixelsPerMercatorPixel,P,R);for(let de=0;de<f.length;de++)Rs(f[de],ce[de],ae);const Ee=ki([],ce[V],ce[(V+1)%4]);Fi(Ee,Ee,.5),Rs(te,Ee,ae)}for(const ce of f)lo(v,v,ce),Ln(g,g,ce);return v[2]=Math.min(G[2],re[2]),lo(v,v,te),Ln(g,g,te),new kt(v,g)}function mp({x:r,y:e,z:i},o=!1){const a=1/(1<<i),h=new S(N(r*a),e===(1<<i)-1&&o?-90:j((e+1)*a)),u=new S(N((r+1)*a),e===0&&o?90:j(e*a));return new M(h,u)}function Hf(r,e=Ur){const i=ei(r.getNorth()),o=ei(r.getSouth()),a=Math.cos(i),h=Math.cos(o),u=Math.sin(i),f=Math.sin(o),_=r.getWest(),g=r.getEast();return[m(h,f,_,e),m(h,f,g,e),m(a,u,g,e),m(a,u,_,e)]}function Su(r,e,i,o){const a=1<<i.z,h=(r/We+i.x)/a;return y(j((e/We+i.y)/a),N(h),o)}function _p({min:r,max:e}){return t/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const c_=new Float64Array(16);function gp(r){const e=_p(r),i=Ls(c_,[e,e,e]);return qr(i,i,Po([],r.min))}function $f(r){const e=(o=r.min,(i=c_)[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]=o[0],i[13]=o[1],i[14]=o[2],i[15]=1,i);var i,o;const a=1/_p(r);return Fr(e,e,[a,a,a])}function Zf(r){const e=We/(2*Math.PI);return r/(2*Math.PI)/e}function h_(r,e){return We/(512*Math.pow(2,r))*_p(ns(e))}function u_(r,e,i,o,a){const h=Zf(i),u=[r,e,-i/(2*Math.PI)],f=Bt(new Float64Array(16));return qr(f,f,u),Fr(f,f,[h,h,h]),Ao(f,f,ei(-a)),ao(f,f,ei(-o)),f}function Sa(r){return le(dp,l,r)}function d_(r,e){const i=y(e.lat,e.lng),o=function(A){const P=y(A._center.lat,A._center.lng);let R=cr([],lr(0,1,0),P);const O=qn([],-A.angle,P);R=tr(R,R,O),qn(O,-A._pitch,R);const U=Ri([],P);return Fi(U,U,fp(A.cameraToCenterDistance/A.pixelsPerMeter)),tr(U,U,O),ki([],P,U)}(r);return u=(a=cn([],o,i))[0],f=a[1],_=a[2],g=(h=i)[0],v=h[1],b=h[2],I=(w=Math.sqrt(u*u+f*f+_*_)*Math.sqrt(g*g+v*v+b*b))&&er(a,h)/w,Math.acos(Math.min(Math.max(I,-1),1));var a,h,u,f,_,g,v,b,w,I}function Wf(r,e){return d_(r,e)>Math.PI/2*1.01}const p_=ei(85),ix=Math.cos(p_),rx=Math.sin(p_),nx=cs(),f_=r=>{const e=[];return r.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),r.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function m_(r,e,i,o,a,h,u,f,_){if(h&&r.queryGeometry.isAboveHorizon)return!1;h&&(_*=r.pixelToTileUnitsFactor);const g=r.tileID.canonical,v=i.projection.upVectorScale(g,i.center.lat,i.worldSize).metersToTile;for(const b of e)for(const w of b){const I=w.add(f),A=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(I.x,I.y,!0):0,P=i.projection.projectTilePoint(I.x,I.y,g);if(A>0){const V=i.projection.upVector(g,I.x,I.y);P.x+=V[0]*v*A,P.y+=V[1]*v*A,P.z+=V[2]*v*A}const R=h?I:ox(P.x,P.y,P.z,o),O=h?r.tilespaceRays.map(V=>ax(V,A)):r.queryGeometry.screenGeometry,U=hn([],[P.x,P.y,P.z,1],o);if(!u&&h?_*=U[3]/i.cameraToCenterDistance:u&&!h&&(_*=i.cameraToCenterDistance/U[3]),h){const V=j((w.y/We+g.y)/(1<<g.z));_/=i.projection.pixelsPerMeter(V,1)/L(1,V)}if(sr(O,R,_))return!0}return!1}function ox(r,e,i,o){const a=hn([],[r,e,i,1],o);return new ke(a[0]/a[3],a[1]/a[3])}const __=lr(0,0,0),sx=lr(0,0,1);function ax(r,e){const i=ui();return __[2]=e,r.intersectsPlane(__,sx,i),new ke(i[0],i[1])}class g_ extends oi{}let y_,x_,v_,b_;function w_(r,{width:e,height:i},o,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*o)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*o);return r.width=e,r.height=i,r.data=a,r}function T_(r,e,i){const{width:o,height:a}=e;o===r.width&&a===r.height||(Xf(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,o),height:Math.min(r.height,a)},i,null),r.width=o,r.height=a,r.data=e.data)}function Xf(r,e,i,o,a,h,u,f){if(a.width===0||a.height===0)return e;if(a.width>r.width||a.height>r.height||i.x>r.width-a.width||i.y>r.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||o.x>e.width-a.width||o.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const _=r.data,g=e.data,v=h===4&&f;for(let b=0;b<a.height;b++){const w=((i.y+b)*r.width+i.x)*h,I=((o.y+b)*e.width+o.x)*h;if(v)for(let A=0;A<a.width;A++){const P=w+A*h+3,R=I+A*h;g[R+0]=255,g[R+1]=255,g[R+2]=255,g[R+3]=_[P]}else if(u)for(let A=0;A<a.width;A++){const P=w+A*h,R=I+A*h,O=new li(_[P+0]/255,_[P+1]/255,_[P+2]/255,_[P+3]).toNonPremultipliedRenderColor(u).toArray();g[R+0]=O[0],g[R+1]=O[1],g[R+2]=O[2],g[R+3]=O[3]}else for(let A=0;A<a.width*h;A++)g[I+A]=_[w+A]}return e}rt(g_,"HeatmapBucket",{omit:["layers"]});class Ea{constructor(e,i){w_(this,e,1,i)}resize(e){T_(this,new Ea(e),1)}clone(){return new Ea({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,o,a,h){Xf(e,i,o,a,h,1,null)}}class Rr{constructor(e,i){w_(this,e,4,i)}resize(e){T_(this,new Rr(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Rr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,o,a,h,u,f){Xf(e,i,o,a,h,4,u,f)}}class S_{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function Eu(r){const e={},i=r.resolution||256,o=r.clips?r.clips.length:1,a=r.image||new Rr({width:i,height:o}),h=(u,f,_)=>{e[r.evaluationKey]=_;const g=r.expression.evaluate(e),v=g?g.toNonPremultipliedRenderColor(null):null;v&&(a.data[u+f+0]=Math.floor(255*v.r),a.data[u+f+1]=Math.floor(255*v.g),a.data[u+f+2]=Math.floor(255*v.b),a.data[u+f+3]=Math.floor(255*v.a))};if(r.clips)for(let u=0,f=0;u<o;++u,f+=4*i)for(let _=0,g=0;_<i;_++,g+=4){const v=_/(i-1),{start:b,end:w}=r.clips[u];h(f,g,b*(1-v)+w*v)}else for(let u=0,f=0;u<i;u++,f+=4)h(0,f,u/(i-1));return a}rt(Ea,"AlphaImage"),rt(Rr,"RGBAImage");const lx=$t([{name:"a_pos",components:2,type:"Int16"}],4),cx=$t([{name:"a_road_z_offset",components:1,type:"Float32"}],4),hx=$t([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),ux=$t([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function Gc(r,e,i=2){const o=e&&e.length,a=o?e[0]*i:r.length;let h=E_(r,0,a,i,!0);const u=[];if(!h||h.next===h.prev)return u;let f,_,g;if(o&&(h=function(v,b,w,I){const A=[];for(let P=0,R=b.length;P<R;P++){const O=E_(v,b[P]*I,P<R-1?b[P+1]*I:v.length,I,!1);O===O.next&&(O.steiner=!0),A.push(xx(O))}A.sort(_x);for(let P=0;P<A.length;P++)w=gx(A[P],w);return w}(r,e,h,i)),r.length>80*i){f=r[0],_=r[1];let v=f,b=_;for(let w=i;w<a;w+=i){const I=r[w],A=r[w+1];I<f&&(f=I),A<_&&(_=A),I>v&&(v=I),A>b&&(b=A)}g=Math.max(v-f,b-_),g=g!==0?32767/g:0}return Iu(h,u,i,f,_,g,0),u}function E_(r,e,i,o,a){let h;if(a===function(u,f,_,g){let v=0;for(let b=f,w=_-g;b<_;b+=g)v+=(u[w]-u[b])*(u[b+1]+u[w+1]),w=b;return v}(r,e,i,o)>0)for(let u=e;u<i;u+=o)h=C_(u/o|0,r[u],r[u+1],h);else for(let u=i-o;u>=e;u-=o)h=C_(u/o|0,r[u],r[u+1],h);return h&&qc(h,h.next)&&(Cu(h),h=h.next),h}function Pl(r,e){if(!r)return r;e||(e=r);let i,o=r;do if(i=!1,o.steiner||!qc(o,o.next)&&br(o.prev,o,o.next)!==0)o=o.next;else{if(Cu(o),o=e=o.prev,o===o.next)break;
vendor: 2,272 bytes, line 7
7i=!0}while(i||o!==e);return e}function Iu(r,e,i,o,a,h,u){if(!r)return;!u&&h&&function(_,g,v,b){let w=_;do w.z===0&&(w.z=Yf(w.x,w.y,g,v,b)),w.prevZ=w.prev,w.nextZ=w.next,w=w.next;while(w!==_);w.prevZ.nextZ=null,w.prevZ=null,function(I){let A,P=1;do{let R,O=I;I=null;let U=null;for(A=0;O;){A++;let V=O,G=0;for(let Q=0;Q<P&&(G++,V=V.nextZ,V);Q++);let re=P;for(;G>0||re>0&&V;)G!==0&&(re===0||!V||O.z<=V.z)?(R=O,O=O.nextZ,G--):(R=V,V=V.nextZ,re--),U?U.nextZ=R:I=R,R.prevZ=U,U=R;O=V}U.nextZ=null,P*=2}while(A>1)}(w)}(r,o,a,h);let f=r;for(;r.prev!==r.next;){const _=r.prev,g=r.next;if(h?px(r,o,a,h):dx(r))e.push(_.i,r.i,g.i),Cu(r),r=g.next,f=g.next;else if((r=g)===f){u?u===1?Iu(r=fx(Pl(r),e),e,i,o,a,h,2):u===2&&mx(r,e,i,o,a,h):Iu(Pl(r),e,i,o,a,h,1);break}}}function dx(r){const e=r.prev,i=r,o=r.next;if(br(e,i,o)>=0)return!1;const a=e.x,h=i.x,u=o.x,f=e.y,_=i.y,g=o.y,v=Math.min(a,h,u),b=Math.min(f,_,g),w=Math.max(a,h,u),I=Math.max(f,_,g);let A=o.next;for(;A!==e;){if(A.x>=v&&A.x<=w&&A.y>=b&&A.y<=I&&Au(a,f,h,_,u,g,A.x,A.y)&&br(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function px(r,e,i,o){const a=r.prev,h=r,u=r.next;if(br(a,h,u)>=0)return!1;const f=a.x,_=h.x,g=u.x,v=a.y,b=h.y,w=u.y,I=Math.min(f,_,g),A=Math.min(v,b,w),P=Math.max(f,_,g),R=Math.max(v,b,w),O=Yf(I,A,e,i,o),U=Yf(P,R,e,i,o);let V=r.prevZ,G=r.nextZ;for(;V&&V.z>=O&&G&&G.z<=U;){if(V.x>=I&&V.x<=P&&V.y>=A&&V.y<=R&&V!==a&&V!==u&&Au(f,v,_,b,g,w,V.x,V.y)&&br(V.prev,V,V.next)>=0||(V=V.prevZ,G.x>=I&&G.x<=P&&G.y>=A&&G.y<=R&&G!==a&&G!==u&&Au(f,v,_,b,g,w,G.x,G.y)&&br(G.prev,G,G.next)>=0))return!1;G=G.nextZ}for(;V&&V.z>=O;){if(V.x>=I&&V.x<=P&&V.y>=A&&V.y<=R&&V!==a&&V!==u&&Au(f,v,_,b,g,w,V.x,V.y)&&br(V.prev,V,V.next)>=0)return!1;V=V.prevZ}for(;G&&G.z<=U;){if(G.x>=I&&G.x<=P&&G.y>=A&&G.y<=R&&G!==a&&G!==u&&Au(f,v,_,b,g,w,G.x,G.y)&&br(G.prev,G,G.next)>=0)return!1;G=G.nextZ}return!0}function fx(r,e){let i=r;do{const o=i.prev,a=i.next.next;!qc(o,a)&&A_(o,i,i.next,a)&&Mu(o,a)&&Mu(a,o)&&(e.push(o.i,i.i,a.i),Cu(i),Cu(i.next),i=r=a),i=i.next}while(i!==r);return Pl(i)}function mx(r,e,i,o,a,h){let u=r;do{let f=u.next.next;for(;f!==u.prev;){if(u.i!==f.i&&vx(u,f)){let _=M_(u,f);return u=Pl(u,u.next),_=Pl(_,_.next),Iu(u,e,i,o,a,h,0),void Iu(_,e,i,o,a,h,0)}f=f.next}u=u.next}while(u!==r)}function _x(r,e){let i=r.x-e.x;
vendor: 18,717 bytes, line 7
7return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function gx(r,e){const i=function(a,h){let u=h;const f=a.x,_=a.y;let g,v=-1/0;if(qc(a,u))return u;do{if(qc(a,u.next))return u.next;if(_<=u.y&&_>=u.next.y&&u.next.y!==u.y){const P=u.x+(_-u.y)*(u.next.x-u.x)/(u.next.y-u.y);if(P<=f&&P>v&&(v=P,g=u.x<u.next.x?u:u.next,P===f))return g}u=u.next}while(u!==h);if(!g)return null;const b=g,w=g.x,I=g.y;let A=1/0;u=g;do{if(f>=u.x&&u.x>=w&&f!==u.x&&I_(_<I?f:v,_,w,I,_<I?v:f,_,u.x,u.y)){const P=Math.abs(_-u.y)/(f-u.x);Mu(u,a)&&(P<A||P===A&&(u.x>g.x||u.x===g.x&&yx(g,u)))&&(g=u,A=P)}u=u.next}while(u!==b);return g}(r,e);if(!i)return e;const o=M_(i,r);return Pl(o,o.next),Pl(i,i.next)}function yx(r,e){return br(r.prev,r,e.prev)<0&&br(e.next,r,r.next)<0}function Yf(r,e,i,o,a){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*a|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function xx(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function I_(r,e,i,o,a,h,u,f){return(a-u)*(e-f)>=(r-u)*(h-f)&&(r-u)*(o-f)>=(i-u)*(e-f)&&(i-u)*(h-f)>=(a-u)*(o-f)}function Au(r,e,i,o,a,h,u,f){return!(r===u&&e===f)&&I_(r,e,i,o,a,h,u,f)}function vx(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!function(i,o){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==o.i&&a.next.i!==o.i&&A_(a,a.next,i,o))return!0;a=a.next}while(a!==i);return!1}(r,e)&&(Mu(r,e)&&Mu(e,r)&&function(i,o){let a=i,h=!1;const u=(i.x+o.x)/2,f=(i.y+o.y)/2;do a.y>f!=a.next.y>f&&a.next.y!==a.y&&u<(a.next.x-a.x)*(f-a.y)/(a.next.y-a.y)+a.x&&(h=!h),a=a.next;while(a!==i);return h}(r,e)&&(br(r.prev,r,e.prev)||br(r,e.prev,e))||qc(r,e)&&br(r.prev,r,r.next)>0&&br(e.prev,e,e.next)>0)}function br(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function qc(r,e){return r.x===e.x&&r.y===e.y}function A_(r,e,i,o){const a=xp(br(r,e,i)),h=xp(br(r,e,o)),u=xp(br(i,o,r)),f=xp(br(i,o,e));return a!==h&&u!==f||!(a!==0||!yp(r,i,e))||!(h!==0||!yp(r,o,e))||!(u!==0||!yp(i,r,o))||!(f!==0||!yp(i,e,o))}function yp(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function xp(r){return r>0?1:r<0?-1:0}function Mu(r,e){return br(r.prev,r,r.next)<0?br(r,e,r.next)>=0&&br(r,r.prev,e)>=0:br(r,e,r.prev)<0||br(r,r.next,e)<0}function M_(r,e){const i=Kf(r.i,r.x,r.y),o=Kf(e.i,e.x,e.y),a=r.next,h=e.prev;return r.next=e,e.prev=r,i.next=a,a.prev=i,o.next=i,i.prev=o,h.next=o,o.prev=h,o}function C_(r,e,i,o){const a=Kf(r,e,i);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function Cu(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Kf(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Pu(r,e){const i=r.length;if(i<=1)return[r];const o=[];let a,h;for(let u=0;u<i;u++){const f=yr(r[u]);f!==0&&(r[u].area=Math.abs(f),h===void 0&&(h=f<0),h===f<0?(a&&o.push(a),a=[r[u]]):a.push(r[u]))}if(a&&o.push(a),e>1)for(let u=0;u<o.length;u++)o[u].length<=e||(Nr(o[u],e,1,o[u].length-1,bx),o[u]=o[u].slice(0,e));return o}function bx(r,e){return e.area-r.area}function P_(r,e,i=1){if(!r)return null;const o=typeof r=="string"?on.from(r).getPrimary():r.getPrimary(),a=typeof r=="string"?null:r.getSecondary();for(const h of[o,a]){if(!h)continue;const u=h.id.toString();e.has(u)||e.set(u,[]),h.scaleSelf(i),e.get(u).push(h)}return{primary:o.toString(),secondary:a?a.toString():null}}function Jf(r,e,i,o){const a=o.patternDependencies;let h=!1;for(const u of e){const f=u.paint.get(`${r}-pattern`);f.isConstant()||(h=!0),P_(f.constantOr(null),a,i)&&(h=!0)}return h}function Qf(r,e,i,o,a,h){const u=h.patternDependencies;for(const f of e){const _=f.paint.get(`${r}-pattern`).value;if(_.kind!=="constant"){let g=_.evaluate({zoom:o},i,{},h.availableImages);g=g&&g.name?g.name:g;const v=P_(g,u,a);if(!v)continue;const{primary:b,secondary:w}=v;b&&(i.patterns[f.id]=[b,w].filter(Boolean))}}return i}class z_{constructor(){this.polygons=new Map}add(e,...i){this.polygons.has(e)?this.polygons.get(e).push(...i):this.polygons.set(e,i)}merge(e){for(const[i,o]of e.polygons)this.add(i,...o)}}class zl{constructor(){this.portals=[]}static evaluate(e){if(e.length===0)return new zl;let i=[];for(const g of e)i.push(...g.portals);if(i.length===0)return new zl;const o=(g,v)=>g<=0&&v<=0||g>=We&&v>=We;for(const g of i){const v=g.va,b=g.vb;(o(v.x,b.x)||o(v.y,b.y))&&(g.type="border")}const a=i.filter(g=>g.type!=="unevaluated"),h=i.filter(g=>g.type==="unevaluated");if(h.length===0)return new zl;h.sort((g,v)=>g.hash===v.hash?g.isTunnel===v.isTunnel?0:g.isTunnel?-1:1:g.hash<v.hash?1:-1),i=a.concat(h);let u=a.length,f=u,_=u;do if(f++,f===i.length||i[u].hash!==i[f].hash){if(f-u==2){_<u&&(i[_]=i[u],i[u]=null);const g=i[_],v=i[f-1];g.type=g.isTunnel!==v.isTunnel?"tunnel":"polygon",g.connection={a:g.connection.a,b:v.connection.a},_++}u=f}while(u!==i.length);return i.splice(_),i.sort((g,v)=>g.hash<v.hash?1:-1),{portals:i}}}rt(zl,"ElevationPortalGraph"),rt(z_,"ElevationPolygons");class wx{constructor(e,i,o){this.outPositions=e,this.outNormals=i,this.outIndices=o,this.vertexLookup=new Map,this.buffer=new ArrayBuffer(4),this.view=new DataView(this.buffer)}addVertex(e,i,o){let a=e[2];o!=null&&(a*=o);const h=this.getVec3Bits(e)<<96n|this.getVec3Bits(i),u=this.vertexLookup.get(h);if(u!=null)return u;const f=this.outPositions.length;this.vertexLookup.set(h,f);const _=Math.trunc(16384*i[0]),g=Math.trunc(16384*i[1]),v=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],a),this.outNormals.emplaceBack(_,g,v),f}addTriangle(e,i,o){this.outIndices.emplaceBack(e,i,o)}addTriangles(e,i,o){if(e.length===0)return;const a=o.length===1,h=ui(),u=ui();for(let f=0;f<e.length;f+=3){const _=i[e[f+0]],g=i[e[f+1]],v=i[e[f+2]],b=a?o[0]:o[e[f+1]],w=a?o[0]:o[e[f+2]];nr(h,_.x,_.y,a?o[0]:o[e[f+0]]);const I=this.addVertex(h,u);nr(h,g.x,g.y,b);const A=this.addVertex(h,u);nr(h,v.x,v.y,w);const P=this.addVertex(h,u);this.outIndices.emplaceBack(I,A,P)}}addQuad(e,i,o,a,h,u){const f=this.addVertex(e,h,u),_=this.addVertex(i,h,u),g=this.addVertex(o,h,u),v=this.addVertex(a,h,u);this.addTriangle(f,_,g),this.addTriangle(g,v,f)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}getBits(e){return this.view.setFloat32(0,e),BigInt(this.view.getUint32(0))}getVec3Bits(e){return this.getBits(e[0])<<64n|this.getBits(e[1])<<32n|this.getBits(e[2])}}class Rn{constructor(e,i,o,a){this.unevaluatedPortals=new zl,this.portalPolygons=new z_,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new ou,this.vertexNormals=new su,this.indexArray=new Li,this.tileToMeters=K(e),this.bridgeProgramConfigurations=new An(i,{zoom:o,lut:a},h=>h!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new An(i,{zoom:o,lut:a},h=>h!=="fill-bridge-guard-rail-color")}addVertices(e,i){const o=this.unevalVertices.length;for(let a=0;a<e.length;a++)this.unevalVertices.push(e[a]),this.unevalHeights.push(i[a]);return o}addTriangles(e,i,o){const a=o?this.unevalTunnelTriangles:this.unevalTriangles;for(const h of e)a.push(h+i)}addRenderableRing(e,i,o,a,h,u){const f=[new ke(h.min.x,h.min.y),new ke(h.max.x,h.min.y),new ke(h.max.x,h.max.y),new ke(h.min.x,h.max.y)];for(let _=0;_<o-1;_++){const g=i+_,v=g+1,b=this.unevalVertices[g],w=this.unevalVertices[v];if(!(b.x>=h.min.x&&b.x<=h.max.x&&b.y>=h.min.y&&b.y<=h.max.y||w.x>=h.min.x&&w.x<=h.max.x&&w.y>=h.min.y&&w.y<=h.max.y||Zi(b,w,f))||this.isOnBorder(b.x,w.x)||this.isOnBorder(b.y,w.y))continue;const I=Rn.computeEdgeHash(this.unevalVertices[g],this.unevalVertices[v]);let A,P=this.vertexHashLookup.get(Rn.computePosHash(b));P!=null?A=P.next:(P=this.vertexHashLookup.get(Rn.computePosHash(w)),A=P!=null?P.prev:I),this.unevalEdges.push({polygonIdx:e,a:g,b:v,hash:I,portalHash:A,isTunnel:a,type:"unevaluated",featureInfo:u})}}addPortalCandidates(e,i,o,a,h){if(i.length===0)return;this.portalPolygons.add(e,{geometry:i,zLevel:h});const u=i[0];this.vertexHashLookup.clear();let f=Rn.computeEdgeHash(u[u.length-2],u[u.length-1]);for(let _=0;_<u.length-1;_++){const g=u[_+0],v=u[_+1],b=xn(v.x-g.x,v.y-g.y),w=Oo(b);if(w===0)continue;let I="unevaluated";const A=a.pointElevation(g),P=a.pointElevation(v);Math.abs(A)<.01&&Math.abs(P)<.01?I="entrance":(this.isOnBorder(g.x,v.x)||this.isOnBorder(g.y,v.y))&&(I="border");const R=Rn.computeEdgeHash(g,v);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:g,vb:v,vab:b,length:w,hash:R,isTunnel:o,type:I});const O=Rn.computePosHash(g);this.vertexHashLookup.set(O,{prev:f,next:R}),f=R}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),o=w=>{w.primitiveLength=this.indexArray.length-w.primitiveOffset},a=new wx(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const h=i(),u=i(),f=i(),_=(w,I)=>{w.sort((P,R)=>P.type===I&&R.type!==I?-1:P.type!==I&&R.type===I?1:0);const A=w.findIndex(P=>P.type!==I);return A>=0?A:w.length};let g=0;this.unevalEdges.length>0&&(g=_(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},this.tileToMeters)),o(f);const v=i(),b=i();if(this.unevalEdges.length>0){const w=this.unevalEdges.splice(g),I=_(w,"tunnel")+g;this.unevalEdges.push(...w),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},{min:g,max:I})}o(v),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),o(b),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),o(u),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),o(h),this.maskSegments=Ni.simpleSegment(0,b.primitiveOffset,0,b.primitiveLength),this.depthSegments=Ni.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength),this.renderableBridgeSegments=Ni.simpleSegment(0,f.primitiveOffset,0,f.primitiveLength),this.renderableTunnelSegments=Ni.simpleSegment(0,v.primitiveOffset,0,v.primitiveLength),this.shadowCasterSegments=Ni.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength)}update(e,i,o,a,h,u,f,_){this.bridgeProgramConfigurations.updatePaintArrays(e,i,h,o,a,u,f,_),this.tunnelProgramConfigurations.updatePaintArrays(e,i,h,o,a,u,f,_)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,hx.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,ux.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,i,o,a,h){const u=(f,_)=>{for(let g=0;g<_.length-1;g++){const v=_[g].featureIndex,b=_[g+1].vertexStart,w=e.feature(v);f.populatePaintArrays(b,w,v,{},o,i,a,void 0,h)}};u(this.bridgeProgramConfigurations,this.bridgeFeatureSections),u(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,o,a,h){const u=new Map;for(let f=a;f<h;f++){const _=o[f],g=_.a,v=_.b,b=Rn.computePosHash(e[g]),w=Rn.computePosHash(e[v]);let I=u.get(b);I||(I={},u.set(b,I));let A=u.get(w);A||(A={},u.set(w,A)),i[g]<=0&&i[v]<=0||(I.to=v,A.from=g)}return u}isTerminalVertex(e,i){const o=Rn.computePosHash(this.unevalVertices[e]),a=i.get(o);return!a||!a.from||!a.to}constructBridgeStructures(e,i,o,a,h,u){e.clearVertexLookup();const f=this.computeVertexConnections(i,o,a,h.min,h.max),_=1/u,g=.5*_,v=(Fe,Ve)=>nr(Fe,i[Ve].x,i[Ve].y,o[Ve]*_),b=ui(),w=ui(),I=ui(),A=ui(),P=ui(),R=(Fe,Ve)=>{const Te=f.get(Rn.computePosHash(i[Ve])),Oe=Te.from,pe=Te.to;if(!Oe||!pe)return;v(b,Oe),v(w,Ve),v(I,pe),La(A),Fn(b,w)||(ir(P,w,b),Ri(A,P)),Fn(I,w)||(ir(P,I,w),ki(A,A,Ri(P,P)));const Se=Do(A);return Se>0?Fi(Fe,A,1/Se):void 0};let O=Number.POSITIVE_INFINITY;this.sortSubarray(a,h.min,h.max,(Fe,Ve)=>Fe.featureInfo.featureIndex-Ve.featureInfo.featureIndex);const U=ui(),V=ui(),G=ui(),re=ui(),Q=ui(),te=ui(),ae=ui(),ce=ui(),Ee=ui(),de=[ui(),ui(),ui(),ui()],Ae=[ui(),ui(),ui(),ui()],je=[{coord:new ke(0,0),height:0},{coord:new ke(0,0),height:0}],Ce=(Fe,Ve)=>Fe>Ve;for(let Fe=h.min;Fe<h.max;Fe++){const Ve=a[Fe];if(!Ve.featureInfo.guardRailEnabled||!this.prepareEdgePoints(je,i,o,Ve,Ce))continue;const[Te,Oe]=je;if(nr(U,Te.coord.x,Te.coord.y,_*Te.height),nr(V,Oe.coord.x,Oe.coord.y,_*Oe.height),Fn(U,V))continue;ir(G,V,U),Ri(G,G);const pe=R(ce,Ve.a)||G,Se=R(Ee,Ve.b)||G;nr(re,pe[1],-pe[0],0),Ri(re,re),nr(Q,Se[1],-Se[0],0),Ri(Q,Q),cr(ce,re,pe),Ri(te,ce),cr(ce,Q,Se),Ri(ae,ce),ki(de[0],U,Fi(ce,ir(ce,re,te),g)),ki(de[1],U,Fi(ce,ki(ce,re,te),g)),ki(de[2],U,Fi(ce,te,g)),de[3]=U,ki(Ae[0],V,Fi(ce,ir(ce,Q,ae),g)),ki(Ae[1],V,Fi(ce,ki(ce,Q,ae),g)),ki(Ae[2],V,Fi(ce,ae,g)),Ae[3]=V,O=this.addFeatureSection(Ve.featureInfo.featureIndex,O,this.bridgeFeatureSections,e);const He=e.addVertex(de[0],re,u),Be=e.addVertex(de[1],re,u),ct=e.addVertex(Ae[0],Q,u),nt=e.addVertex(Ae[1],Q,u);e.addTriangle(He,Be,ct),e.addTriangle(Be,nt,ct);const De=e.addVertex(de[1],te,u),Ne=e.addVertex(de[2],te,u),st=e.addVertex(Ae[1],ae,u),et=e.addVertex(Ae[2],ae,u);e.addTriangle(De,Ne,st),e.addTriangle(Ne,et,st),Po(re,re),Po(Q,Q);const Xe=e.addVertex(de[2],re,u),tt=e.addVertex(de[3],re,u),_t=e.addVertex(Ae[2],Q,u),Tt=e.addVertex(Ae[3],Q,u);e.addTriangle(Xe,tt,_t),e.addTriangle(tt,Tt,_t);const Mt=this.isTerminalVertex(Ve.a,f),It=this.isTerminalVertex(Ve.b,f);Te.height<.01&&Mt&&e.addQuad(de[3],de[2],de[1],de[0],Po(pe,pe),u),Oe.height<.01&&It&&e.addQuad(Ae[0],Ae[1],Ae[2],Ae[3],Se,u)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,o,a,h,u){e.clearVertexLookup();let f=Number.POSITIVE_INFINITY;const _=(O,U)=>O.featureInfo.featureIndex-U.featureInfo.featureIndex;this.sortSubarray(a,h.min,h.max,_),this.sortSubarray(a,u.min,u.max,_);const g=O=>Ri(O,O),v=[{coord:new ke(0,0),height:0},{coord:new ke(0,0),height:0}],b=(O,U)=>O<U,w=ui(),I=ui(),A=ui(),P=ui(),R=ui();for(let O=h.min;O<h.max;O++){if(!this.prepareEdgePoints(v,i,o,a[O],b))continue;const[U,V]=v,G=g(nr(R,-(V.coord.y-U.coord.y),V.coord.x-U.coord.x,0));f=this.addFeatureSection(a[O].featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(nr(w,U.coord.x,U.coord.y,U.height),nr(I,V.coord.x,V.coord.y,V.height),nr(A,V.coord.x,V.coord.y,a[O].isTunnel?-.1:0),nr(P,U.coord.x,U.coord.y,a[O].isTunnel?-.1:0),G)}for(let O=u.min;O<u.max;O++){const U=a[O];U.isTunnel&&([U.a,U.b]=[U.b,U.a]);const V=i[U.a],G=i[U.b],re=g(nr(R,-(G.y-V.y),G.x-V.x,0));f=this.addFeatureSection(U.featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(nr(w,G.x,G.y,0),nr(I,V.x,V.y,0),nr(A,V.x,V.y,o[U.a]+4),nr(P,G.x,G.y,o[U.b]+4),re),e.addQuad(nr(w,V.x,V.y,0),nr(I,G.x,G.y,0),nr(A,G.x,G.y,o[U.b]+4),nr(P,V.x,V.y,o[U.a]+4),re)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,i,o,a){e.coord.x=i,e.coord.y=o,e.height=a}prepareEdgePoints(e,i,o,a,h){let u=i[a.a].x,f=i[a.a].y,_=i[a.b].x,g=i[a.b].y,v=o[a.a],b=o[a.b];const w=h(v,0),I=h(b,0);if(w&&I)return this.setElevatedPoint(e[0],u,f,v),this.setElevatedPoint(e[1],_,g,b),!0;if(!w&&!I)return!1;if(w){if(!I){const A=b/(b-v);_=ft(_,u,A),g=ft(g,f,A),b=ft(b,v,A)}}else{const A=v/(v-b);u=ft(u,_,A),f=ft(f,g,A),v=ft(v,b,A)}return this.setElevatedPoint(e[0],u,f,v),this.setElevatedPoint(e[1],_,g,b),!0}prepareEdges(e,i){if(i.length===0)return;i.sort((f,_)=>f.hash===_.hash?_.polygonIdx-f.polygonIdx:_.hash>f.hash?1:-1);let o=0,a=0,h=0,u=i[o].polygonIdx;do a++,(a===i.length||i[o].hash!==i[a].hash)&&((a-o==1||i[a-1].polygonIdx!==u)&&(h<o&&(i[h]=i[o],i[o]=null),i[h].type="none",h++),o=a,o!==i.length&&(u=i[o].polygonIdx));while(o!==i.length);if(i.splice(h),i.length!==0&&e.length!==0){i.sort((g,v)=>g.portalHash<v.portalHash?1:-1);let f=0,_=0;for(;f!==i.length&&_!==e.length;){const g=i[f],v=e[_];g.portalHash>v.hash?f++:v.hash>g.portalHash?_++:(g.type=v.type,f++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=We&&i>=We}addFeatureSection(e,i,o,a){return e!==i&&(i=e,o.push({featureIndex:e,vertexStart:a.getVertexCount()}),a.clearVertexLookup()),i}sortSubarray(e,i,o,a){const h=e.slice(i,o);h.sort(a),e.splice(i,h.length,...h)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(Rn.computePosHash(e))<<32n|BigInt(Rn.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}var R_,D_={exports:{}},L_=(R_||(R_=1,function(r,e){(function(i){function o(H,$){return H>$?1:H<$?-1:0}var a=function(H,$){H===void 0&&(H=o),$===void 0&&($=!1),this._compare=H,this._root=null,this._size=0,this._noDuplicates=!!$},h={size:{configurable:!0}};function u(H,$,be,$e,Ke){var Ye=Ke-$e;if(Ye>0){var ot=$e+Math.floor(Ye/2),vt={key:$[ot],data:be[ot],parent:H};return vt.left=u(vt,$,be,$e,ot),vt.right=u(vt,$,be,ot+1,Ke),vt}return null}function f(H,$,be,$e,Ke){if(!(be>=$e)){for(var Ye=H[be+$e>>1],ot=be-1,vt=$e+1;;){do ot++;while(Ke(H[ot],Ye)<0);do vt--;while(Ke(H[vt],Ye)>0);if(ot>=vt)break;var Nt=H[ot];H[ot]=H[vt],H[vt]=Nt,Nt=$[ot],$[ot]=$[vt],$[vt]=Nt}f(H,$,be,vt,Ke),f(H,$,vt+1,$e,Ke)}}a.prototype.rotateLeft=function(H){var $=H.right;$&&(H.right=$.left,$.left&&($.left.parent=H),$.parent=H.parent),H.parent?H===H.parent.left?H.parent.left=$:H.parent.right=$:this._root=$,$&&($.left=H),H.parent=$},a.prototype.rotateRight=function(H){var $=H.left;$&&(H.left=$.right,$.right&&($.right.parent=H),$.parent=H.parent),H.parent?H===H.parent.left?H.parent.left=$:H.parent.right=$:this._root=$,$&&($.right=H),H.parent=$},a.prototype._splay=function(H){for(;H.parent;){var $=H.parent;$.parent?$.left===H&&$.parent.left===$?(this.rotateRight($.parent),this.rotateRight($)):$.right===H&&$.parent.right===$?(this.rotateLeft($.parent),this.rotateLeft($)):$.left===H&&$.parent.right===$?(this.rotateRight($),this.rotateLeft($)):(this.rotateLeft($),this.rotateRight($)):$.left===H?this.rotateRight($):this.rotateLeft($)}},a.prototype.splay=function(H){for(var $,be,$e,Ke,Ye;H.parent;
7)(be=($=H.parent).parent)&&be.parent?(($e=be.parent).left===be?$e.left=H:$e.right=H,H.parent=$e):(H.parent=null,this._root=H),Ke=H.left,Ye=H.right,H===$.left?(be&&(be.left===$?($.right?(be.left=$.right,be.left.parent=be):be.left=null,$.right=be,be.parent=$):(Ke?(be.right=Ke,Ke.parent=be):be.right=null,H.left=be,be.parent=H)),Ye?($.left=Ye,Ye.parent=$):$.left=null,H.right=$,$.parent=H):(be&&(be.right===$?($.left?(be.right=$.left,be.right.parent=be):be.right=null,$.left=be,be.parent=$):(Ye?(be.left=Ye,Ye.parent=be):be.left=null,H.right=be,be.parent=H)),Ke?($.right=Ke,Ke.parent=$):$.right=null,H.left=$,$.parent=H)},a.prototype.replace=function(H,$){H.parent?H===H.parent.left?H.parent.left=$:H.parent.right=$:this._root=$,$&&($.parent=H.parent)},a.prototype.minNode=function(H){if(H===void 0&&(H=this._root),H)for(;H.left;)H=H.left;return H},a.prototype.maxNode=function(H){if(H===void 0&&(H=this._root),H)for(;H.right;)H=H.right;return H},a.prototype.insert=function(H,$){var be=this._root,$e=null,Ke=this._compare;if(this._noDuplicates)for(;be;){if($e=be,Ke(be.key,H)===0)return;be=Ke(be.key,H)<0?be.right:be.left}else for(;be;)$e=be,be=Ke(be.key,H)<0?be.right:be.left;return be={key:H,data:$,left:null,right:null,parent:$e},$e?Ke($e.key,be.key)<0?$e.right=be:$e.left=be:this._root=be,this.splay(be),this._size++,be},a.prototype.find=function(H){for(var $=this._root,be=this._compare;$;){var $e=be($.key,H);if($e<0)$=$.right;else{if(!($e>0))return $;$=$.left}}return null},a.prototype.contains=function(H){for(var $=this._root,be=this._compare;$;){var $e=be(H,$.key);if($e===0)return!0;$=$e<0?$.left:$.right}return!1},a.prototype.remove=function(H){var $=this.find(H);if(!$)return!1;if(this.splay($),$.left)if($.right){var be=this.minNode($.right);be.parent!==$&&(this.replace(be,be.right),be.right=$.right,be.right.parent=be),this.replace($,be),be.left=$.left,be.left.parent=be}else this.replace($,$.left);else this.replace($,$.right);return this._size--,!0},a.prototype.removeNode=function(H){if(!H)return!1;if(this.splay(H),H.left)if(H.right){var $=this.minNode(H.right);$.parent!==H&&(this.replace($,$.right),$.right=H.right,$.right.parent=$),this.replace(H,$),$.left=H.left,$.left.parent=$}else this.replace(H,H.left);else this.replace(H,H.right);return this._size--,!0},a.prototype.erase=function(H){var $=this.find(H);if($){this.splay($);var be=$.left,$e=$.right,Ke=null;be&&(be.parent=null,Ke=this.maxNode(be),this.splay(Ke),this._root=Ke),$e&&(be?Ke.right=$e:this._root=$e,$e.parent=Ke),this._size--}},a.prototype.pop=function(){var H=this._root,$=null;if(H){for(;H.left;)H=H.left;$={key:H.key,data:H.data},this.remove(H.key)}return $},a.prototype.next=function(H){var $=H;if($)if($.right)for($=$.right;$&&$.left;)$=$.left;else for($=H.parent;$&&$.right===H;)H=$,$=$.parent;return $},a.prototype.prev=function(H){var $=H;if($)if($.left)for($=$.left;$&&$.right;)$=$.right;else for($=H.parent;$&&$.left===H;)H=$,$=$.parent;return $},a.prototype.forEach=function(H){for(var $=this._root,be=[],$e=!1,Ke=0;!$e;)$?(be.push($),$=$.left):be.length>0?(H($=be.pop(),Ke++),$=$.right):$e=!0;return this},a.prototype.range=function(H,$,be,$e){for(var Ke=[],Ye=this._compare,ot=this._root;Ke.length!==0||ot;)if(ot)Ke.push(ot),ot=ot.left;else{if(Ye((ot=Ke.pop()).key,$)>0)break;if(Ye(ot.key,H)>=0&&be.call($e,ot))return this;ot=ot.right}return this},a.prototype.keys=function(){for(var H=this._root,$=[],be=[],$e=!1;!$e;)H?($.push(H),H=H.left):$.length>0?(H=$.pop(),be.push(H.key),H=H.right):$e=!0;return be},a.prototype.values=function(){for(var H=this._root,$=[],be=[],$e=!1;!$e;)H?($.push(H),H=H.left):$.length>0?(H=$.pop(),be.push(H.data),H=H.right):$e=!0;return be},a.prototype.at=function(H){for(var $=this._root,be=[],$e=!1,Ke=0;!$e;)if($)be.push($),$=$.left;else if(be.length>0){if($=be.pop(),Ke===H)return $;Ke++,$=$.right}else $e=!0;return null},a.prototype.load=function(H,$,be){if(H===void 0&&(H=[]),$===void 0&&($=[]),be===void 0&&(be=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var $e=H.length;return be&&f(H,$,0,$e-1,this._compare),this._root=u(null,H,$,0,$e),this._size=$e,this},a.prototype.min=function(){var H=this.minNode(this._root);return H?H.key:null},a.prototype.max=function(){var H=this.maxNode(this._root);return H?H.key:null},a.prototype.isEmpty=function(){return this._root===null},h.size.get=function(){return this._size},a.createTree=function(H,$,be,$e,Ke){return new a(be,Ke).load(H,$,$e)},Object.defineProperties(a.prototype,h);var _=0,g=1,v=2,b=3,w=0,I=1,A=2,P=3;function R(H,$,be){$===null?(H.inOut=!1,H.otherInOut=!0):(H.isSubject===$.isSubject?(H.inOut=!$.inOut,H.otherInOut=$.otherInOut):(H.inOut=!$.otherInOut,H.otherInOut=$.isVertical()?!$.inOut:$.inOut),$&&(H.prevInResult=!O($,be)||$.isVertical()?$.prevInResult:$));var $e=O(H,be);H.resultTransition=$e?function(Ke,Ye){var ot,vt=!Ke.inOut,Nt=!Ke.otherInOut;switch(Ye){case w:ot=vt&&Nt;break;case I:ot=vt||Nt;break;case P:ot=vt^Nt;break;case A:ot=Ke.isSubject?vt&&!Nt:Nt&&!vt}return ot?1:-1}(H,be):0}function O(H,$){switch(H.type){case _:switch($){case w:return!H.otherInOut;case I:return H.otherInOut;case A:return H.isSubject&&H.otherInOut||!H.isSubject&&!H.otherInOut;case P:return!0}break;case v:return $===w||$===I;case b:return $===A;case g:return!1}return!1}var U=function(H,$,be,$e,Ke){this.left=$,this.point=H,this.otherEvent=be,this.isSubject=$e,this.type=Ke||_,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},V={inResult:{configurable:!0}};function G(H,$){return H[0]===$[0]&&H[1]===$[1]}U.prototype.isBelow=function(H){var $=this.point,be=this.otherEvent.point;
7return this.left?($[0]-H[0])*(be[1]-H[1])-(be[0]-H[0])*($[1]-H[1])>0:(be[0]-H[0])*($[1]-H[1])-($[0]-H[0])*(be[1]-H[1])>0},U.prototype.isAbove=function(H){return!this.isBelow(H)},U.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},V.inResult.get=function(){return this.resultTransition!==0},U.prototype.clone=function(){var H=new U(this.point,this.left,this.otherEvent,this.isSubject,this.type);return H.contourId=this.contourId,H.resultTransition=this.resultTransition,H.prevInResult=this.prevInResult,H.isExteriorRing=this.isExteriorRing,H.inOut=this.inOut,H.otherInOut=this.otherInOut,H},Object.defineProperties(U.prototype,V);var re=11102230246251565e-32,Q=134217729,te=(3+8*re)*re;function ae(H,$,be,$e,Ke){var Ye,ot,vt,Nt,Vt=$[0],zt=$e[0],mi=0,Hi=0;zt>Vt==zt>-Vt?(Ye=Vt,Vt=$[++mi]):(Ye=zt,zt=$e[++Hi]);var Ct=0;if(mi<H&&Hi<be)for(zt>Vt==zt>-Vt?(vt=Ye-((ot=Vt+Ye)-Vt),Vt=$[++mi]):(vt=Ye-((ot=zt+Ye)-zt),zt=$e[++Hi]),Ye=ot,vt!==0&&(Ke[Ct++]=vt);mi<H&&Hi<be;)zt>Vt==zt>-Vt?(vt=Ye-((ot=Ye+Vt)-(Nt=ot-Ye))+(Vt-Nt),Vt=$[++mi]):(vt=Ye-((ot=Ye+zt)-(Nt=ot-Ye))+(zt-Nt),zt=$e[++Hi]),Ye=ot,vt!==0&&(Ke[Ct++]=vt);for(;mi<H;)vt=Ye-((ot=Ye+Vt)-(Nt=ot-Ye))+(Vt-Nt),Vt=$[++mi],Ye=ot,vt!==0&&(Ke[Ct++]=vt);for(;Hi<be;)vt=Ye-((ot=Ye+zt)-(Nt=ot-Ye))+(zt-Nt),zt=$e[++Hi],Ye=ot,vt!==0&&(Ke[Ct++]=vt);return Ye===0&&Ct!==0||(Ke[Ct++]=Ye),Ct}function ce(H){return new Float64Array(H)}var Ee=33306690738754716e-32,de=22204460492503146e-32,Ae=11093356479670487e-47,je=ce(4),Ce=ce(8),Fe=ce(12),Ve=ce(16),Te=ce(4);function Oe(H,$,be){var $e=function(Ke,Ye,ot,vt,Nt,Vt){var zt=(Ye-Vt)*(ot-Nt),mi=(Ke-Nt)*(vt-Vt),Hi=zt-mi;if(zt===0||mi===0||zt>0!=mi>0)return Hi;var Ct=Math.abs(zt+mi);return Math.abs(Hi)>=Ee*Ct?Hi:-function(Pi,Ti,hi,Ui,Ai,Si,Ei){var pi,Rt,_i,ji,yt,Zt,Mi,Wi,zi,_r,xi,ur,mn,Dr,Mr,_n,as,gr,vr=Pi-Ai,Lr=hi-Ai,Kr=Ti-Si,jr=Ui-Si;je[0]=(Mr=(Wi=vr-(Mi=(Zt=Q*vr)-(Zt-vr)))*(_r=jr-(zi=(Zt=Q*jr)-(Zt-jr)))-((Dr=vr*jr)-Mi*zi-Wi*zi-Mi*_r))-((xi=Mr-(as=(Wi=Kr-(Mi=(Zt=Q*Kr)-(Zt-Kr)))*(_r=Lr-(zi=(Zt=Q*Lr)-(Zt-Lr)))-((_n=Kr*Lr)-Mi*zi-Wi*zi-Mi*_r)))+(yt=Mr-xi))+(yt-as),je[1]=(mn=Dr-((ur=Dr+xi)-(yt=ur-Dr))+(xi-yt))-((xi=mn-_n)+(yt=mn-xi))+(yt-_n),je[2]=ur-((gr=ur+xi)-(yt=gr-ur))+(xi-yt),je[3]=gr;var Ra=function(Cb,$0){for(var Z0=$0[0],n_=1;n_<4;n_++)Z0+=$0[n_];return Z0}(0,je),ad=de*Ei;if(Ra>=ad||-Ra>=ad||(pi=Pi-(vr+(yt=Pi-vr))+(yt-Ai),_i=hi-(Lr+(yt=hi-Lr))+(yt-Ai),Rt=Ti-(Kr+(yt=Ti-Kr))+(yt-Si),ji=Ui-(jr+(yt=Ui-jr))+(yt-Si),pi===0&&Rt===0&&_i===0&&ji===0)||(ad=Ae*Ei+te*Math.abs(Ra),(Ra+=vr*ji+jr*pi-(Kr*_i+Lr*Rt))>=ad||-Ra>
7=ad))return Ra;Te[0]=(Mr=(Wi=pi-(Mi=(Zt=Q*pi)-(Zt-pi)))*(_r=jr-(zi=(Zt=Q*jr)-(Zt-jr)))-((Dr=pi*jr)-Mi*zi-Wi*zi-Mi*_r))-((xi=Mr-(as=(Wi=Rt-(Mi=(Zt=Q*Rt)-(Zt-Rt)))*(_r=Lr-(zi=(Zt=Q*Lr)-(Zt-Lr)))-((_n=Rt*Lr)-Mi*zi-Wi*zi-Mi*_r)))+(yt=Mr-xi))+(yt-as),Te[1]=(mn=Dr-((ur=Dr+xi)-(yt=ur-Dr))+(xi-yt))-((xi=mn-_n)+(yt=mn-xi))+(yt-_n),Te[2]=ur-((gr=ur+xi)-(yt=gr-ur))+(xi-yt),Te[3]=gr;var wb=ae(4,je,4,Te,Ce);Te[0]=(Mr=(Wi=vr-(Mi=(Zt=Q*vr)-(Zt-vr)))*(_r=ji-(zi=(Zt=Q*ji)-(Zt-ji)))-((Dr=vr*ji)-Mi*zi-Wi*zi-Mi*_r))-((xi=Mr-(as=(Wi=Kr-(Mi=(Zt=Q*Kr)-(Zt-Kr)))*(_r=_i-(zi=(Zt=Q*_i)-(Zt-_i)))-((_n=Kr*_i)-Mi*zi-Wi*zi-Mi*_r)))+(yt=Mr-xi))+(yt-as),Te[1]=(mn=Dr-((ur=Dr+xi)-(yt=ur-Dr))+(xi-yt))-((xi=mn-_n)+(yt=mn-xi))+(yt-_n),Te[2]=ur-((gr=ur+xi)-(yt=gr-ur))+(xi-yt),Te[3]=gr;var Tb=ae(wb,Ce,4,Te,Fe);Te[0]=(Mr=(Wi=pi-(Mi=(Zt=Q*pi)-(Zt-pi)))*(_r=ji-(zi=(Zt=Q*ji)-(Zt-ji)))-((Dr=pi*ji)-Mi*zi-Wi*zi-Mi*_r))-((xi=Mr-(as=(Wi=Rt-(Mi=(Zt=Q*Rt)-(Zt-Rt)))*(_r=_i-(zi=(Zt=Q*_i)-(Zt-_i)))-((_n=Rt*_i)-Mi*zi-Wi*zi-Mi*_r)))+(yt=Mr-xi))+(yt-as),Te[1]=(mn=Dr-((ur=Dr+xi)-(yt=ur-Dr))+(xi-yt))-((xi=mn-_n)+(yt=mn-xi))+(yt-_n),Te[2]=ur-((gr=ur+xi)-(yt=gr-ur))+(xi-yt),Te[3]=gr;var Sb=ae(Tb,Fe,4,Te,Ve);return Ve[Sb-1]}(Ke,Ye,ot,vt,Nt,Vt,Ct)}(H[0],H[1],$[0],$[1],be[0],be[1]);return $e>0?-1:$e<0?1:0}function pe(H,$){var be=H.point,$e=$.point;return be[0]>$e[0]?1:be[0]<$e[0]?-1:be[1]!==$e[1]?be[1]>$e[1]?1:-1:function(Ke,Ye,ot,vt){return Ke.left!==Ye.left?Ke.left?1:-1:Oe(ot,Ke.otherEvent.point,Ye.otherEvent.point)!==0?Ke.isBelow(Ye.otherEvent.point)?-1:1:!Ke.isSubject&&Ye.isSubject?1:-1}(H,$,be)}function Se(H,$,be){var $e=new U($,!1,H,H.isSubject),Ke=new U($,!0,H.otherEvent,H.isSubject);return G(H.point,H.otherEvent.point)&&console.warn("what is that, a collapsed segment?",H),$e.contourId=Ke.contourId=H.contourId,pe(Ke,H.otherEvent)>0&&(H.otherEvent.left=!0,Ke.left=!1),H.otherEvent.otherEvent=Ke,H.otherEvent=$e,be.push(Ke),be.push($e),be}function He(H,$){return H[0]*$[1]-H[1]*$[0]}function Be(H,$){return H[0]*$[0]+H[1]*$[1]}function ct(H,$,be){var $e=function(Nt,Vt,zt,mi,Hi){var Ct=[Vt[0]-Nt[0],Vt[1]-Nt[1]],Pi=[mi[0]-zt[0],mi[1]-zt[1]];function Ti(Zt,Mi,Wi){return[Zt[0]+Mi*Wi[0],Zt[1]+Mi*Wi[1]]}var hi=[zt[0]-Nt[0],zt[1]-Nt[1]],Ui=He(Ct,Pi),Ai=Ui*Ui,Si=Be(Ct,Ct);if(Ai>0){var Ei=He(hi,Pi)/Ui;if(Ei<0||Ei>1)return null;var pi=He(hi,Ct)/Ui;return pi<0||pi>1?null:Ei===0||Ei===1?[Ti(Nt,Ei,Ct)]:pi===0||pi===1?[Ti(zt,pi,Pi)]:[Ti(Nt,Ei,Ct)]}if((Ai=(Ui=He(hi,Ct))*Ui)>0)return null;var Rt=Be(Ct,hi)/Si,_i=Rt+Be(Ct,Pi)/Si,ji=Math.min(Rt,_i),yt=Math.max(Rt,_i);return ji<=1&&yt>=0?ji===1?[Ti(Nt,ji>0?ji:0,Ct)]:yt===0?[Ti(Nt,yt<1?yt:1,Ct)]:[Ti(Nt,ji>0?ji:0,Ct),Ti(Nt,yt<1?yt:1,Ct)]:null}(H.point,H.otherEvent.point,$.point,$.otherEvent.point),Ke=$e?$e.length:0;if(Ke===0||Ke===1&&(G(H.point,$.point)||G(H.otherEvent.point,$.otherEvent.point))||Ke===2&&H.isSubject===$.isSubject)return 0;if(Ke===1)return G(H.point,$e[0])||G(H.otherEvent.point,$e[0])||Se(H,$e[0],be),G($.point,$e[0])||G($.otherEvent.point,$e[0])||Se($,$e[0],be),1;var Ye=[],ot=!1,vt=!1;return G(H.point,$.point)?ot=!0:pe(H,$)===1?Ye.push($,H):Ye.push(H,$),G(H.otherEvent.point,$.otherEvent.point)?vt=!0:pe(H.otherEvent,$.otherEvent)===1?Ye.push($.otherEvent,H.otherEvent):Ye.push(H.otherEvent,$.otherEvent),ot&&vt||ot?($.type=g,H.type=$.inOut===H.inOut?v:b,ot&&!vt&&Se(Ye[1].otherEvent,Ye[0].point,be),2):vt?(Se(Ye[0],Ye[1].point,be),3):Ye[0]!==Ye[3].otherEvent?(Se(Ye[0],Ye[1].point,be),Se(Ye[1],Ye[2].point,be),3):(Se(Ye[0],Ye[1].point,be),Se(Ye[3].otherEvent,Ye[2].point,be),3)}function nt(H,$){if(H===$)return 0;if(Oe(H.point,H.otherEvent.point,$.point)!==0||Oe(H.point,H.otherEvent.point,$.otherEvent.point)!==0)return G(H.point,$.point)?H.isBelow($.otherEvent.point)?-1:1:H.point[0]===$.point[0]?H.point[1]<$.point[1]?-1:1:pe(H,$)===1?$.isAbove(H.point)?-1:1:H.isBelow($.point)?-1:1;if(H.isSubject!==$.isSubject)return H.isSubject?-1:1;var be=H.point,$e=$.point;return be[0]===$e[0]&&be[1]===$e[1]?(be=H.otherEvent.point)[0]===($e=$.otherEvent.point)[0]&&be[1]===$e[1]?0:H.contourId>$.contourId?1:-1:pe(H,$)===1?1:-1}var De=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function Ne(H,$,be,$e){var Ke,Ye=H+1,ot=$[H].point,vt=$.length;for(Ye<vt&&(Ke=$[Ye].point);Ye<vt&&Ke[0]===ot[0]&&Ke[1]===ot[1];){if(!be[Ye])return Ye;++Ye<vt&&(Ke=$[Ye].point)}for(Ye=H-1;be[Ye]&&Ye>$e;)Ye--;return Ye}De.prototype.isExterior=function(){return this.holeOf==null};var st=Xe,et=Xe;function Xe(H,$){if(!(this instanceof Xe))return new Xe(H,$);
7if(this.data=H||[],this.length=this.data.length,this.compare=$||tt,this.length>0)for(var be=(this.length>>1)-1;be>=0;be--)this._down(be)}function tt(H,$){return H<$?-1:H>$?1:0}Xe.prototype={push:function(H){this.data.push(H),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var H=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),H}},peek:function(){return this.data[0]},_up:function(H){for(var $=this.data,be=this.compare,$e=$[H];H>0;){var Ke=H-1>>1,Ye=$[Ke];if(be($e,Ye)>=0)break;$[H]=Ye,H=Ke}$[H]=$e},_down:function(H){for(var $=this.data,be=this.compare,$e=this.length>>1,Ke=$[H];H<$e;){var Ye=1+(H<<1),ot=Ye+1,vt=$[Ye];if(ot<this.length&&be($[ot],vt)<0&&(Ye=ot,vt=$[ot]),be(vt,Ke)>=0)break;$[H]=vt,H=Ye}$[H]=Ke}},st.default=et;var _t=Math.max,Tt=Math.min,Mt=0;function It(H,$,be,$e,Ke,Ye){var ot,vt,Nt,Vt,zt,mi;for(ot=0,vt=H.length-1;ot<vt;ot++)if(Vt=H[ot+1],zt=new U(Nt=H[ot],!1,void 0,$),mi=new U(Vt,!1,zt,$),zt.otherEvent=mi,Nt[0]!==Vt[0]||Nt[1]!==Vt[1]){zt.contourId=mi.contourId=be,Ye||(zt.isExteriorRing=!1,mi.isExteriorRing=!1),pe(zt,mi)>0?mi.left=!0:zt.left=!0;var Hi=Nt[0],Ct=Nt[1];Ke[0]=Tt(Ke[0],Hi),Ke[1]=Tt(Ke[1],Ct),Ke[2]=_t(Ke[2],Hi),Ke[3]=_t(Ke[3],Ct),$e.push(zt),$e.push(mi)}}var qt=[];function Lt(H,$,be){typeof H[0][0][0]=="number"&&(H=[H]),typeof $[0][0][0]=="number"&&($=[$]);var $e=function(Ct,Pi,Ti){var hi=null;return Ct.length*Pi.length==0&&(Ti===w?hi=qt:Ti===A?hi=Ct:Ti!==I&&Ti!==P||(hi=Ct.length===0?Pi:Ct)),hi}(H,$,be);if($e)return $e===qt?null:$e;var Ke=[1/0,1/0,-1/0,-1/0],Ye=[1/0,1/0,-1/0,-1/0],ot=function(Ct,Pi,Ti,hi,Ui){var Ai,Si,Ei,pi,Rt,_i,ji=new st(null,pe);for(Ei=0,pi=Ct.length;Ei<pi;Ei++)for(Rt=0,_i=(Ai=Ct[Ei]).length;Rt<_i;
7Rt++)(Si=Rt===0)&&Mt++,It(Ai[Rt],!0,Mt,ji,Ti,Si);for(Ei=0,pi=Pi.length;Ei<pi;Ei++)for(Rt=0,_i=(Ai=Pi[Ei]).length;Rt<_i;Rt++)Si=Rt===0,Ui===A&&(Si=!1),Si&&Mt++,It(Ai[Rt],!1,Mt,ji,hi,Si);return ji}(H,$,Ke,Ye,be);if($e=function(Ct,Pi,Ti,hi,Ui){var Ai=null;return(Ti[0]>hi[2]||hi[0]>Ti[2]||Ti[1]>hi[3]||hi[1]>Ti[3])&&(Ui===w?Ai=qt:Ui===A?Ai=Ct:Ui!==I&&Ui!==P||(Ai=Ct.concat(Pi))),Ai}(H,$,Ke,Ye,be))return $e===qt?null:$e;for(var vt=function(Ct){var Pi,Ti,hi=function(Ei){var pi,Rt,_i,ji,yt=[];for(Rt=0,_i=Ei.length;Rt<_i;Rt++)((pi=Ei[Rt]).left&&pi.inResult||!pi.left&&pi.otherEvent.inResult)&&yt.push(pi);for(var Zt=!1;!Zt;)for(Zt=!0,Rt=0,_i=yt.length;Rt<_i;Rt++)Rt+1<_i&&pe(yt[Rt],yt[Rt+1])===1&&(ji=yt[Rt],yt[Rt]=yt[Rt+1],yt[Rt+1]=ji,Zt=!1);for(Rt=0,_i=yt.length;Rt<_i;Rt++)(pi=yt[Rt]).otherPos=Rt;for(Rt=0,_i=yt.length;Rt<_i;Rt++)(pi=yt[Rt]).left||(ji=pi.otherPos,pi.otherPos=pi.otherEvent.otherPos,pi.otherEvent.otherPos=ji);return yt}(Ct),Ui={},Ai=[],Si=function(){if(!Ui[Pi]){var Ei=Ai.length,pi=function(yt,Zt,Mi){var Wi=new De;if(yt.prevInResult!=null){var zi=yt.prevInResult,_r=zi.outputContourId;if(zi.resultTransition>0){var xi=Zt[_r];if(xi.holeOf!=null){var ur=xi.holeOf;Zt[ur].holeIds.push(Mi),Wi.holeOf=ur,Wi.depth=Zt[_r].depth}else Zt[_r].holeIds.push(Mi),Wi.holeOf=_r,Wi.depth=Zt[_r].depth+1}else Wi.holeOf=null,Wi.depth=Zt[_r].depth}else Wi.holeOf=null,Wi.depth=0;return Wi}(hi[Pi],Ai,Ei),Rt=function(yt){Ui[yt]=!0,yt<hi.length&&hi[yt]&&(hi[yt].outputContourId=Ei)},_i=Pi,ji=Pi;for(pi.points.push(hi[Pi].point);Rt(_i),Rt(_i=hi[_i].otherPos),pi.points.push(hi[_i].point),!((_i=Ne(_i,hi,Ui,ji))==ji||_i>=hi.length)&&hi[_i];);Ai.push(pi)}};for(Pi=0,Ti=hi.length;Pi<Ti;Pi++)Si();return Ai}(function(Ct,Pi,Ti,hi,Ui,Ai){for(var Si,Ei,pi,Rt=new a(nt),_i=[],ji=Math.min(hi[2],Ui[2]);Ct.length!==0;){var yt=Ct.pop();if(_i.push(yt),Ai===w&&yt.point[0]>ji||Ai===A&&yt.point[0]>hi[2])break;if(yt.left){Ei=Si=Rt.insert(yt),Si=Si!==(pi=Rt.minNode())?Rt.prev(Si):null,Ei=Rt.next(Ei);var Zt=Si?Si.key:null;if(R(yt,Zt,Ai),Ei&&ct(yt,Ei.key,Ct)===2&&(R(yt,Zt,Ai),R(Ei.key,yt,Ai)),Si&&ct(Si.key,yt,Ct)===2){var Mi=Si;R(Zt,(Mi=Mi!==pi?Rt.prev(Mi):null)?Mi.key:null,Ai),R(yt,Zt,Ai)}}else Ei=Si=Rt.find(yt=yt.otherEvent),Si&&Ei&&(Si=Si!==pi?Rt.prev(Si):null,Ei=Rt.next(Ei),Rt.remove(yt),Ei&&Si&&ct(Si.key,Ei.key,Ct))}return _i}(ot,0,0,Ke,Ye,be)),Nt=[],Vt=0;Vt<vt.length;Vt++){var zt=vt[Vt];if(zt.isExterior()){for(var mi=[zt.points],Hi=0;Hi<zt.holeIds.length;Hi++)mi.push(vt[zt.holeIds[Hi]].points);Nt.push(mi)}}return Nt}var Ii={UNION:I,DIFFERENCE:A,INTERSECTION:w,XOR:P};i.diff=function(H,$){return Lt(H,$,A)},i.intersection=function(H,$){return Lt(H,$,w)},i.operations=Ii,i.union=function(H,$){return Lt(H,$,I)},i.xor=function(H,$){return Lt(H,$,P)},Object.defineProperty(i,"__esModule",{value:!0})})(e)}(0,D_.exports)),D_.exports);/**
8 * martinez v0.7.4
9 * Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor
10 *
11 * @author Alex Milevski <[email protected]>
12 * @license MIT
13 * @preserve
14 */function vp(r,e,i,o){const a=[],h=o===0?(u,f,_,g,v,b)=>{u.push(new ke(b,_+(b-f)/(g-f)*(v-_)))}:(u,f,_,g,v,b)=>{u.push(new ke(f+(b-_)/(v-_)*(g-f),b))};for(const u of r){const f=[];for(const _ of u){if(_.length<=2)continue;const g=[];for(let w=0;w<_.length-1;w++){const I=_[w].x,A=_[w].y,P=_[w+1].x,R=_[w+1].y,O=o===0?I:A,U=o===0?P:R;O<e?U>e&&h(g,I,A,P,R,e):O>i?U<i&&h(g,I,A,P,R,i):g.push(_[w]),U<e&&O>=e&&h(g,I,A,P,R,e),U>i&&O<=i&&h(g,I,A,P,R,i)}let v=_[_.length-1];const b=o===0?v.x:v.y;b>=e&&b<=i&&g.push(v),g.length&&(v=g[g.length-1],g[0].x===v.x&&g[0].y===v.y||g.push(g[0]),f.push(g))}f.length&&a.push(f)}return a}function Tx(r,e){const i=em(r),o=em([e]),a=L_.intersection(i,o);return a==null?[]:F_(a)}function Sx(r,e){let o=em(r,65536);for(;e.valid();e.next()){const[a,h]=e.get(),u=a.x*65536,f=a.y*65536,_=h.x*65536,g=h.y*65536,v=_-u,b=g-f,w=Math.hypot(v,b),I=Math.trunc(b/w*3),A=-Math.trunc(v/w*3);o=L_.diff(o,[[[u,f],[_,g],[_+I,g+A],[u+I,f+A],[u,f]]])}return F_(o,1/65536)}function em(r,e=1){return[r.map(i=>i.map(o=>[o.x*e,o.y*e]))]}function F_(r,e=1){return r.map(i=>i.map((o,a)=>{const h=o.map(u=>
14new ke(u[0]*e,u[1]*e).round());return a>0&&h.reverse(),h}))}class tm{constructor(e,i){this.layoutVertexArray=new ln,this.indexArray=new Li,this.lineIndexArray=new io,this.triangleSegments=new Ni,this.lineSegments=new Ni,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new Ms)}update(e,i,o,a,h,u,f,_){this.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f,_)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,lx.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,cx.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,o,a,h,u,f){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,a,h,u,void 0,f)}}class im{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new tm(e,!1),this.elevationBufferData=new tm(e,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,o,a){this.hasPattern=Jf("fill",this.layers,this.pixelRatio,i);const h=this.layers[0].layout.get("fill-sort-key"),u=[];for(const{feature:f,id:_,index:g,sourceLayerIndex:v}of e){const b=this.layers[0]._featureFilter.needGeometry,w=we(f,b);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom,{worldview:this.worldview}),w,o))continue;const I=h?h.evaluate(w,{},o,i.availableImages):void 0,A={id:_,properties:f.properties,type:f.type,sourceLayerIndex:v,index:g,geometry:b?w.geometry:oe(f,o,a),patterns:{},sortKey:I};u.push(A)}h&&u.sort((f,_)=>f.sortKey-_.sortKey);for(const f of u){const{geometry:_,index:g,sourceLayerIndex:v}=f;if(this.hasPattern){const b=Qf("fill",this.layers,f,this.zoom,this.pixelRatio,i);this.patternFeatures.push(b)}else this.addFeature(f,_,g,o,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[g].feature,_,g,v,this.index)}}update(e,i,o,a,h,u,f){this.bufferData.update(e,i,o,a,h,u,f,this.worldview),this.elevationBufferData.update(e,i,o,a,h,u,f,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,i,o,a,h,u,f,this.worldview)}addFeatures(e,i,o,a,h,u){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,o,a,u,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(e,i,o,a,h,u=[],f,_){const g=Pu(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,g,a,o,_):this.addGeometry(g,this.bufferData),this.bufferData.populatePaintArrays(e,o,h,u,a,f,this.worldview),this.elevationBufferData.populatePaintArrays(e,o,h,u,a,f,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e,i,o,a,h){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,o,a,h,this.worldview))}addElevatedRoadFeature(e,i,o,a,h){const u=new Array,f=Vi.getElevationFeature(e,h);if(!f)return void this.addGeometry(i,this.bufferData);{const g=this.clipPolygonsToTile(i,1);g.length>0&&u.push({polygons:g,elevationFeature:f,elevationTileID:o})}const _={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},o),featureIndex:a};for(const g of u)if(g.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Rn(g.elevationTileID,this.layers,this.zoom,this.lut));const b=g.elevationFeature.isTunnel();let w=0;e.properties.hasOwnProperty(ht)&&(w=+e.properties[ht]);for(const I of g.polygons)this.elevatedStructures.addPortalCandidates(g.elevationFeature.i
vendor: 43,475 bytes, line 14
14d,I,b,g.elevationFeature,w)}g.elevationFeature.constantHeight==null&&(g.polygons=this.prepareElevatedPolygons(g.polygons,g.elevationFeature,g.elevationTileID));const v=new Wt(o,g.elevationTileID);this.addElevatedGeometry(g.polygons,v,g.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,a,_)}}addElevatedGeometry(e,i,o,a,h,u){const f={elevation:o,elevationSampler:i,bias:a,index:h,featureInfo:u},[_,g]=this.addGeometry(e,this.elevationBufferData,f);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:_,max:g}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,_),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,g))}addGeometry(e,i,o){let a=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,u=null;o&&(u=o.elevationSampler.constantElevation(o.elevation,o.bias),u!=null&&(a=u,h=u));const f=(_,g,v)=>{if(o!=null)if(g.push(_),u!=null)i.elevatedLayoutVertexArray.emplaceBack(u),v.push(u);else{const b=o.elevationSampler.pointElevation(_,o.elevation,o.bias);i.elevatedLayoutVertexArray.emplaceBack(b),v.push(b),a=Math.min(a,b),h=Math.max(h,b)}};for(const _ of e){let g=0;for(const V of _)g+=V.length;const v=i.triangleSegments.prepareSegment(g,i.layoutVertexArray,i.indexArray),b=v.vertexLength,w=[],I=[],A=[],P=[],R=[],O=i.layoutVertexArray.length;for(const V of _){if(V.length===0)continue;V!==_[0]&&I.push(w.length/2);const G=i.lineSegments.prepareSegment(V.length,i.layoutVertexArray,i.lineIndexArray),re=G.vertexLength;o&&R.push(i.layoutVertexArray.length-O),f(V[0],A,P),i.layoutVertexArray.emplaceBack(V[0].x,V[0].y),i.lineIndexArray.emplaceBack(re+V.length-1,re),w.push(V[0].x),w.push(V[0].y);for(let Q=1;Q<V.length;Q++)f(V[Q],A,P),i.layoutVertexArray.emplaceBack(V[Q].x,V[Q].y),i.lineIndexArray.emplaceBack(re+Q-1,re+Q),w.push(V[Q].x),w.push(V[Q].y);G.vertexLength+=V.length,G.primitiveLength+=V.length}const U=Gc(w,I);for(let V=0;V<U.length;V+=3)i.indexArray.emplaceBack(b+U[V],b+U[V+1],b+U[V+2]);if(U.length>0&&o&&this.elevationMode==="hd-road-base"){const V=o.elevation.isTunnel(),G=o.elevation.safeArea,re=this.elevatedStructures.addVertices(A,P);this.elevatedStructures.addTriangles(U,re,V);const Q=R.length;if(Q>0){for(let te=0;te<Q-1;te++)this.elevatedStructures.addRenderableRing(o.index,R[te]+re,R[te+1]-R[te],V,G,o.featureInfo);this.elevatedStructures.addRenderableRing(o.index,R[Q-1]+re,A.length-R[Q-1],V,G,o.featureInfo)}}v.vertexLength+=g,v.primitiveLength+=U.length/3}return[a,h]}prepareElevatedPolygons(e,i,o){const a=1/K(o),h=[];for(const u of e){const f=Sx(u,new di(i,a));h.push(...f)}return h}clipPolygonsToTile(e,i){const o=-i,a=-i,h=We+i,u=We+i;let f=0;const _=[],g=[];for(;f<e.length;f++){const w=e[f],I=yh(w);(I.min.x>=o&&I.max.x<=h&&I.min.y>=a&&I.max.y<=u?_:g).push(w)}if(_.length===e.length)return e;const v=[new ke(o,a),new ke(h,a),new ke(h,u),new ke(o,u),new ke(o,a)],b=_;for(const w of g)b.push(...Tx(w,v));return b}}let O_,k_,B_,N_;rt(im,"FillBucket",{omit:["layers","patternFeatures"]}),rt(tm,"FillBufferData"),rt(Rn,"ElevatedStructures");class bp{constructor(e,i,o,a){if(this.triangleCount=i.length/3,this.min=new ke(0,0),this.max=new ke(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[h,u]=[e[0].clone(),e[0].clone()];for(let b=1;b<e.length;++b){const w=e[b];h.x=Math.min(h.x,w.x),h.y=Math.min(h.y,w.y),u.x=Math.max(u.x,w.x),u.y=Math.max(u.y,w.y)}if(a){const b=Math.ceil(Math.max(u.x-h.x,u.y-h.y)/a);o=Math.max(o,b)}if(o===0)return;this.min=h,this.max=u;const f=this.max.sub(this.min);f.x=Math.max(f.x,1),f.y=Math.max(f.y,1);const _=Math.max(f.x,f.y)/o;this.cellsX=Math.max(1,Math.ceil(f.x/_)),this.cellsY=Math.max(1,Math.ceil(f.y/_)),this.xScale=1/_,this.yScale=1/_;const g=[];for(let b=0;b<this.triangleCount;b++){const w=e[i[3*b+0]].sub(this.min),I=e[i[3*b+1]].sub(this.min),A=e[i[3*b+2]].sub(this.min),P=os(Math.floor(Math.min(w.x,I.x,A.x)),this.xScale,this.cellsX),R=os(Math.floor(Math.max(w.x,I.x,A.x)),this.xScale,this.cellsX),O=os(Math.floor(Math.min(w.y,I.y,A.y)),this.yScale,this.cellsY),U=os(Math.floor(Math.max(w.y,I.y,A.y)),this.yScale,this.cellsY),V=new ke(0,0),G=new ke(0,0),re=new ke(0,0),Q=new ke(0,0);for(let te=O;te<=U;++te){V.y=G.y=te*_,re.y=Q.y=(te+1)*_;for(let ae=P;ae<=R;++ae)V.x=re.x=ae*_,G.x=Q.x=(ae+1)*_,(fr(w,I,A,V,G,Q)||fr(w,I,A,V,Q,re))&&g.push({cellIdx:te*this.cellsX+ae,triIdx:b})}}if(g.length===0)return;g.sort((b,w)=>b.cellIdx-w.cellIdx||b.triIdx-w.triIdx);let v=0;for(;v<g.length;){const b=g[v].cellIdx,w={start:this.payload.length,len:0};for(;v<g.length&&g[v].cellIdx===b;)++w.len,this.payload.push(g[v++].triIdx);this.cells[b]=w}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){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 o=os(e.x-this.min.x,this.xScale,this.cellsX),a=os(e.y-this.min.y,this.yScale,this.cellsY),h=this.cells[a*this.cellsX+o];if(h){this._lazyInitLookup();for(let u=0;u<h.len;u++){const f=this.payload[h.start+u],_=Math.floor(f/8),g=1<<f%8;if(!(this.lookup[_]&g)&&(this.lookup[_]|=g,i.push(f),i.length===this.triangleCount))return}}}query(e,i,o){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const a=os(e.x-this.min.x,this.xScale,this.cellsX),h=os(i.x-this.min.x,this.xScale,this.cellsX),u=os(e.y-this.min.y,this.yScale,this.cellsY),f=os(i.y-this.min.y,this.yScale,this.cellsY);for(let _=u;_<=f;_++)for(let g=a;g<=h;g++){const v=this.cells[_*this.cellsX+g];if(v)for(let b=0;b<v.len;b++){const w=this.payload[v.start+b],I=Math.floor(w/8),A=1<<w%8;if(!(this.lookup[I]&A)&&(this.lookup[I]|=A,o.push(w),o.length===this.triangleCount))return}}}}function os(r,e,i){return Math.max(0,Math.min(i-1,Math.floor(r*e)))}rt(bp,"TriangleGridIndex");class V_{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=e.worldview}updateFootprints(e,i){for(const o of this.footprints)i.push({footprint:o,id:e})}populate(e,i,o,a){const h=[];for(const{feature:u,id:f,index:_,sourceLayerIndex:g}of e){const v=this.layers[0]._featureFilter.needGeometry,b=we(u,v);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom,{worldview:this.worldview}),b,o))continue;const w={id:f,properties:u.properties,type:u.type,sourceLayerIndex:g,index:_,geometry:v?b.geometry:oe(u,o,a),patterns:{}};h.push(w)}for(const u of h){const{geometry:f,index:_,sourceLayerIndex:g}=u;this.addFeature(u,f,_,o,{},i.availableImages,i.brightness),i.featureIndex.insert(e[_].feature,f,_,g,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,o,a,h,u,f){}destroy(){}addFeature(e,i,o,a,h,u=[],f){for(const _ of Pu(i,2)){const g=[],v=[],b=[],w=new ke(1/0,1/0),I=new ke(-1/0,-1/0);for(const R of _)if(R.length!==0){R!==_[0]&&b.push(v.length/2);for(let O=0;O<R.length;O++)v.push(R[O].x),v.push(R[O].y),g.push(R[O]),w.x=Math.min(w.x,R[O].x),w.y=Math.min(w.y,R[O].y),I.x=Math.max(I.x,R[O].x),I.y=Math.max(I.y,R[O].y)}const A=Gc(v,b),P=new bp(g,A,8,256);this.footprints.push({vertices:g,indices:A,grid:P,min:w,max:I})}}}rt(V_,"ClipBucket",{omit:["layers"]});const Ex=$t([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Ix=$t([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),Ax=$t([{name:"a_centroid_pos",components:2,type:"Uint16"}]),Mx=$t([{name:"a_join_normal_inside",components:3,type:"Int16"}]),Cx=$t([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),Px=$t([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:zx}=Ex,zu=Number.MAX_SAFE_INTEGER,U_=zu-1;function j_(r,e,i,o){return r.order<e||r.order===zu||!(r.clipMask&i)||function(a,h){return h.length!==0&&h.find(u=>u===a)===void 0}(o,r.clipScope)}function wp(r,e){return r.x-e.x||r.y-e.y}function G_(r,e){return wp(r.min,e.min)===0&&wp(r.max,e.max)===0}function rm(r,e){return!(r.min.x>e.max.x||r.max.x<e.min.x||r.min.y>e.max.y||r.max.y<e.min.y)}function Tp(r,e){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(r[i].sourceId!==e[i].sourceId||!G_(r[i],e[i])||r[i].order!==e[i].order||r[i].clipMask!==e[i].clipMask||!mo(r[i].clipScope,e[i].clipScope))return!1;return!0}function q_(r,e,i){const o=1/We,a=1/(1<<i.canonical.z),h=(e.x*o+i.canonical.x)*a+i.wrap,u=(e.y*o+i.canonical.y)*a;return{min:new ke((r.x*o+i.canonical.x)*a+i.wrap,(r.y*o+i.canonical.y)*a),max:new ke(h,u)}}function Rx(r,e,i){const o=1<<i.canonical.z,a=((e.x-i.wrap)*o-i.canonical.x)*We,h=(e.y*o-i.canonical.y)*We;return{min:new ke(((r.x-i.wrap)*o-i.canonical.x)*We,(r.y*o-i.canonical.y)*We),max:new ke(a,h)}}function nm(r,e,i,o,a,h,u){const f=r.indices,_=r.vertices,g=[];for(let v=o;v<o+a;v+=3){const b=e[i[v+0]+h],w=e[i[v+1]+h],I=e[i[v+2]+h],A=Math.min(b.x,w.x,I.x),P=Math.max(b.x,w.x,I.x),R=Math.min(b.y,w.y,I.y),O=Math.max(b.y,w.y,I.y);g.length=0,r.grid.query(new ke(A,R),new ke(P,O),g);for(let U=0;U<g.length;U++){const V=g[U];if(fr(_[f[3*V+0]],_[f[3*V+1]],_[f[3*V+2]],b,w,I,u))return!0}}return!1}function H_(r,e,i,o){if(!r||!i)return!1;let a=r.vertices;if(!e.canonical.equals(o.canonical)||e.wrap!==o.wrap){if(i.vertices.length<r.vertices.length)return H_(i,o,r,e);const h=e.canonical,u=o.canonical,f=Math.pow(2,u.z-h.z);a=r.vertices.map(_=>new ke((_.x+h.x*We)*f-u.x*We,(_.y+h.y*We)*f-u.y*We))}return nm(i,a,r.indices,0,r.indices.length,0,0)}function $_(r,e,i,o){const a=Math.pow(2,o.z-i.z);return new ke((r+i.x*We)*a-o.x*We,(e+i.y*We)*a-o.y*We)}function om(r,e){const i=[];e.grid.queryPoint(r,i);const o=e.indices,a=e.vertices;for(let h=0;h<i.length;h++){const u=i[h];if(zr([a[o[3*u+0]],a[o[3*u+1]],a[o[3*u+2]]],r))return!0}return!1}const sm=[new ke(0,0),new ke(We,0),new ke(We,We),new ke(0,We)];function Z_(r,e){const i=[];let o=[];if(!e||r.length<2)return[r];if(r.length===2)return Zi(r[0],r[1],sm)?[r]:[];for(let a=0;a<r.length+2;a++){const h=r[a%r.length],u=r[(a+1)%r.length],f=Zi(a===0?r[r.length-1]:r[(a-1)%r.length],h,sm),_=Zi(h,u,sm),g=f||_;g&&o.push(h),g&&_||o.length>0&&(o.length>1&&i.push(o),o=[])}return o.length>1&&i.push(o),i}const am=_e.types,Dx=["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"],Lx=["fill-extrusion-flood-light-ground-radius"],Fx=Math.pow(2,13),Ox=Math.pow(2,15)-1,W_=new ke(0,1),Ia=2147483648;function Ru(r,e,i,o,a,h,u,f){r.emplaceBack((e<<1)+u,(i<<1)+h,(Math.floor(o*Fx)<<1)+a,Math.round(f))}function Du(r,e,i){r.emplaceBack(e.x*We,e.y*We,i?1:0)}function Sp(r,e,i,o,a,h){r.emplaceBack(e.x,e.y,(i.x<<1)+o,(i.y<<1)+a,h)}function Lu(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class X_{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Y_{constructor(){this.centroidXY=new ke(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 ke(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new ke(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new ke(this.max.x-this.min.x,this.max.y-this.min.y)}}class K_{constructor(){this.acc=new ke(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,o){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((i.x===0||i.x===We)&&i.x===o.x)!=((i.y===0||i.y===We)&&i.y===o.y)&&this.processBorderOverlap(i,o),a&&this.checkBorderIntersection(i,o)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,ft(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>We!=e.x>We&&this.addBorderIntersection(1,ft(i.y,e.y,(We-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,ft(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>We!=e.y>We&&this.addBorderIntersection(3,ft(i.x,e.x,(We-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){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 o=this.borders[e];i<o[0]&&(o[0]=i),i>o[1]&&(o[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const o=e.x===0?0:1;this.addBorderIntersection(o,i.y),this.addBorderIntersection(o,e.y)}else{const o=e.y===0?2:3;this.addBorderIntersection(o,i.x),this.addBorderIntersection(o,e.x)}}centroid(){return this.accCount===0?new ke(0,0):new ke(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,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function J_(r,e){const i=r.add(e)._unit(),o=W(r.x*i.x+r.y*i.y,-1,1);var a,h,u;return a=Math.acos(o),Math.min(4,Math.max(-4,Math.tan(a)))/4*Ox*((h=r).x*(u=e).y-h.y*u.x<0?-1:1)}const kx=[r=>r.x<0,r=>r.x>We,r=>r.y<0,r=>r.y>We];function Bx(r,e,i,o){const a=[4];if(o===0)return a;i._mult(o);const h=r.sub(i),u=e.sub(i),f=[r,e,h,u];for(let _=0;_<4;_++)for(const g of f)if(kx[_](g)){a.push(_);break}return a}class lm{constructor(e){this.vertexArray=new Rc,this.indexArray=new Li,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut},i=>Lx.includes(i)),this._segments=new Ni,this.hiddenByLandmarkVertexArray=new Bc,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Ni}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,o,a=!1){const h=e.length;if(h>2){let u=Math.max(0,this._segments.get().length-1);const f=this._segments._prepareSegment(4*h,this.vertexArray.length,2*this._segmentToGroundQuads[u].length);let _;u!==this._segments.get().length-1&&(u++,this._segmentToGroundQuads[u]=[],this._segmentToRegionTriCounts[u]=[0,0,0,0,0]);{const g=e[0],v=e[1];_=J_(g.sub(e[h-1])._perp()._unit(),v.sub(g)._perp()._unit())}for(let g=0;g<h;g++){const v=g===h-1?0:g+1,b=e[g],w=e[v],I=e[v===h-1?0:v+1],A=w.sub(b)._perp()._unit(),P=J_(A,I.sub(w)._perp()._unit()),R=_,O=P;if(cm(b,w,i)||a&&tg(b,i)&&tg(w,i)){_=P;continue}const U=f.vertexLength;Sp(this.vertexArray,b,w,1,1,R),Sp(this.vertexArray,b,w,1,0,R),Sp(this.vertexArray,b,w,0,1,O),Sp(this.vertexArray,b,w,0,0,O),f.vertexLength+=4;const V=Bx(b,w,A,o);for(const G of V)this._segmentToGroundQuads[u].push({id:U,region:G}),this._segmentToRegionTriCounts[u][G]+=2,f.primitiveLength+=2;_=P}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let o=0;o<i;o++)this._segmentToGroundQuads[o].sort((a,h)=>a.region-h.region);for(let o=0;o<i;o++){const a=this._segmentToGroundQuads[o],h=e[o],u=this._segmentToRegionTriCounts[o];u.reduce((_,g)=>_+g,0);let f=0;for(let _=0;_<=4;_++){const g=u[_];if(g!==0){let v=this.regionSegments[_];v||(v=this.regionSegments[_]=new Ni);const b={vertexOffset:h.vertexOffset,primitiveOffset:h.primitiveOffset+f,vertexLength:h.vertexLength,primitiveLength:g};v.get().push(b)}f+=g}for(let _=0;_<a.length;_++){const g=a[_].id;this.indexArray.emplaceBack(g,g+1,g+3),this.indexArray.emplaceBack(g,g+3,g+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,o,a,h,u,f){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,o,a,h,u,void 0,f)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,Ix.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,o,a,h,u,f,_){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,o,a,h,u,f,_)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&Ia))}updateHiddenByLandmarkRange(e,i,o){if(!this.hasData())return;const a=i+e;if(i!==0){for(let h=e;h<a;++h)this.hiddenByLandmarkVertexArray.emplace(h,o?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,Cx.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._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class Ep{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(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Li,this.footprintVertices=new ln,this.footprintSegments=[],this.layoutVertexArray=new pa,this.centroidVertexArray=new np,this.wallVertexArray=new sp,this.indexArray=new Li,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut},i=>Dx.includes(i)),this.segments=new Ni,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new lm(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,o,a){this.features=[],this.hasPattern=Jf("fill-extrusion",this.layers,this.pixelRatio,i),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=K(o),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:h,id:u,index:f,sourceLayerIndex:_}of e){const g=this.layers[0]._featureFilter.needGeometry,v=we(h,g);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom,{worldview:this.worldview}),v,o))continue;const b={id:u,sourceLayerIndex:_,index:f,geometry:g?v.geometry:oe(h,o,a),properties:h.properties,type:h.type,patterns:{}},w=this.layoutVertexArray.length,I=am[b.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:h.id,feature:Qf("fill-extrusion",this.layers,b,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(const A of b.geometry)for(const P of Z_(A,I))this.addFeature(h.id,b,[P],f,o,{},i.availableImages,a,i.brightness);else this.addFeature(h.id,b,b.geometry,f,o,{},i.availableImages,a,i.brightness);i.featureIndex.insert(h,b.geometry,f,_,this.index,w)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,o,a,h,u){for(const{featureId:f,feature:_}of this.features){const g=am[_.type]==="Polygon",{geometry:v}=_;if(this.wallMode)for(const b of v)for(const w of Z_(b,g))this.addFeature(f,_,[w],_.index,i,o,a,h,u);else this.addFeature(f,_,v,_.index,i,o,a,h,u)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,o,a,h,u,f){this.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f,this.worldview),this.groundEffect.update(e,i,h,o,a,u,f,this.worldview)}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,zx),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,Mx.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,Px.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,Ax.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,i,o,a,h,u,f,_,g){const v=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(i,{})/this.tileToMeter,b=[new ke(0,0),new ke(We,We)],w=_.projection,I=w.name==="globe",A=this.wallMode||am[i.type]==="Polygon",P=new K_;P.centroidDataIndex=this.centroidData.length;const R=new Y_;R.buildingId=e,i.properties&&i.properties.hasOwnProperty("building_id")&&(R.buildingId=i.properties.building_id);const O=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},h)<=0,U=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},h);let V;if(R.height=U,R.vertexArrayOffset=this.layoutVertexArray.length,R.groundVertexArrayOffset=this.groundEffect.vertexArray.length,I&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Lc),this.wallMode){if(I)return void Gt("Non zero fill-extrusion-line-width is not yet supported on globe.");if(o.length!==1)return;V=function(de){const Ae=de[0].x===de[de.length-1].x&&de[0].y===de[de.length-1].y;(function(Ne){let st=0;const et=Ne.length;for(let Xe=0;Xe<et;Xe++)st+=(Ne[(Xe+1)%et].x-Ne[Xe].x)*(Ne[(Xe+1)%et].y+Ne[Xe].y);return st>=0})(de)||(de=de.reverse());const Ce={geometry:[],joinNormals:[],indices:[]},Fe=[],Ve=[],Te=[];let Oe=de.length;for(;Oe>=2&&de[Oe-1].equals(de[Oe-2]);)Oe--;if(Oe<(Ae?3:2))return Ce;let pe,Se,He,Be,ct,nt=0;for(;nt<Oe-1&&de[nt].equals(de[nt+1]);)nt++;Ae&&(pe=de[Oe-2],ct=de[nt].sub(pe)._unit()._perp());for(let Ne=nt;Ne<Oe;Ne++){if(He=Ne===Oe-1?Ae?de[nt+1]:void 0:de[Ne+1],He&&de[Ne].equals(He))continue;ct&&(Be=ct),pe&&(Se=pe),pe=de[Ne],ct=He?He.sub(pe)._unit()._perp():Be,Be=Be||ct;let st=Be.add(ct);st.x===0&&st.y===0||st._unit();const et=st.x*ct.x+st.y*ct.y,Xe=et!==0?1/et:1/0,tt=Be.x*ct.y-Be.y*ct.x>0;let _t="miter";const Tt=2;_t==="miter"&&Xe>Tt&&(_t="bevel"),_t==="bevel"&&(Xe>100&&(_t="flipbevel"),Xe<Tt&&(_t="miter"));const Mt=(It,qt,Lt,Ii)=>{const H=new ke(It.x,It.y),$=new ke(It.x,It.y);H.x+=qt.x*Ii,H.y+=qt.y*Ii,$.x-=qt.x*Math.max(Lt,1),$.y-=qt.y*Math.max(Lt,1),Te.push(qt),Fe.push(H),Ve.push($)};if(_t==="miter")st._mult(Xe),Mt(pe,st,0,0);else if(_t==="flipbevel")st=ct.mult(-1),Mt(pe,st,0,0),Mt(pe,st.mult(-1),0,0);else{const It=-Math.sqrt(Xe*Xe-1),qt=tt?It:0,Lt=tt?0:It;Se&&Mt(pe,Be,qt,Lt),He&&Mt(pe,ct,qt,Lt)}}Ce.geometry=[...Fe,...Ve.reverse(),Fe[0]],Ce.joinNormals=[...Te,...Te.reverse(),Te[Te.length-1]];const De=Ce.geometry.length-1;for(let Ne=0;Ne<De/2;Ne++)if(Ne+1<De/2){let st=Ne,et=Ne+1,Xe=De-1-Ne,tt=De-2-Ne;st=st===0?De-1:st-1,et=et===0?De-1:et-1,Xe=Xe===0?De-1:Xe-1,tt=tt===0?De-1:tt-1,Ce.indices.push(Xe),Ce.indices.push(et),Ce.indices.push(st),Ce.indices.push(Xe),Ce.indices.push(tt),Ce.indices.push(et)}return Ce}(o[0]),o=[V.geometry]}const G=(de,Ae)=>de<(Ae.length-1)/2||de===Ae.length-1,re=this.wallMode?[o]:Pu(o,500);for(let de=re.length-1;de>=0;de--){const Ae=re[de];(Ae.length===0||(Q=Ae[0]).every(je=>je.x<=0)||Q.every(je=>je.x>=We)||Q.every(je=>je.y<=0)||Q.every(je=>je.y>=We))&&re.splice(de,1)}var Q;let te;if(I)te=og(re,b,h);else{te=[];for(const de of re)te.push({polygon:de,bounds:b})}const ae=A?this.edgeRadius:0,ce=ae>0&&this.zoom<17,Ee=(de,Ae)=>{if(de.length===0)return!1;const je=de[de.length-1];return Ae.x===je.x&&Ae.y===je.y};for(const{polygon:de,bounds:Ae}of te){let je=0,Ce=0;for(const Oe of de)A&&!Oe[0].equals(Oe[Oe.length-1])&&Oe.push(Oe[0]),Ce+=A?Oe.length-1:Oe.length;const Fe=this.segments.prepareSegment((A?5:4)*Ce,this.layoutVertexArray,this.indexArray);R.footprintSegIdx<0&&(R.footprintSegIdx=this.footprintSegments.length),R.polygonSegIdx<0&&(R.polygonSegIdx=this.polygonSegments.length);const Ve={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},Te=new X_;if(Te.vertexOffset=this.footprintVertices.length,Te.indexOffset=3*this.footprintIndices.length,Te.ringIndices=[],A){const Oe=[],pe=[];je=Fe.vertexLength;for(let He=0;He<de.length;He++){const Be=de[He];Be.length&&He!==0&&pe.push(Oe.length/2);const ct=[];let nt,De;nt=Be[1].sub(Be[0])._perp()._unit(),Te.ringIndices.push(Be.length-1);for(let Ne=1;Ne<Be.length;Ne++){const st=Be[Ne],et=Be[Ne===Be.length-1?1:Ne+1],Xe=st.clone();if(ae){De=et.sub(st)._perp()._unit();const tt=nt.add(De)._unit(),_t=ae*Math.min(4,1/(nt.x*tt.x+nt.y*tt.y));Xe.x+=_t*tt.x,Xe.y+=_t*tt.y,Xe.x=Math.round(Xe.x),Xe.y=Math.round(Xe.y),nt=De}if(!O||ae!==0&&!ce||Ee(ct,Xe)||ct.push(Xe),Ru(this.layoutVertexArray,Xe.x,Xe.y,0,0,1,1,0),this.wallMode){const tt=G(Ne,Be);Du(this.wallVertexArray,V.joinNormals[Ne],!tt)}Fe.vertexLength++,this.footprintVertices.emplaceBack(st.x,st.y),Oe.push(st.x,st.y),I&&Lu(this.layoutVertexExtArray,w.projectTilePoint(Xe.x,Xe.y,h),w.upVector(h,Xe.x,Xe.y))}O&&(ae===0||ce)&&(ct.length!==0&&Ee(ct,ct[0])&&ct.pop(),this.groundEffect.addData(ct,Ae,v))}const Se=this.wallMode?V.indices:Gc(Oe,pe);for(let He=0;He<Se.length;He+=3)this.footprintIndices.emplaceBack(Te.vertexOffset+Se[He+0],Te.vertexOffset+Se[He+1],Te.vertexOffset+Se[He+2]),this.indexArray.emplaceBack(je+Se[He],je+Se[He+2],je+Se[He+1]),Fe.primitiveLength++;Te.indexCount+=Se.length,Te.vertexCount+=this.footprintVertices.length-Te.vertexOffset}for(let Oe=0;Oe<de.length;Oe++){const pe=de[Oe];P.startRing(R,pe[0]);let Se=pe.length>4&&ig(pe[pe.length-2],pe[0],pe[1]),He=ae?Nx(pe[pe.length-2],pe[0],pe[1],ae):0;const Be=[];let ct,nt,De;nt=pe[1].sub(pe[0])._perp()._unit();let Ne=!0;for(let st=1,et=0;st<pe.length;st++){let Xe=pe[st-1],tt=pe[st];const _t=pe[st===pe.length-1?1:st+1];if(P.appendEdge(R,tt,Xe),cm(tt,Xe,Ae)){ae&&(nt=_t.sub(tt)._perp()._unit(),Ne=!Ne);continue}const Tt=tt.sub(Xe)._perp(),Mt=Tt.x/(Math.abs(Tt.x)+Math.abs(Tt.y)),It=Tt.y>0?1:0,qt=Xe.dist(tt);if(et+qt>32768&&(et=0),ae){De=_t.sub(tt)._perp()._unit();let $=eg(Xe,tt,_t,Q_(nt,De),ae);isNaN($)&&($=0);const be=tt.sub(Xe)._unit();Xe=Xe.add(be.mult(He))._round(),tt=tt.add(be.mult(-$))._round(),He=$,nt=De,O&&this.zoom>=17&&(Ee(Be,Xe)||Be.push(Xe),Ee(Be,tt)||Be.push(tt))}const Lt=Fe.vertexLength,Ii=pe.length>4&&ig(Xe,tt,_t);let H=rg(et,Se,Ne);if(Ru(this.layoutVertexArray,Xe.x,Xe.y,Mt,It,0,0,H),Ru(this.layoutVertexArray,Xe.x,Xe.y,Mt,It,0,1,H),this.wallMode){const $=G(st-1,pe),be=V.joinNormals[st-1];Du(this.wallVertexArray,be,$),Du(this.wallVertexArray,be,$)}if(et+=qt,H=rg(et,Ii,!Ne),Se=Ii,Ru(this.layoutVertexArray,tt.x,tt.y,Mt,It,0,0,H),Ru(this.layoutVertexArray,tt.x,tt.y,Mt,It,0,1,H),this.wallMode){const $=G(st,pe),be=V.joinNormals[st];Du(this.wallVertexArray,be,$),Du(this.wallVertexArray,be,$)}if(Fe.vertexLength+=4,this.indexArray.emplaceBack(Lt+0,Lt+1,Lt+2),this.indexArray.emplaceBack(Lt+1,Lt+3,Lt+2),Fe.primitiveLength+=2,ae){const $=je+(st===1?pe.length-2:st-2),be=st===1?je:$+1;if(this.indexArray.emplaceBack(Lt+1,$,Lt+3),this.indexArray.emplaceBack($,be,Lt+3),Fe.primitiveLength+=2,ct===void 0&&(ct=Lt),!cm(_t,pe[st],Ae)){const $e=st===pe.length-1?ct:Fe.vertexLength;this.indexArray.emplaceBack(Lt+2,Lt+3,$e),this.indexArray.emplaceBack(Lt+3,$e+1,$e),this.indexArray.emplaceBack(Lt+3,be,$e+1),Fe.primitiveLength+=3}Ne=!Ne}if(I){const $=this.layoutVertexExtArray,be=w.projectTilePoint(Xe.x,Xe.y,h),$e=w.projectTilePoint(tt.x,tt.y,h),Ke=w.upVector(h,Xe.x,Xe.y),Ye=w.upVector(h,tt.x,tt.y);Lu($,be,Ke),Lu($,be,Ke),Lu($,$e,Ye),Lu($,$e,Ye)}}A&&(je+=pe.length-1),O&&ae&&this.zoom>=17&&(Be.length!==0&&Ee(Be,Be[0])&&Be.pop(),this.groundEffect.addData(Be,Ae,v,ae>0))}this.footprintSegments.push(Te),Ve.triangleCount=this.indexArray.length-Ve.triangleArrayOffset,this.polygonSegments.push(Ve),++R.footprintSegLen,++R.polygonSegLen}if(R.vertexCount=this.layoutVertexArray.length-R.vertexArrayOffset,R.groundVertexCount=this.groundEffect.vertexArray.length-R.groundVertexArrayOffset,R.vertexCount!==0){if(R.centroidXY=P.borders?W_:this.encodeCentroid(P,R),this.centroidData.push(R),P.borders){this.featuresOnBorder.push(P);const de=this.featuresOnBorder.length-1;for(let Ae=0;Ae<P.borders.length;Ae++)P.borders[Ae][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[Ae].push(de)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,u,f,h,g,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(i,a,u,f,h,g,this.worldview),this.maxHeight=Math.max(this.maxHeight,U)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,o)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[o].borders[e][0])}splitToSubtiles(){const e=[];for(let f=0;f<this.centroidData.length;f++){const _=this.centroidData[f],g=+(_.min.y+_.max.y>We),v=2*g+(+(_.min.x+_.max.x>We)^g);for(let b=0;b<_.polygonSegLen;b++){const w=_.polygonSegIdx+b;e.push({centroidIdx:f,subtile:v,polygonSegmentIdx:w,triangleSegmentIdx:this.polygonSegments[w].triangleSegIdx})}}const i=new Li;e.sort((f,_)=>f.triangleSegmentIdx===_.triangleSegmentIdx?f.subtile-_.subtile:f.triangleSegmentIdx-_.triangleSegmentIdx);let o=0,a=0,h=0;for(const f of e){if(f.triangleSegmentIdx!==o)break;h++}const u=e.length;for(;a!==e.length;){o=e[a].triangleSegmentIdx;let f=0,_=a,g=a;for(let v=_;v<h&&e[v].subtile===f;v++)g++;for(;_!==h;){const v=e[_];f=v.subtile;const b=this.centroidData[v.centroidIdx].min.clone(),w=this.centroidData[v.centroidIdx].max.clone(),I={vertexOffset:this.segments.segments[o].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[o].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let A=_;A<g;A++){const P=e[A],R=this.polygonSegments[P.polygonSegmentIdx],O=this.centroidData[P.centroidIdx].min,U=this.centroidData[P.centroidIdx].max,V=this.indexArray.uint16;for(let G=R.triangleArrayOffset;G<R.triangleArrayOffset+R.triangleCount;G++)i.emplaceBack(V[3*G],V[3*G+1],V[3*G+2]);I.primitiveLength+=R.triangleCount,b.x=Math.min(b.x,O.x),b.y=Math.min(b.y,O.y),w.x=Math.max(w.x,U.x),w.y=Math.max(w.y,U.y)}I.primitiveLength>0&&this.triangleSubSegments.push({segment:I,min:b,max:w}),_=g;for(let A=_;A<h&&e[A].subtile===e[_].subtile;A++)g++}a=h;for(let v=a;v<u&&e[v].triangleSegmentIdx===e[a].triangleSegmentIdx;v++)h++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,o){const a=new Ni;if(this.wallMode){for(const P of this.triangleSubSegments)a.segments.push(P.segment);return a}let h=0,u=0;const f=1<<e.canonical.z;if(i){const P=i.getMinMaxForTile(e);P&&(h=P.min,u=P.max)}u+=this.maxHeight;const _=e.toUnwrapped();let g;const v=[_.canonical.x/f+_.wrap,_.canonical.y/f],b=[(_.canonical.x+1)/f+_.wrap,(_.canonical.y+1)/f],w=(P,R,O)=>[P[0]*(1-O[0])+R[0]*O[0],P[1]*(1-O[1])+R[1]*O[1]],I=[],A=[];for(const P of this.triangleSubSegments){I[0]=P.min.x/We,I[1]=P.min.y/We,A[0]=P.max.x/We,A[1]=P.max.y/We;const R=w(v,b,I),O=w(v,b,A);if(new kt([R[0],R[1],h],[O[0],O[1],u]).intersectsPrecise(o)===0){g&&(a.segments.push(g),g=void 0);continue}const U=P.segment;g&&g.vertexOffset!==U.vertexOffset&&(a.segments.push(g),g=void 0),g?(g.vertexLength+=U.vertexLength,g.primitiveLength+=U.primitiveLength):g={vertexOffset:U.vertexOffset,primitiveLength:U.primitiveLength,vertexLength:U.vertexLength,primitiveOffset:U.primitiveOffset,sortKey:void 0,vaos:{}}}return g&&a.segments.push(g),a}encodeCentroid(e,i){const o=e.centroid(),a=i.span(),h=Math.min(7,Math.round(a.x*this.tileToMeter/10)),u=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new ke(W(o.x,1,We-1)<<3|h,W(o.y,1,We-1)<<3|u)}encodeBorderCentroid(e){if(!e.borders)return new ke(0,0);const i=e.borders,o=Number.MAX_VALUE;if(i[0][0]!==o||i[1][0]!==o){const a=i[0][0]!==o?0:1;return new ke(6|(i[0][0]!==o?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==o?2:3;return new ke((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==o?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=2147483647,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,o=e.vertexCount+e.vertexArrayOffset,a=e.flags&Ia?W_:e.centroidXY,h=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||h!==a.x){for(let u=i;u<o;++u)this.centroidVertexArray.emplace(u,a.x,a.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,i,o){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(Tp(this.activeReplacements,a))return;if(this.activeReplacements=a,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const u of this.centroidData)u.flags&=2147483647;const h=[];for(const u of this.activeReplacements){if(u.order<o)continue;const f=Math.max(1,Math.pow(2,u.footprintTileId.canonical.z-e.canonical.z));if(u.footprint.buildingId){const _=u.footprint.buildingId;for(const g of this.centroidData)g.buildingId===_&&(g.flags|=Ia)}else for(const _ of this.centroidData)if(!(_.flags&Ia||u.min.x>_.max.x||_.min.x>u.max.x||u.min.y>_.max.y||_.min.y>u.max.y))for(let g=0;g<_.footprintSegLen;g++){const v=this.footprintSegments[_.footprintSegIdx+g];if(h.length=0,Vx(this.footprintVertices,v.vertexOffset,v.vertexCount,u.footprintTileId.canonical,e.canonical,h),nm(u.footprint,h,this.footprintIndices.uint16,v.indexOffset,v.indexCount,-v.vertexOffset,-f)){_.flags|=Ia;break}}}for(const u of this.centroidData)this.writeCentroidToBuffer(u);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,o){let a=!1;for(let h=0;h<o.footprintSegLen;h++){const u=this.footprintSegments[o.footprintSegIdx+h];let f=0;for(const _ of u.ringIndices){for(let g=f,v=_+f-1;g<_+f;v=g++){const b=this.footprintVertices.int16[2*(g+u.vertexOffset)+0],w=this.footprintVertices.int16[2*(g+u.vertexOffset)+1],I=this.footprintVertices.int16[2*(v+u.vertexOffset)+1];w>i!=I>i&&e<(this.footprintVertices.int16[2*(v+u.vertexOffset)+0]-b)*(i-w)/(I-w)+b&&(a=!a)}f=_}}return a}getHeightAtTileCoord(e,i){let o=Number.NEGATIVE_INFINITY,a=!0;const h=4*(e+We)*We+(i+We);if(this.partLookup.hasOwnProperty(h)){const u=this.partLookup[h];return u?{height:u.height,hidden:!!(u.flags&Ia)}:void 0}for(const u of this.centroidData)e>u.max.x||u.min.x>e||i>u.max.y||u.min.y>i||u.height<=o||this.footprintContainsPoint(e,i,u)&&(o=u.height,this.partLookup[h]=u,a=!!(u.flags&Ia));if(o!==Number.NEGATIVE_INFINITY)return{height:o,hidden:a};this.partLookup[h]=void 0}}function Q_(r,e){const i=r.add(e)._unit();return r.x*i.x+r.y*i.y}function Nx(r,e,i,o){const a=e.sub(r)._perp()._unit(),h=i.sub(e)._perp()._unit();return eg(r,e,i,Q_(a,h),o)}function eg(r,e,i,o,a){const h=Math.sqrt(1-o*o);return Math.min(r.dist(e)/3,e.dist(i)/3,a*h/o)}function cm(r,e,i){return r.x<i[0].x&&e.x<i[0].x||r.x>i[1].x&&e.x>i[1].x||r.y<i[0].y&&e.y<i[0].y||r.y>i[1].y&&e.y>i[1].y}function tg(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function ig(r,e,i){if(r.x<0||r.x>=We||e.x<0||e.x>=We||i.x<0||i.x>=We)return!1;const o=i.sub(e),a=o.perp(),h=r.sub(e);return(o.x*h.x+o.y*h.y)/Math.sqrt((o.x*o.x+o.y*o.y)*(h.x*h.x+h.y*h.y))>-.866&&a.x*h.x+a.y*h.y<0}function rg(r,e,i){const o=e?2|r:-3&r;return i?1|o:-2&o}function ng(){const r=Math.PI/32,e=Math.tan(r),i=x;return i*Math.sqrt(1+2*e*e)-i}function og(r,e,i){const o=1<<i.z,a=N(i.x/o),h=N((i.x+1)/o),u=j(i.y/o),f=j((i.y+1)/o);return function(_,g,v,b,w=0,I){const A=[];if(!_.length||!v||!b)return A;const P=(Q,te)=>{for(const ae of Q)A.push({polygon:ae,bounds:te})},R=Math.ceil(Math.log2(v)),O=Math.ceil(Math.log2(b)),U=R-O,V=[];for(let Q=0;Q<Math.abs(U);Q++)V.push(U>0?0:1);for(let Q=0;Q<Math.min(R,O);Q++)V.push(0),V.push(1);let G=_;if(G=vp(G,g[0].y-w,g[1].y+w,1),G=vp(G,g[0].x-w,g[1].x+w,0),!G.length)return A;const re=[];for(V.length?re.push({polygons:G,bounds:g,depth:0}):P(G,g);re.length;){const Q=re.pop(),te=Q.depth,ae=V[te],ce=Q.bounds[0],Ee=Q.bounds[1],de=ae===0?ce.x:ce.y,Ae=ae===0?Ee.x:Ee.y,je=I?I(ae,de,Ae):.5*(de+Ae),Ce=vp(Q.polygons,de-w,je+w,ae),Fe=vp(Q.polygons,je-w,Ae+w,ae);if(Ce.length){const Ve=[ce,new ke(ae===0?je:Ee.x,ae===1?je:Ee.y)];V.length>te+1?re.push({polygons:Ce,bounds:Ve,depth:te+1}):P(Ce,Ve)}if(Fe.length){const Ve=[new ke(ae===0?je:ce.x,ae===1?je:ce.y),Ee];V.length>te+1?re.push({polygons:Fe,bounds:Ve,depth:te+1}):P(Fe,Ve)}}return A}(r,e,Math.ceil((h-a)/11.25),Math.ceil((u-f)/11.25),1,(_,g,v)=>{if(_===0)return .5*(g+v);{const b=j((i.y+g/We)/o);return(F(.5*(j((i.y+v/We)/o)+b))*o-i.y)*We}})}function Vx(r,e,i,o,a,h){const u=Math.pow(2,o.z-a.z);for(let f=0;f<i;f++){let _=r.int16[2*(f+e)+0],g=r.int16[2*(f+e)+1];_=(_+a.x*We)*u-o.x*We,g=(g+a.y*We)*u-o.y*We,h.push(new ke(_,g))}}let sg,ag;rt(Ep,"FillExtrusionBucket",{omit:["layers","features"]}),rt(Y_,"PartData"),rt(X_,"FootprintSegment"),rt(K_,"BorderCentroidData"),rt(lm,"GroundEffect");class Rl extends ke{constructor(e,i,o){super(e,i),this.z=o}}class lg extends Rl{constructor(e,i,o,a){super(e,i,o),this.w=a}}function cg(r,e,i,o){const a=i==="x"?"y":"x",h=(o-r[i])/(e[i]-r[i]);r[a]=Math.round(r[a]+(e[a]-r[a])*h),r[i]=o,r.hasOwnProperty("z")&&(r.z=ft(r.z,e.z,h)),r.hasOwnProperty("w")&&(r.w=ft(r.w,e.w,h))}function hg(r,e,i,o){const a=i,h=o;for(const u of["x","y"]){let f=r,_=e;f[u]>=_[u]&&(f=e,_=r),f[u]<a&&_[u]>a&&cg(f,_,u,a),f[u]<h&&_[u]>h&&cg(_,f,u,h)}}function Ip(r,e,i,o,a,h){const u=[];for(let f=0;f<r.length;f++){const _=r[f];let g;const v=u.length;let b=0;for(let w=0;w<_.length-1;w++){let I=_[w],A=_[w+1],P=0;const R=b;let O,U;h&&(P=Math.hypot(A.x-I.x,A.y-I.y),b+=P,O=I,U=A),I.x<e&&A.x<e||(I.x<e?I=new ke(e,I.y+(e-I.x)/(A.x-I.x)*(A.y-I.y))._round():A.x<e&&(A=new ke(e,I.y+(e-I.x)/(A.x-I.x)*(A.y-I.y))._round()),I.y<i&&A.y<i||(I.y<i?I=new ke(I.x+(i-I.y)/(A.y-I.y)*(A.x-I.x),i)._round():A.y<i&&(A=new ke(I.x+(i-I.y)/(A.y-I.y)*(A.x-I.x),i)._round()),I.x>=o&&A.x>=o||(I.x>=o?I=new ke(o,I.y+(o-I.x)/(A.x-I.x)*(A.y-I.y))._round():A.x>=o&&(A=new ke(o,I.y+(o-I.x)/(A.x-I.x)*(A.y-I.y))._round()),I.y>=a&&A.y>=a||(I.y>=a?I=new ke(I.x+(a-I.y)/(A.y-I.y)*(A.x-I.x),a)._round():A.y>=a&&(A=new ke(I.x+(a-I.y)/(A.y-I.y)*(A.x-I.x),a)._round()),g&&I.equals(g[g.length-1])||(g=[I],u.push(g),h&&h.push({progress:{min:R+ug(O,U,I)*P,max:1},parentIndex:f,prevPoint:O,nextPoint:U})),g.push(A),h&&(h[h.length-1].progress.max=R+ug(O,U,A)*P,h[h.length-1].nextPoint=U)))))}if(h&&b>0)for(let w=v;w<u.length;w++)h[w].progress.min/=b,h[w].progress.max/=b}return u}function Ux(r,e,i,o,a){if(r.length<2)return void o.push(r);const h=[];for(;e.valid();){const[g,v]=e.get();for(let b=0;b<r.length-1;b++){const w=r[b],I=r[b+1],A=fn(w,I,g,v);if(A){const[P]=A,R=new ke(ft(w.x,I.x,P),ft(w.y,I.y,P));h.push({t:b+P,distance:0,point:R})}}e.next()}if(h.length===0)return void o.push(r);h.sort((g,v)=>g.t-v.t);let u=0,f=0,_=[];for(o.push(_);u!==r.length;){if(f===h.length){for(;u!==r.length;)_.length!==0&&_[_.length-1].equals(r[u])||_.push(r[u]),u++;break}h[f].t<=u?(_.length!==0&&_[_.length-1].equals(h[f].point)||_.push(h[f].point),Math.trunc(h[f].t),f++):(_.length!==0&&_[_.length-1].equals(r[u])||_.push(r[u]),u++)}}function ug(r,e,i){return r.x!==e.x?(i.x-r.x)/(e.x-r.x):r.y!==e.y?(i.y-r.y)/(e.y-r.y):0}function Fu(r,e){return r.x*e.x+r.y*e.y}function dg(r,e){if(r.length===1){let i=0;const o=e[i++];let a;for(;!a||o.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const h=e[i],u=r[0],f=a.sub(o),_=h.sub(o),g=u.sub(o),v=Fu(f,f),b=Fu(f,_),w=Fu(_,_),I=Fu(g,f),A=Fu(g,_),P=v*w-b*b,R=(w*I-b*A)/P,O=(v*A-b*I)/P,U=o.z*(1-R-O)+a.z*R+h.z*O;if(isFinite(U))return U}return 1/0}{let i=1/0;for(const o of e)i=Math.min(i,o.z);return i}}function pg(r,e,i,o,a,h,u,f){const _=u*a.getElevationAt(r,e,!0,!0),g=h[0]!==0,v=g?h[1]===0?u*(h[0]/7-450):u*function(b,w,I){const A=Math.floor(w[0]/8),P=Math.floor(w[1]/8),R=10*(w[0]-8*A),O=10*(w[1]-8*P),U=b.getElevationAt(A,P,!0,!0),V=b.getMeterToDEM(I),G=Math.floor(.5*(R*V-1)),re=Math.floor(.5*(O*V-1)),Q=b.tileCoordToPixel(A,P),te=2*G+1,ae=2*re+1,ce=function(Fe,Ve,Te,Oe,pe){return[Fe.getElevationAtPixel(Ve,Te,!0),Fe.getElevationAtPixel(Ve+pe,Te,!0),Fe.getElevationAtPixel(Ve,Te+pe,!0),Fe.getElevationAtPixel(Ve+Oe,Te+pe,!0)]}(b,Q.x-G,Q.y-re,te,ae),Ee=Math.abs(ce[0]-ce[1]),de=Math.abs(ce[2]-ce[3]),Ae=Math.abs(ce[0]-ce[2])+Math.abs(ce[1]-ce[3]),je=Math.min(.25,.5*V*(Ee+de)/te),Ce=Math.min(.25,.5*V*Ae/ae);return U+Math.max(je*R,Ce*O)}(a,h,f):_;return{base:_+(i===0?-1:i),top:g?Math.max(v+o,_+i+2):_+o}}class jx{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=void 0,this._callback=()=>{}}}class Gx{constructor(){this.tasks={},this.taskQueue=[],bt(["process"],this),this.invoker=new jx(this.process),this.nextId=0}add(e,i){const o=this.nextId++,a=function({type:h,isSymbolTile:u,zoom:f}){return f=f||0,h==="message"?0:h!=="maybePrepare"||u?h!=="parseTile"||u?h==="parseTile"&&u?300-f:h==="maybePrepare"&&u?400-f:500:200-f:100-f}(i);if(a===0){try{e()}finally{}return null}return this.tasks[o]={fn:e,metadata:i,priority:a,id:o},this.taskQueue.push(o),this.invoker.trigger(),{cancel:()=>{delete this.tasks[o]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(o=>!!this.tasks[o]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let a=0;a<this.taskQueue.length;a++){const h=this.tasks[this.taskQueue[a]];h.priority<i&&(i=h.priority,e=a)}if(e===null)return null;const o=this.taskQueue[e];return this.taskQueue.splice(e,1),o}remove(){this.invoker.remove()}}class fg{constructor(e,i,o){this.target=e,this.parent=i,this.mapId=o,this.callbacks={},this.cancelCallbacks={},bt(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
14=new Gx}send(e,i,o,a,h=!1,u){const f=Math.round(1e18*Math.random()).toString(36).substring(0,10);o&&(o.metadata=u,this.callbacks[f]=o);const _=new Set;return this.target.postMessage({id:f,type:e,hasCallback:!!o,targetMapId:a,mustQueue:h,sourceMapId:this.mapId,data:bo(i,_)},_),{cancel:()=>{o&&delete this.callbacks[f],this.target.postMessage({id:f,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const i=e.data;if(!i)return;const o=i.id;if(o&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const a=this.cancelCallbacks[o];delete this.cancelCallbacks[o],a&&a.cancel()}else if(i.mustQueue||gi(self)){const a=this.callbacks[o],h=this.scheduler.add(()=>this.processTask(o,i),a&&a.metadata||{type:"message"});h&&(this.cancelCallbacks[o]=h)}else this.processTask(o,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const o=this.callbacks[e];delete this.callbacks[e],o&&(i.error?o(an(i.error)):o(null,an(i.data)))}else{const o=new Set,a=i.hasCallback?(u,f)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:u?bo(u):null,data:bo(f,o)},o)}:()=>{},h=an(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,h,a);else if(this.parent.getWorkerSource){const u=i.type.split("."),{source:f,scope:_}=h;this.parent.getWorkerSource(i.sourceMapId,u[0],f,_)[u[1]](h,a)}else a(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var Ou={workerUrl:"",workerClass:null,workerParams:void 0};const hm="mapboxgl_preloaded_worker_pool";class Dl{constructor(){this.active={}}acquire(e,i=Dl.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;)this.workers.push(Ou.workerClass!=null?new Ou.workerClass:new self.Worker(Ou.workerUrl,Ou.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[hm]}numActive(){return Object.keys(this.active).length}}Dl.workerCount=2;class Hc{constructor(e,i,o="Worker",a=Dl.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=Pe();const h=this.workerPool.acquire(this.id,a);for(let u=0;u<h.length;u++){const f=new Hc.Actor(h[u],i,this.id);f.name=`${o} ${u}`,this.actors.push(f)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,o){he(this.actors,(a,h)=>{a.send(e,i,h)},o=o||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}let ku,um;function Ap(){return ku||(ku=new Dl),ku}Hc.Actor=fg;class qx{constructor(e){this.module=e}createIntArray(e){const i=new Int32Array(e),o=this.module.malloc(i.length*i.BYTES_PER_ELEMENT);return this.module.heap32.set(i,o/i.BYTES_PER_ELEMENT),o}createFloatArray(e){const i=new Float32Array(e),o=this.module.malloc(i.length*i.BYTES_PER_ELEMENT);return this.module.heapF32.set(i,o/i.BYTES_PER_ELEMENT),o}createStringBuffer(e){const i=this.module.malloc(e.length+1);for(let o=0;o<e.length;++o)this.module.heapU8[i+o]=e.charCodeAt(o);return this.module.heapU8[i+e.length]=0,i}readStringBuffer(e){let i="";for(;this.module.heapU8[e]!==0;)i+=String.fromCharCode(this.module.heapU8[e]),++e;return i}setStyle(e){const i=e.entranceColorRgb,o=e.facadeGlazingColorRgb,a=e.roofColorRgb,h=e.wallColorRgb,u=e.normalScale;this.module.setStyle(i[0],i[1],i[2],o[0],o[1],o[2],a[0],a[1],a[2],h[0],h[1],h[2],u[0],u[1],u[2],e.tileToMeters)}setAOOptions(e,i){this.module.setAOOptions(e?1:0,i)}setMetricOptions(e,i){this.module.setMetricOptions(e?1:0,i)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,i){this.module.setFacadeOptions(e,i?1:0)}setFauxFacadeOptions(e,i,o){this.module.setFauxFacadeOptions(e?1:0,i?1:0,o)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,i){for(const f of e){const _=this.createStringBuffer(f.roofType),g=[0],v=[];for(const I of f.coordinates)if(Array.isArray(I)){for(const A of I)v.pu
14sh(A.x),v.push(A.y);g.push(v.length)}const b=this.createIntArray(g),w=this.createFloatArray(v);this.module.addFeature(f.id,f.sourceId,f.minHeight,f.height,_,f.roofType.length,w,b,g.length-1),this.module.free(_),this.module.free(b),this.module.free(w)}for(const f of i){let _;_=f.entrances?JSON.parse(f.entrances):[];const g=this.createFloatArray(_),v=[];for(const w of f.coordinates)v.push(w.x),v.push(w.y);const b=this.createFloatArray(v);this.module.addFacade(f.sourceId,f.crossPerc,f.distanceToRoad,g,_.length,b,v.length),this.module.free(g),this.module.free(b)}if(!this.module.generateMesh()){const f=this.module.getLastError();return this.readStringBuffer(f)}const o=this.module.getMeshCount(),a=new Array(o);for(let f=0;f<o;f++){const _=this.module.getPositionsPtr(f),g=this.module.getPositionsLength(f),v=new Float32Array(this.module.heapF32.buffer,_,g),b=this.module.getNormalsPtr(f),w=this.module.getNormalsLength(f),I=new Float32Array(this.module.heapF32.buffer,b,w),A=this.module.getColorsPtr(f),P=this.module.getColorsLength(f),R=new Uint8Array(this.module.heapU8.buffer,A,P),O=this.module.getAOPtr(f),U=this.module.getAOLength(f),V=new Float32Array(this.module.heapF32.buffer,O,U),G=this.module.getUVPtr(f),re=this.module.getUVLength(f),Q=new Float32Array(this.module.heapF32.buffer,G,re),te=this.module.getFauxFacadePtr(f),ae=this.module.getFauxFacadeLength(f),ce=new Uint8Array(this.module.heapU8.buffer,te,ae),Ee=this.module.getIndicesPtr(f),de=this.module.getIndicesLength(f),Ae=new Int32Array(this.module.heap32.buffer,Ee,de),je=this.module.getBuildingPart(f),Ce=this.readStringBuffer(je);a[f]={positions:v,normals:I,colors:R,ao:V,uv:Q,isFauxFacade:ce,indices:Ae,buildingPart:Ce}}const h=this.module.getRingCount(),u=[];for(let f=0;f<h;f++){const _=this.module.getRingPtr(f),g=this.module.getRingLength(f),v=new Float32Array(this.module.heapF32.buffer,_,g);u.push(v)}return{meshes:a,modifiedPolygonRings:u}}}let Bu,dm,To,$c,pm,Zc=null,Wc=null,mg=null,Mp=null;function _g(){return gi(self)&&self.worker.dracoUrl?self.worker.dracoUrl:dm||Ar.DRACO_URL}function gg(){if(gi(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if($c)return $c;const r=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]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return $c=WebAssembly.validate(r)?Ar.MESHOPT_SIMD_URL:Ar.MESHOPT_URL,$c}function Hx(){return Mp}const Cp={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},$x={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},Nu={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function yg(r,e,i){const o=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=o,i.json.bufferViews[o]={buffer:a,byteLength:r.byteLength},i.buffers[a]=r}const fm="KHR_draco_mesh_compression";function Zx(r,e){const i=r.extensions&&r.extensions[fm];if(!i)return;const o=new To.Decoder,a=wg(e,i.bufferView),h=new To.Mesh;if(!o.DecodeArrayToMesh(a,a.byteLength,h))throw new Error("Failed to decode Draco mesh");const u=e.json.accessors[r.indices],f=Cp[u.componentType],_=u.count*f.BYTES_PER_ELEMENT,g=To._malloc(_);f===Uint16Array?o.GetTrianglesUInt16Array(h,_,g):o.GetTrianglesUInt32Array(h,_,g),yg(To.memory.buffer.slice(g,g+_),u,e),To._free(g);for(const v of Object.keys(i.attributes)){const b=o.GetAttributeByUniqueId(h,i.attributes[v]),w=e.json.accessors[r.attributes[v]],I=$x[w.componentType],A=w.count*Nu[w.type]*Cp[w.componentType].BYTES_PER_ELEMENT,P=To._malloc(A);o.GetAttributeDataArrayForAllPoints(h,b,To[I],A,P),yg(To.memory.buffer.slice(P,P+A),w,e),To._free(P)}o.destroy(),h.destroy(),delete r.extensions[fm]}const Pp="EXT_meshopt_compression";function Wx(r,e){if(!r.extensions||!r.extensions[Pp])return;const i=r.extensions[Pp],o=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);pm.decodeGltfBuffer(a,i.count,i.byteStride,o,i.mode,i.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=a.buffer,delete r.extensions[Pp]}const xg=1179937895,vg=new TextDecoder("utf8");function bg(r,e){return new URL(r,e).href}function Xx(r,e,i,o){return fetch(bg(r.uri,o)).then(a=>a.arrayBuffer()).then(a=>{e.buffers[i]=a})}function wg(r,e){const i=r.json.bufferViews[e];return new Uint8Array(r.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function Yx(r,e,i,o){if(r.uri){const a=bg(r.uri,o);return fetch(a).then(h=>h.blob()).then(h=>createImageBitmap(h)).then(h=>{e.images[i]=h})}if(r.bufferView!==void 0){const a=wg(e,r.bufferView),h=new Blob([a],{type:r.mimeType});return createImageBitmap(h).then(u=>{e.images[i]=u})}}function Tg(r,e=0,i){const o={json:null,images:[],buffers:[]};
14if(new Uint32Array(r,e,1)[0]===xg){const v=new Uint32Array(r,e);let b=2;const w=(v[b++]>>2)-3,I=v[b++]>>2;if(b++,o.json=JSON.parse(vg.decode(v.subarray(b,b+I))),b+=I,b<w){const A=v[b++];b++;const P=e+(b<<2);o.buffers[0]=r.slice(P,P+A)}}else o.json=JSON.parse(vg.decode(new Uint8Array(r,e)));const{buffers:a,images:h,meshes:u,extensionsUsed:f,bufferViews:_}=o.json;let g=Promise.resolve();if(a){const v=[];for(let b=0;b<a.length;b++){const w=a[b];w.uri?v.push(Xx(w,o,b,i)):o.buffers[b]||(o.buffers[b]=null)}g=Promise.all(v)}return g.then(()=>{const v=[],b=f&&f.includes(fm),w=f&&f.includes(Pp);if(b&&v.push(function(){if(!To)return Bu??(Bu=function(I){let A,P=null;function R(){A=new Uint8Array(P.buffer)}function O(){throw new Error("Unexpected Draco error.")}const U={a:{a:O,d:function(V,G,re){return A.copyWithin(V,G,G+re)},c:function(V){const G=A.length,re=Math.max(V>>>0,Math.ceil(1.2*G)),Q=Math.ceil((re-G)/65536);try{return P.grow(Q),R(),!0}catch{return!1}},b:O}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(I,U):I.then(V=>V.arrayBuffer()).then(V=>WebAssembly.instantiate(V,U))).then(V=>{const{Rb:G,Qb:re,P:Q,T:te,X:ae,Ja:ce,La:Ee,Qa:de,Va:Ae,Wa:je,eb:Ce,jb:Fe,f:Ve,e:Te,yb:Oe,zb:pe,Ab:Se,Bb:He,Db:Be,Gb:ct}=V.instance.exports;P=Te;const nt=(()=>{let De=0,Ne=0,st=0,et=0;return Xe=>{st&&(G(et),G(De),Ne+=st,st=De=0),De||(Ne+=128,De=re(Ne));const tt=Xe.length+7&-8;let _t=De;tt>=Ne&&(st=tt,_t=et=re(tt));for(let Tt=0;Tt<Xe.length;Tt++)A[_t+Tt]=Xe[Tt];return _t}})();return R(),Ve(),{memory:Te,_free:G,_malloc:re,Mesh:class{constructor(){this.ptr=Q()}destroy(){te(this.ptr)}},Decoder:class{constructor(){this.ptr=ce()}destroy(){Fe(this.ptr)}DecodeArrayToMesh(De,Ne,st){const et=nt(De),Xe=Ee(this.ptr,et,Ne,st.ptr);return!!ae(Xe)}GetAttributeByUniqueId(De,Ne){return{ptr:de(this.ptr,De.ptr,Ne)}}GetTrianglesUInt16Array(De,Ne,st){Ae(this.ptr,De.ptr,Ne,st)}GetTrianglesUInt32Array(De,Ne,st){je(this.ptr,De.ptr,Ne,st)}GetAttributeDataArrayForAllPoints(De,Ne,st,et,Xe){Ce(this.ptr,De.ptr,Ne.ptr,st,et,Xe)}},DT_INT8:Oe(),DT_UINT8:pe(),DT_INT16:Se(),DT_UINT16:He(),DT_UINT32:Be(),DT_FLOAT32:ct()}})}(fetch(_g())),Bu.then(I=>{To=I,Bu=void 0}))}()),w&&v.push(function(){if(pm)return;const I=function(A){let P;const R=WebAssembly.instantiateStreaming(A,{}).then(V=>{P=V.instance,P.exports.__wasm_call_ctors()}),O={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},U={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:R,supported:!0,decodeGltfBuffer(V,G,re,Q,te,ae){(function(ce,Ee,de,Ae,je,Ce,Fe){const Ve=ce.exports.sbrk,Te=Ae+3&-4,Oe=Ve(Te*je),pe=Ve(Ce.length),Se=new Uint8Array(ce.exports.memory.buffer);Se.set(Ce,pe);const He=Ee(Oe,Ae,je,pe,Ce.length);if(He===0&&Fe&&Fe(Oe,Te,je),de.set(Se.subarray(Oe,Oe+Ae*je)),Ve(Oe-Ve(0)),He!==0)throw new Error(`Malformed buffer data: ${He}`)})(P,P.exports[U[te]],V,G,re,Q,P.exports[O[ae]])}}}(fetch(gg()));return I.ready.then(()=>{pm=I})}()),h)for(let I=0;I<h.length;I++)v.push(Yx(h[I],o,I,i));return(v.length?Promise.all(v):Promise.resolve()).then(()=>{if(b&&u)for(const{primitives:I}of u)for(const A of I)Zx(A,o);if(w&&u&&_)for(const I of _)Wx(I,o);return o}
vendor: 5,044 bytes, line 14
14)})}function mm(r){switch(r){case WebGL2RenderingContext.RGBA8: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 _m(r){switch(r){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class gm{constructor(e,i,o,a){this.context=e,this.format=o,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){const o=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:h}=this,{gl:u}=h,{x:f,y:_}=i&&i.position?i.position:{x:0,y:0},g=f+o,v=_+a;!this.size||this.size[0]===g&&this.size[1]===v||(u.bindTexture(u.TEXTURE_2D,null),u.deleteTexture(this.texture),this.texture=u.createTexture(),this.size=null),u.bindTexture(u.TEXTURE_2D,this.texture),h.pixelStoreUnpackFlipY.set(!1),h.pixelStoreUnpack.set(1),h.pixelStoreUnpackPremultiplyAlpha.set(this.format===u.RGBA8&&(!i||i.premultiply!==!1));const b=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&g>0&&v>0){const w=this.useMipmap?Math.floor(Math.log2(Math.max(g,v)))+1:1;u.texStorage2D(u.TEXTURE_2D,w,this.format,g,v),this.size=[g,v]}if(this.size)if(b)u.texSubImage2D(u.TEXTURE_2D,0,f,_,mm(this.format),_m(this.format),e);else{const w=e.data;w&&u.texSubImage2D(u.TEXTURE_2D,0,f,_,o,a,mm(this.format),_m(this.format),w)}this.useMipmap&&u.generateMipmap(u.TEXTURE_2D)}bind(e,i,o=!1){const{context:a}=this,{gl:h}=a;h.bindTexture(h.TEXTURE_2D,this.texture),e!==this.minFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,e),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,this.useMipmap&&!o?e===h.NEAREST?h.NEAREST_MIPMAP_NEAREST:h.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,i),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,o,a,h){const{context:u}=this,{gl:f}=u;f.bindTexture(f.TEXTURE_2D,this.texture),i!==this.magFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,this.useMipmap?e===f.NEAREST?f.NEAREST_MIPMAP_NEAREST:f.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),o!==this.wrapS&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,o),this.wrapS=o),a!==this.wrapT&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,a),this.wrapT=a),h!==this.compareMode&&(h?(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.COMPARE_REF_TO_TEXTURE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_FUNC,h)):f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.NONE),this.compareMode=h)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class Vu{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:o}=this,{gl:a}=o;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}const Kx=$t([{name:"a_pos_3f",components:3,type:"Float32"}]),Jx=$t([{name:"a_color_3f",components:3,type:"Float32"}]),Qx=$t([{name:"a_color_4f",components:4,type:"Float32"}]),ev=$t([{name:"a_uv_2f",components:2,type:"Float32"}]),tv=$t([{name:"a_normal_3f",components:3,type:"Float32"}]),iv=$t([{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"}]),rv=$t([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function Sg(r,e){const i=zp(r.projection,r.zoom,r.width,r.height),o=function(h,u,f,_,g){const v=new S(f.lng-180*Aa,f.lat),b=new S(f.lng+180*Aa,f.lat),w=h.project(v.lng,v.lat),I=h.project(b.lng,b.lat),A=-Math.atan2(I.y-w.y,I.x-w.x),P=J.fromLngLat(f);P.y=W(P.y,-1+Aa,1-Aa);const R=P.toLngLat(),O=h.project(R.lng,R.lat),U=J.fromLngLat(R);U.x+=Aa;const V=U.toLngLat(),G=h.project(V.lng,V.lat),re=Ig(G.x-O.x,G.y-O.y,A),Q=J.fromLngLat(R);Q.y+=Aa;const te=Q.toLngLat(),ae=h.project(te.lng,te.lat),ce=Ig(ae.x-O.x,ae.y-O.y,A),Ee=Math.abs(re.x)/Math.abs(ce.y),de=Bt([]);Mo(de,de,-A*(1-(g?0:_)));const Ae=Bt([]);
vendor: 5,253 bytes, line 14
14return Fr(Ae,Ae,[1,1-(1-Ee)*_,1]),Ae[4]=-ce.x/ce.y*_,Mo(Ae,Ae,A),Gi(Ae,de,Ae),Ae}(r.projection,0,r.center,i,e),a=Eg(r);return Fr(o,o,[a,a,1]),o}function Eg(r){const e=r.projection,i=zp(r.projection,r.zoom,r.width,r.height),o=ym(e,r.center),a=ym(e,S.convert(e.center));return Math.pow(2,o*i+(1-i)*a)}function zp(r,e,i,o,a=1/0){const h=r.range;if(!h)return 0;const u=Math.min(a,Math.max(i,o)),f=Math.log(u/1024)/Math.LN2;return le(h[0]+f,h[1]+f,e)}const Aa=1/4e4;function ym(r,e){const i=W(e.lat,-X,X),o=new S(e.lng-180*Aa,i),a=new S(e.lng+180*Aa,i),h=r.project(o.lng,i),u=r.project(a.lng,i),f=J.fromLngLat(o),_=J.fromLngLat(a),g=u.x-h.x,v=u.y-h.y,b=_.x-f.x,w=_.y-f.y,I=Math.sqrt((b*b+w*w)/(g*g+v*v));return Math.log(I)/Math.LN2}function Ig(r,e,i){const o=Math.cos(i),a=Math.sin(i);return{x:r*o-e*a,y:r*a+e*o}}function Ag(r,e,i){Bt(r),Mo(r,r,ei(e[2])),Ao(r,r,ei(e[0])),ao(r,r,ei(e[1])),Fr(r,r,i),Gi(r,r,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function Rp(r,e,i,o,a,h,u,f){const _=[i[0]-e[0],i[1]-e[1],0],g=[o[0]-e[0],o[1]-e[1],0];if(Cr(_)<1e-12||Cr(g)<1e-12)return uo(r);const v=cr([],_,g);Ri(v,v),cn(g,o,e),_[2]=(h-a)*f,g[2]=(u-a)*f;const b=_;return cr(b,_,g),Ri(b,b),Bs(r,v,b)}function xm(r,e,i=!1){const o=Sa(e.zoom),a=function(h,u,f){const _=u.worldSize,g=[h[12],h[13],h[14]],v=j(g[1]/_),b=N(g[0]/_),w=Bt([]),I=L(1,v)*_,A=L(1,0)*_*ie(v,u.zoom),P=1/Zf(_);let R=A*P;if(f){const G=zp(u.projection,u.zoom,u.width,u.height,1024);R=P*u.projection.pixelSpaceConversion(u.center.lat,_,G)}const O=y(v,b);ki(O,O,Fi([],Ri([],O),I*R*g[2]));const U=function(G){const re=[G[0],G[1],G[2]];let Q=[0,1,0];const te=cr([],Q,re);return cr(Q,re,te),Vl(Q)===0&&(Q=[0,1,0],cr(te,re,Q)),Ri(te,te),Ri(Q,Q),Ri(re,re),[te[0],te[1],te[2],0,Q[0],Q[1],Q[2],0,re[0],re[1],re[2],0,G[0],G[1],G[2],1]}(O);Fr(w,w,[R,R,R*I]),qr(w,w,[-g[0],-g[1],-g[2]]);const V=Gi([],u.globeMatrix,U);return Gi(V,V,w),Gi(V,V,h),V}(r,e,i);if(o>0){const h=function(u,f){const _=f.worldSize,g=L(1,0)*_*ie(f.center.lat,f.zoom)/Zf(_),v=L(1,f.center.lat)*_,b=Bt([]);return ao(b,b,ei(f.center.lng)),Ao(b,b,ei(f.center.lat)),qr(b,b,[0,0,Ur]),Fr(b,b,[g,g,g*v]),qr(b,b,[f.point.x-.5*_,f.point.y-.5*_,0]),Gi(b,b,u),Gi(b,f.globeMatrix,b)}(r,e);return function(u,f,_){const g=(A,P,R)=>{const O=Cr(A),U=Cr(P),V=Rs(A,P,R);return Fi(V,V,1/Cr(V)*ft(O,U,R))},v=g([u[0],u[1],u[2]],[f[0],f[1],f[2]],_),b=g([u[4],u[5],u[6]],[f[4],f[5],f[6]],_),w=g([u[8],u[9],u[10]],[f[8],f[9],f[10]],_),I=Rs([u[12],u[13],u[14]],[f[12],f[13],f[14]],_);return[v[0],v[1],v[2],0,b[0],b[1],b[2],0,w[0],w[1],w[2],0,I[0],I[1],I[2],1]}(a,h,o)}return a}function Mg(r,e,i,o){const a=kt.projectAabbCorners(o,i);let h=Number.MAX_VALUE,u=-1;for(let g=0;g<a.length;++g){const v=a[g];v[0]=(.5*v[0]+.5)*e.width,v[1]=(.5-.5*v[1])*e.height,v[2]<h&&(u=g,h=v[2])}const f=g=>new ke(a[g][0],a[g][1]);let _;switch(u){case 0:case 6:_=[f(1),f(5),f(4),f(7),f(3),f(2),f(1)];break;case 1:case 7:_=[f(0),f(4),f(5),f(6),f(2),f(3),f(0)];break;case 3:case 5:_=[f(1),f(0),f(4),f(7),f(6),f(2),f(1)];break;default:_=[f(1),f(5),f(6),f(7),f(3),f(0),f(1)]}if(yi(r,_))return h}const Ll=64,Xc={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Cg(r,e,i,o,a,h,u,f,_,g=!1){const v=i.zoom,b=i.project(o),w=ie(o.lat,v),I=1/w;Bt(r),qr(r,r,[b.x+u[0]*I,b.y+u[1]*I,u[2]]);let A=1,P=1;const R=i.worldSize;if(g){if(i.projection.name==="mercator"){let G=0;i.elevation&&(G=i.elevation.getAtPointOrZero(new J(b.x/R,b.y/R),0));const re=hn([],[b.x,b.y,G,1],i.projMatrix)[3]/i.cameraToCenterDistance;A=re,P=re*ie(i.center.lat,v)}else if(i.projection.name==="globe"){const G=xm(r,i),re=[0,0,0,1];hn(re,re,Gi([],i.projMatrix,G));const Q=re[3]/i.cameraToCenterDistance,te=Sa(v),ae=i.projection.pixelsPerMeter(o.lat,R)*ie(o.lat,v),ce=i.projection.pixelsPerMeter(i.center.lat,R)*ie(i.center.lat,v);A=Q/ft(ae,ee(i.center.lat),te),P=Q*w/ae,A*=ce,P*=ce}}else A=I;Fr(r,r,[A,A,P]);const O=[...r],U=e.orientation,V=[];if(Ag(V,[U[0]+a[0],U[1]+a[1],U[2]+a[2]],h),Gi(r,O,V),f&&i.elevation){let G=0;const re=[];if(_&&i.elevation){G=function(te,ae,ce,Ee,de){const Ae=ae.elevation;if(!Ae)return 0;const je=kt.projectAabbCorners(ce,Ee),Ce=L(1,de.lat)*ae.worldSize,Fe=function(Ne,st){const et=[0,0,1],Xe=[{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 tt of Xe){const _t=Ne[tt.corners[0]],Tt=Ne[tt.corners[1]],Mt=Ne[tt.corners[2]],It=[Tt[0]-_t[0],Tt[1]-_t[1],st*(Tt[2]-_t[2])],qt=cr(It,It,[Mt[0]-_t[0],Mt[1]-_t[1],st*(Mt[2]-_t[2])]);Ri(qt,qt),tt.dotProductWithUp=er(qt,et)}return Xe.sort((tt,_t)=>tt.dotProductWithUp-_t.dotProductWithUp),Xe[0].corners}(je,Ce),Ve=je[Fe[0]],Te=je[Fe[1]],Oe=je[Fe[2]],pe=je[Fe[3]],Se=Ae.getAtPointOrZero(new J(Ve[0]/ae.worldSize,Ve[1]/ae.worldSize),0),He=Ae.getAtPointOrZero(new J(Te[0]/ae.worldSize,Te[1]/ae.worldSize),0),Be=Ae.getAtPointOrZero(new J(Oe[0]/ae.worldSize,Oe[1]/ae.worldSize),0),ct=Ae.getAtPointOrZero(new J(pe[0]/ae.worldSize,pe[1]/ae.worldSize),0),nt=(Se+ct)/2,De=(He+Be)/2;return nt>De?He<Be?Rp(te,Te,pe,Ve,He,ct,Se,Ce):Rp(te,Oe,Ve,pe,Be,Se,ct,Ce):Se<ct?Rp(te,Ve,Te,Oe,Se,He,Be,Ce):Rp(te,pe,Oe,Te,ct,Be,He,Ce),Math.max(nt,De)}(re,i,e.aabb,r,o);
14const Q=Gi([],Co([],re),V);Gi(r,O,Q)}else G=i.elevation.getAtPointOrZero(new J(b.x/R,b.y/R),0);G!==0&&(r[14]+=G)}}function Uu(r,e,i=!1){r.uploaded||(r.gfxTexture=new gm(e,r.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:r.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),r.uploaded=!0,r.image=null)}function nv(r,e,i){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,Kx.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,tv.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,ev.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?Jx:Qx).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,rv.members,!0)),r.segments=Ni.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const o=r.material;o.pbrMetallicRoughness.baseColorTexture&&Uu(o.pbrMetallicRoughness.baseColorTexture,e),o.pbrMetallicRoughness.metallicRoughnessTexture&&Uu(o.pbrMetallicRoughness.metallicRoughnessTexture,e),o.normalTexture&&Uu(o.normalTexture,e),o.occlusionTexture&&Uu(o.occlusionTexture,e,i),o.emissionTexture&&Uu(o.emissionTexture,e)}function vm(r,e,i){if(r.meshes)for(const o of r.meshes)nv(o,e,i);if(r.children)for(const o of r.children)vm(o,e,i)}function Dp(r){if(r.meshes)for(const e of r.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(r.children)for(const e of r.children)Dp(e)}function bm(r){if(r.meshes)for(const i of r.meshes)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()));var e;if(r.children)for(const i of r.children)bm(i)}function Fl(r,e){const i=r.json.bufferViews[e.bufferView],o=Cp[e.componentType];return new o(r.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==Nu[e.type]*o.BYTES_PER_ELEMENT?i.byteStride/o.BYTES_PER_ELEMENT:Nu[e.type]))}function wm(r,e,i,o){const a=Cp[e.componentType],h=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}}(a),u=r.json.bufferViews[e.bufferView],f=u.byteStride?u.byteStride/a.BYTES_PER_ELEMENT:Nu[e.type],_=i.float32,g=_.length/i.capacity;for(let v=0,b=0;v<e.count*f;v+=f,b+=g)for(let w=0;w<g;w++)_[b+w]=o[v+w]*h;i._trim()}function ov(r,e,i){const o=r.indices,a=r.attributes,h={};h.indexArray=new Li;const u=e.json.accessors[o],f=u.count/3;h.indexArray.reserve(f);const _=Fl(e,u);for(let w=0;w<f;w++)h.indexArray.emplaceBack(_[3*w],_[3*w+1],_[3*w+2]);h.indexArray._trim(),h.vertexArray=new En;const g=e.json.accessors[a.POSITION];h.vertexArray.reserve(g.count);const v=Fl(e,g);for(let w=0;w<g.count;w++)h.vertexArray.emplaceBack(v[3*w],v[3*w+1],v[3*w+2]);if(h.vertexArray._trim(),h.aabb=new kt(g.min,g.max),h.centroid=function(w,I){const A=[0,0,0],P=w.length;if(P>0){for(let R=0;R<P;R++){const O=3*w[R];A[0]+=I[O],A[1]+=I[O+1],A[2]+=I[O+2]}A[0]/=P,A[1]/=P,A[2]/=P}return A}(_,v),a.COLOR_0!==void 0){const w=e.json.accessors[a.COLOR_0],I=Nu[w.type],A=Fl(e,w);h.colorArray=I===3?new En:new ts,h.colorArray.resize(w.count),wm(e,w,h.colorArray,A)}if(a.NORMAL!==void 0){h.normalArray=new En;const w=e.json.accessors[a.NORMAL];h.normalArray.resize(w.count);
vendor: 6,838 bytes, line 14
14const I=Fl(e,w);wm(e,w,h.normalArray,I)}if(a.TEXCOORD_0!==void 0&&i.length>0){h.texcoordArray=new is;const w=e.json.accessors[a.TEXCOORD_0];h.texcoordArray.resize(w.count);const I=Fl(e,w);wm(e,w,h.texcoordArray,I)}if(a._FEATURE_ID_RGBA4444!==void 0){const w=e.json.accessors[a._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(h.featureData=Fl(e,w))}a._FEATURE_RGBA4444!==void 0&&(h.featureData=new Uint32Array(Fl(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const b=r.material;return h.material=function(w,I){const{emissiveFactor:A=[0,0,0],alphaMode:P="OPAQUE",alphaCutoff:R=.5,normalTexture:O,occlusionTexture:U,emissiveTexture:V,doubleSided:G}=w,{baseColorFactor:re=[1,1,1,1],metallicFactor:Q=1,roughnessFactor:te=1,baseColorTexture:ae,metallicRoughnessTexture:ce}=w.pbrMetallicRoughness||{},Ee=U?I[U.index]:void 0;if(U&&U.extensions&&U.extensions.KHR_texture_transform&&Ee){const de=U.extensions.KHR_texture_transform;Ee.offsetScale=[de.offset[0],de.offset[1],de.scale[0],de.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new li(...re),metallicFactor:Q,roughnessFactor:te,baseColorTexture:ae?I[ae.index]:void 0,metallicRoughnessTexture:ce?I[ce.index]:void 0},doubleSided:G,emissiveFactor:new li(...A),alphaMode:P,alphaCutoff:R,normalTexture:O?I[O.index]:void 0,occlusionTexture:Ee,emissionTexture:V?I[V.index]:void 0,defined:w.defined===void 0}}(b!==void 0?e.json.materials[b]:{defined:!1},i),h}function Pg(r,e,i){const{matrix:o,rotation:a,translation:h,scale:u,mesh:f,extras:_,children:g}=r,v={};if(v.matrix=o||function(b,w,I,A){var P=w[0],R=w[1],O=w[2],U=w[3],V=P+P,G=R+R,re=O+O,Q=P*V,te=P*G,ae=P*re,ce=R*G,Ee=R*re,de=O*re,Ae=U*V,je=U*G,Ce=U*re,Fe=A[0],Ve=A[1],Te=A[2];return b[0]=(1-(ce+de))*Fe,b[1]=(te+Ce)*Fe,b[2]=(ae-je)*Fe,b[3]=0,b[4]=(te-Ce)*Ve,b[5]=(1-(Q+de))*Ve,b[6]=(Ee+Ae)*Ve,b[7]=0,b[8]=(ae+je)*Te,b[9]=(Ee-Ae)*Te,b[10]=(1-(Q+ce))*Te,b[11]=0,b[12]=I[0],b[13]=I[1],b[14]=I[2],b[15]=1,b}([],a||[0,0,0,1],h||[0,0,0],u||[1,1,1]),f!==void 0){v.meshes=i[f];const b=v.anchor=[0,0];for(const w of v.meshes){const{min:I,max:A}=w.aabb;b[0]+=I[0]+A[0],b[1]+=I[1]+A[1]}b[0]=Math.floor(b[0]/v.meshes.length/2),b[1]=Math.floor(b[1]/v.meshes.length/2)}if(_&&(_.id&&(v.id=_.id),_.lights&&(v.lights=function(b){if(!b.length)return[];const w=function(O){const U=atob(O),V=new Uint8Array(U.length);for(let G=0;G<U.length;G++)V[G]=U.codePointAt(G);return V}(b),I=[],A=w.length/24,P=new Uint16Array(w.buffer),R=new Float32Array(w.buffer);for(let O=0;O<A;O++){const U=P[2*O*6]/30,V=P[2*O*6+1]/30,G=P[2*O*6+10]/100,re=R[6*O+1],Q=R[6*O+2],te=R[6*O+3],ae=R[6*O+4],ce=te-re,Ee=ae-Q,de=Math.hypot(ce,Ee);I.push({pos:[re+.5*ce,Q+.5*Ee,V],normal:[Ee/de,-ce/de,0],width:de,height:U,depth:G,points:[re,Q,te,ae]})}return I}(_.lights))),g){const b=[];for(const w of g)b.push(Pg(e.json.nodes[w],e,i));v.children=b}return v}function sv(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new bp(r.vertices,r.indices,8,256),[i,o]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:i,max:o}}function av(r){if(!r.extras||!r.extras.ground)return null;const e=r.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const o=[];for(const u of i){if(!Array.isArray(u)||u.length!==2)continue;const f=u[0],_=u[1];typeof f=="number"&&typeof _=="number"&&o.push(new ke(f,_))}if(o.length<3)return null;o.length>1&&o[o.length-1].equals(o[0])&&o.pop();let a=0;for(let u=0;u<o.length;u++){const f=o[u],_=o[(u+1)%o.length],g=o[(u+2)%o.length];a+=(f.x-_.x)*(g.y-_.y)-(g.x-_.x)*(f.y-_.y)}a>0&&o.reverse();const h=Gc(o.flatMap(u=>[u.x,u.y]),[]);return h.length===0?null:{vertices:o,indices:h}}function lv(r,e){const i=[],o=[];let a=0;const h=[];for(const u of r){a=i.length;const f=u.vertexArray.float32,_=u.indexArray.uint16;for(let g=0;g<u.vertexArray.length;g++)h[0]=f[3*g+0],h[1]=f[3*g+1],h[2]=f[3*g+2],tr(h,h,e),i.push(new ke(h[0],h[1]));for(let g=0;g<3*u.indexArray.length;g++)o.push(_[g]+a)}if(o.length%3!=0)return null;for(let u=0;u<o.length;u+=3){const f=i[o[u+0]],_=i[o[u+1]],g=i[o[u+2]];(f.x-_.x)*(g.y-_.y)-(g.x-_.x)*(f.y-_.y)>0&&([o[u+1],o[u+2]]=[o[u+2],o[u+1]])}return{vertices:i,indices:o}}function zg(r){const e=function(_,g){const v=[],b=WebGL2RenderingContext;if(_.json.textures)for(const w of _.json.textures){const I={magFilter:b.LINEAR,minFilter:b.NEAREST,wrapS:b.REPEAT,wrapT:b.REPEAT};w.sampler!==void 0&&Object.assign(I,_.json.samplers[w.sampler]),v.push({image:g[w.source],sampler:I,uploaded:!1})}return v}(r,r.images),i=function(_,g){const v=[];for(const b of _.json.meshes){const w=[];for(const I of b.primitives)w.push(ov(I,_,g));v.push(w)}return v}(r,e),{scenes:o,scene:a,nodes:h}=r.json,u=o?o[a||0].nodes:h,f=[];for(const _ of u)f.push(Pg(h[_],r,i));return function(_,g,v){const b={},w=new Set;for(let I=0;I<_.length;I++){const A=v[g[I]];if(!A.extras)continue;const P=A.extras["mapbox:footprint:version"],R=A.extras["mapbox:footprint:id"];(P||R)&&w.add(I),P==="1.0.0"&&R&&(b[R]=I)}for(let I=0;I<_.length;I++){if(w.has(I))continue;const A=_[I],P=v[g[I]];if(!P.extras)continue;let R=null;A.id in b&&(R=lv(_[b[A.id]].meshes,A.matrix)),R||(R=av(P)),R&&(A.footprint=sv(R))}if(w.size>0){const I=Array.from(w.values()).sort((A,P)=>A-P);for(let A=I.length-1;A>=0;A--)_.splice(I[A],1)}}(f,u,r.json.nodes),f}function cv(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,i=r.aabb.min[0]-1,o=r.aabb.min[1]-1,a=Ll/(r.aabb.max[0]-i+2),h=Ll/(r.aabb.max[1]-o+2);for(let u=0;u<e.length;u+=3){const f=e[u+2],_=(e[u+0]-i)*a|0,g=(e[u+1]-o)*h|0;f>r.heightmap[g*Ll+_]&&(r.heightmap[g*Ll+_]=f)}}function Rg(r,e,i,o,a){i.reserve(i.length+4*r.length),o.reserve(o.length+10*r.length),a.reserve(a.length+10*r.length);let h=o.length;for(const u of r){const f=Math.min(10,Math.max(4,1.3*u.height))*e,_=[-u.normal[1],u.normal[0],0],g=Math.min(.29,.1*u.width/u.depth),v=u.width-2*u.depth*e*(g+.01),b=Hr([],u.pos,_,v/2),w=Hr([],u.pos,_,-v/2),I=[b[0],b[1],b[2]+u.height],A=[w[0],w[1],w[2]+u.height],P=Hr([],u.normal,_,g);Fi(P,P,f);const R=Hr([],u.normal,_,-g);Fi(R,R,f),ki(P,b,P),ki(R,w,R),b[2]+=.1,w[2]+=.1,o.emplaceBack(P[0],P[1],P[2]),o.emplaceBack(R[0],R[1],R[2]),o.emplaceBack(b[0],b[1],b[2]),o.emplaceBack(w[0],w[1],w[2]),o.emplaceBack(I[0],I[1],I[2]),o.emplaceBack(A[0],A[1],A[2]),o.emplaceBack(b[0],b[1],b[2]),o.emplaceBack(w[0],w[1],w[2]),o.emplaceBack(P[0],P[1],P[2]),o.emplaceBack(R[0],R[1],R[2]);const O=v/f/2;a.emplaceBack(-O-g,-1,O,.8),a.emplaceBack(O+g,-1,O,.8),a.emplaceBack(-O,0,O,1.3),a.emplaceBack(O,0,O,1.3),a.emplaceBack(O+g,-.8,O,.7),a.emplaceBack(O+g,-.8,O,.7),a.emplaceBack(0,0,O,1.3),a.emplaceBack(0,0,O,1.3),a.emplaceBack(O+g,-1.2,O,.8),a.emplaceBack(O+g,-1.2,O,.8),i.emplaceBack(6+h,4+h,8+h),i.emplaceBack(7+h,9+h,5+h
14),i.emplaceBack(0+h,1+h,2+h),i.emplaceBack(1+h,3+h,2+h),h+=10}}function hv(r,e){const i={};i.indexArray=new Li,i.vertexArray=new En,i.colorArray=new ts,Rg(r,e,i.indexArray,i.vertexArray,i.colorArray);const o={defined:!0};o.emissiveFactor=li.black;const a={};return a.baseColorFactor=li.white,o.pbrMetallicRoughness=a,i.material=o,i.aabb=new kt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const Dg=$t([{name:"a_pos_3f",components:3,type:"Float32"}]),uv=$t([{name:"a_normal_3",components:3,type:"Int16"}]),Lg=$t([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),dv=$t([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),Fg=_e.types,Tm=32767;function pv(r,e){const i=We+e;for(const o of r)for(const a of o)if(a.x<-e||a.x>i||a.y<-e||a.y>i)return!1;return!0}class Og{constructor(e){this.layoutAOArray=[],this.indexArrayForConflationUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.featuresOnBorder=[],this.buildingFeatures=[],this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.layoutVertexArray=new En,this.layoutNormalArray=new da,this.layoutColorArray=new io,this.indexArray=new Li,this.indexArrayForConflation=new Li,this.entranceBloom={layoutVertexArray:new En,layoutVertexBuffer:null,layoutAttenuationArray:new ts,layoutAttenuationBuffer:null,layoutColorArray:new io,layoutColorBuffer:null,indexArray:new Li,indexArrayForConflation:new Li,indexBuffer:null,segmentsBucket:new Ni},this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut}),this.segmentsBucket=new Ni,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.groundEffect=new lm(e)}get segments(){return this.segmentsBucket}get bloomGeometry(){return this.entranceBloom}updateFootprints(e,i){for(const o of this.footprints)i.push({footprint:o,id:e})}prepare(){return function(){if(Mp!=null||mg!=null)return null;if(Wc!=null)return Wc;const e=fetch(Ar.BUILDING_GEN_URL);return Wc=function(i){let o,a,h,u;function f(){o=new Uint8Array(u.buffer),a=new Int32Array(u.buffer),h=new Float32Array(u.buffer)}function _(){throw new Error("Unexpected BuildingGen error.")}const g=()=>{},v={a:{a:_,f:function(b){const w=o.length,I=Math.max(b>>>0,Math.ceil(1.2*w)),A=Math.ceil((I-w)/65536);try{return u.grow(A),f(),!0}catch{return!1}},g:_,b:g,c:g,d:g,e:g}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,v):i.then(b=>b.arrayBuffer()).then(b=>WebAssembly.instantiate(b,v))).then(b=>{const w=b.instance.exports;return(0,w.g)(),u=w.f,f(),new qx({setStyle:w.h,setAOOptions:w.i,setMetricOptions:w.j,setStructuralOptions:w.k,setFacadeOptions:w.l,setFauxFacadeOptions:w.m,setFacadeClassifierOptions:w.n,addFeature:w.o,addFacade:w.p,generateMesh:w.q,getLastError:w.r,getMeshCount:w.s,getPositionsPtr:w.t,getPositionsLength:w.u,getNormalsPtr:w.v,getNormalsLength:w.w,getColorsPtr:w.x,getColorsLength:w.y,getAOPtr:w.z,getAOLength:w.A,getUVPtr:w.B,getUVLength:w.C,getFauxFacadePtr:w.D,getFauxFacadeLength:w.E,getIndicesPtr:w.F,getIndicesLength:w.G,getBuildingPart:w.H,getRingCount:w.I,getRingPtr:w.J,getRingLength:w.K,free:w.L,malloc:w.M,heapU8:o,heap32:a,heapF32:h})})}(e).then(i=>(Wc=null,Mp=i,Mp)).catch(i=>{Gt("Could not load building-gen"),Wc=null,mg=i}),Wc}()}populate(e,i,o,a){const h=Hx();if(!h)return;const u=K(o);this.tileToMeter=u,this.brightness=i.brightness,h.setStyle({convertToMeters:!1,entranceColorRgb:[1,1,1],facadeGlazingColorRgb:[.5607843137254902,.6745098039215687,.7215686274509804],normalScale:[1,-1,u],ridgeHeight:3,roofColorRgb:[.886274516,.784313738,.713725507],tileToMeters:u,tileZoom:16,wallColorRgb:[.988235294,.933333337,.811764717]}),h.setAOOptions(!1,.3),h.setMetricOptions(!1,16),h.setStructuralOptions(!0),h.setFacadeOptions(4,!0),h.setFauxFacadeOptions(!1,!1,1),h.setFacadeClassifierOptions(3);const f=new Map;for(const{feature:_}of e){if(Fg[_.type]!=="LineString")continue;const g=this.layers[0]._featureFilter.needGeometry,v=we(_,g);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),v,o))continue;const b=g?v.geometry:oe(_,o,a),w=[];for(const R of b)for(const O of R)w.push({x:O.x,y:O.y});const I={coordinates:w,crossPerc:_.properties.cross_perc,distanceToRoad:_.properties.distance_to_road,entrances:_.properties.entrances,sourceId:0},A=_.properties.source_id;let P=f.get(A);P||(P=[],f.set(A,P)),P.push(I)}this.maxHeight=0;for(const{feature:_,index:g}of e){if(Fg[_.type]==="LineString")continue;const v=this.layers[0]._featureFilter.needGeometry,b=we(_,v);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom),b,o))continue;const w=v?b.geometry:oe(_,o,a),I=Pu(w,500);if(!pv(w,163))continue;const A=this.layers[0],P=A.layout.get("building-base").evaluate(_,{},o),R=A.layout.get("building-height").evaluate(_,{},o),O=A.layout.get("building-roof-shape").evaluate(_,{},o),U=A.paint.get("building-ambient-occlusion-intensity"),V=A.paint.get("building-ambient-occlusion-ground-radius")/this.tileToMeter;if(O==="flat")continue;const G=_.properties.source_id;let re;re=f.has(G)?f.get(G):[];const Q=[],te=new ke(1/0,1/0),ae=new ke(-1/0,-1/0);for(const De of I)if(De.length>0){const Ne=[];for(const st of De){const et=[];for(let Xe=st.length-1;Xe>=0;Xe--){const tt=st[Xe];et.push({x:tt.x,y:tt.y}),te.x=Math.min(te.x,tt.x),te.y=Math.min(te.y,tt.y),ae.x=Math.max(ae.x,tt.x),ae.y=Math.max(ae.y,tt.y)}Ne.push(et)}Q.push({id:_.id,height:R,minHeight:P,sourceId:0,roofType:O,coordinates:Ne})}const ce=h.generateMesh(Q,re);if(typeof ce=="string"||ce.meshes.length===0||ce.modifiedPolygonRings.length===0)continue;let Ee=0;for(const De of ce.meshes)Ee+=De.positions.length/3;const de=this.segmentsBucket.prepareSegment(Ee,this.layoutVertexArray,this.indexArray),Ae=[];let je=null,Ce=0,Fe=-1;const Ve=this.indexArray.length;let Te=0;for(const De of ce.meshes){const Ne=this.layoutVertexArray.length;if(De.buildingPart==="entrance"){const et=new Array;for(let Tt=0;Tt<De.indices.length;Tt+=12){const Mt=De.positions[Tt+0],It=De.positions[Tt+1],qt=De.positions[Tt+3],Lt=De.positions[Tt+4],Ii=De.positions[Tt+2],H=De.positions[Tt+8]-Ii,$=1,be=qt-Mt,$e=Lt-It,Ke=Math.hypot(be,$e);et.push({pos:[Mt+.5*be,It+.5*$e,Ii],normal:[$e/Ke,-be/Ke,0],width:Ke,height:H,depth:$,points:[Mt,It,qt,Lt]})}const Xe=this.entranceBloom.segmentsBucket.prepareSegment(10*et.length,this.entranceBloom.layoutVertexArray,this.entranceBloom.indexArray),tt=this.entranceBloom.layoutVertexArray.length;Ce=this.entranceBloom.indexArray.length,Rg(et,.5/this.tileToMeter,this.entranceBloom.indexArray,this.entranceBloom.layoutVertexArray,this.entranceBloom.layoutAttenuationArray);const _t=this.entranceBloom.layoutVertexArray.length-tt;Fe=this.entranceBloom.indexArray.length-Ce;for(let Tt=0;Tt<_t;Tt++)this.entranceBloom.layoutColorArray.emplaceBack(65535,65535);Xe.vertexLength+=_t,Xe.primitiveLength+=Fe,je={part:De.buildingPart,vertexOffset:tt,vertexLength:_t}}for(let et=0;et<De.positions.length;et+=3)Te=Math.max(Te,De.positions[et+2]),this.layoutVertexArray.emplaceBack(De.positions[et],De.positions[et+1],De.positions[et+2]);for(let et=0;et<De.normals.length;et+=3)this.layoutNormalArray.emplaceBack(De.normals[et+0]*Tm,De.normals[et+1]*Tm,De.normals[et+2]*Tm);for(let et=0;et<De.ao.length;et++)this.layoutAOArray.push(De.ao[et]);for(let et=0;et<De.colors.length;et+=3){const Xe=1+(De.ao[et/3]-1)*U;this.layoutColorArray.emplaceBack(De.colors[et]*Xe<<8|De.colors[et+1]*Xe,De.colors[et+2]*Xe<<8)}const st=de.vertexLength;for(let et=0;et<De.indices.length;et+=3)this.indexArray.emplaceBack(st+De.indices[et],st+De.indices[et+1],st+De.indices[et+2]);de.vertexLength+=De.positions.length/3,de.primitiveLength+=De.indices.length/3,(De.buildingPart==="roof"||De.buildingPart==="wall"||De.buildingPart==="facade_glazing"||De.buildingPart==="entrance")&&Ae.push({part:De.buildingPart,vertexOffset:Ne,vertexLength:De.positions.length/3})}this.maxHeight=Math.max(this.maxHeight,Te),this.buildingFeatures.push({feature:b,segment:de,parts:Ae,buildingBloom:je});const Oe=this.indexArray.length-Ve,pe=[],Se=[],He=new ke(1/0,1/0),Be=new ke(-1/0,-1/0),ct=this.groundEffect.vertexArray.length;for(const De of ce.modifiedPolygonRings){const Ne=[],st=new ke(1/0,1/0),et=new ke(-1/0,-1/0);for(let Xe=0;Xe<De.length;Xe+=2){const tt=De.length-Xe-2;st.x=Math.min(st.x,De[tt]),st.y=Math.min(st.y,De[tt+1]),et.x=Math.max(et.x,De[tt]),et.y=Math.max(et.y,De[tt+1]);const _t=new ke(De[tt],De[tt+1]);Ne.push(_t),pe.push(_t.x,_t.y),Se.push(_t.clone())}He.x=Math.min(He.x,st.x),He.y=Math.min(He.y,st.y),Be.x=Math.max(Be.x,et.x),Be.y=Math.max(Be.y,et.y),this.groundEffect.addData(Ne,[st,et],V)}const nt=this.groundEffect.vertexArray.length-ct;(te.x<0||ae.x>We||te.y<0||ae.y>We)&&this.featuresOnBorder.push({featureId:_.id,footprintIndex:this.footprints.length});{const De=Gc(pe,null,2),Ne=new bp(Se,De,8,256);let st=_.id;_.properties&&_.properties.hasOwnProperty("building_id")&&(st=_.properties.building_id),this.footprints.push({vertices:Se,indices:De,grid:Ne,min:He,max:Be,buildingId:st,hiddenFlags:0,indicesOffset:Ve,indicesLength:Oe,bloomIndicesOffset:Ce,bloomIndicesLength:Fe,groundEffectVertexOffset:ct,groundEffectVertexLength:nt,segment:de,height:Te})}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,_,g,{},i.availableImages,o,i.brightness),this.groundEffect.addPaintPropertiesData(_,g,{},i.availableImages,o,i.brightness)}this.groundEffect.prepareBorderSegments(),this.evaluate(this.layers[0])}update(e,i,o,a,h,u,f){this.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f),this.groundEffect.update(e,i,h,o,a,u,f)}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,Dg.members),this.layoutNormalBuffer=e.createVertexBuffer(this.layoutNormalArray,uv.members),this.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(this.entranceBloom.layoutVertexArray,Dg.members),this.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(this.entranceBloom.layoutAttenuationArray,dv.members),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.layoutNormalBuffer.destroy(),this.layoutColorBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segmentsBucket.destroy(),this.entranceBloom.layoutVertexBuffer.destroy(),this.entranceBloom.layoutColorBuffer.destroy(),this.entranceBloom.layoutAttenuationBuffer.destroy(),this.entranceBloom.indexBuffer.destroy(),this.entranceBloom.segmentsBucket.destroy())}updateFootprintHiddenFlags(e,i,o=!0){let a=!1;
14const h=o?i:0,u=0|(o?-1:~i);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const f of e){const _=this.footprints[f],g=_.hiddenFlags&u|h;_.hiddenFlags!==g&&(_.hiddenFlags=g,a=!0,this.groundEffect.updateHiddenByLandmarkRange(_.groundEffectVertexOffset,_.groundEffectVertexLength,_.hiddenFlags!==0))}return a&&(this.indexArrayForConflationUploaded=!1),a}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),!this.indexArrayForConflationUploaded&&this.indexArray.length!==0){this.indexArrayForConflation.resize(this.indexArray.length),this.indexArrayForConflation.uint16.set(this.indexArray.uint16),this.entranceBloom.indexArrayForConflation.resize(this.entranceBloom.indexArray.length),this.entranceBloom.indexArrayForConflation.uint16.set(this.entranceBloom.indexArray.uint16);for(const i of this.footprints){const o=i.indicesOffset+i.indicesLength;if(i.hiddenFlags!==0){for(let h=i.indicesOffset;h<o;h++)this.indexArrayForConflation.uint16[3*h+0]=0,this.indexArrayForConflation.uint16[3*h+1]=0,this.indexArrayForConflation.uint16[3*h+2]=0;const a=i.bloomIndicesOffset+i.bloomIndicesLength;for(let h=i.bloomIndicesOffset;h<a;h++)this.entranceBloom.indexArrayForConflation.uint16[3*h+0]=0,this.entranceBloom.indexArrayForConflation.uint16[3*h+1]=0,this.entranceBloom.indexArrayForConflation.uint16[3*h+2]=0}}this.indexBuffer?this.indexBuffer.updateData(this.indexArrayForConflation):this.indexBuffer=e.createIndexBuffer(this.indexArrayForConflation,!0),this.entranceBloom.indexBuffer?this.entranceBloom.indexBuffer.updateData(this.entranceBloom.indexArrayForConflation):this.entranceBloom.indexBuffer=e.createIndexBuffer(this.entranceBloom.indexArrayForConflation,!0),this.indexArrayForConflationUploaded=!0}}uploadUpdatedColorBuffer(e){this.layoutColorBuffer?this.layoutColorBuffer.updateData(this.layoutColorArray):this.layoutColorBuffer=e.createVertexBuffer(this.layoutColorArray,Lg.members,!0),this.entranceBloom.layoutColorBuffer?this.entranceBloom.layoutColorBuffer.updateData(this.entranceBloom.layoutColorArray):this.entranceBloom.layoutColorBuffer=e.createVertexBuffer(this.entranceBloom.layoutColorArray,Lg.members,!0)}evaluate(e){const i=e.paint.get("building-ambient-occlusion-intensity");for(const o of this.buildingFeatures){const a=o.feature;a.properties["building-part"]="roof";const h=e.paint.get("building-color").evaluate(a,{},this.canonical),u=e.paint.get("building-emissive-strength").evaluate(a,{},this.canonical);a.properties["building-part"]="wall";const f=e.paint.get("building-color").evaluate(a,{},this.canonical),_=e.paint.get("building-emissive-strength").evaluate(a,{},this.canonical);a.properties["building-part"]="window";const g=e.paint.get("building-color").evaluate(a,{},this.canonical),v=e.paint.get("building-emissive-strength").evaluate(a,{},this.canonical);a.properties["building-part"]="door";const b=e.paint.get("building-color").evaluate(a,{},this.canonical),w=e.paint.get("building-emissive-strength").evaluate(a,{},this.canonical);for(const A of o.parts){let P,R=h;A.part==="roof"?(R=h,P=u):A.part==="wall"?(R=f,P=_):A.part==="facade_glazing"?(R=g,P=v):A.part==="entrance"&&(R=b,P=w),P=W(P,0,1);for(let O=0;O<A.vertexLength;O++){const U=A.vertexOffset+O,V=1+(this.layoutAOArray[U]-1)*i;this.layoutColorArray.emplace(U,R.r*V*255<<8|R.g*V*255,R.b*V*255<<8|255*P)}}const I=o.buildingBloom;if(I)for(let A=0;A<I.vertexLength;A++)this.bloomGeometry.layoutColorArray.emplace(I.vertexOffset+A,255*b.r<<8|255*b.g,255*b.b<<8|51*w)}}needsEvaluation(e,i){const o=e.transform.projectionOptions,a=e.style.getBrightness();return!(this.uploaded&&o.name===this.projection.name&&this.brightness===a||(this.projection=o,this.brightness=a,0))}updateReplacement(e,i,o){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(Tp(this.activeReplacements,a))return;this.activeReplacements=a;for(const u of this.footprints)u.hiddenFlags&=-2;const h=[];for(const u of this.activeReplacements){if(u.order<=U_)continue;const f=Math.max(1,Math.pow(2,u.footprintTileId.canonical.z-e.canonical.z));for(const _ of this.footprints)_.min.x>u.max.x||_.max.x<u.min.x||_.min.y>u.max.y||_.max.y<u.min.y||(h.length=0,fv(_.vertices,0,_.vertices.length,u.footprintTileId.canonical,e.canonical,h),nm(u.footprint,h,_.indices,0,_.
vendor: 15,767 bytes, line 14
14indices.length,0,-f)&&(_.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const u of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(u.groundEffectVertexOffset,u.groundEffectVertexLength,u.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getHeightAtTileCoord(e,i){let o=Number.NEGATIVE_INFINITY,a=!0;const h=4*(e+We)*We+(i+We);if(this.footprintLookup.hasOwnProperty(h)){const f=this.footprintLookup[h];return f?{height:f.height,hidden:f.hiddenFlags!==0}:void 0}const u=new ke(e,i);for(const f of this.footprints)e>f.max.x||f.min.x>e||i>f.max.y||f.min.y>i||f.height<=o||om(u,f)&&(o=f.height,this.footprintLookup[h]=f,a=f.hiddenFlags!==0);if(o!==Number.NEGATIVE_INFINITY)return{height:o,hidden:a};this.footprintLookup[h]=void 0}}function fv(r,e,i,o,a,h){const u=Math.pow(2,o.z-a.z);for(let f=0;f<i;f++){let _=r[f+e].x,g=r[f+e].y;_=(_+a.x*We)*u-o.x*We,g=(g+a.y*We)*u-o.y*We,h.push(new ke(_,g))}}let kg,Bg;rt(Og,"BuildingBucket",{omit:["layers"]});const mv=$t([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),_v=$t([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:gv}=mv,yv=$t([{name:"a_packed",components:3,type:"Float32"}]),{members:xv}=yv,vv=$t([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:bv}=vv;class Ng{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new Ea({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const o=this.getKey(e,i);return this.positions[o]}trim(){const e=this.width,i=this.height=pt(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,o){const a=[];let h=e.length%2==1?-e[e.length-1]*o:0,u=e[0]*o,f=!0;a.push({left:h,right:u,isDash:f,zeroLength:e[0]===0});let _=e[0];for(let g=1;g<e.length;g++){f=!f;const v=e[g];h=_*o,_+=v,u=_*o,a.push({left:h,right:u,isDash:f,zeroLength:v===0})}return a}addRoundDash(e,i,o){const a=i/2;for(let h=-o;h<=o;h++){const u=this.width*(this.nextRow+o+h);let f=0,_=e[f];for(let g=0;g<this.width;g++){g/_.right>1&&(_=e[++f]);const v=Math.abs(g-_.left),b=Math.abs(g-_.right),w=Math.min(v,b);let I;const A=h/o*(a+1);if(_.isDash){const P=a-Math.abs(A);I=Math.sqrt(w*w+P*P)}else I=a-Math.sqrt(w*w+A*A);this.image.data[u+g]=Math.max(0,Math.min(255,I+128))}}}addRegularDash(e,i){for(let _=e.length-1;_>=0;--_){const g=e[_],v=e[_+1];g.zeroLength?e.splice(_,1):v&&v.isDash===g.isDash&&(v.left=g.left,e.splice(_,1))}const o=e[0],a=e[e.length-1];o.isDash===a.isDash&&(o.left=a.left-this.width,a.right=o.right+this.width);const h=this.width*this.nextRow;let u=0,f=e[u];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++u]);const g=Math.abs(_-f.left),v=Math.abs(_-f.right),b=Math.min(g,v);this.image.data[h+_]=Math.max(0,Math.min(255,(f.isDash?b:-b)+i+128))}}addDash(e,i){const o=this.getKey(e,i);if(this.positions[o])return this.positions[o];const a=i==="round",h=a?7:0,u=2*h+1;if(this.nextRow+u>this.height)return Gt("LineAtlas out of space"),null;e.length===0&&e.push(1);let f=0;for(let v=0;v<e.length;v++)e[v]<0&&(Gt("Negative value is found in line dasharray, replacing values with 0"),e[v]=0),f+=e[v];if(f!==0){const v=this.width/f,b=this.getDashRanges(e,this.width,v);a?this.addRoundDash(b,v,h):this.addRegularDash(b,i==="square"?.5*v:0)}const _=this.nextRow+h;this.nextRow+=u;const g={tl:[_,h],br:[f,0]};return this.positions[o]=g,g}}rt(Ng,"LineAtlas");const wv=_e.types,Tv=Math.cos(Math.PI/180*37.5),Sv=Math.cos(Math.PI/180*5);class Sm{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",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(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new Dc,this.layoutVertexArray2=new En,this.patternVertexArray=new En,this.indexArray=new Li,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Ni,this.maxLineLength=0,this.zOffsetVertexArray=new En,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:We/64,this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,o,a){this.hasPattern=Jf("line",this.layers,this.pixelRatio,i);const h=this.layers[0].layout.get("line-sort-key");this.tileToMeter=K(o);const u=this.layers[0].layout.get("line-elevation-reference");if(u==="hd-road-markup")this.elevationType="road";else{const w=this.layers[0].layout.get("line-z-offset"),I=w.isConstant()&&!w.constantOr(0);this.elevationType=u!=="sea"&&u!=="ground"&&I?"none":"offset",this.elevationType==="offset"&&u==="none"&&Gt(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const f=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&f!==void 0;const _=[];for(const{feature:w,id:I,index:A,sourceLayerIndex:P}of e){const R=this.layers[0]._featureFilter.needGeometry,O=we(w,R);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom,{worldview:this.worldview}),O,o))continue;const U=h?h.evaluate(O,{},o):void 0,V={id:I,properties:w.properties,type:w.type,sourceLayerIndex:P,index:A,geometry:R?O.geometry:oe(w,o,a),patterns:{},sortKey:U};_.push(V)}h&&_.sort((w,I)=>w.sortKey-I.sortKey);const{lineAtlas:g,featureIndex:v}=i,b=this.addConstantDashes(g);for(const w of _){const{geometry:I,index:A,sourceLayerIndex:P}=w;if(b&&this.addFeatureDashes(w,g),this.hasPattern){const R=Qf("line",this.layers,w,this.zoom,this.pixelRatio,i);this.patternFeatures.push(R)}else this.addFeature(w,I,A,o,g.positions,i.availableImages,i.brightness,i.elevationFeatures);v.insert(e[A].feature,I,A,P,this.index)}}addConstantDashes(e){let i=!1;for(const o of this.layers){const a=o.paint.get("line-dasharray").value,h=o.layout.get("line-cap").value;if(a.kind!=="constant"||h.kind!=="constant")i=!0;else{const u=h.value,f=a.value;if(!f)continue;e.addDash(f,u)}}return i}addFeatureDashes(e,i){const o=this.zoom;for(const a of this.layers){const h=a.paint.get("line-dasharray").value,u=a.layout.get("line-cap").value;if(h.kind==="constant"&&u.kind==="constant")continue;let f,_;if(h.kind==="constant"){if(f=h.value,!f)continue}else f=h.evaluate({zoom:o},e);_=u.kind==="constant"?u.value:u.evaluate({zoom:o},e),i.addDash(f,_),e.patterns[a.id]=[i.getKey(f,_)]}}update(e,i,o,a,h,u,f,_){this.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f,_)}addFeatures(e,i,o,a,h,u){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,o,a,u)}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,xv)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,bv)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,_v.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,gv),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,o,a,h,u,f,_){const g=this.layers[0].layout,v=g.get("line-join").evaluate(e,{}),b=g.get("line-cap").evaluate(e,{}),w=g.get("line-miter-limit"),I=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=g.get("line-z-offset").value;const A=this.layers[0].paint.get("line-width").value;if(A.kind!=="constant"&&A.isLineProgressConstant===!1&&(this.variableWidthValue=A),this.elevationType==="road"){const P=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,a,_,v,b,w,I)){const[R,O]=this.clipRuntimeLinesToTile(i,1);for(let U=0;U<R.length;U++){const V=R[U],G=O[U],re={progress:{min:G.progress.min,max:G.progress.max},nextDir:this.computeSegNextDir(G,V),prevDir:this.computeSegPrevDir(G,V)};this.addLine(V,e,a,v,b,w,I,re)}this.fillNonElevatedRoadSegment(P)}}else for(const P of i)this.addLine(P,e,a,v,b,w,I);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,u,a,f,void 0,this.worldview)}computeSegNextDir(e,i){return e.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(e,i){return i[1].sub(e.prevPoint).unit()}clipLinesToTile(e,i){return Ip(e,-i,-i,We+i,We+i)}clipRuntimeLinesToTile(e,i){const o=[];return[Ip(e,-i,-i,We+i,We+i,o),o]}addElevatedRoadFeature(e,i,o,a,h,u,f,_){const g=[],v=Vi.getElevationFeature(e,a);if(v){const b=this.clipLinesToTile(i,1),w=this.prepareElevatedLines(b,v,o);for(const I of w)g.push({geometry:I,elevation:v,elevationTileID:o,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(g.length===0)return!1;for(const b of g){const w=this.layoutVertexArray.length;this.addLine(b.geometry,e,o,h,u,f,_);const I=new Wt(o,b.elevationTileID);if(b.elevation)for(let A=w;A<this.layoutVertexArray.length;A++){const P=new ke(this.layoutVertexArray.int16[6*A]>>1,this.layoutVertexArray.int16[6*A+1]>>1),R=I.pointElevation(P,b.elevation,.05);this.updateHeightRange(R),this.zOffsetVertexArray.emplaceBack(R,0,0)}else this.fillNonElevatedRoadSegment(w)}return!0}prepareElevatedLines(e,i,o){if(i.constantHeight!=null)return e;const a=[],h=1/K(o);for(const u of e)Ux(u,new di(i,h),0,a);return a}fillNonElevatedRoadSegment(e){for(let i=e;i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0)}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}}addLine(e,i,o,a,h,u,f,_){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0;const g=a==="none";this.patternJoinNone=this.hasPattern&&g,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const v=_&&_.progress.min>0,b=_&&_.progress.max<1;if(this.lineClips){let ae={min:this.lineClips.start,max:this.lineClips.end},ce=1;if(_){const Ae=this.lineClips.end-this.lineClips.start;ae=function(je,Ce,Fe){return{min:Ua(je.min,Ce,Fe),max:Ua(je.max,Ce,Fe)}}(_.progress,{min:0,max:1},ae),Ae>0&&(ce=(ae.max-ae.min)/Ae)}const Ee=+i.properties.mapbox_clip_feature_len,de=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(Ee)||Number.isNaN(de)){for(let je=0;je<e.length-1;je++)this.totalDistance+=e[je].dist(e[je+1]);const Ae=this.totalDistance/(ae.max-ae.min);this.totalFeatureLength=Number.isFinite(Ae)?Ae:0,this.lineClips.start=ae.min,this.lineClips.end=ae.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=Ee,this.distance=de*ce,this.lineClips.start=ae.min,this.lineClips.end=ae.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const w=wv[i.type]==="Polygon";let I=e.length;for(;I>=2&&e[I-1].equals(e[I-2]);)I--;let A=0;for(;A<I-1&&e[A].equals(e[A+1]);)A++;if(I<(w?3:2))return;a==="bevel"&&(u=1.05);const P=this.segments.prepareSegment(10*I,this.layoutVertexArray,this.indexArray);let R,O,U,V,G,re,Q,te;_&&_.prevDir&&(re=_.prevDir.perp()),_&&_.nextDir&&(Q=_.nextDir.perp()),this.e1=this.e2=-1,w&&(R=e[I-2],G=e[A].sub(R)._unit()._perp());for(let ae=A;ae<I;ae++){if(U=ae===I-1?w?e[A+1]:void 0:e[ae+1],U&&e[ae].equals(U))continue;G&&(V=G),R&&(O=R),R=e[ae],te=this.evaluateLineProgressFeatures(O?O.dist(R):0),G=U?U.sub(R)._unit()._perp():V,V=V||G;const ce=O&&U;let Ee=ce?a:w||g?"butt":h;const de=V.x*G.x+V.y*G.y;if(g){const pe=function(Se){if(Se.patternJoinNone){const He=Se.segmentPoints.length/2,Be=Se.lineSoFar-Se.segmentStart;for(let ct=0;ct<He;++ct){const nt=Se.segmentPoints[2*ct+1],De=Math.round(Se.segmentPoints[2*ct])+.5+.25*nt;Se.patternVertexArray.emplaceBack(De,Be,Se.segmentStart),Se.patternVertexArray.emplaceBack(De,Be,Se.segmentStart)}Se.segmentPoints.length=0}Se.e1=Se.e2=-1};if(ce&&de<Sv){this.updateDistance(O,R),this.addCurrentVertex(R,V,1,1,P,te),pe(this),this.addCurrentVertex(R,G,-1,-1,P,te);continue}if(O){if(!U){this.updateDistance(O,R),this.addCurrentVertex(R,V,1,1,P,te),pe(this);continue}Ee="miter"}}let Ae=V.add(G);Ae.x===0&&Ae.y===0||Ae._unit();const je=Ae.x*G.x+Ae.y*G.y,Ce=je!==0?1/je:1/0,Fe=2*Math.sqrt(2-2*je),Ve=je<Tv&&O&&U,Te=V.x*G.y-V.y*G.x>0,Oe=this.overscaling<=16?15*We/(512*this.overscaling):0;if(ce&&Ee==="round"){if(Ce<f)Ee="miter";else if(Ce<=2){const pe=Em(R,-10,We+10);Ee=this.elevationType==="offset"&&(pe||this.hasCrossSlope)?"miter":"fakeround"}}if(Ee==="miter"&&Ce>u&&(Ee="bevel"),Ee==="bevel"&&(Ce>2&&(Ee="flipbevel"),Ce<u&&(Ee="miter")),O&&!(Ee==="miter"&&Ve)&&this.updateDistance(O,R),Ee==="miter")if(Ve){const pe=R.dist(O);if(pe>2*Oe){const He=R.sub(R.sub(O)._mult(Oe/pe)._round());this.updateDistance(O,He),this.addCurrentVertex(He,V,0,0,P,te),O=He}this.updateDistance(O,R),Ae._mult(Ce),this.addCurrentVertex(R,Ae,0,0,P,te);const Se=R.dist(U);if(Se>2*Oe){const He=R.add(U.sub(R)._mult(Oe/Se)._round());this.updateDistance(R,He),this.addCurrentVertex(He,G,0,0,P,te),R=He}}else Ae._mult(Ce),this.addCurrentVertex(R,Ae,0,0,P,te);else if(Ee==="flipbevel"){if(Ce>100)Ae=G.mult(-1);else{const pe=Ce*V.add(G).mag()/V.sub(G).mag();Ae._perp()._mult(pe*(Te?-1:1))}this.addCurrentVertex(R,Ae,0,0,P,te),this.addCurrentVertex(R,Ae.mult(-1),0,0,P,te)}else if(Ee==="bevel"||Ee==="fakeround"){te!=null&&O&&this.addCurrentVertex(R,Q||V,-1,-1,P,te);const pe=R.dist(O)<=2*Oe&&Ee!=="bevel",Se=Ae.mult(Te?1:-1);Se._mult(Ce);const He=G.mult(Te?-1:1),Be=V.mult(Te?-1:1),ct=this.evaluateLineProgressFeatures(this.distance);if(te==null&&(this.addHalfVertex(R,Se.x,Se.y,!1,!Te,0,P,ct),pe||this.addHalfVertex(R,Se.x+2*Be.x,Se.y+2*Be.y,!1,Te,0,P,ct)),Ee==="fakeround"){const nt=Math.round(180*Fe/Math.PI/20);this.addHalfVertex(R,Be.x,Be.y,!1,Te,0,P,ct);for(let De=0;De<nt;De++){let Ne=De/nt;if(Ne!==.5){const et=Ne-.5;Ne+=Ne*et*(Ne-1)*((1.0904+de*(de*(3.55645-1.43519*de)-3.2452))*et*et+(.848013+de*(.215638*de-1.06021)))}const st=He.sub(Be)._mult(Ne)._add(Be)._unit();this.addHalfVertex(R,st.x,st.y,!1,Te,0,P,ct)}this.addHalfVertex(R,He.x,He.y,!1,Te,0,P,ct)}pe||te!=null||this.addHalfVertex(R,Se.x+2*He.x,Se.y+2*He.y,!1,Te,0,P,ct),te!=null&&U&&this.addCurrentVertex(R,re||G,1,1,P,te)}else if(Ee==="butt")this.addCurrentVertex(R,Ae,0,0,P,te);else if(Ee==="square"){if(!O){const pe=v?0:-1;this.addCurrentVertex(R,Ae,pe,pe,P,te)}if(this.addCurrentVertex(R,Ae,0,0,P,te),O){const pe=b?0:1;this.addCurrentVertex(R,Ae,pe,pe,P,te)}}else if(Ee==="round"){if(O){const pe=!ce&&Q?Q:V;this.addCurrentVertex(R,pe,0,0,P,te),!ce&&b||this.addCurrentVertex(R,pe,1,1,P,te,!0)}if(U){const pe=!ce&&re?re:G;!ce&&v||this.addCurrentVertex(R,pe,-1,-1,P,te,!0),this.addCurrentVertex(R,pe,0,0,P,te)}}}}addVerticesTo(e,i,o,a,h,u,f,_,g,v){const b=(i.w-e.w)/this.tessellationStep|0;let w=0;const I=this.scaledDistance;if(b>
141){this.lineSoFar=e.w;const P=(i.x-e.x)/b,R=(i.y-e.y)/b,O=(i.z-e.z)/b,U=(i.w-e.w)/b;for(let V=1;V<b;++V){e.x+=P,e.y+=R,e.z+=O,this.lineSoFar+=U,w+=U;const G=this.evaluateLineProgressFeatures(this.prevDistance+w);this.scaledDistance=(this.prevDistance+w)/this.totalDistance,this.addHalfVertex(e,o,a,v,!1,f,g,G),this.addHalfVertex(e,h,u,v,!0,-_,g,G)}}this.lineSoFar=i.w,this.scaledDistance=I;const A=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,o,a,v,!1,f,g,A),this.addHalfVertex(i,h,u,v,!0,-_,g,A)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&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):Gt(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:i}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}}addCurrentVertex(e,i,o,a,h,u,f=!1){const _=i.x+i.y*o,g=i.y-i.x*o,v=i.y*a-i.x,b=-i.y-i.x*a;if(u!=null){const w=this.elevationType==="offset",I=-10,A=We+10,P=u.zOffset,R=new lg(e.x,e.y,P,this.lineSoFar),O=!!w&&Em(e,I,A),U=this.lineS
vendor: 4,589 bytes, line 14
14oFar,V=this.distance;if(this.currentVertex)if(O){const G=this.currentVertexIsOutside,re=this.currentVertex,Q=new lg(e.x,e.y,P,this.lineSoFar);if(hg(re,Q,I,A),!Em(Q,I,A)){if(G){this.e1=this.e2=-1,this.distance-=re.dist(R),this.lineSoFar=re.w;const te=this.evaluateLineProgressFeatures(re.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(re,_,g,f,!1,o,h,te),this.addHalfVertex(re,v,b,f,!0,-a,h,te),this.prevDistance=this.distance}this.distance=this.prevDistance+re.dist(Q),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(re,Q,_,g,v,b,o,a,h,f),this.distance=V,this.scaledDistance=this.distance/this.totalDistance}}else{const G=this.currentVertex;if(this.currentVertexIsOutside){hg(G,R,I,A),this.e1=this.e2=-1,this.distance-=G.dist(R),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=G.w;const re=this.evaluateLineProgressFeatures(G.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(G,_,g,f,!1,o,h,re),this.addHalfVertex(G,v,b,f,!0,-a,h,re),this.prevDistance=this.distance,this.distance=V,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(G,R,_,g,v,b,o,a,h,f)}else O||(this.addHalfVertex(e,_,g,f,!1,o,h,u),this.addHalfVertex(e,v,b,f,!0,-a,h,u));this.currentVertex=R,this.currentVertexIsOutside=O,this.lineSoFar=U}else this.addHalfVertex(e,_,g,f,!1,o,h,u),this.addHalfVertex(e,v,b,f,!0,-a,h,u)}addHalfVertex({x:e,y:i},o,a,h,u,f,_,g){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),u||this.segmentPoints.push(this.lineSoFar-this.segmentStart,f)),this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(i<<1)+(u?1:0),Math.round(63*o)+128,Math.round(63*a)+128,1+(f===0?0:f<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const b=ft(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,b)}const v=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,v),_.primitiveLength++),u?this.e2=v:this.e1=v,g!=null&&this.zOffsetVertexArray.emplaceBack(g.zOffset,g.variableWidth,g.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function Em(r,e,i){return r.x<e||r.x>i||r.y<e||r.y>i}let Vg,Ug;function jg(r,e,i){return e*(We/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}rt(Sm,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Gg=(r,e,i)=>(1-i)*r+i*e;function qg(r,e){return 1/jg(r,1,e.tileZoom)}function Hg(r,e,i,o){return r.translatePosMatrix(o||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const $g=r=>{const e=[];Zg(r)&&e.push("RENDER_LINE_DASH"),r.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=r.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),r.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const o=r.layout.get("line-join").constantOr("miter")==="none",a=!!r.paint.get("line-pattern").constantOr(1);return o&&a&&e.push("LINE_JOIN_NONE"),e};function Zg(r){const e=r.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}let Im;const Wg=()=>Im||(Im={layout:Vg||(Vg=new Yi({"line-cap":new Je(ue.layout_line["line-cap"]),"line-join":new Je(ue.layout_line["line-join"]),"line-miter-limit":new Ge(ue.layout_line["line-miter-limit"]),"line-round-limit":new Ge(ue.layout_line["line-round-limit"]),"line-sort-key":new Je(ue.layout_line["line-sort-key"]),"line-z-offset":new Je(ue.layout_line["line-z-offset"]),"line-elevation-reference":new Ge(ue.layout_line["line-elevation-reference"]),"line-cross-slope":new Ge(ue.layout_line["line-cross-slope"]),visibility:new Ge(ue.layout_line.visibility),"line-width-unit":new Ge(ue.layout_line["line-width-unit"])})),paint:Ug||(Ug=new Yi({"line-opacity":new Je(ue.paint_line["line-opacity"]),"line-color":new Je(ue.paint_line["line-color"]),"line-translate":new Ge(ue.paint_line["line-translate"]),"line-translate-anchor":new Ge(ue.paint_line["line-translate-anchor"]),"line-width":new Je(ue.paint_line["line-width"]),"line-gap-width":new Je(ue.paint_line["line-gap-width"]),"line-offset":new Je(ue.paint_line["line-offset"]),"line-blur"
vendor: 5,335 bytes, line 14
14:new Je(ue.paint_line["line-blur"]),"line-dasharray":new Je(ue.paint_line["line-dasharray"]),"line-pattern":new Je(ue.paint_line["line-pattern"]),"line-pattern-cross-fade":new Ge(ue.paint_line["line-pattern-cross-fade"]),"line-gradient":new la(ue.paint_line["line-gradient"]),"line-trim-offset":new Ge(ue.paint_line["line-trim-offset"]),"line-trim-fade-range":new Ge(ue.paint_line["line-trim-fade-range"]),"line-trim-color":new Ge(ue.paint_line["line-trim-color"]),"line-emissive-strength":new Ge(ue.paint_line["line-emissive-strength"]),"line-border-width":new Je(ue.paint_line["line-border-width"]),"line-border-color":new Je(ue.paint_line["line-border-color"]),"line-occlusion-opacity":new Ge(ue.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},Im);class Ev extends Je{possiblyEvaluate(e,i){return i=new fi(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,o,a){return i=ye({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,o,a)}}let ju;function Xg(r,e){return e>0?e+2*r:r}const Iv=$t([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Av=$t([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Mv=$t([{name:"a_projected_pos",components:4,type:"Float32"}],4);$t([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Cv=$t([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),Pv=$t([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),zv=$t([{name:"a_texb",components:2,type:"Uint16"}]),Rv=$t([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),Dv=$t([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);$t([{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 Yg=$t([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Lv=$t([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);$t([{name:"triangle",components:3,type:"Uint16"}]),$t([{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"}]),$t([{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: 6,034 bytes, line 14
14]),$t([{type:"Float32",name:"offsetX"}]),$t([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Ir=24;function Fv(r,e,i){return r.sections.forEach(o=>{o.text=function(a,h,u){const f=h.layout.get("text-transform").evaluate(u,{});return f==="uppercase"?a=a.toLocaleUpperCase():f==="lowercase"&&(a=a.toLocaleLowerCase()),eo.applyArabicShaping&&(a=eo.applyArabicShaping(a)),a}(o.text,e,i)}),r}const Gu={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function Ov(r){return r==="︶"||r==="﹈"||r==="︸"||r==="﹄"||r==="﹂"||r==="︾"||r==="︼"||r==="︺"||r==="︘"||r==="﹀"||r==="︐"||r==="︓"||r==="︔"||r==="`"||r===" ̄"||r==="︑"||r==="︒"}function kv(r){return r==="︵"||r==="﹇"||r==="︷"||r==="﹃"||r==="﹁"||r==="︽"||r==="︻"||r==="︹"||r==="︗"||r==="︿"}const Am=4294967296,Kg=1/Am,Jg=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let Lp=class{constructor(r=new Uint8Array(16)){this.buf=ArrayBuffer.isView(r)?r:new Uint8Array(r),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(r,e,i=this.length){for(;this.pos<i;){const o=this.readVarint(),a=o>>3,h=this.pos;this.type=7&o,r(a,e,this),this.pos===h&&this.skip(o)}return e}readMessage(r,e){return this.readFields(r,e,this.readVarint()+this.pos)}readFixed32(){const r=this.dataView.getUint32(this.pos,!0);return this.pos+=4,r}readSFixed32(){const r=this.dataView.getInt32(this.pos,!0);return this.pos+=4,r}readFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Am;return this.pos+=8,r}readSFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Am;return this.pos+=8,r}readFloat(){const r=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,r}readDouble(){const r=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,r}readVarint(r){const e=this.buf;let i,o;return o=e[this.pos++],i=127&o,o<128?i:(o=e[this.pos++],i|=(127&o)<<7,o<128?i:(o=e[this.pos++],i|=(127&o)<<14,o<128?i:(o=e[this.pos++],i|=(127&o)<<21,o<128?i:(o=e[this.pos],i|=(15&o)<<28,function(a,h,u){const f=u.buf;let _,g;if(g=f[u.pos++],_=(112&g)>>4,g<128||(g=f[u.pos++],_|=(127&g)<<3,g<128)||(g=f[u.pos++],_|=(127&g)<<10,g<128)||(g=f[u.pos++],_|=(127&g)<<17,g<128)||(g=f[u.pos++],_|=(127&g)<<24,g<128)||(g=f[u.pos++],_|=(1&g)<<31,g<128))return Yc(a,_,h);throw new Error("Expected varint not more than 10 bytes")}(i,r,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const r=this.readVarint();return r%2==1?(r+1)/-2:r/2}readBoolean(){return!!this.readVarint()}readString(){const r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=12&&Jg?Jg.decode(this.buf.subarray(e,r)):function(i,o,a){let h="",u=o;for(;u<a;){const f=i[u];let _,g,v,b=null,w=f>239?4:f>223?3:f>191?2:1;if(u+w>a)break;w===1?f<128&&(b=f):w===2?(_=i[u+1],(192&_)==128&&(b=(31&f)<<6|63&_,b<=127&&(b=null))):w===3?(_=i[u+1],g=i[u+2],(192&_)==128&&(192&g)==128&&(b=(15&f)<<12|(63&_)<<6|63&g,(b<=2047||b>=55296&&b<=57343)&&(b=null))):w===4&&(_=i[u+1],g=i[u+2],v=i[u+3],(192&_)==128&&(192&g)==128&&(192&v)==128&&(b=(15&f)<<18|(63&_)<<12|(63&g)<<6|63&v,(b<=65535||b>=1114112)&&(b=null))),b===null?(b=65533,w=1):b>65535&&(b-=65536,h+=String.fromCharCode(b>>>10&1023|55296),b=56320|1023&b),h+=String.fromCharCode(b),u+=w}return h}(this.buf,e,r)}readBytes(){const r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e}readPackedVarint(r=[],e){const i=this.readPackedEnd();for(;this.pos<i;)r.push(this.readVarint(e));return r}readPackedSVarint(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSVarint());return r}readPackedBoolean(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readBoolean());return r}readPackedFloat(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFloat());return r}readPackedDouble(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readDouble());return r}readPackedFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed32());return r}readPackedSFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed32());return r}readPackedFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed64());return r}readPackedSFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed64());return r}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(r){const e=7&r;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else{if(e!==1)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(r,e){this.writeVarint(r<<3|e)}realloc(r){let e=this.length||16;for(;e<this.pos+r;)e*=2;if(e!==this.length){const i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(r){this.realloc(4),this.dataView.setInt32(this.pos,r,!0),this.pos+=4}writeSFixed32(r){this.realloc(4),this.dataView.setInt32(this.pos,r,!0),this.pos+=4}
vendor: 2,771 bytes, line 14
14writeFixed64(r){this.realloc(8),this.dataView.setInt32(this.pos,-1&r,!0),this.dataView.setInt32(this.pos+4,Math.floor(r*Kg),!0),this.pos+=8}writeSFixed64(r){this.realloc(8),this.dataView.setInt32(this.pos,-1&r,!0),this.dataView.setInt32(this.pos+4,Math.floor(r*Kg),!0),this.pos+=8}writeVarint(r){(r=+r||0)>268435455||r<0?function(e,i){let o,a;if(e>=0?(o=e%4294967296|0,a=e/4294967296|0):(o=~(-e%4294967296),a=~(-e/4294967296),4294967295^o?o=o+1|0:(o=0,a=a+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(h,u,f){f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,f.buf[f.pos]=127&(h>>>=7)}(o,0,i),function(h,u){const f=(7&h)<<4;u.buf[u.pos++]|=f|((h>>>=3)?128:0),h&&(u.buf[u.pos++]=127&h|((h>>>=7)?128:0),h&&(u.buf[u.pos++]=127&h|((h>>>=7)?128:0),h&&(u.buf[u.pos++]=127&h|((h>>>=7)?128:0),h&&(u.buf[u.pos++]=127&h|((h>>>=7)?128:0),h&&(u.buf[u.pos++]=127&h)))))}(a,i)}(r,this):(this.realloc(4),this.buf[this.pos++]=127&r|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=r>>>7&127))))}writeSVarint(r){this.writeVarint(r<0?2*-r-1:2*r)}writeBoolean(r){this.writeVarint(+r)}writeString(r){r=String(r),this.realloc(4*r.length),this.pos++;const e=this.pos;this.pos=function(o,a,h){for(let u,f,_=0;_<a.length;_++){if(u=a.charCodeAt(_),u>55295&&u<57344){if(!f){u>56319||_+1===a.length?(o[h++]=239,o[h++]=191,o[h++]=189):f=u;continue}if(u<56320){o[h++]=239,o[h++]=191,o[h++]=189,f=u;continue}u=f-55296<<10|u-56320|65536,f=null}else f&&(o[h++]=239,o[h++]=191,o[h++]=189,f=null);u<128?o[h++]=u:(u<2048?o[h++]=u>>6|192:(u<65536?o[h++]=u>>12|224:(o[h++]=u>>18|240,o[h++]=u>>12&63|128),o[h++]=u>>6&63|128),o[h++]=63&u|128)}return h}(this.buf,r,this.pos);const i=this.pos-e;i>=128&&Qg(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(r){this.realloc(4),this.dataView.setFloat32(this.pos,r,!0),this.pos+=4}writeDouble(r){this.realloc(8),this.dataView.setFloat64(this.pos,r,!0),this.pos+=8}writeBytes(r){const e=r.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=r[i]}writeRawMessage(r,e){this.pos++;const i=this.pos;r(e,this);const o=this.pos-i;o>=128&&Qg(i,o,this),this.pos=i-1,this.writeVarint(o),this.pos+=o}writeMessage(r,e,i){this.writeTag(r,2),this.writeRawMessage(e,i)}writePackedVarint(r,e){e.length&&this.writeMessage(r,Bv,e)}writePackedSVarint(r,e){e.length&&this.writeMessage(r,Nv,e)}writePackedBoolean(r,e){e.length&&this.writeMessage(r,jv,e)}writePackedFloat(r,e){e.length&&this.writeMessage(r,Vv,e)}writePackedDouble(r,e){e.length&&this.writeMessage(r,Uv,e)}
14writePackedFixed32(r,e){e.length&&this.writeMessage(r,Gv,e)}writePackedSFixed32(r,e){e.length&&this.writeMessage(r,qv,e)}writePackedFixed64(r,e){e.length&&this.writeMessage(r,Hv,e)}writePackedSFixed64(r,e){e.length&&this.writeMessage(r,$v,e)}writeBytesField(r,e){this.writeTag(r,2),this.writeBytes(e)}writeFixed32Field(r,e){this.writeTag(r,5),this.writeFixed32(e)}writeSFixed32Field(r,e){this.writeTag(r,5),this.writeSFixed32(e)}writeFixed64Field(r,e){this.writeTag(r,1),this.writeFixed64(e)}writeSFixed64Field(r,e){this.writeTag(r,1),this.writeSFixed64(e)}writeVarintField(r,e){this.writeTag(r,0),this.writeVarint(e)}writeSVarintField(r,e){this.writeTag(r,0),this.writeSVarint(e)}writeStringField(r,e){this.writeTag(r,2),this.writeString(e)}writeFloatField(r,e){this.writeTag(r,5),this.writeFloat(e)}writeDoubleField(r,e){this.writeTag(r,1),this.writeDouble(e)}writeBooleanField(r,e){this.writeVarintField(r,+e)}};function Yc(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function Qg(r,e,i){const o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(o);for(let a=i.pos-1;a>=r;a--)i.buf[a+o]=i.buf[a]}function Bv(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function Nv(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function Vv(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function Uv(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function jv(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function Gv(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function qv(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function Hv(r,e){for(let i=0;i<r.length;i++)e.writeFixed64(r[i])}function $v(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}const Mm=3;function Zv(r,e,i){e.glyphs=[],r===1&&i.readMessage(Wv,e)}function Wv(r,e,i){if(r===3){const{id:o,bitmap:a,width:h,height:u,left:f,top:_,advance:g}=i.readMessage(Xv,{});e.glyphs.push({id:o,bitmap:new Ea({width:h+2*Mm,height:u+2*Mm},a),metrics:{width:h,height:u,left:f,top:_,advance:g}})}else r===4?e.ascender=i.readSVarint():r===5&&(e.descender=i.readSVarint())}function Xv(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}const ey=Mm,Dn={horizontal:1,vertical:2,horizontalOnly:3};class qu{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const o=new qu;return o.scale=e||1,o.fontStack=i,o}static forImage(e){const i=new qu;return i.image=e,i}}class Kc{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,o){const a=new Kc;for(let h=0;h<e.sections.length;h++){const u=e.sections[h];u.image?a.addImageSection(u,o):a.addTextSection(u,i)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(i,o){let a="";for(let h=0;h<i.length;h++){const u=i.charCodeAt(h+1)||null,f=i.charCodeAt(h-1)||null;a+=!o&&(u&&Ic(u)&&!Gu[i[h+1]]||f&&Ic(f)&&!Gu[i[h-1]])||!Gu[i[h]]?i[h]:Gu[i[h]]}return a}(this.text,e)}trim(){let e=0;for(let o=0;o<this.text.length&&Fp[this.text.charCodeAt(o)];o++)e++;let i=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&Fp[this.text.charCodeAt(o)];o--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const o=new Kc;return o.text=this.text.substring(e,i),o.sectionIndex=this.sectionIndex.slice(e,i),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(qu.forText(e.scale,e.fontStack||i));const o=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(o)}addImageSection(e,i){const o=e.image?e.image.getPrimary():null;if(!o)return void Gt("Can't add FormattedSection with an empty image.");o.scaleSelf(i);const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCodePoint(a),this.sections.push(qu.forImage(o)),this.sectionIndex.push(this.sections.length-1)):Gt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Cm(r,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P=1){const R=Kc.fromFeature(r,a,P);
14b===Dn.vertical&&R.verticalizePunctuation(w);let O=[];const U=function(te,ae,ce,Ee,de,Ae){if(!te)return[];const je=[],Ce=function(Oe,pe,Se,He,Be,ct){let nt=0;for(let De=0;De<Oe.length();De++){const Ne=Oe.getSection(De);nt+=ty(Oe.getCodePoint(De),Ne,He,Be,pe,ct)}return nt/Math.max(1,Math.ceil(nt/Se))}(te,ae,ce,Ee,de,Ae),Fe=te.text.indexOf("​")>=0;let Ve=0;for(let Oe=0;Oe<te.length();Oe++){const pe=te.getSection(Oe),Se=te.getCodePoint(Oe);if(Fp[Se]||(Ve+=ty(Se,pe,Ee,de,ae,Ae)),Oe<te.length()-1){const He=!((Te=Se)<11904||!(gt["Bopomofo Extended"](Te)||gt.Bopomofo(Te)||gt["CJK Compatibility Forms"](Te)||gt["CJK Compatibility Ideographs"](Te)||gt["CJK Compatibility"](Te)||gt["CJK Radicals Supplement"](Te)||gt["CJK Strokes"](Te)||gt["CJK Symbols and Punctuation"](Te)||gt["CJK Unified Ideographs Extension A"](Te)||gt["CJK Unified Ideographs"](Te)||gt["Enclosed CJK Letters and Months"](Te)||gt["Halfwidth and Fullwidth Forms"](Te)||gt.Hiragana(Te)||gt["Ideographic Description Characters"](Te)||gt["Kangxi Radicals"](Te)||gt["Katakana Phonetic Extensions"](Te)||gt.Katakana(Te)||gt["Vertical Forms"](Te)||gt["Yi Radicals"](Te)||gt["Yi Syllables"](Te)));(Yv[Se]||He||pe.image)&&je.push(ry(Oe+1,Ve,Ce,je,Kv(Se,te.getCodePoint(Oe+1),He&&Fe),!1))}}var Te;return ny(ry(te.length(),Ve,Ce,je,0,!0))}(R,g,h,e,o,I),{processBidirectionalText:V,processStyledBidirectionalText:G}=eo;if(V&&R.sections.length===1){const te=V(R.toString(),U);for(const ae of te){const ce=new Kc;ce.text=ae,ce.sections=R.sections;for(let Ee=0;Ee<ae.length;Ee++)ce.sectionIndex.push(0);O.push(ce)}}else if(G){const te=G(R.text,R.sectionIndex,U);for(const ae of te){const ce=new Kc;ce.text=ae[0],ce.sectionIndex=ae[1],ce.sections=R.sections,O.push(ce)}}else O=function(te,ae){const ce=[],Ee=te.text;let de=0;for(const Ae of ae)ce.push(te.substring(de,Ae)),de=Ae;return de<Ee.length&&ce.push(te.substring(de,Ee.length)),ce}(R,U);const re=[],Q={positionedLines:re,text:R.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:b,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(te,ae,ce,Ee,de,Ae,je,Ce,Fe,Ve,Te,Oe){let pe=0,Se=0,He=0;const Be=Ce==="right"?1:Ce==="left"?0:.5;let ct=!1;for(const Xe of de){const tt=Xe.getSections();for(const _t of tt){if(_t.image)continue;const Tt=ae[_t.fontStack];if(Tt&&(ct=Tt.ascender!==void 0&&Tt.descender!==void 0,!ct))break}if(!ct)break}let nt=0;for(const Xe of de){Xe.trim();const tt=Xe.getMaxScale(),_t=(tt-1)*Ir,Tt={positionedGlyphs:[],lineOffset:0};te.positionedLines[nt]=Tt;const Mt=Tt.positionedGlyphs;let It=0;if(!Xe.length()){Se+=Ae,++nt;continue}let qt=0,Lt=0;for(let H=0;H<Xe.length();H++){const $=Xe.getSection(H),be=Xe.getSectionIndex(H),$e=Xe.getCodePoint(H);let Ke=$.scale,Ye=null,ot=null,vt=null,Nt=Ir,Vt=0,zt=Fe;zt===Dn.vertical&&((De=$e)===12312||De===12313||De===12316||De===12540||De===12448)&&(zt=Dn.horizontal);const mi=!(zt===Dn.horizontal||!Te&&!Ec($e)||Te&&(Fp[$e]||Hd($e)));if($.image){const Hi=Ee.get($.image.toString());if(!Hi)continue;vt=$.image,te.iconsInText=te.iconsInText||!0,ot=Hi.paddedRect;const Ct=Hi.displaySize;Ke=Ke*Ir/Oe,Ye={width:Ct[0],height:Ct[1],left:0,top:-ey,advance:mi?Ct[1]:Ct[0],localGlyph:!1},Vt=ct?-Ye.height*Ke:tt*Ir-17-Ct[1]*Ke,Nt=Ye.advance;const Pi=(mi?Ct[0]:Ct[1])*Ke-Ir*tt;Pi>0&&Pi>It&&(It=Pi)}else{const Hi=ce[$.fontStack];if(!Hi)continue;Hi[$e]&&(ot=Hi[$e]);const Ct=ae[$.fontStack];if(!Ct)continue;const Pi=Ct.glyphs[$e];if(!Pi)continue;if(Ye=Pi.metrics,Nt=$e!==8203?Ir:0,ct){const Ti=Ct.ascender!==void 0?Math.abs(Ct.ascender):0,hi=Ct.descender!==void 0?Math.abs(Ct.descender):0,Ui=(Ti+hi)*Ke;qt<Ui&&(qt=Ui,Lt=(Ti-hi)/2*Ke),Vt=-Ti*Ke}else Vt=(tt-Ke)*Ir-17}mi?(te.verticalizable=!0,Mt.push({glyph:$e,image:vt,x:pe,y:Se+Vt,vertical:mi,scale:Ke,localGlyph:Ye.localGlyph,fontStack:$.fontStack,sectionIndex:be,metrics:Ye,rect:ot}),pe+=Nt*Ke+Ve):(Mt.push({glyph:$e,image:vt,x:pe,y:Se+Vt,vertical:mi,scale:Ke,localGlyph:Ye.localGlyph,fontStack:$.fontStack,sectionIndex:be,metrics:Ye,rect:ot}),pe+=Ye.advance*Ke+Ve)}Mt.length!==0&&(He=Math.max(pe-Ve,He),ct?oy(Mt,Be,It,Lt,Ae*tt/2):oy(Mt,Be,It,0,Ae/2)),pe=0;const Ii=Ae*tt+It;Tt.lineOffset=Math.max(It,_t),Se+=Ii,++nt}var De;const Ne=Se,{horizontalAlign:st,verticalAlign:et}=Pm(je);(function(Xe,tt,_t,Tt,Mt,It){const qt=(tt-_t)*Mt,Lt=-It*Tt;for(const Ii of Xe)for(const H of Ii.positionedGlyphs)H.x+=qt,H.y+=Lt})(te.positionedLines,Be,st,et,He,Ne),te.top+=-et*Ne,te.bottom=te.to
vendor: 10,196 bytes, line 14
14p+Ne,te.left+=-st*He,te.right=te.left+He,te.hasBaseline=ct}(Q,e,i,o,O,u,f,_,b,g,w,A),!function(te){for(const ae of te)if(ae.positionedGlyphs.length!==0)return!1;return!0}(re))return Q}const Fp={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Yv={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 ty(r,e,i,o,a,h){if(e.image){const u=o.get(e.image.toString());return u?u.displaySize[0]*e.scale*Ir/h+a:0}{const u=i[e.fontStack],f=u&&u.glyphs[r];return f?f.metrics.advance*e.scale+a:0}}function iy(r,e,i,o){const a=Math.pow(r-e,2);return o?r<e?a/2:2*a:a+Math.abs(i)*i}function Kv(r,e,i){let o=0;return r===10&&(o-=1e4),i&&(o+=150),r!==40&&r!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function ry(r,e,i,o,a,h){let u=null,f=iy(e,i,a,h);for(const _ of o){const g=iy(e-_.x,i,a,h)+_.badness;g<=f&&(u=_,f=g)}return{index:r,x:e,priorBreak:u,badness:f}}function ny(r){return r?ny(r.priorBreak).concat(r.index):[]}function Pm(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function oy(r,e,i,o,a){if(!(e||i||o||a))return;const h=r.length-1,u=r[h],f=(u.x+u.metrics.advance*u.scale)*e;for(let _=0;_<=h;_++)r[_].x-=f,r[_].y+=i+o+a}function sy(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function Jv(r,e,i,o){const{horizontalAlign:a,verticalAlign:h}=Pm(o),u=i[0]-r.displaySize[0]*a,f=i[1]-r.displaySize[1]*h;return{imagePrimary:r,imageSecondary:e,top:f,bottom:f+r.displaySize[1],left:u,right:u+r.displaySize[0]}}function ay(r,e,i,o,a,h){const u=r.imagePrimary;let f;if(u.content){const R=u.content,O=u.pixelRatio||1;f=[R[0]/O,R[1]/O,u.displaySize[0]-R[2]/O,u.displaySize[1]-R[3]/O]}const _=e.left*h,g=e.right*h;let v,b,w,I;i==="width"||i==="both"?(I=a[0]+_-o[3],b=a[0]+g+o[1]):(I=a[0]+(_+g-u.displaySize[0])/2,b=I+u.displaySize[0]);const A=e.top*h,P=e.bottom*h;return i==="height"||i==="both"?(v=a[1]+A-o[0],w=a[1]+P+o[2]):(v=a[1]+(A+P-u.displaySize[1])/2,w=v+u.displaySize[1]),{imagePrimary:u,imageSecondary:void 0,top:v,right:b,bottom:w,left:I,collisionPadding:f}}function ly(r){return!r.imagePrimary.stretchX}function cy(r){return!r.imagePrimary.stretchY}function hy(r){return{width:r.right-r.left,height:r.bottom-r.top}}const ss=128;function uy(r,e,i){const{expression:o}=e;if(o.kind==="constant")return{kind:"constant",layoutSize:o.evaluate(new fi(r+1,{worldview:i}))};if(o.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:h}=o;let u=0;for(;u<a.length&&a[u]<=r;)u++;u=Math.max(0,u-1);let f=u;for(;f<a.length&&a[f]<r+1;)f++;f=Math.min(a.length-1,f);const _=a[u],g=a[f];return o.kind==="composite"?{kind:"composite",minZoom:_,maxZoom:g,interpolationType:h}:{kind:"camera",minZoom:_,maxZoom:g,minSize:o.evaluate(new fi(_,{worldview:i})),maxSize:o.evaluate(new fi(g,{worldview:i})),interpolationType:h}}}function zm(r,{uSize:e,uSizeT:i},{lowerSize:o,upperSize:a}){return r.kind==="source"?o/ss:r.kind==="composite"?ft(o/ss,a/ss,i):e}function Hu(r,e,i=1){let o=0,a=0;if(r.kind==="constant")a=r.layoutSize*i;else if(r.kind!=="source"){const{interpolationType:h,minZoom:u,maxZoom:f}=r,_=h?W(sn.interpolationFactor(h,e,u,f),0,1):0;r.kind==="camera"?a=ft(r.minSize,r.maxSize,_)*i:o=_*i}return{uSizeT:o,uSize:a}}class Ds extends ke{constructor(e,i,o,a,h){super(e,i),this.angle=a,this.z=o,h!==void 0&&(this.segment=h)}clone(){return new Ds(this.x,this.y,this.z,this.angle,this.segment)}}function dy(r,e,i,o,a){if(e.segment===void 0)return!0;let h=e,u=e.segment+1,f=0;for(;f>-i/2;){if(u--,u<0)return!1;f-=r[u].dist(h),h=r[u]}f+=r[u].dist(r[u+1]),u++;const _=[];let g=0;for(;f<i/2;){const v=r[u],b=r[u+1];if(!b)return!1;let w=r[u-1].angleTo(v)-v.angleTo(b);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:w}),g+=w;f-_[0].distance>o;)g-=_.shift().angleDelta;if(g>a)return!1;u++,f+=v.dist(b)}return!0}function py(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function fy(r,e,i){return r?.6*e*i:0}function my(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function Qv(r,e,i,o,a,h){const u=fy(i,a,h),f=my(i,o)*h;let _=0;const g=py(r)/2;for(let v=0;v<r.length-1;v++){const b=r[v],w=r[v+1],I=b.dist(w);if(_+I>g){const A=(g-_)/I,P=ft(b.x,w.x,A),R=ft(b.y,w.y,A),O=new Ds(P,R,0,w.angleTo(b),v);return!u||dy(r,O,f,u,e)?O:void 0}_+=I}}function e1(r,e,i,o,a,h,u,f,_){const g=fy(o,h,u),v=my(o,a),b=v*u,w=r[0].x===0||r[0].x===_||r[0].y===0||r[0].y===_;return e-b<e/4&&(e=b+e/4),_y(r,w?e/2*f%e:(v/2+2*h)*u*f%e,e,g,i,b,w,!1,_)}function _y(r,e,i,o,a,h,u,f,_){const g=h/2,v=py(r);let b=0,w=e-i,I=[];for(let A=0;A<r.length-1;A++){const P=r[A],R=r[A+1],O=P.dist(R),U=R.angleTo(P);for(;w+i<b+O;){w+=i;const V=(w-b)/O,G=ft(P.x,R.x,V),re=ft(P.y,R.y,V);if(G>=0&&G<_&&re>=0&&re<_&&w-g>=0&&w+g<=v){const Q=new Ds(G,re,0,U,A);o&&!dy(r,Q,h,o,a)||I.push(Q)}}b+=O}return f||I.length||u||(I=_y(r,b/2,i,o,a,h,u,!0,_)),I}function gy(r){let e=0,i=0;for(const u of r)e+=u.w*u.h,i=Math.max(i,u.w);r.sort((u,f)=>f.h-u.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,h=0;for(const u of r)for(let f=o.length-1;f>=0;f--){const _=o[f];if(!(u.w>_.w||u.h>_.h)){if(u.x=_.x,u.y=_.y,h=Math.max(h,u.y+u.h),a=Math.max(a,u.x+u.w),u.w===_.w&&u.h===_.h){const g=o.pop();g&&f<o.length&&(o[f]=g)}else u.h===_.h?(_.x+=u.w,_.w-=u.w):u.w===_.w?(_.y+=u.h,_.h-=u.h):(o.push({x:_.x+u.w,y:_.y,w:_.w-u.w,h:u.h}),_.y+=u.h,_.h-=u.h);break}}return{w:a,h,fill:e/(a*h)||0}}rt(Ds,"Anchor");const Ol=1;class $u{static getImagePositionScale(e,i,o){if(i&&e&&e.options&&e.options.transform){const a=e.options.transform;return{x:a.a,y:a.d}}return{x:o,y:o}}constructor(e,i,o,a){this.paddedRect=e;const{pixelRatio:h,version:u,stretchX:f,stretchY:_,content:g,sdf:v,usvg:b}=i;this.pixelRatio=h,this.stretchX=f,this.stretchY=_,this.content=g,this.version=u,this.padding=o,this.sdf=v,this.usvg=b,this.scale=$u.getImagePositionScale(a,b,h)}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 Rm(r,e,i){const o=vo.parse(r),a=function(h,u,f=[1,1]){return{x:0,y:0,w:(h.data?h.data.width:h.width*f[0])+2*u,h:(h.data?h.data.height:h.height*f[1])+2*u}}(e,i,[o.options.transform.a,o.options.transform.d]);return{bin:a,imagePosition:new $u(a,e,i,o),imageVariant:o}}class yy{constructor(e,i,o){const a=new Map,h=new Map;this.haveRenderCallbacks=[];const u=[];this.addImages(e,a,Ol,u),this.addImages(i,h,2,u);const{w:f,h:_}=gy(u),g=new Rr({width:f||1,height:_||1});for(const[v,b]of e.entries()){const w=a.get(v).paddedRect;Rr.copy(b.data,g,{x:0,y:0},{x:w.x+Ol,y:w.y+Ol},b.data,o,b.sdf)}for(const[v,b]of i.entries()){const w=h.get(v),I=w.paddedRect;let A=w.padding;const P=I.x+A,R=I.y+A,O=b.data.width,U=b.data.height;A=A>1?A-1:A,Rr.copy(b.data,g,{x:0,y:0},{x:P,y:R},b.data,o),Rr.copy(b.data,g,{x:0,y:U-A},{x:P,y:R-A},{width:O,height:A},o),Rr.copy(b.data,g,{x:0,y:0},{x:P,y:R+U},{width:O,height:A},o),Rr.copy(b.data,g,{x:O-A,y:0},{x:P-A,y:R},{width:A,height:U},o),Rr.copy(b.data,g,{x:0,y:0},{x:P+O,y:R},{width:A,height:U},o),Rr.copy(b.data,g,{x:O-A,y:U-A},{x:P-A,y:R-A},{width:A,height:A},o),Rr.copy(b.data,g,{x:0,y:U-A},{x:P+O,y:R-A},{width:A,height:A},o),Rr.copy(b.data,g,{x:0,y:0},{x:P+O,y:R+U},{width:A,height:A},o),Rr.copy(b.data,g,{x:O-A,y:0},{x:P-A,y:R+U},{width:A,height:A},o)}this.lut=o,this.image=g,this.iconPositions=a,this.patternPositions=h}addImages(e,i,o,a){for(const[h,u]of e.entries()){const{bin:f,imagePosition:_,imageVariant:g}=Rm(h,u,o);i.set(h,_),a.push(f),u.hasRenderCallback&&this.haveRenderCallbacks.push(g.id)}}patchUpdatedImages(e,i,o){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(a=>e.hasImage(a,o)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,o);for(const a of e.getUpdatedImages(o)){for(const h of this.iconPositions.keys()){const u=vo.parse(h);if(un.isEqual(u.id,a)){const f=e.getImage(a,o);this.patchUpdatedImage(this.iconPositions.get(h),f,i)}}for(const h of this.patternPositions.keys()){const u=vo.parse(h);if(un.isEqual(u.id,a)){const f=e.getImage(a,o);this.patchUpdatedImage(this.patternPositions.get(h),f,i)}}}}patchUpdatedImage(e,i,o){if(!e||!i||e.version===i.version)return;e.version=i.version;const[a,h]=e.tl,u=e.sdf;if(this.lut||u){const f={width:i.data.width,height:i.data.height},_=new Rr(f);Rr.copy(i.data,_,{x:0,y:0},{x:0,y:0},f,this.lut,u),o.update(_,{position:{x:a,y:h}})}else o.update(i.data,{position:{x:a,y:h}})}}rt($u,"ImagePosition"),rt(yy,"ImageAtlas");const Zu=1e20;function xy(r,e,i,o,a,h,u,f,_){for(let g=e;g<e+o;g++)vy(r,i*h+g,h,a,u,f,_);for(let g=i;g<i+a;g++)vy(r,g*h+e,1,o,u,f,_)}function vy(r,e,i,o,a,h,u){h[0]=0,u[0]=-Zu,u[1]=Zu,a[0]=r[e];for(let f=1,_=0,g=0;f<o;f++){a[f]=r[e+f*i];const v=f*f;do{const b=h[_];g=(a[f]-a[b]+v-b*b)/(f-b)/2}while(g<=u[_]&&--_>-1);_++,h[_]=f,u[_]=g,u[_+1]=Zu}for(let f=0,_=0;f<o;f++){for(;u[_+1]<f;)_++;const g=h[_],v=f-g;r[e+f*i]=a[g]+v*v}}const So=2,Dm={none:0,ideographs:1,all:2};class Jc{constructor(e,i,o){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=o,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e){this.url=e}getGlyphs(e,i){const o=[],a=this.url||Ar.GLYPHS_URL;for(const h in e)for(const u of e[h])o.push({stack:h,id:u});he(o,({stack:h,id:u},f)=>{let _=this.entries[h];_||(_=this.entries[h]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let g=_.glyphs[u];if(g!==void 0)return void f(null,{stack:h,id:u,glyph:g});if(g=this._tinySDF(_,h,u),g)return _.glyphs[u]=g,void f(null,{stack:h,id:u,glyph:g});const v=Math.floor(u/256);if(256*v>65535)return Gt("glyphs > 65535 not supported"),void f(null,{stack:h,id:u,glyph:g});if(_.ranges[v])return void f(null,{stack:h,id:u,glyph:g});let b=_.requests[v];b||(b=_.requests[v]=[],Jc.loadGlyphRange(h,v,a,this.requestManager,(w,I)=>
14{if(I){_.ascender=I.ascender,_.descender=I.descender;for(const A in I.glyphs)this._doesCharSupportLocalGlyph(+A)||(_.glyphs[+A]=I.glyphs[+A]);_.ranges[v]=!0}for(const A of b)A(w,I);delete _.requests[v]})),b.push((w,I)=>{w?f(w):I&&f(null,{stack:h,id:u,glyph:I.glyphs[u]||null})})},(h,u)=>{if(h)i(h);else if(u){const f={};for(const{stack:_,id:g,glyph:v}of u)f[_]===void 0&&(f[_]={}),f[_].glyphs===void 0&&(f[_].glyphs={}),f[_].glyphs[g]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics},f[_].ascender=this.entries[_].ascender,f[_].descender=this.entries[_].descender;i(null,f)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==Dm.none&&(this.localGlyphMode===Dm.all?!!this.localFontFamily:!!this.localFontFamily&&(gt["CJK Unified Ideographs"](e)||gt["Hangul Syllables"](e)||gt.Hiragana(e)||gt.Katakana(e)||gt["CJK Symbols and Punctuation"](e)||gt["CJK Unified Ideographs Extension A"](e)||gt["CJK Unified Ideographs Extension B"](e)||gt.Osage(e)))}_tinySDF(e,i,o){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(o))return;let h=e.tinySDF;if(!h){let P="400";/bold/i.test(i)?P="900":/medium/i.test(i)?P="500":/light/i.test(i)&&(P="200"),h=e.tinySDF=new Jc.TinySDF({fontFamily:a,fontWeight:P,fontSize:24*So,buffer:3*So,radius:8*So}),h.fontWeight=P}if(this.localGlyphs[h.fontWeight][o])return this.localGlyphs[h.fontWeight][o];const u=String.fromCodePoint(o),{data:f,width:_,height:g,glyphWidth:v,glyphHeight:b,glyphLeft:w,glyphTop:I,glyphAdvance:A}=h.draw(u);return this.localGlyphs[h.fontWeight][o]={id:o,bitmap:new Ea({width:_,height:g},f),metrics:{width:v/So,height:b/So,left:w/So,top:I/So-27,advance:A/So,localGlyph:!0}}}}Jc.loadGlyphRange=function(r,e,i,o,a){const h=256*e,u=h+255,f=o.transformRequest(o.normalizeGlyphsURL(i).replace("{fontstack}",r).replace("{range}",`${h}-${u}`),Wa.Glyphs);Xa(f,(_,g)=>{if(_)a(_);else if(g){const v={},b=function(w){return new Lp(w).readFields(Zv,{})}(g);for(const w of b.glyphs)v[w.id]=w;a(null,{glyphs:v,ascender:b.ascender,descender:b.descender})}})},Jc.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:i=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:h="normal",fontStyle:u="normal"}={}){this.buffer=e,this.cutoff=o,this.radius=i;const f=this.size=r+4*e,_=this._createCanvas(f),g=this.ctx=_.getContext("2d",{willReadFrequently:!0});g.font=`${u} ${h} ${r}px ${a}`,g.textBaseline="alphabetic",g.textAlign="left",g.fillStyle="black",this.gridOuter=new Float64Array(f*f),this.gridInner=new Float64Array(f*f),this.f=new Float64Array(f),this.z=new Float64Array(f+1),this.v=new Uint16Array(f)}_createCanvas(r){const e=document.createElement("canvas");return e.width=e.height=r,e}draw(r){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:h}=this.ctx.measureText(r),u=Math.ceil(i),f=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-a))),_=Math.min(this.size-this.buffer,u+Math.ceil(o)),g=f+2*this.buffer,v=_+2*this.buffer,b=Math.max(g*v,0),w=new Uint8ClampedArray(b),I={data:w,width:g,height:v,glyphWidth:f,glyphHeight:_,glyphTop:u,glyphLeft:0,glyphAdvance:e};if(f===0||_===0)return I;const{ctx:A,buffer:P,gridInner:R,gridOuter:O}=this;A.clearRect(P,P,f,_),A.fillText(r,P,P+u);const U=A.getImageData(P,P,f,_);O.fill(Zu,0,b),R.fill(0,0,b);for(let V=0;V<_;V++)for(let G=0;G<f;G++){const re=U.data[4*(V*f+G)+3]/255;if(re===0)continue;const Q=(V+P)*g+G+P;if(re===1)O[Q]=0,R[Q]=Zu;else{const te=.5-re;O[Q]=te>0?te*te:0,R[Q]=te<0?te*te:0}}xy(O,0,0,g,v,g,this.f,this.v,this.z),xy(R,P,P,f,_,g,this.f,this.v,this.z);for(let V=0;V<b;V++){const G=Math.sqrt(O[V])-Math.sqrt(R[V]);w[V]=Math.round(255-255*(G/this.radius+this.cutoff))}return I}};const Ma=Ol;function by(r,e){return r+e[1]-e[0]}function wy(r,e,i,o,a=1){const h=[],u=r.imagePrimary,f=u.pixelRatio,_=u.paddedRect.w-2*Ma,g=u.paddedRect.h-2*Ma,v=(r.right-r.left)*a,b=(r.bottom-r.top)*a,w=u.stretchX||[[0,_]],I=u.stretchY||[[0,g]],A=w.reduce(by,0),P=I.reduce(by,0),R=_-A,O=g-P;let U=0,V=A,G=0,re=P,Q=0,te=R,ae=0,ce=O;if(u.content&&o){const de=u.content;U=Op(w,0,de[0]),G=Op(I,0,de[1]),V=Op(w,de[0],de[2]),re=Op(I,de[1],de[3]),Q=de[0]-U,ae=de[1]-G,te=de[2]-de[0]-V,ce=de[3]-de[1]-re}const Ee=(de,Ae,je,Ce)=>{const Fe=kp(de.stretch-U,V,v,r.left*a),Ve=Bp(de.fixed-Q,te,de.stretch,A),Te=kp(Ae.stretch-G,re,b,r.top*a),Oe=Bp(Ae.fixed-ae,ce,Ae.stretch,P),pe=kp(je.stretch-U,V,v,r.left*a),Se=Bp(je.fixed-Q,te,je.stretch,A),He=kp(Ce.stretch-G,re,b,r.top*a),Be=Bp(Ce.fixed-ae,ce,Ce.stretch,P),ct=new ke(Fe,Te),nt=ne
vendor: 6,749 bytes, line 14
14w ke(pe,Te),De=new ke(pe,He),Ne=new ke(Fe,He),st=new ke(Ve/f,Oe/f),et=new ke(Se/f,Be/f),Xe=e*Math.PI/180;if(Xe){const qt=Math.sin(Xe),Lt=Math.cos(Xe),Ii=[Lt,-qt,qt,Lt];ct._matMult(Ii),nt._matMult(Ii),Ne._matMult(Ii),De._matMult(Ii)}const tt=de.stretch+de.fixed,_t=je.stretch+je.fixed,Tt=Ae.stretch+Ae.fixed,Mt=Ce.stretch+Ce.fixed,It=r.imageSecondary;return{tl:ct,tr:nt,bl:Ne,br:De,texPrimary:{x:u.paddedRect.x+Ma+tt,y:u.paddedRect.y+Ma+Tt,w:_t-tt,h:Mt-Tt},texSecondary:It?{x:It.paddedRect.x+Ma+tt,y:It.paddedRect.y+Ma+Tt,w:_t-tt,h:Mt-Tt}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:st,pixelOffsetBR:et,minFontScaleX:te/f/v,minFontScaleY:ce/f/b,isSDF:i}};if(o&&(u.stretchX||u.stretchY)){const de=Ty(w,R,A),Ae=Ty(I,O,P);for(let je=0;je<de.length-1;je++){const Ce=de[je],Fe=de[je+1];for(let Ve=0;Ve<Ae.length-1;Ve++)h.push(Ee(Ce,Ae[Ve],Fe,Ae[Ve+1]))}}else h.push(Ee({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_+1},{fixed:0,stretch:g+1}));return h}function Op(r,e,i){let o=0;for(const a of r)o+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return o}function Ty(r,e,i){const o=[{fixed:-Ma,stretch:0}];for(const[a,h]of r){const u=o[o.length-1];o.push({fixed:a-u.stretch,stretch:u.stretch}),o.push({fixed:a-u.stretch,stretch:u.stretch+(h-a)})}return o.push({fixed:e+Ma,stretch:i}),o}function kp(r,e,i,o){return r/e*i+o}function Bp(r,e,i,o){return r-e*i/o}function t1(r,e,i,o){const a=e+r.positionedLines[o].lineOffset;return o===0?i+a/2:i+(a+(e+r.positionedLines[o-1].lineOffset))/2}function i1(r,e=1,i=!1){let o=1/0,a=1/0,h=-1/0,u=-1/0;const f=r[0];for(let I=0;I<f.length;I++){const A=f[I];(!I||A.x<o)&&(o=A.x),(!I||A.y<a)&&(a=A.y),(!I||A.x>h)&&(h=A.x),(!I||A.y>u)&&(u=A.y)}const _=Math.min(h-o,u-a);let g=_/2;const v=new ec([],r1);if(_===0)return new ke(o,a);for(let I=o;I<h;I+=_)for(let A=a;A<u;A+=_)v.push(new Qc(I+g,A+g,g,r));let b=function(I){let A=0,P=0,R=0;const O=I[0];for(let U=0,V=O.length,G=V-1;U<V;G=U++){const re=O[U],Q=O[G],te=re.x*Q.y-Q.x*re.y;P+=(re.x+Q.x)*te,R+=(re.y+Q.y)*te,A+=3*te}return new Qc(P/A,R/A,0,I)}(r),w=v.length;for(;v.length;){const I=v.pop();(I.d>b.d||!b.d)&&(b=I,i&&console.log("found best %d after %d probes",Math.round(1e4*I.d)/1e4,w)),I.max-b.d<=e||(g=I.h/2,v.push(new Qc(I.p.x-g,I.p.y-g,g,r)),v.push(new Qc(I.p.x+g,I.p.y-g,g,r)),v.push(new Qc(I.p.x-g,I.p.y+g,g,r)),v.push(new Qc(I.p.x+g,I.p.y+g,g,r)),w+=4)}return i&&(console.log(`num probes: ${w}`),console.log(`best distance: ${b.d}`)),b.p}function r1(r,e){return e.max-r.max}class Qc{constructor(e,i,o,a){this.p=new ke(e,i),this.h=o,this.d=function(h,u){let f=!1,_=1/0;for(let g=0;g<u.length;g++){const v=u[g];for(let b=0,w=v.length,I=w-1;b<w;I=b++){const A=v[b],P=v[I];A.y>h.y!=P.y>h.y&&h.x<(P.x-A.x)*(h.y-A.y)/(P.y-A.y)+A.x&&(f=!f),_=Math.min(_,Mn(h,A,P))}}return(f?1:-1)*Math.sqrt(_)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const n1=Object.keys,Lm=Number.POSITIVE_INFINITY,o1=Math.sqrt(2);function Sy(r,[e,i]){let o=0,a=0;if(i===Lm){e<0&&(e=0);const h=e/o1;switch(r){case"top-right":case"top-left":a=h-7;break;case"bottom-right":case"bottom-left":a=7-h;break;case"bottom":a=7-e;break;case"top":a=e-7}switch(r){case"top-right":case"bottom-right":o=-h;break;case"top-left":case"bottom-left":o=h;break;case"left":o=e;break;case"right":o=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),r){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-i}switch(r){case"top-right":case"bottom-right":case"right":o=-e;break;case"top-left":case"bottom-left":case"left":o=e}}return[o,a]}function Np(r,e,i,o,a,h,u,f,_){if(!e||!e.usvg)return;const g=hy(o),v=hy(a),b=h!=="both"&&h!=="width"||!ly(o)?1:v.width/g.width,w=h!=="both"&&h!=="height"||!cy(o)?1:v.height/g.height;i.scaleSelf(b,w);const I=i.toString();u.set(I,i),f.set(I,e);const{imagePosition:A}=Rm(I,e,Ol);_.set(I,A)}function Ey(r,e,i,o,a,h,u,f,_){if(!r)return;const g=function(v,b,w,I,A,P){if(v.kind==="camera")return v.maxSize;if(v.kind==="composite"){const R=b.possiblyEvaluate(new fi(v.maxZoom,{worldview:P}),w).evaluate(A,{},w),O=b.possiblyEvaluate(new fi(v.minZoom,{worldview:P}),w).evaluate(A,{},w);return Math.max(R,O)}return b.possiblyEvaluate(new fi(I,{worldview:P})).evaluate(A,{},w)}(e,i,o,a,h,_);return r.scaleSelf(g*f*u)}function Iy(r,e,i,o,a,h,u,f,_){return{iconPrimary:Ey(r.getPrimary(),e,i,o,a,h,u,f,_),iconSecondary:Ey(r.getSecondary(),e,i,o,a,h,u,f,_)}}function s1(r,e,i){if(!e)return;const o=i.get(r.toString()),a=i.get(e.toString());a&&(o.paddedRect.w===a.paddedRect.w&&o.paddedRect.h===a.paddedRect.h||Gt(`Mismatch in icon variant sizes: ${r.toString()} and ${e.toString()}`),o.usvg!==a.usvg&&Gt(`Mismatch in icon variant image types: ${r.id} and ${e.id}`))}function Ay(r,e,i,o){if(!r)return;const a=e.get(i.toString());if(r.imagePrimary=a,o){const h=e.get(o.toString());r.imageSecondary=h}}function a1(r,e){for(const i in r.horizontal)My(r.horizontal[i],e);My(r.vertical,e)}function My(r,e){if(r){for(const i of r.positionedLines)for(const o of i.positionedGlyphs)if(o.image!==null){const a=o.image.toString();o.rect=e.get(a).paddedRect}}}function Fm(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function l1(r,e,i,o,a,h,u,f,_){const g=Om(h.horizontal)||h.vertical,v=i.get("icon-text-fit-padding").evaluate(o,{},a);let b,w=e;return e&&_!=="none"&&(r.allowVerticalPlacement&&h.vertical&&(b=ay(e,h.vertical,_,v,f,u)),g&&(w=ay(e,g,_,v,f,u))),{defaultShapedIcon:w,verticallyShapedIcon:b}}function c1(r,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,U,V){let G=u.textMaxSize.evaluate(e,{},w);G===void 0?G=f*u.textScaleFactor:G*=u.textScaleFactor;const re=r.layers[0].layout,Q=Om(i.horizontal)||i.vertical,te=I.name==="globe",ae=Ir,ce=r.tilePixelRatio*G/ae,Ee=(Ve=r.overscaling,r.zoom>18&&Ve>2&&(Ve>>=1),Math.max(We/(512*Ve),1)*re.get("symbol-spacing")),de=re.get("text-padding")*r.tilePixelRatio,Ae=re.get("icon-padding")*r.tilePixelRatio,je=ei(re.get("text-max-angle")),Ce=re.get("icon-rotation-alignment")==="map"&&V!=="point",Fe=Ee/2;var Ve;r.hasAnyIconTextFit===!1&&R!=="none"&&(r.hasAnyIconTextFit=!0);const Te=e.properties?+e.properties[Qe]:null,Oe=Te&&r.elevationFeatureIdToIndex?r.elevationFeatureIdToIndex.get(Te):65535,pe=(Se,He,Be)=>{if(He.x<0||He.x>=We||He.y<0||He.y>=We)return;let ct=null;if(te){const{x:nt,y:De,z:Ne}=I.projectTilePoint(He.x,He.y,Be);ct={anchor:new Ds(nt,De,Ne,0,void 0),up:I.upVector(Be,He.x,He.y)}}(function(nt,De,Ne,st,et,Xe,tt,_t,Tt,Mt,It,qt,Lt,Ii,H,$,be,$e,Ke,Ye,ot,vt,Nt,Vt,zt,mi,Hi,Ct,Pi){const Ti=nt.addToLineVertexArray(De,st);let hi,Ui,Ai,Si,Ei,pi,Rt,_i=0,ji=0,yt=0,Zt=0,Mi=-1,Wi=-1;const zi={};let _r=Hs("");const xi=Ne?Ne.anchor:De,ur=Ct!=="none";let mn=0,Dr=0;
14if(Tt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const gr=Tt.layout.get("text-offset").evaluate(ot,{},zt);mn=gr[0]*Ir,Dr=gr[1]*Ir}else mn=Tt.layout.get("text-radial-offset").evaluate(ot,{},zt)*Ir,Dr=Lm;if(nt.allowVerticalPlacement&&et.vertical){const gr=et.vertical;if(H)pi=km(gr),_t&&(Rt=km(_t));else{const vr=Tt.layout.get("text-rotate").evaluate(ot,{},zt)+90;Ai=Vp(Mt,xi,De,It,qt,Lt,gr,Ii,vr,$),_t&&(Si=Vp(Mt,xi,De,It,qt,Lt,_t,$e,vr))}}if(Xe){const gr=nt.iconSizeData,vr=Tt.layout.get("icon-rotate").evaluate(ot,{},zt),Lr=wy(Xe,vr,Nt,ur,vt.iconScaleFactor),Kr=_t?wy(_t,vr,Nt,ur,vt.iconScaleFactor):void 0;Ui=Vp(Mt,xi,De,It,qt,Lt,Xe,$e,vr,null),_i=4*Lr.length;let jr=null;gr.kind==="source"?(jr=[ss*Tt.layout.get("icon-size").evaluate(ot,{},zt)*vt.iconScaleFactor],jr[0]>Ca&&Gt(`${nt.layerIds[0]}: Value for "icon-size" is >= ${Wu}. Reduce your "icon-size".`)):gr.kind==="composite"&&(jr=[ss*vt.compositeIconSizes[0].evaluate(ot,{},zt)*vt.iconScaleFactor,ss*vt.compositeIconSizes[1].evaluate(ot,{},zt)*vt.iconScaleFactor],(jr[0]>Ca||jr[1]>Ca)&&Gt(`${nt.layerIds[0]}: Value for "icon-size" is >= ${Wu}. Reduce your "icon-size".`)),nt.addSymbols(nt.icon,Lr,jr,Ye,Ke,ot,void 0,Ne,De,Ti.lineStartIndex,Ti.lineLength,-1,Vt,zt,mi,Hi),Mi=nt.icon.placedSymbolArray.length-1,Kr&&(ji=4*Kr.length,nt.addSymbols(nt.icon,Kr,jr,Ye,Ke,ot,Dn.vertical,Ne,De,Ti.lineStartIndex,Ti.lineLength,-1,Vt,zt,mi,Hi),Wi=nt.icon.placedSymbolArray.length-1)}for(const gr in et.horizontal){const vr=gr,Lr=et.horizontal[vr];hi||(_r=Hs(Lr.text),H?Ei=km(Lr):hi=Vp(Mt,xi,De,It,qt,Lt,Lr,Ii,Tt.layout.get("text-rotate").evaluate(ot,{},zt),$));const Kr=Lr.positionedLines.length===1;if(yt+=Cy(nt,Ne,De,Lr,tt,Tt,H,ot,$,Ti,et.vertical?Dn.horizontal:Dn.horizontalOnly,Kr?n1(et.horizontal):[vr],zi,Mi,vt,Vt,zt,mi),Kr)break}et.vertical&&(Zt+=Cy(nt,Ne,De,et.vertical,tt,Tt,H,ot,$,Ti,Dn.vertical,["vertical"],zi,Wi,vt,Vt,zt,mi));let Mr=-1;const _n=(gr,vr)=>gr?Math.max(gr,vr):vr;Mr=_n(Ei,Mr),Mr=_n(pi,Mr),Mr=_n(Rt,Mr);const as=Mr>-1?1:0;nt.glyphOffsetArray.length>=65535&&Gt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ot.sortKey!==void 0&&nt.addToSortKeyRanges(nt.symbolInstances.length,ot.sortKey),nt.symbolInstances.emplaceBack(De.x,De.y,xi.x,xi.y,xi.z,zi.right>=0?zi.right:-1,zi.center>=0?zi.center:-1,zi.left>=0?zi.left:-1,zi.vertical>=0?zi.vertical:-1,Mi,Wi,_r,hi!==void 0?hi:nt.collisionBoxArray.length,hi!==void 0?hi+1:nt.collisionBoxArray.length,Ai!==void 0?Ai:nt.collisionBoxArray.length,Ai!==void 0?Ai+1:nt.collisionBoxArray.length,Ui!==void 0?Ui:nt.collisionBoxArray.length,Ui!==void 0?Ui+1:nt.collisionBoxArray.length,Si||nt.collisionBoxArray.length,Si?Si+1:nt.collisionBoxArray.length,It,yt,Zt,_i,ji,as,0,mn,Dr,Mr,0,ur?1:0,Pi)})(r,He,ct,Se,i,o,h,a,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,de,U,g,0,Ae,Ce,O,e,u,v,b,w,A,P,R,Oe)};if(V==="line")for(const Se of Ip(e.geometry,0,0,We,We)){const He=e1(Se,Ee,je,i.vertical||Q,o,ae,ce,r.overscaling,We);for(const Be of He)Q&&h1(r,Q.text,Fe,Be)||pe(Se,Be,w)}else if(V==="line-center"){for(const Se of e.geometry)if(Se.length>1){const He=Qv(Se,je,i.vertical||Q,o,ae,ce);He&&pe(Se,He,w)}}else if(e.type==="Polygon")for(const Se of Pu(e.geometry,0)){const He=i1(Se,16);pe(Se[0],new Ds(He.x,He.y,0,0,void 0),w)}else if(e.type==="LineString")for(const Se of e.geometry)pe(Se,new Ds(Se[0].x,Se[0].y,0,0,void 0),w);else if(e.type==="Point")for(const Se of e.geometry)for(const He of Se)pe([He],new Ds(He.x,He.y,0,0,void 0),w)}const Wu=255,Ca=Wu*ss;function Cy(r,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O){const U=function(re,Q,te,ae,ce,Ee,de,Ae){const je=[];if(Q.positionedLines.length===0)return je;const Ce=ae.layout.get("text-rotate").evaluate(Ee,{})*Math.PI/180,Fe=function(Se){const He=Se[0],Be=Se[1],ct=He*Be;return ct>0?[He,-Be]:ct<0?[-He,Be]:He===0?[Be,He]:[Be,-He]}(te);let Ve=Math.abs(Q.top-Q.bottom);for(const Se of Q.positionedLines)Ve-=Se.lineOffset;const Te=Q.positionedLines.length,Oe=Ve/Te;let pe=Q.top-te[1];for(let Se=0;Se<Te;++Se){const He=Q.positionedLines[Se];pe=t1(Q,Oe,pe,Se);for(const Be of He.positionedGlyphs){if(!Be.rect)continue;const ct=Be.rect||{};let nt=ey+1,De=!0,Ne=1,st=0;if(Be.image){const ot=de.get(Be.image.toString());if(!ot)continue;if(ot.sdf){Gt("SDF images are not supported in formatted text and will be ignored.");continue}De=!1,Ne=ot.pixelRatio,nt=Ol/Ne}const et=(ce||Ae)&&Be.vertical,Xe=Be.metrics.advance*Be.scale/2,tt=Be.metrics,_t=Be.rect;if(_t===null)continue;Ae&&Q.verticalizable&&(st=Be.image?Xe-Be.metrics.width*Be.scale/2:0);const Tt=ce?[Be.x+Xe,Be.y]:[0,0];let Mt=[0,0],It=[0,0],qt=!1;ce||(et?(It=[Be.x+Xe+Fe[0],Be.y+Fe[1]-st],qt=!0):Mt=[Be.x+Xe+te[0],Be.y+te[1]-st]);const Lt=_t.w*Be.scale/(Ne*(Be.localGlyph?So:1)),Ii=_t.h*Be.scale/(Ne*(Be.localGlyph?So:1));let H,$,be,$e;if(et){const ot=Be.y-pe,vt=new ke(-Xe,Xe-ot),Nt=-Math.PI/2,Vt=new ke(...It);
vendor: 5,238 bytes, line 14
14H=new ke(-Xe+Mt[0],Mt[1]),H._rotateAround(Nt,vt)._add(Vt),H.x+=-ot+Xe,H.y-=(tt.left-nt)*Be.scale;const zt=Be.image?tt.advance*Be.scale:Ir*Be.scale,mi=String.fromCodePoint(Be.glyph);Ov(mi)?H.x+=(1-nt)*Be.scale:kv(mi)?H.x+=zt-tt.height*Be.scale+(-nt-1)*Be.scale:H.x+=Be.image||tt.width+2*nt===_t.w&&tt.height+2*nt===_t.h?(zt-Ii)/2:(zt-(tt.height+2*nt)*Be.scale)/2,$=new ke(H.x,H.y-Lt),be=new ke(H.x+Ii,H.y),$e=new ke(H.x+Ii,H.y-Lt)}else{const ot=(tt.left-nt)*Be.scale-Xe+Mt[0],vt=(-tt.top-nt)*Be.scale+Mt[1],Nt=ot+Lt,Vt=vt+Ii;H=new ke(ot,vt),$=new ke(Nt,vt),be=new ke(ot,Vt),$e=new ke(Nt,Vt)}if(Ce){let ot;ot=ce?new ke(0,0):qt?new ke(Fe[0],Fe[1]):new ke(te[0],te[1]),H._rotateAround(Ce,ot),$._rotateAround(Ce,ot),be._rotateAround(Ce,ot),$e._rotateAround(Ce,ot)}const Ke=new ke(0,0),Ye=new ke(0,0);je.push({tl:H,tr:$,bl:be,br:$e,texPrimary:ct,texSecondary:void 0,writingMode:Q.writingMode,glyphOffset:Tt,sectionIndex:Be.sectionIndex,isSDF:De,pixelOffsetTL:Ke,pixelOffsetBR:Ye,minFontScaleX:0,minFontScaleY:0})}}return je}(0,o,_,h,u,f,a,r.allowVerticalPlacement),V=r.textSizeData;let G=null;V.kind==="source"?(G=[ss*h.layout.get("text-size").evaluate(f,{},R)*A.textScaleFactor],G[0]>Ca&&Gt(`${r.layerIds[0]}: Value for "text-size" is >= ${Wu}. Reduce your "text-size".`)):V.kind==="composite"&&(G=[ss*A.compositeTextSizes[0].evaluate(f,{},R)*A.textScaleFactor,ss*A.compositeTextSizes[1].evaluate(f,{},R)*A.textScaleFactor],(G[0]>Ca||G[1]>Ca)&&Gt(`${r.layerIds[0]}: Value for "text-size" is >= ${Wu}. Reduce your "text-size".`)),r.addSymbols(r.text,U,G,_,u,f,v,e,i,g.lineStartIndex,g.lineLength,I,P,R,O,!1);for(const re of b)w[re]=r.text.placedSymbolArray.length-1;return 4*U.length}function Om(r){for(const e in r)return r[e];return null}function Vp(r,e,i,o,a,h,u,f,_,g){let v=u.top,b=u.bottom,w=u.left,I=u.right;if(sy(u)&&u.collisionPadding){const A=u.collisionPadding;w-=A[0],v-=A[1],I+=A[2],b+=A[3]}if(_){const A=new ke(w,v),P=new ke(I,v),R=new ke(w,b),O=new ke(I,b),U=ei(_);let V=new ke(0,0);g&&(V=new ke(g[0],g[1])),A._rotateAround(U,V),P._rotateAround(U,V),R._rotateAround(U,V),O._rotateAround(U,V),w=Math.min(A.x,P.x,R.x,O.x),I=Math.max(A.x,P.x,R.x,O.x),v=Math.min(A.y,P.y,R.y,O.y),b=Math.max(A.y,P.y,R.y,O.y)}return r.emplaceBack(e.x,e.y,e.z,i.x,i.y,w,v,I,b,f,o,a,h),r.length-1}function km(r){sy(r)&&r.collisionPadding&&(r.top-=r.collisionPadding[1],r.bottom+=r.collisionPadding[3]);const e=r.bottom-r.top;return e>0?Math.max(10,e):null}function h1(r,e,i,o){const a=r.compareText;if(e in a){const h=a[e];for(let u=h.length-1;u>=0;u--)if(o.dist(h[u])<i)return!0}else a[e]=[];return a[e].push(o),!1}function Py(r,e){const i=r.fovAboveCenter,o=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,a=(r._camera.position[2]*r.worldSize-o)/Math.cos(r._pitch),h=Math.sin(i)*a/Math.sin(Math.max(Math.PI/2-r._pitch-i,.01));let u=Math.sin(r._pitch)*h+a;const f=a*(1/r._horizonShift);if(!r.elevation||r.elevation.exaggeration()===0){let _=Math.max(r.zoom-17,0);r.isOrthographic&&(_/=10),u*=1+_}return Math.min(1.01*u,f)}function Xu(r,e){if(!e.isReprojectedInTileSpace)return{scale:1<<r.z,x:r.x,y:r.y,x2:r.x+1,y2:r.y+1,projection:e};const i=Math.pow(2,-r.z),o=r.x*i,a=(r.x+1)*i,h=r.y*i,u=(r.y+1)*i,f=N(o),_=N(a),g=j(h),v=j(u),b=e.project(f,g),w=e.project(_,g),I=e.project(_,v),A=e.project(f,v);let P=Math.min(b.x,w.x,I.x,A.x),R=Math.min(b.y,w.y,I.y,A.y),O=Math.max(b.x,w.x,I.x,A.x),U=Math.max(b.y,w.y,I.y,A.y);const V=i/16;function G(Q,te,ae,ce,Ee,de){const Ae=(ae+Ee)/2,je=(ce+de)/2,Ce=e.project(N(Ae),j(je)),Fe=Math.max(0,P-Ce.x,R-Ce.y,Ce.x-O,Ce.y-U);P=Math.min(P,Ce.x),O=Math.max(O,Ce.x),R=Math.min(R,Ce.y),U=Math.max(U,Ce.y),Fe>V&&(G(Q,Ce,ae,ce,Ae,je),G(Ce,te,Ae,je,Ee,de))}G(b,w,o,h,a,h),G(w,I,a,h,a,u),G(I,A,a,u,o,u),G(A,b,o,u,o,h),P-=V,R-=V,O+=V,U+=V;const re=1/Math.max(O-P,U-R);return{scale:re,x:P*re,y:R*re,x2:O*re,y2:U*re,projection:e}}function zy(r,{x:e,y:i},o=0){return new ke(((e-o)*r.scale-r.x)*We,(i*r.scale-r.y)*We)}const u1=Bt(new Float32Array(16));class Pa{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,i){return{x:0,y:0,z:0}}unproject(e,i){return new S(0,0)}projectTilePoint(e,i,o){return{x:e,y:i,z:0}}locationPoint(e,i,o,a=!0){return e._coordinatePoint(e.locationCoordinate(i,o),a)}pixelsPerMeter(e,i){return L(1,e)*i}pixelSpaceConversion(e,i,o){return 1}farthestPixelDistance(e){return Py(e,e.pixelsPerMeter)}pointCoordinate(e,i,o,a){const h=e.horizonLineFromTop(!1),u=new ke(i,Math.max(h,o));return e.rayIntersectionCoordinate(e.pointRayIntersection(u,a))}pointCoordinate3D(e,i,o){const a=new ke(i,o);if(e.elevation)return e.elevation.pointCoordinate(a);{const h=this.pointCoordinate(e,a.x,a.y,0);return[h.x,h.y,h.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const o=e.horizonLineFromTop();return i.y<o}createInversionMatrix(e,i){return u1}createTileMatrix(e,i,o){let a,h,u;const f=o.canonical,_=Bt(new Float64Array(16));if(this.isReprojectedInTileSpace){const g=Xu(f,this);
vendor: 7,409 bytes, line 14
14a=1,h=g.x+o.wrap*g.scale,u=g.y,Fr(_,_,[a/g.scale,a/g.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(f.z),h=(f.x+Math.pow(2,f.z)*o.wrap)*a,u=f.y*a;return qr(_,_,[h,u,0]),Fr(_,_,[a/We,a/We,1]),_}upVector(e,i,o){return[0,0,1]}upVectorScale(e,i,o){return{metersToTile:1}}}class d1 extends Pa{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,o]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(ei(i));this.n=(a+Math.sin(ei(o)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:o,c:a,r0:h}=this,u=ei(e-this.center[0]),f=ei(i),_=Math.sqrt(a-2*o*Math.sin(f))/o;return{x:_*Math.sin(u*o),y:_*Math.cos(u*o)-h,z:0}}unproject(e,i){const{n:o,c:a,r0:h}=this,u=h+i;let f=Math.atan2(e,Math.abs(u))*Math.sign(u);u*o<0&&(f-=Math.PI*Math.sign(e)*Math.sign(u));const _=ei(this.center[0])*o;f=ve(f,-Math.PI-_,Math.PI-_);const g=W(ge(f/o)+this.center[0],-180,180),v=Math.asin(W((a-(e*e+u*u)*o*o)/(2*o),-1,1)),b=W(ge(v),-X,X);return new S(g,b)}}const Yu=1.340264,Ku=-.081106,Ju=893e-6,Qu=.003796,Up=Math.sqrt(3)/2;class p1 extends Pa{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const o=Math.asin(Up*Math.sin(i)),a=o*o,h=a*a*a;return{x:.5*(e*Math.cos(o)/(Up*(Yu+3*Ku*a+h*(7*Ju+9*Qu*a)))/Math.PI+.5),y:1-.5*(o*(Yu+Ku*a+h*(Ju+Qu*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let o=i=(2*(1-i)-1)*Math.PI,a=o*o,h=a*a*a;for(let v,b,w,I=0;I<12&&(b=o*(Yu+Ku*a+h*(Ju+Qu*a))-i,w=Yu+3*Ku*a+h*(7*Ju+9*Qu*a),v=b/w,o=W(o-v,-Math.PI/3,Math.PI/3),a=o*o,h=a*a*a,!(Math.abs(v)<1e-12));++I);const u=Up*e*(Yu+3*Ku*a+h*(7*Ju+9*Qu*a))/Math.cos(o),f=Math.asin(Math.sin(o)/Up),_=W(180*u/Math.PI,-180,180),g=W(180*f/Math.PI,-X,X);return new S(_,g)}}class f1 extends Pa{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){const o=360*(e-.5),a=W(360*(.5-i),-X,X);return new S(o,a)}}const eh=Math.PI/2;function jp(r){return Math.tan((eh+r)/2)}class m1 extends Pa{constructor(e){super(e),this.center=e.center||[0,30];const[i,o]=this.parallels=e.parallels||[30,30];let a=ei(i),h=ei(o);this.southernCenter=a+h<0,this.southernCenter&&(a=-a,h=-h);const u=Math.cos(a),f=jp(a);this.n=a===h?Math.sin(a):Math.log(u/Math.cos(h))/Math.log(jp(h)/f),this.f=u*Math.pow(jp(a),this.n)/this.n}project(e,i){i=ei(i),this.southernCenter&&(i=-i),e=ei(e-this.center[0]);const o=1e-6,{n:a,f:h}=this;h>0?i<-eh+o&&(i=-eh+o):i>eh-o&&(i=eh-o);const u=h/Math.pow(jp(i),a);let f=u*Math.sin(a*e),_=h-u*Math.cos(a*e);return f=.5*(f/Math.PI+.5),_=.5*(_/Math.PI+.5),{x:f,y:this.southernCenter?_:1-_,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n:o,f:a}=this,h=a-i,u=Math.sign(h),f=Math.sign(o)*Math.sqrt(e*e+h*h);let _=Math.atan2(e,Math.abs(h))*u;h*o<0&&(_-=Math.PI*Math.sign(e)*u);const g=W(ge(_/o)+this.center[0],-180,180),v=W(ge(2*Math.atan(Math.pow(a/f,1/o))-eh),-X,X);return new S(g,this.southernCenter?-v:v)}}class Ry extends Pa{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,i){return{x:z(e),y:F(i),z:0}}unproject(e,i){const o=N(e),a=j(i);return new S(o,a)}}const Dy=ei(X);class _1 extends Pa{project(e,i){const o=(i=ei(i))*i,a=o*o;return{x:.5*((e=ei(e))*(.8707-.131979*o+a*(a*(.003971*o-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let o=i=(2*(1-i)-1)*Math.PI,a=25,h=0,u=o*o;do{u=o*o;const g=u*u;h=(o*(1.007226+u*(.015085+g*(.028874*u-.044475-.005916*g)))-i)/(1.007226+u*(.045255+g*(.259866*u-.311325-.005916*11*g))),o=W(o-h,-Dy,Dy)}while(Math.abs(h)>1e-6&&--a>0);u=o*o;const f=W(ge(e/(.8707+u*(u*(u*u*u*(.003971-.001529*u)-.013791)-.131979))),-180,180),_=ge(o);return new S(f,_)}}const Ly=ei(X);class g1 extends Pa{project(e,i){i=ei(i),e=ei(e);const o=Math.cos(i),a=2/Math.PI,h=Math.acos(o*Math.cos(e/2)),u=Math.sin(h)/h,f=.5*(e*a+2*o*Math.sin(e/2)/u)||0,_=.5*(i+Math.sin(i)/u)||0;return{x:.5*(f/Math.PI+.5),y:1-.5*(_/Math.PI+1),z:0}}unproject(e,i){let o=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,h=25;const u=1e-6;let f=0,_=0;do{const g=Math.cos(a),v=Math.sin(a),b=2*v*g,w=v*v,I=g*g,A=Math.cos(o/2),P=Math.sin(o/2),R=2*A*P,O=P*P,U=1-I*A*A,V=U?1/U:0,G=U?Math.acos(g*A)*Math.sqrt(1/U):0,re=.5*(2*G*g*P+2*o/Math.PI)-e,Q=.5*(G*v+a)-i,te=.5*V*(I*O+G*g*A*w)+1/Math.PI,ae=V*(R*b/4-G*v*P),ce=.125*V*(b*P-G*v*I*R),Ee=.5*V*(w*A+G*O*g)+.5,de=ae*ce-Ee*te;f=(Q*ae-re*Ee)/de,_=(re*ce-Q*te)/de,o=W(o-f,-Math.PI,Math.PI),a=W(a-_,-Ly,Ly)}while((Math.abs(f)>u||Math.abs(_)>u)&&--h>0);return new S(ge(o),ge(a))}}class Fy extends Pa{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(ei(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:o,cosPhi:a}=this;return{x:ei(e)*a*o+.5,y:-Math.sin(ei(i))/a*o+.5,z:0}}unproject(e,i){const{scale:o,cosPhi:a}=this,h=-(i-.5)/o,u=W(ge((e-.5)/o)/a,-180,180),f=Math.asin(W(h*a,-1,1)),_=W(ge(f),-X,X);return new S(u,_)}}class y1 extends Ry{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,i,o){const a=Su(e,i,o);return tr(a,a,gp(ns(o))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,o){const a=y(i.lat,i.lng),h=Ri([],a),u=o?e._centerAltitude+o:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;Hr(a,a,h,L(1,0)*We*u);const f=Bt(new Float64Array(16));return Gi(f,e.pixelMatrix,e.globeMatrix),tr(a,a,f),new ke(a[0],a[1])}pixelsPerMeter(e,i){return L(1,0)*i}pixelSpaceConversion(e,i,o){const a=L(1,e)*i,h=ft(L(1,45)*i,a,o);return this.pixelsPerMeter(e,i)/h}createTileMatrix(e,i,o){const a=$f(ns(o.canonical));return Gi(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:o}=e,a=gp(ns(i));return ao(a,a,ei(o.lng)),Ao(a,a,ei(o.lat)),Fr(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,o,a){return s_(e,i,o,!0)||new J(0,0)}pointCoordinate3D(e,i,o){const a=this.pointCoordinate(e,i,o,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!s_(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(a,h){const u=a.cameraToCenterDistance,f=a._centerAltitude*h,_=a._camera,g=a._camera.forward(),v=ki([],Fi([],g,-u),[0,0,f]),b=a.worldSize/(2*Math.PI),w=[0,0,-b],I=a.width/a.height,A=Math.tan(a.fovAboveCenter),P=Fi([],_.up(),A),R=Fi([],_.right(),A*I),O=Ri([],ki([],ki([],g,P),R)),U=[];let V;if(new Kt(v,O).closestPointOnSphere(w,b,U)){const G=ki([],U,w),re=ir([],G,v);V=Math.cos(a.fovAboveCenter)*Cr(re)}else{const G=ir([],v,w),re=ir([],w,v);Ri(re,re);const Q=Cr(G)-b;V=Math.sqrt(Q*(Q+2*b));const te=Math.acos(V/(b+Q))-Math.acos(er(g,re));V*=Math.cos(te)}return 1.01*V}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),o=Sa(e.zoom);if(o>0){const a=Py(e,L(1,e.center.lat)*e.worldSize),h=e.worldSize/(2*Math.PI),u=Math.max(e.width,e.height)/e.worldSize*Math.PI;return ft(i,a+h*(1-Math.cos(u)),Math.pow(o,10))}return i}upVector(e,i,o){return Su(i,o,e,1)}upVectorScale(e){return{metersToTile:fp(_p(ns(e)))}}}function Oy(r){const e=r.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;
vendor: 14,990 bytes, line 14
14switch(r.name){case"mercator":return new Ry(r);case"equirectangular":return new f1(r);case"naturalEarth":return new _1(r);case"equalEarth":return new p1(r);case"winkelTripel":return new g1(r);case"albers":return i?new Fy(r):new d1(r);case"lambertConformalConic":return i?new Fy(r):new m1(r);case"globe":return new y1(r)}throw new Error(`Invalid projection name: ${r.name}`)}const x1=_e.types,v1=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Gp(r,e,i,o,a,h,u,f,_,g,v,b,w){const I=f?Math.min(Ca,Math.round(f[0])):0,A=f?Math.min(Ca,Math.round(f[1])):0;r.emplaceBack(e,i,Math.round(32*o),Math.round(32*a),h,u,(I<<1)+(_?1:0),A,16*g,16*v,256*b,256*w)}function qp(r,e,i){r.emplaceBack(e,i)}function Hp(r,e,i,o,a,h,u){r.emplaceBack(e,i,o,a,h,u)}const $p=(r,e,i,o)=>{for(let a=0;a<e;a++)r.emplaceBack(i[0],i[1],i[2],o[0],o[1],o[2])};function Zp(r,e,i,o,a){r.emplaceBack(e,i,o,a),r.emplaceBack(e,i,o,a),r.emplaceBack(e,i,o,a),r.emplaceBack(e,i,o,a)}function b1(r){for(const e of r.sections)if(zf(e.text))return!0;return!1}class Bm{constructor(e){this.layoutVertexArray=new Fc,this.indexArray=new Li,this.programConfigurations=e,this.segments=new Ni,this.dynamicLayoutVertexArray=new ts,this.opacityVertexArray=new au,this.placedSymbolArray=new Sl,this.iconTransitioningVertexArray=new io,this.globeExtVertexArray=new ma,this.zOffsetVertexArray=new Ms,this.orientationVertexArray=new hu}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(e,i,o,a,h){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Iv.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Mv.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,v1,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,zv.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Av.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||h)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Cv.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,Pv.members,!0)),this.opacityVertexBuffer.itemSize=1),(o||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}rt(Bm,"SymbolBuffers");class Nm{constructor(e,i,o){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new o,this.segments=new Ni,this.collisionVertexArray=new ga,this.collisionVertexArrayExt=new ts}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Rv.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Dv.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}rt(Nm,"CollisionBuffers");class Wp{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(u=>u.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=Bt([]),this.placementViewportMatrix=Bt([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.textSizeData=uy(this.zoom,i["text-size"],this.worldview),this.iconSizeData=uy(this.zoom,i["icon-size"],this.worldview);const o=this.layers[0].layout,a=o.get("symbol-sort-key"),h=o.get("symbol-z-order");this.canOverlap=o.get("text-allow-overlap")||o.get("icon-allow-overlap")||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=o.get("text-writing-mode").map(u=>Dn[u]),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1}createArrays(){this.text=new Bm(new An(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new Bm(new An(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new yu,this.lineVertexArray=new ip,this.symbolInstances=new tp}calculateGlyphDependencies(e,i,o,a,h){for(const u of e){const f=u.codePointAt(0);if(f===void 0)break;if(i[f]=!0,a&&h&&f<=65535){const _=Gu[u];_&&(i[_.charCodeAt(0)]=!0)}}}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const o=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!Tp(this.activeReplacements,o)&&(this.activeReplacements=o,!0)}populate(e,i,o,a){const h=this.layers[0],u=h.layout,f=this.projection.name==="globe",_=u.get("text-font"),g=u.get("text-field"),v=u.get("icon-image"),[b,w]=u.get("icon-size-scale-range"),I=W(i.scaleFactor||1,b,w),A=(g.value.kind!=="constant"||g.value.value instanceof $r&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(_.value.kind!=="constant"||_.value.value.length>0),P=v.value.kind!=="constant"||!!v.value.value||Object.keys(v.parameters).length>0,R=u.get("symbol-sort-key");if(this.features=[],!A&&!P)return;const O=i.iconDependencies,U=i.glyphDependencies,V=i.availableImages,G=new fi(this.zoom,{worldview:this.worldview});for(const{feature:re,id:Q,index:te,sourceLayerIndex:ae}of e){const ce=h._featureFilter.needGeometry,Ee=we(re,ce);if(!h._featureFilter.filter(G,Ee,o))continue;if(ce||(Ee.geometry=oe(re,o,a)),f&&re.type!==1&&o.z<=5){const Fe=Ee.geometry,Ve=.98078528056,Te=(Oe,pe)=>er(Su(Oe.x,Oe.y,o,1),Su(pe.x,pe.y,o,1))<Ve;for(let Oe=0;Oe<Fe.length;Oe++)Fe[Oe]=xe(Fe[Oe],Te)}let de,Ae;if(A){const Fe=h.getValueAndResolveTokens("text-field",Ee,o,V),Ve=$r.factory(Fe);b1(Ve)&&(this.hasRTLText=!0),(!this.hasRTLText||eu()==="unavailable"||this.hasRTLText&&eo.isParsed())&&(de=Fv(Ve,h,Ee))}if(P){const Fe=h.getValueAndResolveTokens("icon-image",Ee,o,V);Ae=typeof Fe=="string"?on.build(Fe):Fe}if(!de&&!Ae)continue;const je=this.sortFeaturesByKey?R.evaluate(Ee,{},o):void 0,Ce={id:Q,text:de,icon:Ae,index:te,sourceLayerIndex:ae,geometry:Ee.geometry,properties:re.properties,type:x1[re.type],sortKey:je};if(this.features.push(Ce),Ae){const Fe=this.layers[0]._unevaluatedLayout._values,{iconPrimary:Ve,iconSecondary:Te}=Iy(Ae,this.iconSizeData,Fe["icon-size"],o,this.zoom,Ce,this.pixelRatio,I,this.worldview),Oe=Ve.id.toString();if(O.has(Oe)?O.get(Oe).push(Ve):O.set(Oe,[Ve]),Te){this.hasAnySecondaryIcon=!0;const pe=Te.id.toString();O.has(pe)?O.get(pe).push(Te):O.set(pe,[Te])}}if(de){const Fe=_.evaluate(Ee,{},o).join(","),Ve=u.get("text-rotation-alignment")==="map"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Dn.vertical)>=0;for(const Te of de.sections)if(Te.image){const Oe=Te.image.getPrimary().scaleSelf(this.pixelRatio),pe=Oe.id.toString(),Se=O.get(pe)||[];Se.push(Oe),O.set(pe,Se)}else{const Oe=Yh(de.toString()),pe=Te.fontStack||Fe,Se=U[pe]=U[pe]||{};this.calculateGlyphDependencies(Te.text,Se,Ve,this.allowVerticalPlacement,Oe)}}}if(u.get("symbol-placement")==="line"&&(this.features=function(re){const Q={},te={},ae=[];let ce=0;function Ee(Ce){ae.push(re[Ce]),ce++}function de(Ce,Fe,Ve){const Te=te[Ce];return delete te[Ce],te[Fe]=Te,ae[Te].geometry[0].pop(),ae[Te].geometry[0]=ae[Te].geometry[0].concat(Ve[0]),Te}function Ae(Ce,Fe,Ve){const Te=Q[Fe];return delete Q[Fe],Q[Ce]=Te,ae[Te].geometry[0].shift(),ae[Te].geometry[0]=Ve[0].concat(ae[Te].geometry[0]),Te}function je(Ce,Fe,Ve){const Te=Ve?Fe[0][Fe[0].length-1]:Fe[0][0];return`${Ce}:${Te.x}:${Te.y}`}for(let Ce=0;Ce<re.length;Ce++){const Fe=re[Ce],Ve=Fe.geometry,Te=Fe.text?Fe.text.toString():null;if(!Te){Ee(Ce);continue}const Oe=je(Te,Ve),pe=je(Te,Ve,!0);if(Oe in te&&pe in Q&&te[Oe]!==Q[pe]){const Se=Ae(Oe,pe,Ve),He=de(Oe,pe,ae[Se].geometry);delete Q[Oe],delete te[pe],te[je(Te,ae[He].geometry,!0)]=He,ae[Se].geometry=null}else Oe in te?de(Oe,pe,Ve):pe in Q?Ae(Oe,pe,Ve):(Ee(Ce),Q[Oe]=ce-1,te[pe]=ce-1)}return ae.filter(Ce=>Ce.geometry)}(this.features)),u.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const re of i.elevationFeatures)this.elevationFeatureIdToIndex.set(re.id,this.elevationFeatures.length),this.elevationFeatures.push(re)}}else u.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((re,Q)=>re.sortKey-Q.sortKey)}update(e,i,o,a,h,u,f){this.text.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f,this.worldview)}updateRoadElevation(e){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let i=!1;const o=K(e),a=1/o;let h=!1,u=!1;for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f),g=lr(1,0,0),v=lr(0,1,0),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:w,numIconVertices:I,numVerticalIconVertices:A}=_,P=b>0||w>0,R=I>0,O=this.elevationFeatures[_.elevationFeatureIndex];if(O){const U=new ke(_.tileAnchorX,_.tileAnchorY),V=.075+O.pointElevation(U);_.zOffset!==V&&(i=!0,_.zOffset=V);const G=O.computeSlopeNormal(U,a),re=Bs(ho(),lr(0,0,1),G);Ro(g,g,re),Ro(v,v,re),g[2]*=o,v[2]*=o,g[0]===1&&g[1]===0&&g[2]===0&&v[0]===0&&v[1]===1&&v[2]===0||(h=h||P,u=u||R)}if(P&&($p(this.text.orientationVertexArray,b,g,v),$p(this.text.orientationVertexArray,w,g,v)),R){const{placedIconSymbolIndex:U,verticalPlacedIconSymbolIndex:V}=_;U>=0&&$p(this.icon.orientationVertexArray,I,g,v),V>=0&&$p(this.icon.orientationVertexArray,A,g,v)}}h||(this.text.orientationVertexArray=void 0),u||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(h,u,f)=>{o+=u,o>h.length&&h.resize(o);for(let _=-u;_<0;_++)h.emplace(_+o,f)},i=(h,u,f)=>{a+=u,a>h.length&&h.resize(a);for(let _=-u;_<0;_++)h.emplace(_+a,f)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let o=0,a=0;for(let h=0;h<this.symbolInstances.length;h++){const u=this.symbolInstances.get(h),{numHorizontalGlyphVertices:f,numVerticalGlyphVertices:_,numIconVertices:g}=u,v=u.zOffset,b=g>0;if((f>0||_>0)&&(e(this.text.zOffsetVertexArray,f,v),e(this.text.zOffsetVertexArray,_,v)),b){const{placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:I}=u;w>=0&&i(this.icon.zOffsetVertexArray,g,v),I>=0&&i(this.icon.zOffsetVertexArray,u.numVerticalIconVertices,v)}}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){!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.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Oy(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const o=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:h}of i)this.lineVertexArray.emplaceBack(a,h);return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R){const O=e.indexArray,U=e.layoutVertexArray,V=e.globeExtVertexArray,G=e.segments.prepareSegment(4*i.length,U,O,this.canOverlap?u.sortKey:void 0),re=this.glyphOffsetArray.length,Q=G.vertexLength,te=this.allowVerticalPlacement&&f===Dn.vertical?Math.PI/2:0,ae=u.text&&u.text.sections;for(let Ee=0;Ee<i.length;Ee++){const{tl:de,tr:Ae,bl:je,br:Ce,texPrimary:Fe,texSecondary:Ve,pixelOffsetTL:Te,pixelOffsetBR:Oe,minFontScaleX:pe,minFontScaleY:Se,glyphOffset:He,isSDF:Be,sectionIndex:ct}=i[Ee],nt=G.vertexLength,De=He[1];if(Gp(U,g.x,g.y,de.x,De+de.y,Fe.x,Fe.y,o,Be,Te.x,Te.y,pe,Se),Gp(U,g.x,g.y,Ae.x,De+Ae.y,Fe.x+Fe.w,Fe.y,o,Be,Oe.x,Te.y,pe,Se),Gp(U,g.x,g.y,je.x,De+je.y,Fe.x,Fe.y+Fe.h,o,Be,Te.x,Oe.y,pe,Se),Gp(U,g.x,g.y,Ce.x,De+Ce.y,Fe.x+Fe.w,Fe.y+Fe.h,o,Be,Oe.x,Oe.y,pe,Se),_){const{x:Ne,y:st,z:et}=_.anchor,[Xe,tt,_t]=_.up;Hp(V,Ne,st,et,Xe,tt,_t),Hp(V,Ne,st,et,Xe,tt,_t),Hp(V,Ne,st,et,Xe,tt,_t),Hp(V,Ne,st,et,Xe,tt,_t),Zp(e.dynamicLayoutVertexArray,Ne,st,et,te)}else Zp(e.dynamicLayoutVertexArray,g.x,g.y,g.z,te);if(R){const Ne=Ve||Fe;qp(e.iconTransitioningVertexArray,Ne.x,Ne.y),qp(e.iconTransitioningVertexArray,Ne.x+Ne.w,Ne.y),qp(e.iconTransitioningVertexArray,Ne.x,Ne.y+Ne.h),qp(e.iconTransitioningVertexArray,Ne.x+Ne.w,Ne.y+Ne.h)}O.emplaceBack(nt,nt+1,nt+2),O.emplaceBack(nt+1,nt+2,nt+3),G.vertexLength+=4,G.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(He[0]),Ee!==i.length-1&&
vendor: 6,967 bytes, line 14
14ct===i[Ee+1].sectionIndex||e.programConfigurations.populatePaintArrays(U.length,u,u.index,{},I,A,P,ae&&ae[ct],this.worldview)}const ce=_?_.anchor:g;e.placedSymbolArray.emplaceBack(ce.x,ce.y,ce.z,g.x,g.y,re,this.glyphOffsetArray.length-re,Q,v,b,g.segment,o?o[0]:0,o?o[1]:0,a[0],a[1],f,0,0,0,w,0)}_commitLayoutVertex(e,i,o,a,h,u,f){e.emplaceBack(i,o,a,h,u,Math.round(f.x),Math.round(f.y))}_addCollisionDebugVertices(e,i,o,a,h,u,f){const _=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),g=_.vertexLength,v=f.tileAnchorX,b=f.tileAnchorY;for(let I=0;I<4;I++)o.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(o.collisionVertexArrayExt,i,e.padding,f.zOffset),this._commitLayoutVertex(o.layoutVertexArray,a,h,u,v,b,new ke(e.x1,e.y1)),this._commitLayoutVertex(o.layoutVertexArray,a,h,u,v,b,new ke(e.x2,e.y1)),this._commitLayoutVertex(o.layoutVertexArray,a,h,u,v,b,new ke(e.x2,e.y2)),this._commitLayoutVertex(o.layoutVertexArray,a,h,u,v,b,new ke(e.x1,e.y2)),_.vertexLength+=4;const w=o.indexArray;w.emplaceBack(g,g+1),w.emplaceBack(g+1,g+2),w.emplaceBack(g+2,g+3),w.emplaceBack(g+3,g),_.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,o,a,h,u){for(let f=a;f<h;f++){const _=o.get(f),g=this.getSymbolInstanceTextSize(e,u,i,f);this._addCollisionDebugVertices(_,g,this.textCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,u)}}_addIconDebugCollisionBoxes(e,i,o,a,h,u){for(let f=a;f<h;f++){const _=o.get(f),g=this.getSymbolInstanceIconSize(e,i,u.placedIconSymbolIndex);this._addCollisionDebugVertices(_,g,this.iconCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,u)}}generateCollisionDebugBuffers(e,i,o){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Nm(Oc,Yg.members,io),this.iconCollisionBox=new Nm(Oc,Yg.members,io);const a=Hu(this.iconSizeData,e),h=Hu(this.textSizeData,e,o);for(let u=0;u<this.symbolInstances.length;u++){const f=this.symbolInstances.get(u);this._addTextDebugCollisionBoxes(h,e,i,f.textBoxStartIndex,f.textBoxEndIndex,f),this._addTextDebugCollisionBoxes(h,e,i,f.verticalTextBoxStartIndex,f.verticalTextBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.iconBoxStartIndex,f.iconBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.verticalIconBoxStartIndex,f.verticalIconBoxEndIndex,f)}}getSymbolInstanceTextSize(e,i,o,a){const h=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),u=zm(this.textSizeData,e,h)/Ir;return this.tilePixelRatio*u}getSymbolInstanceIconSize(e,i,o){const a=this.icon.placedSymbolArray.get(o),h=zm(this.iconSizeData,e,a);return this.tilePixelRatio*h}_commitDebugCollisionVertexUpdate(e,i,o,a){e.emplaceBack(i,-o,-o,a),e.emplaceBack(i,o,-o,a),e.emplaceBack(i,o,o,a),e.emplaceBack(i,-o,o,a)}_updateTextDebugCollisionBoxes(e,i,o,a,h,u,f){for(let _=a;_<h;_++){const g=o.get(_),v=this.getSymbolInstanceTextSize(e,u,i,_);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,v,g.padding,u.zOffset)}}_updateIconDebugCollisionBoxes(e,i,o,a,h,u,f){for(let _=a;_<h;_++){const g=o.get(_),v=this.getSymbolInstanceIconSize(e,i,u.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,v,g.padding,u.zOffset)}}updateCollisionDebugBuffers(e,i,o,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const h=Hu(this.iconSizeData,e,a),u=Hu(this.textSizeData,e,o);for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f);this._updateTextDebugCollisionBoxes(u,e,i,_.textBoxStartIndex,_.textBoxEndIndex,_,o),this._updateTextDebugCollisionBoxes(u,e,i,_.verticalTextBoxStartIndex,_.verticalTextBoxEndIndex,_,o),this._updateIconDebugCollisionBoxes(h,e,i,_.iconBoxStartIndex,_.iconBoxEndIndex,_,a),this._updateIconDebugCollisionBoxes(h,e,i,_.verticalIconBoxStartIndex,_.verticalIconBoxEndIndex,_,a)}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,i,o,a,h,u,f,_,g){const v={};if(i<o){const{x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G,featureIndex:re}=e.get(i);v.textBox={x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G},v.textFeatureIndex=re}if(a<h){const{x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G,featureIndex:re}=e.get(a);v.verticalTextBox={x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G},v.verticalTextFeatureIndex=re}if(u<f){const{x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G,featureIndex:re}=e.get(u);v.iconBox={x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G},v.iconFeatureIndex=re}if(_<g){const{x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G,featureIndex:re}=e.get(_);v.verticalIconBox={x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:U,tileAnchorX:V,tileAnchorY:G},v.verticalIconFeatureIndex=re}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const o=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.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,i){const o=e.placedSymbolArray.get(i),a=o.vertexStartIndex+4*o.numGlyphs;for(let h=o.vertexStartIndex;h<a;h+=4)e.indexArray.emplaceBack(h,h+1,h+2),e.indexArray.emplaceBack(h+1,h+2,h+3)}
vendor: 11,147 bytes, line 14
14getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),o=Math.cos(e),a=[],h=[],u=[];for(let f=0;f<this.symbolInstances.length;++f){u.push(f);const _=this.symbolInstances.get(f);a.push(0|Math.round(i*_.tileAnchorX+o*_.tileAnchorY)),h.push(_.featureIndex)}return u.sort((f,_)=>a[f]-a[_]||h[_]-h[f]),u}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,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===i?o.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const o=this.symbolInstances.get(i);this.featureSortOrder.push(o.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:h,leftJustifiedTextSymbolIndex:u,verticalPlacedTextSymbolIndex:f,placedIconSymbolIndex:_,verticalPlacedIconSymbolIndex:g}=o;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),h>=0&&h!==a&&this.addIndicesForPlacedSymbol(this.text,h),u>=0&&u!==h&&u!==a&&this.addIndicesForPlacedSymbol(this.text,u),f>=0&&this.addIndicesForPlacedSymbol(this.text,f),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_),g>=0&&this.addIndicesForPlacedSymbol(this.icon,g)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let ky,By,Vm;rt(Wp,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),Wp.addDynamicAttributes=Zp;class Ny{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:Zs,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.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}}rt(Ny,"FormatSectionOverride",{omit:["defaultValue"]});const Um=()=>Vm||(Vm={layout:ky||(ky=new Yi({"symbol-placement":new Ge(ue.layout_symbol["symbol-placement"]),"symbol-spacing":new Ge(ue.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ge(ue.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Je(ue.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ge(ue.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Ge(ue.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Ge(ue.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Ge(ue.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ge(ue.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ge(ue.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ge(ue.layout_symbol["icon-rotation-alignment"]),"icon-size":new Je(ue.layout_symbol["icon-size"]),"icon-size-scale-range":new Ge(ue.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Je(ue.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Je(ue.layout_symbol["icon-text-fit-padding"]),"icon-image":new Je(ue.layout_symbol["icon-image"]),"icon-rotate":new Je(ue.layout_symbol["icon-rotate"]),"icon-padding":new Ge(ue.layout_symbol["icon-padding"]),"icon-keep-upright":new Ge(ue.layout_symbol["icon-keep-upright"]),"icon-offset":new Je(ue.layout_symbol["icon-offset"]),"icon-anchor":new Je(ue.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ge(ue.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ge(ue.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ge(ue.layout_symbol["text-rotation-alignment"]),"text-field":new Je(ue.layout_symbol["text-field"]),"text-font":new Je(ue.layout_symbol["text-font"]),"text-size":new Je(ue.layout_symbol["text-size"]),"text-size-scale-range":new Ge(ue.layout_symbol["text-size-scale-range"]),"text-max-width":new Je(ue.layout_symbol["text-max-width"]),"text-line-height":new Je(ue.layout_symbol["text-line-height"]),"text-letter-spacing":new Je(ue.layout_symbol["text-letter-spacing"]),"text-justify":new Je(ue.layout_symbol["text-justify"]),"text-radial-offset":new Je(ue.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ge(ue.layout_symbol["text-variable-anchor"]),"text-anchor":new Je(ue.layout_symbol["text-anchor"]),"text-max-angle":new Ge(ue.layout_symbol["text-max-angle"]),"text-writing-mode":new Ge(ue.layout_symbol["text-writing-mode"]),"text-rotate":new Je(ue.layout_symbol["text-rotate"]),"text-padding":new Ge(ue.layout_symbol["text-padding"]),"text-keep-upright":new Ge(ue.layout_symbol["text-keep-upright"]),"text-transform":new Je(ue.layout_symbol["text-transform"]),"text-offset":new Je(ue.layout_symbol["text-offset"]),"text-allow-overlap":new Ge(ue.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ge(ue.layout_symbol["text-ignore-placement"]),"text-optional":new Ge(ue.layout_symbol["text-optional"]),visibility:new Ge(ue.layout_symbol.visibility)})),paint:By||(By=new Yi({"icon-opacity":new Je(ue.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Je(ue.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Je(ue.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Je(ue.paint_symbol["text-emissive-strength"]),"icon-color":new Je(ue.paint_symbol["icon-color"]),"icon-halo-color":new Je(ue.paint_symbol["icon-halo-color"]),"icon-halo-width":new Je(ue.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Je(ue.paint_symbol["icon-halo-blur"]),"icon-translate":new Ge(ue.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ge(ue.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Ge(ue.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Je(ue.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Je(ue.paint_symbol["text-occlusion-opacity"]),"text-color":new Je(ue.paint_symbol["text-color"],{runtimeType:dn,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Je(ue.paint_symbol["text-halo-color"]),"text-halo-width":new Je(ue.paint_symbol["text-halo-width"]),"text-halo-blur":new Je(ue.paint_symbol["text-halo-blur"]),"text-translate":new Ge(ue.paint_symbol["text-translate"]),"text-translate-anchor":new Ge(ue.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Ge(ue.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Ge(ue.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Ge(ue.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Ge(ue.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Je(ue.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},Vm);class Xp extends Vr{constructor(e,i,o,a){super(e,Um(),i,o,a),this._colorAdjustmentMatrix=Bt([]),this.hasInitialOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),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 o=this.layout.get("text-writing-mode");if(o){const a=[];for(const h of o)a.indexOf(h)<0&&a.push(h);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,o,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===o&&this._brightnessMax===a||(this._colorAdjustmentMatrix=function(h,u,f,_){h=kr(h),u=rn(u);const g=cs(),v=h/3,b=1-2*v,w=[b,v,v,0,v,b,v,0,v,v,b,0,0,0,0,1],I=.5-.5*u,A=_-f;return Gi(g,[A,0,0,0,0,A,0,0,0,0,A,0,f,f,f,1],[u,0,0,0,0,u,0,0,0,0,u,0,I,I,I,1]),Gi(g,g,w),g}(e,i,o,a),this._saturation=e,this._contrast=i,this._brightnessMin=o,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,o,a){const h=this.layout.get(e).evaluate(i,{},o,a),u=this._unevaluatedLayout._values[e];return u.isDataDriven()||$h(u.value)||!h?h:function(f,_){return _.replace(/{([^{}]+)}/g,(g,v)=>v in f?String(f[v]):"")}(i.properties,h)}createBucket(e){return new Wp(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of Um().paint.overridableProperties){if(!Xp.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),o=new Ny(i),a=new Hh(o,i.property.specification,this.scope,this.options);let h=null;h=i.value.kind==="constant"||i.value.kind==="source"?new Tc("source",a):new Yo("composite",a,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new As(i.property,h,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,o){return!(!this.layout||i.isDataDriven()||o.isDataDriven())&&Xp.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const o=e.get("text-field"),a=Um().paint.properties[i];let h=!1;const u=f=>{for(const _ of f)if(a.overrides&&a.overrides.hasOverride(_))return void(h=!0)};if(o.value.kind==="constant"&&o.value.value instanceof $r)u(o.value.value.sections);else if(o.value.kind==="source"){const f=g=>{h||(g instanceof xt&&it(g.value)===tl?u(g.value.sections):g instanceof Xs?u(g.sections):g.eachChild(f))},_=o.value;_._styleExpression&&f(_._styleExpression.expression)}return h}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,o){return{config:new Xr(this,{zoom:i,lut:o}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}
vendor: 8,902 bytes, line 14
14let Vy,Uy,jy,Gy;var jm=$t([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function Yp(r,e,i,o,a,h,u,f){const _=[r,e,1,i,o,1,a,h,1],g=[u,f,1],v=ls([],_),[b,w,I]=zo(g,g,v);return Kn(_,_,[b,0,0,0,w,0,0,0,I])}function qy(r,e,i,o,a,h,u,f){const _=function(g,v,b,w,I,A,P,R){const O=Yp(0,0,1,0,1,1,0,1),U=Yp(g,v,b,w,I,A,P,R);return Kn(U,U,ls([],O))}(r,e,i,o,a,h,u,f);return[_[2]/_[8]/We,_[5]/_[8]/We]}function Kp(r){return[r[0],Math.min(Math.max(r[1],-X),X)]}class Hy extends _s{constructor(e,i,o,a){super(),this.id=e,this.dispatcher=o,this.coordinates=i.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(a),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new yo("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Ka(this.map._requestManager.transformRequest(this.url,Wa.Image),(o,a)=>{this._imageRequest=null,this._loaded=!0,o?this.fire(new wn(o)):a&&(this.image=a instanceof HTMLImageElement?Hn.getImageData(a):a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new Vu(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new yo("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof Vu||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],o=e[0][1];for(const h of e)h[1]>o&&(o=h[1]),h[1]<i&&(i=h[1]);const a=(o+i)/2;if(a>X?this.onNorthPole=!0:a<-X&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const h=e.map(J.fromLngLat);this.tileID=function(u){let f=1/0,_=1/0,g=-1/0,v=-1/0;for(const P of u)f=Math.min(f,P.x),_=Math.min(_,P.y),g=Math.max(g,P.x),v=Math.max(v,P.y);const b=Math.max(g-f,v-_),w=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),I=Math.pow(2,w);let A=Math.floor((f+g)/2*I);return A>1&&(A-=1),new Pn(w,A,Math.floor((_+v)/2*I))}(h),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new yo("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof Vu||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const O in this.tiles){const U=this.tiles[O];U.state!=="loaded"&&(U.state="loaded",U.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Xu(new Pn(0,0,0),this.map.transform.projection),o=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(O){const U=O[1].x-O[0].x,V=O[1].y-O[0].y,G=O[2].x-O[1].x,re=O[2].y-O[1].y,Q=O[3].x-O[2].x,te=O[3].y-O[2].y,ae=O[0].x-O[3].x,ce=O[0].y-O[3].y,Ee=U*re-G*V,de=G*te-Q*re,Ae=Q*ce-ae*te,je=ae*V-U*ce;return Ee>0&&de>0&&Ae>0&&je>0||Ee<0&&de<0&&Ae<0&&je<0}(o))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const a=Xu(this.tileID,this.map.transform.projection),[h,u,f,_]=this.coordinates.map(O=>{const U=a.projection.project(O[0],O[1]);return zy(a,U)._round()});this.perspectiveTransform=qy(h.x,h.y,u.x,u.y,f.x,f.y,_.x,_.y);const g=this._boundsArray=new pa;g.emplaceBack(h.x,h.y,0,0),g.emplaceBack(u.x,u.y,We,0),g.emplaceBack(_.x,_.y,0,We),g.emplaceBack(f.x,f.y,We,We),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(g,jm.members),this.boundsSegments=Ni.simpleSegment(0,0,4,2);const v=[],b=[Kp((w=this.coordinates)[0]),Kp(w[1]),Kp(w[2]),Kp(w[3])];var w;const[I,A,P,R]=function(O){let U=O[0][0],V=U,G=O[0][1],re=G;for(let Q=1;Q<O.length;Q++)O[Q][0]<U?U=O[Q][0]:O[Q][0]>V&&(V=O[Q][0]),O[Q][1]<G?G=O[Q][1]:O[Q][1]>re&&(re=O[Q][1]);return[U,G,V-U,re-G]}(b);{const O=new pa,[U,V,G,re]=function(Te){let Oe=Te[0].x,pe=Oe,Se=Te[0].y,He=Se;for(let Be=1;Be<Te.length;Be++)Te[Be].x<Oe?Oe=Te[Be].x:Te[Be].x>pe&&(pe=Te[Be].x),Te[Be].y<Se?Se=Te[Be].y:Te[Be].y>He&&(He=Te[Be].y);return[Oe,Se,pe-Oe,He-Se]}(o),Q=Te=>[(Te.x-U)/G,(Te.y-V)/re],[te,ae,ce,Ee]=o.map(Q),de=function(Te,Oe,pe,Se,He,Be,ct,nt){const De=Yp(0,0,1,0,1,1,0,1);return Kn(De,De,ls([],Yp(Te,Oe,pe,Se,He,Be,ct,nt)))}(te[0],te[1],ae[0],ae[1],ce[0],ce[1],Ee[0],Ee[1]);this.elevatedGlobePerspectiveTransform=qy(te[0],te[1],ae[0],ae[1],ce[0],ce[1],Ee[0],Ee[1]);const Ae=(Te,Oe)=>{v.push(Te.lng);const pe=Math.round((Te.lng-I)/P*We),Se=Math.round((Te.lat-A)/R*We),He=Q(Oe),Be=zo([],[He[0],He[1],1],de),ct=Math.round(Be[0]/Be[2]*We),nt=Math.round(Be[1]/Be[2]*We);O.emplaceBack(pe,Se,ct,nt)},je=o[3].x-o[0].x,Ce=o[3].y-o[0].y,Fe=o[2].x-o[1].x,Ve=o[2].y-o[1].y;for(let Te=0;Te<65;Te++){const Oe=Te/64,pe=[o[0].x+Oe*je,o[0].y+Oe*Ce],Se=[o[1].x+Oe*Fe,o[1].y+Oe*Ve],He=Se[0]-pe[0],Be=Se[1]-pe[1];for(let ct=0;ct<65;ct++){const nt=ct/64,De={x:pe[0]+He*nt,y:pe[1]+Be*nt};Ae(i.projection.unproject(De.x,De.y),De)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(O,jm.members)}{this.maxLongitudeTriangleSize=0;let O=[],U=new Li;const V=(G,re,Q)=>{U.emplaceBack(G,re,Q);const te=v[G],ae=v[re],ce=v[Q],Ee=Math.min(Math.min(te,ae),ce),de=Math.max(Math.max(te,ae),ce)-Ee;de>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=de),O.push(Ee+de/2)};for(let G=0;G<64;G++)for(let re=0;re<64;re++){const Q=65*G+re,te=Q+1,ae=Q+65,ce=ae+1;V(Q,ae,te),V(te,ae,ce)}[O,U]=function(G,re){const Q=Array.from({length:G.length},(ce,Ee)=>Ee);Q.sort((ce,Ee)=>G[ce]-G[Ee]);const te=[],ae=new Li;for(let ce=0;ce<Q.length;ce++){const Ee=Q[ce];te.push(G[Ee]);const de=3*Ee,Ae=de+1;ae.emplaceBack(re.uint16[de],re.uint16[Ae],re.uint16[Ae+1])}return[te,ae]}(O,U),this.elevatedGlobeTrianglesCenterLongitudes=O,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(U)}this.elevatedGlobeSegments=Ni.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,P/We,0,R/We,0,0,A,I,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,o=i.gl;!this._dirty||this.texture instanceof Vu||(this.texture?this.texture.update(this.image):(this.texture=new gm(i,this.image,o.RGBA8),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const o=this.elevatedGlobeTrianglesCenterLongitudes;let a=(h=e+180)+360*Math.round((o[0]-h)/360);var h;const u=new Ni,f=(b,w)=>{u.segments.push({vertexOffset:0,primitiveOffset:b,vertexLength:i.segments[0].vertexLength,primitiveLength:w,sortKey:void 0,vaos:{}})},_=.51*this.maxLongitudeTriangleSize;if(Math.abs(o[0]-a)<=_){const b=wr(o,0,o.length,a+_);return b===o.length||f(b,Bi(o,b+1,o.length,a+360-_)-b),u}a<o[0]&&(a+=360);const g=Bi(o,0,o.length,a-_);if(g===o.length)return f(0,o.length),u;f(0,g-0);const v=wr(o,g+1,o.length,a+_);return v!==o.length&&f(v,o.length-v),u}}const w1=(Math.pow(256,2)-1)/16907520;class $y extends Vr{constructor(e,i,o,a){super(e,{layout:jy||(jy=new Yi({visibility:new Ge(ue.layout_raster.visibility)})),paint:Gy||(Gy=new Yi({"raster-opacity":new Ge(ue.paint_raster["raster-opacity"]),"raster-color":new la(ue.paint_raster["raster-color"]),"raster-color-mix":ne
vendor: 13,983 bytes, line 14
14w Ge(ue.paint_raster["raster-color-mix"]),"raster-color-range":new Ge(ue.paint_raster["raster-color-range"]),"raster-hue-rotate":new Ge(ue.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ge(ue.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ge(ue.paint_raster["raster-brightness-max"]),"raster-saturation":new Ge(ue.paint_raster["raster-saturation"]),"raster-contrast":new Ge(ue.paint_raster["raster-contrast"]),"raster-resampling":new Ge(ue.paint_raster["raster-resampling"]),"raster-fade-duration":new Ge(ue.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new Ge(ue.paint_raster["raster-emissive-strength"]),"raster-array-band":new Ge(ue.paint_raster["raster-array-band"]),"raster-elevation":new Ge(ue.paint_raster["raster-elevation"]),"raster-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},i,o,a),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){return!(e&&e._source instanceof Hy&&(e._source.onNorthPole||e._source.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)}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[o,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(o)&&isNaN(a)||o===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=Eu({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:o,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[o,a])}}let Zy,Wy,Xy,Yy,Ky;class Jy extends Vr{constructor(e,i,o,a){super(e,{layout:Zy||(Zy=new Yi({visibility:new Ge(ue["layout_raster-particle"].visibility)})),paint:Wy||(Wy=new Yi({"raster-particle-array-band":new Ge(ue["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new Ge(ue["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new la(ue["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new Ge(ue["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new Ge(ue["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new Ge(ue["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new Ge(ue["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new Ge(ue["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},i,o,a),this._updateColorRamp(),this.lastInvalidatedAt=Hn.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(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,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Eu({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=Hn.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class T1 extends Vr{constructor(e,i){super(e,{},i,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 Gm(r,e,i){const o=[0,0,1],a=uo([]);return ks(a,a,i?-ei(r)+Math.PI:ei(r)),hs(a,a,-ei(e)),Ro(o,o,a),Ri(o,o)}const Qy={None:0,Model:1,Symbol:2,FillExtrusion:4};class Jp{constructor(e,i,o,a){this.message=(e?`${e}: `:"")+o,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function qm(r,e){const i=r.indexOf("://")===-1;try{return new URL(r,i&&e?"http://example.com":void 0),!0}catch{return!1}}class e0{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class t0{constructor(){this.instancedDataArray=new kc,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class Hm{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?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}updateFootprints(e,i){}populate(e,i,o,a){this.tileToMeter=K(o);const h=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:u,id:f,index:_,sourceLayerIndex:g}of e){const v=f??(u.properties&&u.properties.hasOwnProperty("id")?u.properties.id:void 0),b=we(u,h);if(!this.layers[0]._featureFilter.filter(new fi(this.zoom,{worldview:this.worldview}),b,o))continue;const w={id:v,sourceLayerIndex:g,index:_,geometry:h?b.geometry:oe(u,o,a),properties:u.properties,type:u.type,patterns:{}},I=this.addFeature(w,w.geometry,b);I&&i.featureIndex.insert(u,w.geometry,_,g,this.index,this.instancesPerModel[I].instancedDataArray.length,We/32)}this.lookup=null}update(e,i,o,a){for(const h in this.instancesPerModel){const u=this.instancesPerModel[h];for(const f in e)u.idToFeaturesIndex.hasOwnProperty(f)&&(this.evaluate(u.features[u.idToFeaturesIndex[f]],e[f],u,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const o=this.instancesPerModel[i];for(const a of o.features){const h=this.layers[0],u=a.feature,f=this.canonical,_=h.paint.get("model-rotation").evaluate(u,{},f),g=h.paint.get("model-scale").evaluate(u,{},f),v=h.paint.get("model-translation").evaluate(u,{},f);Fn(a.rotation,_)&&Fn(a.scale,g)&&Fn(a.translation,v)||(this.evaluate(a,a.featureStates,o,!0),e=!0)}}return e}updateReplacement(e,i,o,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const h=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(Tp(this.activeReplacements,h))return!1;this.activeReplacements=h;let u=!1;for(const f in this.instancesPerModel){const _=this.instancesPerModel[f],g=_.instancedDataArray;for(const v of _.features){const b=v.instancedDataOffset,w=v.instancedDataCount;for(let I=0;I<w;I++){const A=16*(I+b);let P=g.float32[A+0];const R=P>We;P=R?P-We:P;const O=Math.floor(P),U=g.float32[A+1];let V=!1;for(const G of this.activeReplacements)if(!j_(G,o,Qy.Model,a)&&!(G.min.x>O||O>G.max.x||G.min.y>U||U>G.max.y)&&(V=om($_(O,U,e.canonical,G.footprintTileId.canonical),G.footprint),V))break;g.float32[A]=V?P+We:P,u=u||V!==R}}}return u}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 i in this.instancesPerModel){const o=this.instancesPerModel[i];o.instancedDataArray.length<0||o.instancedDataArray.length===0||(o.instancedDataBuffer?o.instancedDataBuffer.updateData(o.instancedDataArray):o.instancedDataBuffer=e.createVertexBuffer(o.instancedDataArray,iv.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const i in this.instancesPerModel){const o=this.instancesPerModel[i];o.instancedDataArray.length!==0&&o.instancedDataBuffer&&o.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris&&this.modelsRequested)for(const i of this.modelUris)e.removeModel(i,"",!0)}addFeature(e,i,o){const a=this.layers[0],h=a.layout.get("model-id").evaluate(o,{},this.canonical);if(!h)return Gt(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),h;(qm(h,!1)||this.styleDefinedModelURLs[h]!==void 0)&&(this.modelUris.includes(h)||this.modelUris.push(h)),this.instancesPerModel[h]||(this.instancesPerModel[h]=new t0);const u=this.instancesPerModel[h],f=u.instancedDataArray,_=new e0(o,f.length);for(const g of i)for(const v of g){if(v.x<0||v.x>=We||v.y<0||v.y>=We)continue;const b=(this.lookupDim-1)/We,w=this.lookupDim*(v.y*b|0)+v.x*b|0;if(this.lookup){if(this.lookup[w]!==0)continue;this.lookup[w]=1}this.instanceCount++;const I=f.length;f.resize(I+1),u.instancesEvaluatedElevation.push(0),f.float32[16*I]=v.x,f.float32[16*I+1]=v.y}return _.instancedDataCount=u.instancedDataArray.length-_.instancedDataOffset,_.instancedDataCount>0&&(e.id&&(u.idToFeaturesIndex[e.id]=u.features.length),u.features.push(_),this.evaluate(_,{},u,!1)),h}getModelUris(){return this.modelUris}evaluate(e,i,o,a){const h=this.layers[0],u=e.feature,f=this.canonical,_=e.rotation=h.paint.get("model-rotation").evaluate(u,i,f),g=e.scale=h.paint.get("model-scale").evaluate(u,i,f),v=e.translation=h.paint.get("model-translation").evaluate(u,i,f),b=h.paint.get("model-color").evaluate(u,i,f);b.a=h.paint.get("model-color-mix-intensity").evaluate(u,i,f);const w=[];this.maxVerticalOffset<v[2]&&(this.maxVerticalOffset=v[2]),this.maxScale=Math.max(Math.max(this.maxScale,g[0]),Math.max(g[1],g[2])),Ag(w,_,g);const I=Math.round(100*b.a)+b.b/1.05;for(let A=0;A<e.instancedDataCount;++A){const P=e.instancedDataOffset+A,R=16*P,O=o.instancedDataArray.float32;let U=0;a&&(U=O[R+6]-o.instancesEvaluatedElevation[P]);const V=0|O[R+1];O[R]=(0|O[R])+b.r/1.05,O[R+1]=V+b.g/1.05,O[R+2]=I,O[R+3]=1/(f.z>10?this.tileToMeter:K(f,V)),O[R+4]=v[0],O[R+5]=v[1],O[R+6]=v[2]+U,O[R+7]=w[0],O[R+8]=w[1],O[R+9]=w[2],O[R+10]=w[4],O[R+11]=w[5],O[R+12]=w[6],O[R+13]=w[8],O[R+14]=w[9],O[R+15]=w[10],o.instancesEvaluatedElevation[P]=v[2]}}}let i0,r0;rt(Hm,"ModelBucket",{omit:["layers"]}),rt(t0,"PerModelAttributes"),rt(e0,"ModelFeature");class th{constructor(e,i,o){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=o}static create(e,i,o){const a=o||e.findDEMTileFor(i);if(!a||!a.dem)return;const h=a.dem,u=a.tileID,f=1<<i.canonical.z-u.canonical.z;return new th(a,h.dim/We/f,[(i.canonical.x/f-u.canonical.x)*h.dim,(i.canonical.y/f-u.canonical.y)*h.dim])}tileCoordToPixel(e,i){const o=i*this._scale+this._offset[1];return new ke(Math.floor(e*this._scale+this._offset[0]),Math.floor(o))}getElevationAt(e,i,o,a){const h=e*this._scale+this._offset[0],u=i*this._scale+this._offset[1],f=Math.floor(h),_=Math.floor(u),g=this._dem;return a=!!a,o?ft(ft(g.get(f,_,a),g.get(f,_+1,a),u-_),ft(g.get(f+1,_,a),g.get(f+1,_+1,a),u-_),h-f):g.get(f,_,a)}getElevationAtPixel(e,i,o){return this._dem.get(e,i,!!o)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*L(1,e)*this._dem.stride}}const $m=new Float32Array(262144),kl=new Uint8Array(262144);function n0(r){let e=0;if(r.meshes)for(const i of r.meshes)e=Math.max(e,i.aabb.max[2]);if(r.children)for(const i of r.children)e=Math.max(e,n0(i));return e}function o0(r,e,i){if(r.meshes)for(const o of r.meshes){if(o.aabb.min[0]===1/0)continue;const a=kt.applyTransform(o.aabb,r.matrix);i.insert(e,a.min[0],a.min[1],a.max[0],a.max[1])}if(r.children)for(const o of r.children)o0(o,e,i)}const s0=["","wall","door","roof","window","lamp","logo"];class a0{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.feature={type:"Point",id:e.id,geometry:[],properties:{height:n0(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new kt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new kt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const o of this.node.meshes)this.node.lightMeshIndex!==e&&(o.transformedAabb=kt.applyTransformFast(o.aabb,this.node.matrix),i.encapsulate(
14o.transformedAabb)),e++;this.aabb=i}return this.aabb}}class Qp{constructor(e,i,o,a,h,u,f,_){this.id=o,this.layers=e,this.layerIds=this.layers.map(g=>g.fqid),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.modelTraits|=Xc.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=Xc.HasMapboxMeshFeatures),h&&(this.modelTraits|=Xc.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=u,this.worldview=_,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const g of i)this.nodesInfo.push(new a0(g)),o0(g,f.featureIndexArray.length,f.grid),f.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,f.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,i){for(const o of this.getNodesInfo()){const a=o.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const o=i?this.stateDependentLayers:this.layers;if(!mo(e,this.states))for(const a of o)this.evaluate(a,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 i=this.getNodesInfo();for(const o of i){const a=o.node;this.uploaded?this.updatePbrBuffer(a):vm(a,e,!0)}for(const o of i)Dp(o.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const o of e.meshes)o.pbrBuffer&&(o.pbrBuffer.updateData(o.featureArray),i=!0);return i}needsReEvaluation(e,i,o){const a=e.transform.projectionOptions,h=e.style.getBrightness(),u=this.brightness!==h;if(!this.uploaded||this.dirty||a.name!==this.projection.name||ed(o.paint.get("model-color").value,u)||ed(o.paint.get("model-color-mix-intensity").value,u)||ed(o.paint.get("model-roughness").value,u)||ed(o.paint.get("model-emissive-strength").value,u)||ed(o.paint.get("model-height-based-emissive-strength-multiplier").value,u)){this.projection=a,this.brightness=h;const f=this.getNodesInfo();for(const _ of f)_.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const o=this.getNodesInfo(),a=this.id.canonical;for(const h of o){const u=h.feature;h.evaluatedTranslation=i.paint.get("model-translation").evaluate(u,{},a),h.evaluatedScale=i.paint.get("model-scale").evaluate(u,{},a)}}evaluate(e,i){const o=this.getNodesInfo();for(const a of o){if(!a.node.meshes)continue;const h=a.feature,u=i&&i[h.id];if(mo(u,a.state))continue;a.state=structuredClone(u);const f=a.node.meshes&&a.node.meshes[0].featureData,_=a.evaluatedColor[2],g=a.evaluatedRMEA[2],v=this.id.canonical;if(a.hasTranslucentParts=!1,f){for(let b=0;b<s0.length;b++){const w=s0[b];w.length&&(h.properties.part=w);const I=e.paint.get("model-color").evaluate(h,u,v).toPremultipliedRenderColor(null),A=e.paint.get("model-color-mix-intensity").evaluate(h,u,v);a.evaluatedColor[b]=[I.r,I.g,I.b,A],a.evaluatedRMEA[b][0]=e.paint.get("model-roughness").evaluate(h,u,v),a.evaluatedRMEA[b][2]=e.paint.get("model-emissive-strength").evaluate(h,u,v),a.evaluatedRMEA[b][3]=I.a,a.emissionHeightBasedParams[b]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(h,u,v),!a.hasTranslucentParts&&I.a<1&&(a.hasTranslucentParts=!0)}delete h.properties.part,E1(a,_!==a.evaluatedColor[2]||g!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(h,u,v);a.evaluatedTranslation=e.paint.get("model-translation").evaluate(h,u,v),a.evaluatedScale=e.paint.get("model-scale").evaluate(h,u,v),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,o,a){const h=e.findDEMTileFor(o);if(h&&(h.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(h.dem&&h.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=h.tileID.overscaledZ;const u=th.create(e,o,h);if(!u)return;
vendor: 4,202 bytes, line 14
14this.modelTraits&Xc.HasMapboxMeshFeatures&&this.updateDEM(e,u,o,a);for(const f of this.getNodesInfo()){const _=f.node;if(!_.footprint||!_.footprint.vertices||!_.footprint.vertices.length)continue;const g=_.footprint.vertices;let v=u.getElevationAt(g[0].x,g[0].y,!0,!0);for(let b=1;b<g.length;b++)v=Math.min(v,u.getElevationAt(g[b].x,g[b].y,!0,!0));_.elevation=v}}this.terrainTile=h.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,o,a){let h=i._dem._modifiedForSources[a];if(h===void 0&&(i._dem._modifiedForSources[a]=[],h=i._dem._modifiedForSources[a]),h.includes(o.canonical))return;const u=i._dem.dim;h.push(o.canonical);let f=!1;for(const _ of this.getNodesInfo()){const g=_.node;if(!g.footprint||!g.footprint.grid)continue;const v=g.footprint.grid,b=i.tileCoordToPixel(v.min.x,v.min.y),w=i.tileCoordToPixel(v.max.x,v.max.y),I=Math.min(Math.min(u-w.y,b.x),Math.min(b.y,u-w.x));if(I<0)continue;const A=W(I,2,5);let P=Math.max(0,b.x-A),R=Math.max(0,b.y-A),O=Math.min(w.x+A,u-1),U=Math.min(w.y+A,u-1);for(let Q=R;Q<=U;++Q)for(let te=P;te<=O;++te)kl[Q*u+te]=255;let V=0,G=0;for(let Q=0;Q<v.cellsY;++Q)for(let te=0;te<v.cellsX;++te){if(!v.cells[Q*v.cellsX+te])continue;const ae=i.tileCoordToPixel(v.min.x+te/v.xScale,v.min.y+Q/v.yScale),ce=i.tileCoordToPixel(v.min.x+(te+1)/v.xScale,v.min.y+(Q+1)/v.yScale);for(let Ee=ae.y;Ee<=Math.min(ce.y+1,u-1);++Ee)for(let de=ae.x;de<=Math.min(ce.x+1,u-1);++de)kl[Ee*u+de]===255&&(kl[Ee*u+de]=0,V+=i.getElevationAtPixel(de,Ee),G++)}const re=V/G;P=Math.max(1,b.x-A),R=Math.max(1,b.y-A),O=Math.min(w.x+A,u-2),U=Math.min(w.y+A,u-2),f=!0;for(let Q=R;Q<=U;++Q)for(let te=P;te<=O;++te)kl[Q*u+te]===0&&($m[Q*u+te]=i._dem.set(te,Q,re));for(let Q=1;Q<A;++Q){P=Math.max(1,b.x-Q),R=Math.max(1,b.y-Q),O=Math.min(w.x+Q,u-2),U=Math.min(w.y+Q,u-2);for(let te=R;te<=U;++te)for(let ae=P;ae<=O;++ae){const ce=te*u+ae;if(kl[ce]===255){let Ee=0,de=0,Ae=-1,je=-1;for(let Ce=-1;Ce<=1;++Ce)for(let Fe=-1;Fe<=1;++Fe){const Ve=(te+Ce)*u+ae+Fe;if(kl[Ve]>=Q)continue;const Te=$m[Ve],Oe=Math.abs(Te);Oe>de&&(Ee=Te,de=Oe,Ae=Fe,je=Ce)}if(de>.1){const Ce=1-(Q+.5*Math.abs(Ae*je))/A;let Fe=i._dem.get(ae,te)+Ee*Ce;const Ve=i._dem.get(ae+Ae,te+je),Te=i._dem.get(ae-Ae,te-je,!0);(Fe-Ve)*(Fe-Te)>0&&(Fe=(Ve+Te)/2),$m[ce]=i._dem.set(ae,te,Fe),kl[ce]=Q}}}}}f&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Hn.now())}setFilter(e){this.filter=e?ca(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new fi(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)Dp(i.node),bm(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const o=i.getReplacementRegionsForTile(e.toUnwrapped());for(const a of this.getNodesInfo()){const h=a.node.footprint;a.hiddenByReplacement=!!h&&!o.find(u=>u.footprint===h)}}getHeightAtTileCoord(e,i){const o=[],a=[0,0,0],h=Bt([]);for(const u of this.getNodesInfo()){const f=u.node.meshes[0],_=f.transformedAabb;if(e<_.min[0]||i<_.min[1]||e>_.max[0]||i>_.max[1])continue;if(u.node.hidden===!0)return{height:1/0,maxHeight:u.feature.properties.height,hidden:!1,verticalScale:u.evaluatedScale[2]};Jr(h,u.node.matrix),a[0]=e,a[1]=i,tr(a,a,h);const g=(a[0]-f.aabb.min[0])/(f.aabb.max[0]-f.aabb.min[0])*Ll|0,v=Math.min(63,(a[1]-f.aabb.min[1])/(f.aabb.max[1]-f.aabb.min[1])*Ll|0)*Ll+Math.min(63,g),b=f.heightmap[v];if(!(b<0&&u.node.footprint))return u.hiddenByReplacement?void 0:{height:b,maxHeight:u.feature.properties.height,hidden:!1,verticalScale:u.evaluatedScale[2]};if(u.node.footprint.grid.query(new ke(e,i),new ke(e,i),o),o.length>0)return{height:void 0,maxHeight:u.feature.properties.height,hidden:u.hiddenByReplacement,verticalScale:u.evaluatedScale[2]}}}}function ed(r,e){return r instanceof Tc&&!r.isLightConstant&&e}function S1(r,e,i,o,a,h,u,f){let _=(61440&e|(61440&e)>>4)>>8,g=(3840&e|(3840&e)>>4)>>4,v=240&e|(240&e)>>4;i[3]>0&&(_=ft(_,255*i[0],i[3]),g=ft(g,255*i[1],i[3]),v=ft(v,255*i[2],i[3]));const b=_<<8|g,w=v<<8|Math.floor(255*o[3]),I=function(Q){const te=W(Q,0,2);return Math.min(Math.round(.5*te*255),255)}
14(o[2])<<8|15*o[0]<<4|15*o[1],A=W(a[0],0,1),P=W(a[1],0,1),R=W(a[2],0,1),O=W(a[3],0,1);let U,V,G,re;if(A!==P&&u!==h&&P!==A){const Q=u-h;V=1/(Q*(P-A)),G=-(h+Q*A)/(Q*(P-A));const te=W(a[4],-1,1);re=Math.pow(10,te),U=255*R<<8|255*O}else U=65535,V=0,G=1,re=1;if(r.emplaceBack(b,w,I,U,V,G,re),f){const Q=f.length;f.clear();for(let te=0;te<Q;te++)f.emplaceBack(b,w,I,U,V,G,re)}}function E1(r,e,i){const o=r.node;let a=0;const h=i&Xc.HasMeshoptCompression;for(const u of o.meshes){if(o.lights&&o.lightMeshIndex===a||!u.featureData)continue;u.featureArray=new xa,u.featureArray.reserve(u.featureData.length);let f=e;for(const _ of u.featureData){const g=h?65535&_:_>>16&65535,v=h?_>>16&65535:65535&_,b=(15&v)<8?15&v:0,w=r.evaluatedRMEA[b],I=r.evaluatedColor[b],A=r.emissionHeightBasedParams[b];let P;if(f&&b===2&&o.lights&&(P=new xa,P.resize(10*o.lights.length)),S1(u.featureArray,g,I,w,A,u.aabb.min[2],u.aabb.max[2],P),P&&f){f=!1;const R=o.meshes[o.lightMeshIndex];R.featureArray=P,R.featureArray._trim()}}u.featureArray._trim(),a++}}function l0(r,e,i,o){const a=1<<r.z;e.lat=j((o/We+r.y)/a),e.lng=N((i/We+r.x)/a)}function I1(r,e,i,o){const a=r.getNodesInfo()[e];
vendor: 27,388 bytes, line 14
14if(!a||a.hiddenByReplacement||!a.node.meshes)return;let h=Number.MAX_VALUE;const u=a.node,f=i.tile,_=o.calculatePosMatrix(f.tileID.toUnwrapped(),o.worldSize),g=a.evaluatedScale;let v=0;o.elevation&&u.elevation&&(v=u.elevation*o.elevation.exaggeration()),qr(_,_,[(u.anchor?u.anchor[0]:0)*(g[0]-1),(u.anchor?u.anchor[1]:0)*(g[1]-1),v]),Fr(_,_,g);const b=i.queryGeometry,w=b.isPointQuery()?b.screenBounds:b.screenGeometry,I=function(P){const R=Gi([],_,P.matrix);Gi(R,o.expandedFarZProjMatrix,R);for(let O=0;O<P.meshes.length;++O){const U=P.meshes[O];if(O===P.lightMeshIndex)continue;const V=Mg(w,o,R,U.aabb);V!=null&&(h=Math.min(V,h))}if(P.children)for(const O of P.children)I(O)};if(I(u),h===Number.MAX_VALUE)return;const A=new S(0,0);return l0(f.tileID.canonical,A,a.node.anchor[0],a.node.anchor[1]),{intersectionZ:h,position:A,feature:a.feature}}rt(Qp,"Tiled3dModelBucket",{omit:["layers"]}),rt(a0,"Tiled3dModelFeature");const A1={circle:class extends Vr{constructor(r,e,i,o){super(r,{layout:rs||(rs=new Yi({"circle-sort-key":new Je(ue.layout_circle["circle-sort-key"]),"circle-elevation-reference":new Ge(ue.layout_circle["circle-elevation-reference"]),visibility:new Ge(ue.layout_circle.visibility)})),paint:wa||(wa=new Yi({"circle-radius":new Je(ue.paint_circle["circle-radius"]),"circle-color":new Je(ue.paint_circle["circle-color"]),"circle-blur":new Je(ue.paint_circle["circle-blur"]),"circle-opacity":new Je(ue.paint_circle["circle-opacity"]),"circle-translate":new Ge(ue.paint_circle["circle-translate"]),"circle-translate-anchor":new Ge(ue.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ge(ue.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ge(ue.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Je(ue.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Je(ue.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Je(ue.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new Ge(ue.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}createBucket(r){return new oi(r)}queryRadius(r){const e=r;return Er("circle-radius",this,e)+Er("circle-stroke-width",this,e)+Qi(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,i,o,a,h,u,f){const _=Ps(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,r.pixelToTileUnitsFactor),g=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return m_(r,o,h,u,f,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",_,g)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,i){const o=f_(this);return{config:new Xr(this,{zoom:e,lut:i}),defines:o,overrideFog:!1}}is3D(r){return!r&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends Vr{createBucket(r){return new g_(r)}constructor(r,e,i,o){super(r,{layout:y_||(y_=new Yi({visibility:new Ge(ue.layout_heatmap.visibility)})),paint:x_||(x_=new Yi({"heatmap-radius":new Je(ue.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Je(ue.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ge(ue.paint_heatmap["heatmap-intensity"]),"heatmap-color":new la(ue.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ge(ue.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Eu({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(r){return Er("heatmap-radius",this,r)}queryIntersectsFeature(r,e,i,o,a,h,u,f){const _=this.paint.get("heatmap-radius").evaluate(e,i);return m_(r,o,h,u,f,!0,!0,new ke(0,0),_)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(r,e,i){return r==="heatmap"?{config:new Xr(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends Vr{constructor(r,e,i,o){super(r,{layout:v_||(v_=new Yi({visibility:new Ge(ue.layout_hillshade.visibility)})),paint:b_||(b_=new Yi({"hillshade-illumination-direction":new Ge(ue.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ge(ue.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ge(ue.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ge(ue.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ge(ue.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ge(ue.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new Ge(ue.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}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(r,e,i){return{overrideFog:!1}}},fill:class extends Vr{constructor(r,e,i,o){super(r,{layout:O_||(O_=new Yi({"fill-sort-key":new Je(ue.layout_fill["fill-sort-key"]),visibility:new Ge(ue.layout_fill.visibility),"fill-elevation-reference":new Ge(ue.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Je(ue.layout_fill["fill-construct-bridge-guard-rail"])})),paint:k_||(k_=new Yi({"fill-antialias":new Ge(ue.paint_fill["fill-antialias"]),"fill-opacity":new Je(ue.paint_fill["fill-opacity"]),"fill-color":new Je(ue.paint_fill["fill-color"]),"fill-outline-color":new Je(ue.paint_fill["fill-outline-color"]),"fill-translate":new Ge(ue.paint_fill["fill-translate"]),"fill-translate-anchor":new Ge(ue.paint_fill["fill-translate-anchor"]),"fill-pattern":new Je(ue.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new Ge(ue.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new Ge(ue.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Je(ue.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Je(ue.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Je(ue.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}getProgramIds(){const r=this.paint.get("fill-pattern"),e=r&&r.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(r,e,i){return{config:new Xr(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(r,e){super.recalculate(r,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(r){return new im(r)}queryRadius(){return Qi(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,i,o,a,h){return!r.queryGeometry.isAboveHorizon&&rr(Cn(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,r.pixelToTileUnitsFactor),o)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(r){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return r!=null?e&&!r:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends Vr{constructor(r,e,i,o){super(r,{layout:sg||(sg=new Yi({visibility:new Ge(ue["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new Ge(ue["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:ag||(ag=new Yi({"fill-extrusion-opacity":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Je(ue["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Je(ue["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Je(ue["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Je(ue["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Je(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Je(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new Je(ue["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Je(ue["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Ep(r)}queryRadius(){return Qi(this.paint.get("fill-extrusion-translate"))}is3D(r){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(r,e,i,o,a,h,u,f,_){const g=Ps(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,r.pixelToTileUnitsFactor),v=this.paint.get("fill-extrusion-height").evaluate(e,i),b=this.paint.get("fill-extrusion-base").evaluate(e,i),w=[0,0],I=f&&h.elevation,A=h.elevation?h.elevation.exaggeration():1,P=r.tile.getBucket(this);if(I&&P instanceof Ep){const G=P.centroidVertexArray,re=_+1;re<G.length&&(w[0]=G.geta_centroid_pos0(re),w[1]=G.geta_centroid_pos1(re))}if(w[0]===0&&w[1]===1)return!1;h.projection.name==="globe"&&(o=og([o],[new ke(0,0),new ke(We,We)],r.tileID.canonical).map(G=>G.polygon).flat());const R=I?f:null,[O,U]=function(G,re,Q,te,ae,ce,Ee,de,Ae,je,Ce){return G.projection.name==="globe"?function(Fe,Ve,Te,Oe,pe,Se,He,Be,ct,nt,De){const Ne=[],st=[],et=Fe.projection.upVectorScale(De,Fe.center.lat,Fe.worldSize).metersToTile,Xe=[0,0,0,1],tt=[0,0,0,1],_t=(Mt,It,qt,Lt)=>{Mt[0]=It,Mt[1]=qt,Mt[2]=Lt,Mt[3]=1},Tt=ng();Te>0&&(Te+=Tt),Oe+=Tt;for(const Mt of Ve){const It=[],qt=[];for(const Lt of Mt){const Ii=Lt.x+pe.x,H=Lt.y+pe.y,$=Fe.projection.projectTilePoint(Ii,H,De),be=Fe.projection.upVector(De,Lt.x,Lt.y);let $e=Te,Ke=Oe;if(He){const Ye=pg(Ii,H,Te,Oe,He,Be,ct,nt);$e+=Ye.base,Ke+=Ye.top}Te!==0?_t(Xe,$.x+be[0]*et*$e,$.y+be[1]*et*$e,$.z+be[2]*et*$e):_t(Xe,$.x,$.y,$.z),_t(tt,$.x+be[0]*et*Ke,$.y+be[1]*et*Ke,$.z+be[2]*et*Ke),tr(Xe,Xe,Se),tr(tt,tt,Se),It.push(new Rl(Xe[0],Xe[1],Xe[2])),qt.push(new Rl(tt[0],tt[1],tt[2]))}Ne.push(It),st.push(qt)}return[Ne,st]}(G,re,Q,te,ae,ce,Ee,de,Ae,je,Ce):Ee?function(Fe,Ve,Te,Oe,pe,Se,He,Be,ct){const nt=[],De=[],Ne=[0,0,0,1];for(const st of Fe){const et=[],Xe=[];for(const tt of st){const _t=tt.x+Oe.x,Tt=tt.y+Oe.y,Mt=pg(_t,Tt,Ve,Te,Se,He,Be,ct);Ne[0]=_t,Ne[1]=Tt,Ne[2]=Mt.base,Ne[3]=1,hn(Ne,Ne,pe),Ne[3]=Math.max(Ne[3],1e-5);const It=new Rl(Ne[0]/Ne[3],Ne[1]/Ne[3],Ne[2]/Ne[3]);Ne[0]=_t,Ne[1]=Tt,Ne[2]=Mt.top,Ne[3]=1,hn(Ne,Ne,pe),Ne[3]=Math.max(Ne[3],1e-5);const qt=new Rl(Ne[0]/Ne[3],Ne[1]/Ne[3],Ne[2]/Ne[3]);et.push(It),Xe.push(qt)}nt.push(et),De.push(Xe)}return[nt,De]}(re,Q,te,ae,ce,Ee,de,Ae,je):function(Fe,Ve,Te,Oe,pe){const Se=[],He=[],Be=pe[8]*Ve,ct=pe[9]*Ve,nt=pe[10]*Ve,De=pe[11]*Ve,Ne=pe[8]*Te,st=pe[9]*Te,et=pe[10]*Te,Xe=pe[11]*Te;for(const tt of Fe){const _t=[],Tt=[];for(const Mt of tt){const It=Mt.x+Oe.x,qt=Mt.y+Oe.y,Lt=pe[0]*It+pe[4]*qt+pe[12],Ii=pe[1]*It+pe[5]*qt+pe[13],H=pe[2]*It+pe[6]*qt+pe[14],$=pe[3]*It+pe[7]*qt+pe[15],be=Lt+Be,$e=Ii+ct,Ke=H+nt,Ye=Math.max($+De,1e-5),ot=Lt+Ne,vt=Ii+st,Nt=H+et,Vt=Math.max($+Xe,1e-5);_t.push(new Rl(be/Ye,$e/Ye,Ke/Ye)),Tt.push(new Rl(ot/Vt,vt/Vt,Nt/Vt))}Se.push(_t),He.push(Tt)}return[Se,He]}(re,Q,te,ae,ce)}(h,o,b,v,g,u,R,w,A,h.center.lat,r.tileID.canonical),V=r.queryGeometry;return function(G,re,Q){let te=1/0;rr(Q,re)&&(te=dg(Q,re[0]));for(let ae=0;ae<re.length;ae++){const ce=re[ae],Ee=G[ae];for(let de=0;de<ce.length-1;de++){const Ae=ce[de],je=[Ae,ce[de+1],Ee[de+1],Ee[de],Ae];yi(Q,je)&&(te=Math.min(te,dg(Q,je)))}}return te!==1/0&&te}(O,U,V.isPointQuery()?V.screenBounds:V.screenGeometry)}},building:class extends Vr{constructor(r,e,i,o){super(r,{layout:kg||(kg=new Yi({visibility:new Ge(ue.layout_building.visibility),"building-facade":new Je(ue.layout_building["building-facade"]),"building-facade-floors":new Je(ue.layout_building["building-facade-floors"]),"building-facade-window":new Je(ue.layout_building["building-facade-window"]),"building-roof-shape":new Je(ue.layout_building["building-roof-shape"]),"building-height":new Je(ue.layout_building["building-height"]),"building-base":new Je(ue.layout_building["building-base"])})),paint:Bg||(Bg=new Yi({"building-opacity":new Ge(ue.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Ge(ue.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Ge(ue.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Ge(ue.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Ge(ue.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Ge(ue.paint_building["building-vertical-scale"]),"building-cast-shadows":new Ge(ue.paint_building["building-cast-shadows"]),"building-color":new Je(ue.paint_building["building-color"]),"building-emissive-strength":new Je(ue.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Ge(ue.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Ge(ue.paint_building["building-cutoff-fade-range"]),"building-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Og(r)}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(r){return!0}},line:class extends Vr{constructor(r,e,i,o){const a=Wg();super(r,a,e,i,o),a.layout&&(this.layout=new Wn(a.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof ul,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(r,e){super.recalculate(r,e),this.paint._values["line-floorwidth"]=(()=>{if(ju)return ju;const i=Wg();return ju=new Ev(i.paint.properties["line-width"].specification),ju.useIntegerZoom=!0,ju})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new Sm(r)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(r,e,i){const o=$g(this);return{config:new Xr(this,{zoom:e,lut:i}),defines:o,overrideFog:!1}}queryRadius(r){const e=r,i=Xg(Er("line-width",this,e),Er("line-gap-width",this,e)),o=Er("line-offset",this,e);return i/2+Math.abs(o)+Qi(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,i,o,a,h){if(r.queryGeometry.isAboveHorizon)return!1;const u=Cn(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,r.pixelToTileUnitsFactor),f=r.pixelToTileUnitsFactor/2*Xg(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),_=this.paint.get("line-offset").evaluate(e,i);return _&&(o=function(g,v){const b=[],w=new ke(0,0);for(let I=0;I<g.length;I++){const A=g[I],P=[];for(let R=0;R<A.length;R++){const O=A[R],U=A[R+1],V=R===0?w:O.sub(A[R-1])._unit()._perp(),G=R===A.length-1?w:U.sub(O)._unit()._perp(),re=V._add(G)._unit();re._mult(1/(re.x*G.x+re.y*G.y)),P.push(re._mult(v)._add(O))}b.push(P)}return b}(o,_*r.pixelToTileUnitsFactor)),function(g,v,b){for(let w=0;w<v.length;w++){const I=v[w];if(g.length>=3){for(let A=0;A<I.length;A++)if(zr(g,I[A]))return!0}if(ar(g,I,b))return!0}return!1}(u,o,f)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(r){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"}},symbol:Xp,background:class extends Vr{constructor(r,e,i,o){super(r,{layout:Vy||(Vy=new Yi({visibility:new Ge(ue.layout_background.visibility)})),paint:Uy||(Uy=new Yi({"background-pitch-alignment":new Ge(ue.paint_background["background-pitch-alignment"]),"background-color":new Ge(ue.paint_background["background-color"]),"background-pattern":new Ge(ue.paint_background["background-pattern"]),"background-opacity":new Ge(ue.paint_background["background-opacity"]),"background-emissive-strength":new Ge(ue.paint_background["background-emissive-strength"]),"background-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}is3D(r){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:$y,"raster-particle":Jy,sky:class extends Vr{constructor(r,e,i,o){super(r,{layout:Xy||(Xy=new Yi({visibility:new Ge(ue.layout_sky.visibility)})),paint:Yy||(Yy=new Yi({"sky-type":new Ge(ue.paint_sky["sky-type"]),"sky-atmosphere-sun":new Ge(ue.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Ge(ue.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Ge(ue.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Ge(ue.paint_sky["sky-gradient-radius"]),"sky-gradient":new la(ue.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Ge(ue.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Ge(ue.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Ge(ue.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(r){r==="sky-gradient"?this._updateColorRamp():r!=="sky-atmosphere-sun"&&r!=="sky-atmosphere-halo-color"&&r!=="sky-atmosphere-color"&&r!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Eu({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(r){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=r.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(r,e){if(this.paint.get("sky-type")==="atmosphere"){const o=this.paint.get("sky-atmosphere-sun"),a=!o,h=r.style.light,u=h.properties.get("position");return a&&h.properties.get("anchor")==="viewport"&&Gt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?Gm(u.azimuthal,90-u.polar,e):Gm(o[0],90-o[1],e)}const i=this.paint.get("sky-gradient-center");return Gm(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(r){this._skyboxInvalidated=!1,this._lightPosition=r.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const r=this.paint.get("sky-type");return r==="atmosphere"?["skyboxCapture","skybox"]:r==="gradient"?["skyboxGradient"]:null}},slot:class extends Vr{constructor(r,e,i,o){super(r,{paint:Ky||(Ky=new Yi({}))},e,null)}},model:class extends Vr{constructor(r,e,i,o){super(r,{layout:i0||(i0=new Yi({visibility:new Ge(ue.layout_model.visibility),"model-id":new Je(ue.layout_model["model-id"])})),paint:r0||(r0=new Yi({"model-opacity":new Je(ue.paint_model["model-opacity"]),"model-rotation":new Je(ue.paint_model["model-rotation"]),"model-scale":new Je(ue.paint_model["model-scale"]),"model-translation":new Je(ue.paint_model["model-translation"]),"model-color":new Je(ue.paint_model["model-color"]),"model-color-mix-intensity":new Je(ue.paint_model["model-color-mix-intensity"]),"model-type":new Ge(ue.paint_model["model-type"]),"model-cast-shadows":new Ge(ue.paint_model["model-cast-shadows"]),"model-receive-shadows":new Ge(ue.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new Ge(ue.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Je(ue.paint_model["model-emissive-strength"]),"model-roughness":new Je(ue.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Je(ue.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new Ge(ue.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new Ge(ue.paint_model["model-front-cutoff"]),"model-color-use-theme":new Je({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Hm(r)}getProgramIds(){return["model"]}is3D(r){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(r){return r instanceof Qp?We-1:0}queryIntersectsFeature(r,e,i,o,a,h){if(!this.modelManager)return!1;const u=this.modelManager,f=r.tile.getBucket(this);if(!(f&&f instanceof Hm))return!1;for(const _ in f.instancesPerModel){const g=f.instancesPerModel[_],v=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(g.idToFeaturesIndex.hasOwnProperty(v)){const b=g.features[g.idToFeaturesIndex[v]],w=u.getModel(_,this.scope);if(!w)return!1;let I=cs();const A=new S(0,0),P=f.canonical;let R=Number.MAX_VALUE;for(let O=0;O<b.instancedDataCount;++O){const U=16*(b.instancedDataOffset+O),V=g.instancedDataArray.float32,G=[V[U+4],V[U+5],V[U+6]];l0(P,A,V[U],0|V[U+1]),Cg(I,w,h,A,b.rotation,b.scale,G,!1,!1,!1),h.projection.name==="globe"&&(I=xm(I,h));const re=Gi([],h.projMatrix,I),Q=r.queryGeometry,te=Mg(Q.isPointQuery()?Q.screenBounds:Q.screenGeometry,h,re,w.aabb);te!=null&&(R=Math.min(te,R))}return R!==Number.MAX_VALUE&&R}}return!1}_handleOverridablePaintPropertyUpdate(r,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||r!=="model-color"&&r!=="model-color-mix-intensity"&&r!=="model-rotation"&&r!=="model-scale"&&r!=="model-translation"&&r!=="model-emissive-strength")}_isPropertyZoomDependent(r){const e=this._transitionablePaint._values[r];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof Yo}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends Vr{constructor(r,e,i,o){super(r,{layout:B_||(B_=new Yi({"clip-layer-types":ne
14w Ge(ue.layout_clip["clip-layer-types"]),"clip-layer-scope":new Ge(ue.layout_clip["clip-layer-scope"])})),paint:N_||(N_=new Yi({}))},e,i,o)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new V_(r)}is3D(r){return!0}}},Zm=new li(0,0,0),Wm={PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},Xm={LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},ef={LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},M1={PAINT_ORDER_FILL_AND_STROKE:1},td={PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},c0={MASK_TYPE_LUMINANCE:1};function C1(r,e,i){r===1&&e.icons.push(function(o,a){return function(h){if(h.usvg_tree.height||(h.usvg_tree.height=h.usvg_tree.width),!h.metadata)return h;const{metadata:u}=h;if(u.content_area){const{content_area:f}=u;f.top==null&&(f.top=f.left),f.width==null&&(f.width=h.usvg_tree.width),f.height==null&&(f.height=f.width)}return u.stretch_x&&u.stretch_x.length&&h0(u,"x"),u.stretch_y&&u.stretch_y.length&&h0(u,"y"),h}(o.readFields(P1,{name:void 0},a))}(i,i.readVarint()+i.pos))}function h0(r,e){const i=[],o=r[`stretch_${e}`];let a=null;for(let h=0;h<o.length;h++)a===null?a=i.length===0?o[0]:i[i.length-1][1]+o[h]:(i.push([a,a+o[h]]),a=null);r[`stretch_${e}_areas`]=i}function P1(r,e,i){r===1?e.name=i.readString():r===2?e.metadata=function(o,a){return o.readFields(z1,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},a)}(i,i.readVarint()+i.pos):r===3&&(e.usvg_tree=function(o,a){return o.readFields(L1,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},a)}(i,i.readVarint()+i.pos),e.data="usvg_tree")}function z1(r,e,i){r===1?e.stretch_x=i.readPackedVarint():r===2?e.stretch_y=i.readPackedVarint():r===3?e.content_area=function(o,a){return o.readFields(R1,{left:0},a)}(i,i.readVarint()+i.pos):r===4&&e.variables.push(function(o,a){return o.readFields(D1,{name:void 0},a)}(i,i.readVarint()+i.pos))}function R1(r,e,i){r===1?e.left=i.readVarint():r===2?e.width=i.readVarint():r===3?e.top=i.readVarint():r===4&&(e.height=i.readVarint())}function D1(r,e,i){r===1?e.name=i.readString():r===2&&(e.rgb_color=nf(i.readVarint()),e.value="rgb_color")}function L1(r,e,i){r===1?e.width=e.height=i.readVarint():r===2?e.height=i.readVarint():r===3?e.children.push(tf(i,i.readVarint()+i.pos)):r===4?e.linear_gradients.push(function(o,a){return o.readFields(U1,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},a)}(i,i.readVarint()+i.pos)):r===5?e.radial_gradients.push(function(o,a){return o.readFields(G1,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},a)}(i,i.readVarint()+i.pos)):r===7?e.clip_paths.push(function(o,a){return o.readFields(q1,{children:[]},a)}(i,i.readVarint()+i.pos)):r===8&&e.masks.push(function(o,a){const h=o.readFields(H1,{left:0,width:20,mask_type:c0.MASK_TYPE_LUMINANCE,children:[]},a);return h.height==null&&(h.height=h.width),h.top==null&&(h.top=h.left),h}(i,i.readVarint()+i.pos))}function tf(r,e){return r.readFields(F1,{},e)}function F1(r,e,i){r===1?(e.group=function(o,a){return o.readFields(O1,{opacity:255,children:[]},a)}(i,i.readVarint()+i.pos),e.node="group"):r===2&&(e.path=function(o,a){return o.readFields(B1,{paint_order:1,commands:[],step:1,diffs:[],rule:Wm.PATH_RULE_NON_ZERO},a)}(i,i.readVarint()+i.pos),e.node="path")}function O1(r,e,i){r===1?e.transform=rf(i,i.readVarint()+i.pos):r===2?e.opacity=i.readVarint():r===5?e.clip_path_idx=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(tf(i,i.readVarint()+i.pos))}function rf(r,e){return r.readFields(k1,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function k1(r,e,i){r===1?e.sx=i.readFloat():r===2?e.ky=i.readFloat():r===3?e.kx=i.readFloat():r===4?e.sy=i.readFloat():r===5?e.tx=i.readFloat():r===6&&(e.ty=i.readFloat())}function B1(r,e,i){r===1?e.fill=function(o,a){return o.readFields(N1,{rgb_color:Zm,paint:"rgb_color",opacity:255},a)}(i,i.readVarint()+i.pos):r===2?e.stroke=function(o,a){return o.readFields(V1,{rgb_color:Zm,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},a)}(i,i.readVarint()+i.pos):r===3?e.paint_order=i.readVarint():r===5?i.readPackedVarint(e.commands):r===6?e.
14step=i.readFloat():r===7?i.readPackedSVarint(e.diffs):r===8&&(e.rule=i.readVarint())}function N1(r,e,i){r===1?(e.rgb_color=nf(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5&&(e.opacity=i.readVarint())}function nf(r){return new li((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function V1(r,e,i){r===1?(e.rgb_color=nf(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5?i.readPackedFloat(e.dasharray):r===6?e.dashoffset=i.readFloat():r===7?e.miterlimit=i.readFloat():r===8?e.opacity=i.readVarint():r===9?e.width=i.readFloat():r===10?e.linecap=i.readVarint():r===11&&(e.linejoin=i.readVarint())}function U1(r,e,i){r===1?e.transform=rf(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(u0(i,i.readVarint()+i.pos)):r===4?e.x1=i.readFloat():r===5?e.y1=i.readFloat():r===6?e.x2=i.readFloat():r===7&&(e.y2=i.readFloat())}function u0(r,e){return r.readFields(j1,{offset:0,opacity:255,rgb_color:Zm},e)}function j1(r,e,i){r===1?e.offset=i.readFloat():r===2?e.opacity=i.readVarint():r===3&&(e.rgb_color=nf(i.readVarint()))}function G1(r,e,i){r===1?e.transform=rf(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(u0(i,i.readVarint()+i.pos)):r===4?e.cx=i.readFloat():r===5?e.cy=i.readFloat():r===6?e.r=i.readFloat():r===7?e.fx=i.readFloat():r===8?e.fy=i.readFloat():r===9&&(e.fr=i.readFloat())}function q1(r,e,i){r===1?e.transform=rf(i,i.readVarint()+i.pos):r===2?e.clip_path_idx=i.readVarint():r===3&&e.children.push(tf(i,i.readVarint()+i.pos))}function H1(r,e,i){r===1?e.left=e.top=i.readFloat():r===2?e.width=e.height=i.readFloat():r===3?e.top=i.readFloat():r===4?e.height=i.readFloat():r===5?e.mask_type=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(tf(i,i.readVarint()+i.pos))}class $1{static calculate(e={},i=[]){const o=new Map,a=new Map;if(Object.keys(e).length===0)return o;i.forEach(h=>{a.set(h.name,h.rgb_color||new li(0,0,0))});for(const[h,u]of Object.entries(e))a.has(h)?o.set(a.get(h).toString(),u):console.warn(`Ignoring unknown image variable "${h}"`);return o}}function ih(r,e=255,i){const o=e/255,a=r.toString(),h=i.has(a)?i.get(a).clone():r.clone();return h.a*=o,h.toString()}function id(r,e){if(!ql()){const i=document.createElement("canvas");return i.width=r,i.height=e,i}return new OffscreenCanvas(r,e)}function Z1(r,e){const i=$1.calculate(e.params,r.metadata?r.metadata.variables:[]),o=r.usvg_tree,a=o.width,h=o.height,u=e.transform?e.transform:new DOMMatrix,f=Math.max(1,Math.round(a*u.a)),_=Math.max(1,Math.round(h*u.d)),g=new DOMMatrix([f/a,0,0,_/h,0,0]),v=id(f,_).getContext("2d");return Ym(v,g,o,o,i),v.getImageData(0,0,f,_)}function Ym(r,e,i,o,a){for(const h of o.children)d0(r,e,i,h,a)}function d0(r,e,i,o,a){o.group?(r.save(),function(h,u,f,_,g){const v=_.mask_idx!=null?f.masks[_.mask_idx]:null,b=_.clip_path_idx!=null?f.clip_paths[_.clip_path_idx]:null;if(_.transform&&(u=rh(_.transform).preMultiplySelf(u)),!function(A,P,R){return A.opacity!==255||P||R}(_,b!=null,v!=null))return void Ym(h,u,f,_,g);const w=id(h.canvas.width,h.canvas.height),I=w.getContext("2d");Ym(I,u,f,_,g),b&&x0(I,u,f,b),v&&v0(I,u,f,v,g),h.globalAlpha=_.opacity/255,h.drawImage(w,0,0)}(r,e,i,o.group,a),r.restore()):o.path&&(r.save(),function(h,u,f,_,g){h.setTransform(u),_.paint_order===M1.PAINT_ORDER_FILL_AND_STROKE?(p0(h,f,_,g),m0(h,f,_,g)):(m0(h,f,_,g),p0(h,f,_,g))}(r,e,i,o.path,a),r.restore())}function p0(r,e,i,o){const a=i.fill;if(!a)return;const h=a.opacity/255;switch(r.save(),r.beginPath(),b0(i,r),a.paint){case"rgb_color":r.fillStyle=ih(a.rgb_color,a.opacity,o);break;case"linear_gradient_idx":{const u=e.linear_gradients[a.linear_gradient_idx];u.transform&&r.setTransform(rh(u.transform).preMultiplySelf(r.getTransform())),r.fillStyle=_0(r,u,h,o);break}case"radial_gradient_idx":{const u=e.radial_gradients[a.radial_gradient_idx];u.transform&&r.setTransform(rh(u.transform).preMultiplySelf(r.getTransform())),r.fillStyle=g0(r,u,h,o)}}
vendor: 7,453 bytes, line 14
14r.fill(f0(i)),r.restore()}function f0(r){return r.rule===Wm.PATH_RULE_NON_ZERO?"nonzero":r.rule===Wm.PATH_RULE_EVEN_ODD?"evenodd":void 0}function m0(r,e,i,o){const a=i.stroke;if(!a)return;const h=w0(i);r.lineWidth=a.width,r.miterLimit=a.miterlimit,r.setLineDash(a.dasharray),r.lineDashOffset=a.dashoffset;const u=a.opacity/255;switch(a.paint){case"rgb_color":r.strokeStyle=ih(a.rgb_color,a.opacity,o);break;case"linear_gradient_idx":r.strokeStyle=_0(r,e.linear_gradients[a.linear_gradient_idx],u,o,!0);break;case"radial_gradient_idx":r.strokeStyle=g0(r,e.radial_gradients[a.radial_gradient_idx],u,o,!0)}switch(a.linejoin){case ef.LINE_JOIN_MITER_CLIP:case ef.LINE_JOIN_MITER:r.lineJoin="miter";break;case ef.LINE_JOIN_ROUND:r.lineJoin="round";break;case ef.LINE_JOIN_BEVEL:r.lineJoin="bevel"}switch(a.linecap){case Xm.LINE_CAP_BUTT:r.lineCap="butt";break;case Xm.LINE_CAP_ROUND:r.lineCap="round";break;case Xm.LINE_CAP_SQUARE:r.lineCap="square"}r.stroke(h)}function _0(r,e,i,o,a=!1){if(e.stops.length===1){const w=e.stops[0];return ih(w.rgb_color,w.opacity*i,o)}const{x1:h,y1:u,x2:f,y2:_}=e;let g=new DOMPoint(h,u),v=new DOMPoint(f,_);if(a){const w=rh(e.transform);g=w.transformPoint(g),v=w.transformPoint(v)}const b=r.createLinearGradient(g.x,g.y,v.x,v.y);for(const w of e.stops)b.addColorStop(w.offset,ih(w.rgb_color,w.opacity*i,o));return b}function g0(r,e,i,o,a=!1){if(e.stops.length===1){const O=e.stops[0];return ih(O.rgb_color,O.opacity*i,o)}const h=rh(e.transform),{fx:u,fy:f,fr:_,cx:g,cy:v,r:b}=e;let w=new DOMPoint(u,f),I=new DOMPoint(g,v),A=_,P=b;if(a){w=h.transformPoint(w),I=h.transformPoint(I);const O=(h.a+h.d)/2;A=_*O,P=e.r*O}const R=r.createRadialGradient(w.x,w.y,A,I.x,I.y,P);for(const O of e.stops)R.addColorStop(O.offset,ih(O.rgb_color,O.opacity*i,o));return R}function y0(r,e,i,o){const a=o.transform?rh(o.transform).preMultiplySelf(e):e,h=id(r.canvas.width,r.canvas.height),u=h.getContext("2d");for(const _ of o.children)if(_.group)y0(u,a,i,_.group);else if(_.path){const g=_.path,v=new Path2D;v.addPath(w0(g),a),u.fill(v,f0(g))}const f=o.clip_path_idx!=null?i.clip_paths[o.clip_path_idx]:null;f&&x0(u,a,i,f),r.globalCompositeOperation="source-over",r.drawImage(h,0,0)}function x0(r,e,i,o){const a=id(r.canvas.width,r.canvas.height);y0(a.getContext("2d"),e,i,o),r.globalCompositeOperation="destination-in",r.drawImage(a,0,0)}function v0(r,e,i,o,a){if(o.children.length===0)return;const h=o.mask_idx!=null?i.masks[o.mask_idx]:null;h&&v0(r,e,i,h,a);const u=r.canvas.width,f=r.canvas.height,_=id(u,f),g=_.getContext("2d"),v=o.width,b=o.height,w=o.left,I=o.top,A=new Path2D,P=new Path2D;P.rect(w,I,v,b),A.addPath(P,e),g.clip(A);for(const U of o.children)d0(g,e,i,U,a);const R=g.getImageData(0,0,u,f),O=R.data;if(o.mask_type===c0.MASK_TYPE_LUMINANCE)for(let U=0;U<O.length;U+=4)O[U+3]=O[U+3]/255*(.2126*O[U]+.7152*O[U+1]+.0722*O[U+2]);g.putImageData(R,0,0),r.globalCompositeOperation="destination-in",r.drawImage(_,0,0)}function rh(r){return r?new DOMMatrix([r.sx,r.ky,r.kx,r.sy,r.tx,r.ty]):new DOMMatrix}function b0(r,e){const i=r.step;let o=r.diffs[0]*i,a=r.diffs[1]*i;e.moveTo(o,a);for(let h=0,u=2;h<r.commands.length;h++)switch(r.commands[h]){case td.PATH_COMMAND_MOVE:o+=r.diffs[u++]*i,a+=r.diffs[u++]*i,e.moveTo(o,a);break;case td.PATH_COMMAND_LINE:o+=r.diffs[u++]*i,a+=r.diffs[u++]*i,e.lineTo(o,a);break;case td.PATH_COMMAND_QUAD:{const f=o+r.diffs[u++]*i,_=a+r.diffs[u++]*i;o=f+r.diffs[u++]*i,a=_+r.diffs[u++]*i,e.quadraticCurveTo(f,_,o,a);break}case td.PATH_COMMAND_CUBIC:{const f=o+r.diffs[u++]*i,_=a+r.diffs[u++]*i,g=f+r.diffs[u++]*i,v=_+r.diffs[u++]*i;o=g+r.diffs[u++]*i,a=v+r.diffs[u++]*i,e.bezierCurveTo(f,_,g,v,o,a);break}case td.PATH_COMMAND_CLOSE:e.closePath()}return e}function w0(r){return b0(r,new Path2D)}class of{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){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,i)}delete(e){this.cache.delete(e)}}rt(of,"LRUCache");class Km{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new Rr(e,e.data)}getFromCache(e,i,o){return this.cacheMap.has(o)||this.cacheMap.set(o,new of(150)),this.cacheMap.get(o).get(ua(e.toString(),i))}setInCache(e,i,o,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new of(150));const h=this.cacheDependenciesMap.get(a),u=ua(e.id.toString(),o);h.get(u)||h.set(u,new Set);const f=this.cacheMap.get(a),_=e.toString();h.get(u).add(_),f.put(ua(e.toString(),o),i)}removeImagesFromCacheByIds(e,i,o=0){if(!this.cacheMap.has(o)||!this.cacheDependenciesMap.has(o))return;const a=this.cacheMap.get(o),h=this.cacheDependenciesMap.get(o);for(const u of e){const f=ua(u.toString(),i);if(h.has(f)){for(const _ of h.get(f))a.delete(_);h.delete(f)}}}rasterize(e,i,o,a,h=Z1){const u=this.getFromCache(e,o,a);if(u)return u.clone();const f=h(i.icon,e.options),_=Km._getImage(f);return this.setInCache(e,_,o,a),_.clone()}}class T0{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const o=this.toIdx(e,i);return{min:this.minimums[o],max:this.maximums[o]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function S0(r,e,i,o){let a=0,h=Number.MAX_VALUE;for(let u=0;u<3;u++)if(Math.abs(o[u])<1e-15){if(i[u]<r[u]||i[u]>e[u])return null}else{const f=1/o[u];let _=(r[u]-i[u])*f,g=(e[u]-i[u])*f;if(_>g){const v=_;_=g,g=v}if(_>a&&(a=_),g<h&&(h=g),a>h)return null}return a}function E0(r,e,i,o,a,h,u,f,_,g,v){const b=o-r,w=a-e,I=h-i,A=u-r,P=f-e,R=_-i,O=v[1]*R-v[2]*P,U=v[2]*A-v[0]*R,V=v[0]*P-v[1]*A,G=b*O+w*U+I*V;if(Math.abs(G)<1e-15)return null;const re=1/G,Q=g[0]-r,te=g[1]-e,ae=g[2]-i,ce=(Q*O+te*U+ae*V)*re;if(ce<0||ce>1)return null;const Ee=te*I-ae*w,de=ae*b-Q*I,Ae=Q*w-te*b,je=(v[0]*Ee+v[1]*de+v[2]*Ae)*re;return je<0||ce+je>1?null:(A*Ee+P*de+R*Ae)*re}function I0(r,e,i){return(r-e)/(i-e)}function A0(r,e,i,o,a,h,u,f,_){const g=1<<i,v=h-o,b=u-a,w=(r+1)/g*v+o,I=(e+0)/g*b+a,A=(e+1)/g*b+a;f[0]=(r+0)/g*v+o,f[1]=I,_[0]=w,_[1]=A}class M0{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 i=function(h){const u=Math.ceil(Math.log2(h.dim/8)),f=[];let _=Math.ceil(Math.pow(2,u));const g=1/_,v=(I,A,P,R,O)=>{const U=R?1:0,V=(I+1)*P-U,G=A*P,re=(A+1)*P-U;O[0]=I*P,O[1]=G,O[2]=V,O[3]=re};let b=new T0(_);const w=[];for(let I=0;I<_*_;I++){v(I%_,Math.floor(I/_),g,!1,w);const A=za(w[0],w[1],h),P=za(w[2],w[1],h),R=za(w[2],w[3],h),O=za(w[0],w[3],h);b.minimums.push(Math.min(A,P,R,O)),b.maximums.push(Math.max(A,P,R,O)),b.leaves.push(1)}for(f.push(b),_/=2;_>=1;_/=2){const I=f[f.length-1];b=new T0(_);for(let A=0;A<_*_;A++){v(A%_,Math.floor(A/_),2,!0,w);const P=I.getElevation(w[0],w[1]),R=I.getElevation(w[2],w[1]),O=I.getElevation(w[2],w[3]),U=I.getElevation(w[0],w[3]),V=I.isLeaf(w[0],w[1]),G=I.isLeaf(w[2],w[1]),re=I.isLeaf(w[2],w[3]),Q=I.isLeaf(w[0],w[3]),te=Math.min(P.min,R.min,O.min,U.min),ae=Math.max(P.max,R.max,O.max,U.max),ce=V&&G&&re&&Q;b.maximums.push(ae),b.minimums.push(te),b.leaves.push(ae-te<=5&&ce?1:0)}f.push(b)}return f}(this.dem),o=i.length-1,a=i[o];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,
vendor: 24,690 bytes, line 14
140,0,o,0)}raycastRoot(e,i,o,a,h,u,f=1){return S0([e,i,-100],[o,a,this.maximums[0]*f],h,u)}raycast(e,i,o,a,h,u,f=1){if(!this.nodeCount)return null;const _=this.raycastRoot(e,i,o,a,h,u,f);if(_==null)return null;const g=[],v=[],b=[],w=[],I=[{idx:0,t:_,nodex:0,nodey:0,depth:0}];for(;I.length>0;){const{idx:A,t:P,nodex:R,nodey:O,depth:U}=I.pop();if(this.leaves[A]){A0(R,O,U,e,i,o,a,b,w);const G=1<<U,re=(R+0)/G,Q=(R+1)/G,te=(O+0)/G,ae=(O+1)/G,ce=za(re,te,this.dem)*f,Ee=za(Q,te,this.dem)*f,de=za(Q,ae,this.dem)*f,Ae=za(re,ae,this.dem)*f,je=E0(b[0],b[1],ce,w[0],b[1],Ee,w[0],w[1],de,h,u),Ce=E0(w[0],w[1],de,b[0],w[1],Ae,b[0],b[1],ce,h,u),Fe=Math.min(je!==null?je:Number.MAX_VALUE,Ce!==null?Ce:Number.MAX_VALUE);if(Fe!==Number.MAX_VALUE)return Fe;{const Ve=Hr([],h,u,P);if(C0(ce,Ee,Ae,de,I0(Ve[0],b[0],w[0]),I0(Ve[1],b[1],w[1]))>=Ve[2])return P}continue}let V=0;for(let G=0;G<this._siblingOffset.length;G++){A0((R<<1)+this._siblingOffset[G][0],(O<<1)+this._siblingOffset[G][1],U+1,e,i,o,a,b,w),b[2]=-100,w[2]=this.maximums[this.childOffsets[A]+G]*f;const re=S0(b,w,h,u);if(re!=null){const Q=re;g[G]=Q;let te=!1;for(let ae=0;ae<V&&!te;ae++)Q>=g[v[ae]]&&(v.splice(ae,0,G),te=!0);te||(v[V]=G),V++}}for(let G=0;G<V;G++){const re=v[G];I.push({idx:this.childOffsets[A]+re,t:g[re],nodex:(R<<1)+this._siblingOffset[re][0],nodey:(O<<1)+this._siblingOffset[re][1],depth:U+1})}}return null}_addNode(e,i,o){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(o),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,o,a,h){if(e[a].isLeaf(i,o)===1)return;this.childOffsets[h]||(this.childOffsets[h]=this.nodeCount);const u=a-1,f=e[u];let _=0,g=0;for(let v=0;v<this._siblingOffset.length;v++){const b=2*i+this._siblingOffset[v][0],w=2*o+this._siblingOffset[v][1],I=f.getElevation(b,w),A=f.isLeaf(b,w),P=this._addNode(I.min,I.max,A);A&&(_|=1<<v),g||(g=P)}for(let v=0;v<this._siblingOffset.length;v++)_&1<<v||this._construct(e,2*i+this._siblingOffset[v][0],2*o+this._siblingOffset[v][1],u,g+v)}}function C0(r,e,i,o,a,h){return ft(ft(r,i,h),ft(e,o,h),a)}function za(r,e,i){const o=i.dim,a=W(r*o-.5,0,o-1),h=W(e*o-.5,0,o-1),u=Math.floor(a),f=Math.floor(h),_=Math.min(u+1,o-1),g=Math.min(f+1,o-1);return C0(i.get(u,f),i.get(_,f),i.get(u,g),i.get(_,g),a-u,h-f)}const W1={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function X1(r,e,i){return(256*r*256+256*e+i)/10-1e4}function Y1(r,e,i){return 256*r+e+i/256-32768}class sf{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,o,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void Gt(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const h=this.dim=i.height-2,u=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let _=0;_<h;_++)u[this._idx(-1,_)]=u[this._idx(0,_)],u[this._idx(h,_)]=u[this._idx(h-1,_)],u[this._idx(_,-1)]=u[this._idx(_,0)],u[this._idx(_,h)]=u[this._idx(_,h-1)];u[this._idx(-1,-1)]=u[this._idx(0,0)],u[this._idx(h,-1)]=u[this._idx(h-1,0)],u[this._idx(-1,h)]=u[this._idx(0,h-1)],u[this._idx(h,h)]=u[this._idx(h-1,h-1)]}const f=o==="terrarium"?Y1:X1;for(let _=0;_<u.length;++_){const g=4*_;this.floatView[_]=f(this.pixels[g],this.pixels[g+1],this.pixels[g+2])}this._timestamp=Hn.now()}_buildQuadTree(){this._tree=new M0(this)}get(e,i,o=!1){o&&(e=W(e,-1,this.dim),i=W(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,o){const a=this._idx(e,i),h=this.floatView[a];return this.floatView[a]=o,o-h}static getUnpackVector(e){return W1[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const o=[0,0,0,0],a=sf.getUnpackVector(i);let h=Math.floor((e+a[3])/a[2]);return o[2]=h%256,h=Math.floor(h/256),o[1]=h%256,h=Math.floor(h/256),o[0]=h,o}getPixels(){return new S_({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,h=i*this.dim+this.dim,u=o*this.dim,f=o*this.dim+this.dim;switch(i){case-1:a=h-1;break;case 1:h=a+1}switch(o){case-1:u=f-1;break;case 1:f=u+1}const _=-i*this.dim,g=-o*this.dim;for(let v=u;v<f;v++)for(let b=a;b<h;b++){const w=4*this._idx(b,v),I=4*this._idx(b+_,v+g);this.pixels[w+0]=e.pixels[I+0],this.pixels[w+1]=e.pixels[I+1],this.pixels[w+2]=e.pixels[I+2],this.pixels[w+3]=e.pixels[I+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function K1(r,e,i){r===1?e.headerLength=i.readFixed32():r===2?e.x=i.readVarint():r===3?e.y=i.readVarint():r===4?e.z=i.readVarint():r===5&&e.layers.push(function(o,a){return o.readFields(ib,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)}(i,i.readVarint()+i.pos))}function J1(r,e,i){r===1?(e.delta_filter=function(o,a){return o.readFields(Q1,{blockSize:0},a)}(i,i.readVarint()+i.pos),e.filter="delta_filter"):r===2?(i.readVarint(),e.filter="zigzag_filter"):r===3?(i.readVarint(),e.filter="bitshuffle_filter"):r===4&&(i.readVarint(),e.filter="byteshuffle_filter")}function Q1(r,e,i){r===1&&(e.blockSize=i.readVarint())}function eb(r,e,i){r===1?(i.readVarint(),e.codec="gzip_data"):r===2?(i.readVarint(),e.codec="jpeg_image"):r===3?(i.readVarint(),e.codec="webp_image"):r===4&&(i.readVarint(),e.codec="png_image")}function tb(r,e,i){let o=0,a=0;r===1?e.firstByte=i.readFixed64():r===2?e.lastByte=i.readFixed64():r===3?e.filters.push(function(h,u){return h.readFields(J1,{},u)}(i,i.readVarint()+i.pos)):r===4?e.codec=function(h,u){return h.readFields(eb,{},u)}(i,i.readVarint()+i.pos):r===5?a=i.readFloat():r===6?o=i.readFloat():r===7?e.bands.push(i.readString()):r===8?e.offset=i.readDouble():r===9&&(e.scale=i.readDouble()),e.offset===0&&(e.offset=a),e.scale===0&&(e.scale=o)}function ib(r,e,i){r===1?e.version=i.readVarint():r===2?e.name=i.readString():r===3?e.units=i.readString():r===4?e.tileSize=i.readVarint():r===5?e.buffer=i.readVarint():r===6?e.pixelFormat=i.readVarint():r===7&&e.dataIndex.push(function(o,a){return o.readFields(tb,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)}(i,i.readVarint()+i.pos))}function rb(r,e,i){if(r===2)(function(o,a,h){o.readFields(nb,h,a)})(i,i.readVarint()+i.pos,e);else if(r===3)throw new Error("Not implemented")}function nb(r,e,i){if(r===1){let o=0;const a=i.readVarint()+i.pos;for(;i.pos<a;)e[o++]=i.readVarint()}}function ob(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let o=2;o>=1;o--){const a=o===1?1:0,h=o===2?1:0;for(let u=0;u<e[0];u++){const f=e[1]*u;for(let _=a;_<e[1];_++){const g=e[2]*(_+f);for(let v=h;v<e[2];v++){const b=e[3]*(v+g);for(let w=0;w<e[3];w++){const I=b+w;r[I]+=r[I-i]}}}}i*=e[o]}return r}function sb(r){for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function ab(r,e){switch(e){case"uint32":return r;case"uint16":for(let i=0;i<r.length;i+=2){const o=r[i],a=r[i+1];r[i]=(240&o)>>4|(61440&o)>>8|(240&a)<<4|61440&a,r[i+1]=15&o|(3840&o)>>4|(15&a)<<8|(3840&a)<<4}return r;case"uint8":for(let i=0;i<r.length;i+=4){const o=r[i],a=r[i+1],h=r[i+2],u=r[i+3];r[i+0]=(192&o)>>6|(192&a)>>4|(192&h)>>2|192&u,r[i+1]=(48&o)>>4|(48&a)>>2|48&h|(48&u)<<2,r[i+2]=(12&o)>>2|12&a|(12&h)<<2|(12&u)<<4,r[i+3]=3&o|(3&a)<<2|(3&h)<<4|(3&u)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}rt(sf,"DEMData"),rt(M0,"DemMinMaxQuadTree",{omit:["dem"]});var Yn=Uint8Array,rd=Uint16Array,lb=Int32Array,P0=new Yn([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]),z0=new Yn([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]),cb=new Yn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),R0=function(r,e){for(var i=new rd(31),o=0;o<31;++o)i[o]=e+=1<<r[o-1];var a=new lb(i[30]);for(o=1;o<30;++o)for(var h=i[o];h<i[o+1];++h)a[h]=h-i[o]<<5|o;return{b:i,r:a}},D0=R0(P0,2),L0=D0.b,hb=D0.r;L0[28]=258,hb[258]=28;for(var ub=R0(z0,0).b,F0=new rd(32768),xr=0;xr<32768;++xr){var nh=(43690&xr)>>1|(21845&xr)<<1;F0[xr]=((65280&(nh=(61680&(nh=(52428&nh)>>2|(13107&nh)<<2))>>4|(3855&nh)<<4))>>8|(255&nh)<<8)>>1}var nd=function(r,e,i){for(var o=r.length,a=0,h=new rd(e);a<o;++a)r[a]&&++h[r[a]-1];var u,f=new rd(e);for(a=1;a<e;++a)f[a]=f[a-1]+h[a-1]<<1;u=new rd(1<<e);var _=15-e;for(a=0;a<o;++a)if(r[a])for(var g=a<<4|r[a],v=e-r[a],b=f[r[a]-1]++<<v,w=b|(1<<v)-1;b<=w;++b)u[F0[b]>>_]=g;return u},od=new Yn(288);for(xr=0;xr<144;++xr)od[xr]=8;for(xr=144;xr<256;++xr)od[xr]=9;for(xr=256;xr<280;++xr)od[xr]=7;for(xr=280;xr<288;++xr)od[xr]=8;var O0=new Yn(32);for(xr=0;xr<32;++xr)O0[xr]=5;var db=nd(od,9),pb=nd(O0,5),Jm=function(r){for(var e=r[0],i=1;i<r.length;++i)r[i]>e&&(e=r[i]);return e},Eo=function(r,e,i){var o=e/8|0;return(r[o]|r[o+1]<<8)>>(7&e)&i},Qm=function(r,e){var i=e/8|0;return(r[i]|r[i+1]<<8|r[i+2]<<16)>>(7&e)},fb=["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"],Io=function(r,e,i){var o=new Error(e||fb[r]);if(o.code=r,Error.captureStackTrace&&Error.captureStackTrace(o,Io),!i)throw o;return o},mb=new Yn(0),_b=typeof TextDecoder<"u"&&new TextDecoder;try{_b.decode(mb,{stream:!0})}catch{}const gb={gzip_data:"gzip"};class oo extends Error{constructor(e){super(e),this.name="MRTError"}}const yb={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},k0={uint32:1,uint16:2,uint8:4},xb={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let e_;class af{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new oo(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),o=new DataView(e);if(i[0]!==13)throw new oo("File is not a valid MRT.");return o.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),o=this.getHeaderLength(e);if(i.length<o)throw new oo(`Expected header with length >= ${o} but got buffer of length ${i.length}`);const a=new e_(i.subarray(0,o)).readFields(K1,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new oo(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=a.x,this.y=a.y,this.z=a.z;for(const h of a.layers)this.layers[h.name]=new B0(h,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],o=this.getLayer(e.layerName);for(let a of e.blockIndices){const h=o.dataIndex[a],u=h.firstByte-e.firstByte,f=h.lastByte-e.firstByte;if(o._blocksInProgress.has(a))continue;const _={layerName:o.name,firstByte:u,lastByte:f,pixelFormat:o.pixelFormat,blockIndex:a,blockShape:[h.bands.length].concat(o.bandShape),buffer:o.buffer,codec:h.codec.codec,filters:h.filters.map(g=>g.filter)};o._blocksInProgress.add(a),i.push(_)}return new N0(i,()=>{i.forEach(a=>o._blocksInProgress.delete(a.blockIndex))},(a,h)=>{if(i.forEach(u=>o._blocksInProgress.delete(u.blockIndex)),a)throw a;h.forEach(u=>{this.getLayer(u.layerName).processDecodedData(u)})})}}class B0{constructor({version:e,name:i,units:o,tileSize:a,pixelFormat:h,buffer:u,dataIndex:f},_){if(this.version=e,this.version!==1)throw new oo(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=o,this.tileSize=a,this.buffer=u,this.pixelFormat=yb[h],this.dataIndex=f,this.bandShape=[a+2*u,a+2*u,k0[this.pixelFormat]],this._decodedBlocks=new of(_?_.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return k0[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[o,a]of this.dataIndex.entries()){for(const[h,u]of a.bands.entries())if(u===e)return{bandIndex:i+h,blockIndex:o,blockBandIndex:h};i+=a.bands.length}break;case"number":for(const[o,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:o,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new oo(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,o=-1/0;const a=[],h=new Set;for(const u of e){const{blockIndex:f}=this.getBlockForBand(u);if(f<0)throw new oo(`Invalid band: ${JSON.stringify(u)}`);const _=this.dataIndex[f];a.includes(f)||a.push(f),h.add(f),i=Math.min(i,_.firstByte),o=Math.max(o,_.lastByte)}if(h.size>this.cacheSize)throw new oo(`Number of blocks to decode (${h.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:o,blockIndices:a}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:o}=this.getBlockForBand(e);if(i<0)throw new oo(`Band not found: ${JSON.stringify(e)}`);const a=this._decodedBlocks.get(i.toString());if(!a)throw new oo(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const h=this.dataIndex[i],u=this.bandShape.reduce((g,v)=>g*v,1),f=o*u,_=a.subarray(f,f+u);return{data:_,bytes:new Uint8Array(_.buffer).subarray(_.byteOffset,_.byteOffset+_.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:h.offset,scale:h.scale}}}af.setPbf=function(r){e_=r};class N0{constructor(e,i,o){this.tasks=e,this._onCancel=i,this._onComplete=o,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}af.performDecoding=function(r,e){const i=new Uint8Array(r);return Promise.all(e.tasks.map(o=>{const{layerName:a,firstByte:h,lastByte:u,pixelFormat:f,blockShape:_,blockIndex:g,filters:v,codec:b}=o,w=i.subarray(h,u+1),I=new Uint32Array(_[0]*_[1]*_[2]);let A;if(b!=="gzip_data")throw new oo(`Unhandled codec: ${b}`);return A=function(P,R){if(!globalThis.DecompressionStream&&R==="gzip_data")return Promise.resolve(((G=function(te){te[0]==31&&te[1]==139&&te[2]==8||Io(6,"invalid gzip data");var ae=te[3],ce=10;4&ae&&(ce+=2+(te[10]|te[11]<<8));for(var Ee=(ae>>3&1)+(ae>>4&1);Ee>0;Ee-=!te[ce++]);return ce+(2&ae)}(V=P))+8>V.length&&Io(6,"invalid gzip data"),function(te,ae,ce,Ee){var de=te.length;if(!de||ae.f&&!ae.l)return ce||new Yn(0);var Ae=!ce,je=Ae||ae.i!=2,Ce=ae.i;Ae&&(ce=new Yn(3*de));var Fe,Ve,Te=function(Ui){var Ai=ce.length;if(Ui>Ai){var Si=new Yn(Math.max(2*Ai,Ui));Si.set(ce),ce=Si}},Oe=ae.f||0,pe=ae.p||0,Se=ae.b||0,He=ae.l,Be=ae.d,ct=ae.m,nt=ae.n,De=8*de;do{if(!He){Oe=Eo(te,pe,1);var Ne=Eo(te,pe+1,3);if(pe+=3,!Ne){var st=te[(H=4+((pe+7)/8|0))-4]|te[H-3]<<8,et=H+st;if(et>de){Ce&&Io(0);break}je&&Te(Se+st),ce.set(te.subarray(H,et),Se),ae.b=Se+=st,ae.p=pe=8*et,ae.f=Oe;continue}if(Ne==1)He=db,Be=pb,ct=9,nt=5;else if(Ne==2){var Xe=Eo(te,pe,31)+257,tt=Eo(te,pe+10,15)+4,_t=Xe+Eo(te,pe+5,31)+1;pe+=14;for(var Tt=new Yn(_t),Mt=new Yn(19),It=0;It<tt;++It)Mt[cb[It]]=Eo(te,pe+3*It,7);pe+=3*tt;var qt=Jm(Mt),Lt=(1<<qt)-1,Ii=nd(Mt,qt);for(It=0;It<_t;){var H,$=Ii[Eo(te,pe,Lt)];if(pe+=15&$,(H=$>>4)<16)Tt[It++]=H;else{var be=0,$e=0;for(H==16?($e=3+Eo(te,pe,3),pe+=2,be=Tt[It-1]):H==17?($e=3+Eo(te,pe,7),pe+=3):H==18&&($e=11+Eo(te,pe,127),pe+=7);$e--;)Tt[It++]=be}}var Ke=Tt.subarray(0,Xe),Ye=Tt.subarray(Xe);ct=Jm(Ke),nt=Jm(Ye),He=nd(Ke,ct),Be=nd(Ye,nt)}else Io(1);if(pe>De){Ce&&Io(0);break}}je&&Te(Se+131072);for(var ot=(1<<ct)-1,vt=(1<<nt)-1,Nt=pe;;Nt=pe){var Vt=(be=He[Qm(te,pe)&ot])>>4;if((pe+=15&be)>De){Ce&&Io(0);break}if(be||Io(2),Vt<256)ce[Se++]=Vt;else{if(Vt==256){Nt=pe,He=null;break}var zt=Vt-254;Vt>264&&(zt=Eo(te,pe,(1<<(Ct=P0[It=Vt-257]))-1)+L0[It],pe+=Ct);var mi=Be[Qm(te,pe)&vt],Hi=mi>>4;if(mi||Io(3),pe+=15&mi,Ye=ub[Hi],Hi>3){var Ct=z0[Hi];Ye+=Qm(te,pe)&(1<<Ct)-1,pe+=Ct}if(pe>De){Ce&&Io(0);break}je&&Te(Se+131072);var Pi=Se+zt;if(Se<Ye){var Ti=0-Ye,hi=Math.min(Ye,Pi);for(Ti+Se<0&&Io(3);Se<hi;++Se)ce[Se]=(void 0)[Ti+Se]}for(;Se<Pi;++Se)ce[Se]=ce[Se-Ye]}}ae.l=He,ae.p=Nt,ae.b=Se,ae.f=Oe,He&&(Oe=1,ae.m=ct,ae.d=Be,ae.n=nt)}while(!Oe);return Se!=ce.length&&Ae?(Fe=ce,((Ve=Se)==null||Ve>Fe.length)&&(Ve=Fe.length),new Yn(Fe.subarray(0,Ve))):ce.subarray(0,Se)}(V.subarray(G,-8),{i:2},new Yn(((O=V)[(U=O.length)-4]|O[U-3]<<8|O[U-2]<<16|O[U-1]<<24)>>>0))));var O,U,V,G;const re=gb[R];if(!re)throw new Error(`Unhandled codec: ${R}`);const Q=new globalThis.DecompressionStream(re);return new Response(new Blob([P]).stream().pipeThrough(Q)).arrayBuffer().then(te=>new Uint8Array(te))}(w,b).then(P=>(function(R,O){R.readFields(rb,O)}(new e_(P),I),new xb[f](I.buffer))),A.then(P=>{for(let R=v.length-1;R>=0;R--)switch(v[R]){case"delta_filter":ob(P,_);break;case"zigzag_filter":sb(P);break;case"bitshuffle_filter":ab(P,f);break;default:throw new oo(`Unhandled filter "${v[R]}"`)}return{layerName:a,blockIndex:g,data:P}}).catch(P=>{throw P})}))},rt(N0,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),rt(af,"MapboxRasterTile"),rt(B0,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class V0{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const o=e[i];this._stringToNumber[o]=i,this._numberToString[i]=o}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const vb=["id","tile","layer","source","sourceLayer","state"];class oh{constructor(e,i,o,a,h){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=o,this._y=a,this.properties=e.properties,this.id=h}clone(){const e=new oh(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&(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 i of vb)this[i]!==void 0&&(e[i]=this[i]);return e}}class U0{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Ko(We,16,0),this.featureIndexArray=new rp,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,o,a,h,u=0,f=0){const _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,a,h,u);const g=this.grid;for(let v=0;v<i.length;v++){const b=i[v],w=[1/0,1/0,-1/0,-1/0];for(let I=0;I<b.length;I++){const A=b[I];w[0]=Math.min(w[0],A.x),w[1]=Math.min(w[1],A.y),w[2]=Math.max(w[2],A.x),w[3]=Math.max(w[3],A.y)}f!==0&&(w[0]-=f,w[1]-=f,w[2]+=f,w[3]+=f),w[0]<We&&w[1]<We&&w[2]>=0&&w[3]>=0&&g.insert(_,w[0],w[1],w[2],w[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new at(new Lp(this.rawTileData)).layers,this.sourceLayerCoder=new V0(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i){const{tilespaceGeometry:o,transform:a,tileTransform:h,pixelPosMatrix:u,availableImages:f,worldview:_}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const g=o.bufferedTilespaceBounds,v=this.grid.query(g.min.x,g.min.y,g.max.x,g.max.y,(A,P,R,O)=>Ji(o.bufferedTilespaceGeometry,A,P,R,O));v.sort(bb);let b=null;a.elevation&&v.length>0&&(b=th.create(a.elevation,this.tileID));const w={};let I;for(let A=0;A<v.length;A++){const P=v[A];if(P===I)continue;I=P;const R=this.featureIndexArray.get(P);let O=null;this.is3DTile?this.loadMatchingModelFeature(w,R,e,o,a,_):this.loadMatchingFeature(w,R,e,f,_,(U,V,G,re=0)=>(O||(O=oe(U,this.tileID.canonical,h)),V.queryIntersectsFeature(o,U,G,O,this.z,a,u,b,re)))}return w}loadMatchingFeature(e,i,o,a,h,u){const{featureIndex:f,bucketIndex:_,sourceLayerIndex:g,layoutVertexArrayOffset:v}=i,b=this.bucketLayerIDs[_],w=o.layers,I=Object.keys(w);if(I.length&&!jt(I,b))return;const A=o.sourceCache,P=this.sourceLayerCoder.decode(g),R=this.vtLayers[P].feature(f),O=this.getId(R,P);for(let U=0;U<b.length;U++){const V=b[U];if(!w[V])continue;const{styleLayer:G,targets:re}=w[V];let Q={};O!==void 0&&(Q=A.getFeatureState(G.sourceLayer,O));const te=!u||u(R,G,Q,v);if(!te)continue;const ae=new oh(R,this.z,this.x,this.y,O);ae.tile=this.tileID.canonical,ae.state=Q;let ce=this.serializedLayersCache.get(V);ce||(ce=G.serialize(),ce.id=V,this.serializedLayersCache.set(V,ce)),ae.source=ce.source,ae.sourceLayer=ce["source-layer"],ae.layer=ye({},ce),ae.layer.paint=j0(ce.paint,G.paint,R,Q,a),ae.layer.layout=j0(ce.layout,G.layout,R,Q,a);let Ee=!1;for(const de of re){this.updateFeatureProperties(ae,de);const{filter:Ae}=de;if(Ae){if(R.properties=ae.properties,Ae.needGeometry){const je=we(R,!0);if(!Ae.filter(new fi(this.tileID.overscaledZ,{worldview:h}),je,this.tileID.canonical))continue}else if(!Ae.filter(new fi(this.tileID.overscaledZ,{worldview:h}),R))continue}Ee=!0,de.targetId&&this.addFeatureVariant(ae,de)}Ee&&this.appendToResult(e,V,f,ae,te)}}loadMatchingModelFeature(e,i,o,a,h,u){const{featureIndex:f,bucketIndex:_}=i,g=this.bucketLayerIDs[_],v=o.layers,b=Object.keys(v);if(!b.length||jt(b,g))for(let w=0;w<g.length;w++){const I=g[w],{styleLayer:A,targets:P}=v[I];if(A.type!=="model")continue;const R=a.tile,O=R.getBucket(A);if(!(O&&O instanceof Qp))continue;const U=I1(O,f,a,h);if(!U)continue;const{z:V,x:G,y:re}=R.tileID.canonical,{feature:Q,intersectionZ:te,position:ae}=U;let ce={};Q.id!==void 0&&(ce=o.sourceCache.getFeatureState(A.sourceLayer,Q.id));const Ee=new oh({},V,G,re,Q.id);Ee.tile=this.tileID.canonical,Ee.state=ce,Ee.properties=Q.properties,Ee.geometry={type:"Point",coordinates:[ae.lng,ae.lat]};let de=this.serializedLayersCache.get(I);de||(de=A.serialize(),de.id=I,this.serializedLayersCache.set(I,de)),Ee.source=de.source,Ee.sourceLayer=de["source-layer"],Ee.layer=ye({},de);let Ae=!1;for(const je of P){this.updateFeatureProperties(Ee,je);const{filter:Ce}=je;if(Ce){if(Q.properties=Ee.properties,Ce.needGeometry){if(!Ce.filter(new fi(this.tileID.overscaledZ,{worldview:u}),Q,this.tileID.canonical))continue}else if(!Ce.filter(new fi(this.tileID.overscaledZ,{worldview:u}),Q))continue}Ae=!0,je.targetId&&this.addFeatureVariant(Ee,je)}Ae&&this.appendToResult(e,I,f,Ee,te)}}updateFeatureProperties(e,i,o){if(i.properties){const a={};for(const h in i.properties){const u=i.properties[h].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,o);u!=null&&(a[h]=u)}e.properties=a}}addFeatureVariant(e,i,o){const a={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(a.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(a)}appendToResult(e,i,o,a,h){let u=e[i];u===void 0&&(u=e[i]=[]),u.push({featureIndex:o,feature:a,intersectionZ:h})}lookupSymbolFeatures(e,i,o,a,h,u){const f={};this.loadVTLayers();for(const _ of e)this.loadMatchingFeature(f,{bucketIndex:i,sourceLayerIndex:o,featureIndex:_,layoutVertexArrayOffset:0},a,h,u);return f}loadFeature(e){const{featureIndex:i,sourceLayerIndex:o}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(o),h=this.vtFeatures[a];if(h[i])return h[i];const u=this.vtLayers[a].feature(i);return h[i]=u,u}hasLayer(e){for(const i of this.bucketLayerIDs)for(const o of i)if(e===o)return!0;return!1}getId(e,i){let o=e.id;if(this.promoteId){const a=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(a!=null)if(Array.isArray(a)){if(!this.promoteIdExpression){const h=Es(a);if(h.result!=="success"){const u=h.value.map(f=>`${f.key}: ${f.message}`).join(", ");return void Gt(`Failed to create expression for promoteId: ${u}`)}this.promoteIdExpression=h.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new sl),o=this.promoteIdExpression.evaluate({zoom:0},e)}else o=e.properties[a];typeof o=="boolean"&&(o=Number(o))}return o}}function j0(r,e,i,o,a){return St(r,(h,u)=>{const f=e instanceof Wn?e.get(u):null;return f&&f.evaluate?f.evaluate(i,o,void 0,a):f})}function bb(r,e){return e-r}rt(U0,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const G0=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 4,392 bytes, line 14
14];class t_{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,o]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=o>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const h=G0[15&o];if(!h)throw new Error("Unrecognized array type.");const[u]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new t_(f,u,h,e)}constructor(e,i=64,o=Float64Array,a){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=o,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const h=G0.indexOf(this.ArrayType),u=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(h<0)throw new Error(`Unexpected typed array class: ${o}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+u+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+h]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=e,this.coords[this._pos++]=i,o}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return i_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,o,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:h,coords:u,nodeSize:f}=this,_=[0,h.length-1,0],g=[];for(;_.length;){const v=_.pop()||0,b=_.pop()||0,w=_.pop()||0;if(b-w<=f){for(let R=w;R<=b;R++){const O=u[2*R],U=u[2*R+1];O>=e&&O<=o&&U>=i&&U<=a&&g.push(h[R])}continue}const I=w+b>>1,A=u[2*I],P=u[2*I+1];A>=e&&A<=o&&P>=i&&P<=a&&g.push(h[I]),(v===0?e<=A:i<=P)&&(_.push(w),_.push(I-1),_.push(1-v)),(v===0?o>=A:a>=P)&&(_.push(I+1),_.push(b),_.push(1-v))}return g}within(e,i,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:h,nodeSize:u}=this,f=[0,a.length-1,0],_=[],g=o*o;for(;f.length;){const v=f.pop()||0,b=f.pop()||0,w=f.pop()||0;if(b-w<=u){for(let R=w;R<=b;R++)H0(h[2*R],h[2*R+1],e,i)<=g&&_.push(a[R]);continue}const I=w+b>>1,A=h[2*I],P=h[2*I+1];H0(A,P,e,i)<=g&&_.push(a[I]),(v===0?e-o<=A:i-o<=P)&&(f.push(w),f.push(I-1),f.push(1-v)),(v===0?e+o>=A:i+o>=P)&&(f.push(I+1),f.push(b),f.push(1-v))}return _}}function i_(r,e,i,o,a,h){if(a-o<=i)return;const u=o+a>>1;q0(r,e,u,o,a,h),i_(r,e,i,o,u-1,1-h),i_(r,e,i,u+1,a,1-h)}function q0(r,e,i,o,a,h){for(;a>o;){if(a-o>600){const g=a-o+1,v=i-o+1,b=Math.log(g),w=.5*Math.exp(2*b/3),I=.5*Math.sqrt(b*w*(g-w)/g)*(v-g/2<0?-1:1);q0(r,e,i,Math.max(o,Math.floor(i-v*w/g+I)),Math.min(a,Math.floor(i+(g-v)*w/g+I)),h)}const u=e[2*i+h];let f=o,_=a;for(sd(r,e,o,i),e[2*a+h]>u&&sd(r,e,o,a);f<_;){for(sd(r,e,f,_),f++,_--;e[2*f+h]<u;)f++;for(;e[2*_+h]>u;)_--}e[2*o+h]===u?sd(r,e,o,_):(_++,sd(r,e,_,a)),_<=i&&(o=_+1),i<=_&&(a=_-1)}}function sd(r,e,i,o){r_(r,i,o),r_(e,2*i,2*o),r_(e,2*i+1,2*o+1)}function r_(r,e,i){const o=r[e];r[e]=r[i],r[i]=o}function H0(r,e,i,o){const a=r-i,h=e-o;return a*a+h*h}s.$=Tr,s.A=yo,s.B=vo,s.C=ua,s.D=Hc,s.E=_s,s.F=2,s.G=$u,s.H=gy,s.I=un,s.J=Vo,s.K=class extends Jp{},s.L=gs,s.M=Yd,s.N=bc,s.O=vc,s.P=ke,s.Q=Vd,s.R=Wa,s.S=$h,s.T=gm,s.U=xl,s.V=Jp,s.W=Zh,s.X=Es,s.Y=sc,s.Z=ia,s._=ta,s.a=function(r){return Ar.API_CDN_URL_REGEX.test(r)},s.a$=Pe,s.a0=mh,s.a1=vl,s.a2=wc,s.a3=Nd,s.a4=function(r){const e=r.value;let i=[];if(!e)return i;const o=Vo(e);return o!=="string"?(i=i.concat([new Jp(r.key,e,`string expected, "${o}" found`)]),i):(qm(e,!0)||(i=i.concat([new Jp(r.key,e,`invalid url "${e}"`)])),i)},s.a5=ue,s.a6=yl,s.a7=Yi,s.a8=Ge,s.a9=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return dr(r.expression.evaluate(e))}interpolate(r,e,i){return{x:ft(r.x,e.x,i),y:ft(r.y,e.y,i),z:ft(r.z,e.z,i),azimuthal:ft(r.azimuthal,e.azimuthal,i),polar:ft(r.polar,e.polar,i)}}},s.aA=hn,s.aB=Ur,s.aC=zr,s.aD=z,s.aE=se,s.aF=function(r,e){const i={};for(let o=0;o<e.length;o++){const a=e[o];a in r&&(i[a]=r[a])}return i},s.aG=M,s.aH=F,s.aI=class{constructor(r){this.entries={}
vendor: 26,690 bytes, line 14
14,this.scheduler=r}request(r,e,i,o){const a=this.entries[r]=this.entries[r]||{callbacks:[]};if(a.result){const[h,u]=a.result;return this.scheduler?this.scheduler.add(()=>{o(h,u)},e):o(h,u),()=>{}}return a.callbacks.push(o),a.cancel||(a.cancel=i((h,u)=>{a.result=[h,u];for(const f of a.callbacks)this.scheduler?this.scheduler.add(()=>{f(h,u)},e):f(h,u);setTimeout(()=>delete this.entries[r],3e3)})),()=>{a.result||(a.callbacks=a.callbacks.filter(h=>h!==o),a.callbacks.length||(a.cancel(),delete this.entries[r]))}}},s.aJ=function(r,e,i){const o=JSON.stringify(r.request);return r.data&&(this.deduped.entries[o]={result:[null,r.data]}),this.deduped.request(o,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom},a=>{const h=Xa(r.request,(u,f,_,g)=>{u?a(u):f&&a(null,{vectorTile:i?void 0:new at(new Lp(f)),rawData:f,cacheControl:_,expires:g})});return()=>{h.cancel(),a()}},e)},s.aK=function(r){hh++,hh>go&&(r.getActor().send("enforceCacheSizeLimit",$n),hh=0)},s.aL=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log(r)/Math.LN2))},s.aM=mr,s.aN=$y,s.aO=Jy,s.aP=Hy,s.aQ=function(r,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let o=0;o<r.length;o++){const a=document.createElement("source");hf(r[o])||(i.crossOrigin="Anonymous"),a.src=r[o],i.appendChild(a)}return{cancel:()=>{}}},s.aR=Vu,s.aS=function(r){return fetch(r).then(e=>e.arrayBuffer()).then(e=>Tg(e,0,r))},s.aT=zg,s.aU=class{constructor(r,e,i,o){this.id=r,this.position=e!=null?new S(e[0],e[1]):new S(0,0),this.orientation=i??[0,0,0],this.nodes=o,this.uploaded=!1,this.aabb=new kt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(r,e){if(Gi(r.matrix,e,r.matrix),r.meshes)for(const i of r.meshes){const o=kt.applyTransformFast(i.aabb,r.matrix);this.aabb.encapsulate(o)}if(r.children)for(const i of r.children)this._applyTransformations(i,r.matrix)}computeBoundsAndApplyParent(){const r=Bt([]);for(const e of this.nodes)this._applyTransformations(e,r)}computeModelMatrix(r,e,i,o,a,h,u=!1){Cg(this.matrix,this,r.transform,this.position,e,i,o,a,h,u)}upload(r){if(!this.uploaded){for(const e of this.nodes)vm(e,r);for(const e of this.nodes)Dp(e);this.uploaded=!0}}destroy(){for(const r of this.nodes)bm(r)}},s.aV=bt,s.aW=Xu,s.aX=N,s.aY=j,s.aZ=pa,s.a_=Li,s.aa=fi,s.ab=Yo,s.ac=J,s.ad=tr,s.ae=Cr,s.af=le,s.ag=Wn,s.ah=Sa,s.ai=ft,s.aj=We,s.ak=fd,s.al=ei,s.am=li,s.an=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return function([i,o]){const a=dr([1,i,o]);return{x:a.x,y:a.y,z:a.z}}(r.expression.evaluate(e))}interpolate(r,e,i){return{x:ft(r.x,e.x,i),y:ft(r.y,e.y,i),z:ft(r.z,e.z,i)}}},s.ao=function(r,e,i=0,o=!0){const a=new ke(i,i),h=r.sub(a),u=e.add(a),f=[h,new ke(u.x,h.y),u,new ke(h.x,u.y)];return o&&f.push(h.clone()),f},s.ap=function(r,e){const i=[];for(let o=0;o<r.length;o++){const a=ve(o-1,-1,r.length-1),h=ve(o+1,-1,r.length-1),u=r[o],f=r[h],_=r[a].sub(u).unit(),g=f.sub(u).unit(),v=g.angleWithSep(_.x,_.y),b=_.add(g).unit().mult(-1*e/Math.sin(v/2));i.push(u.add(b))}return i},s.aq=zy,s.ar=Ji,s.as=function(r,e,i=0){return lr(((e.x-i)*r.scale-r.x)*We,(e.y*r.scale-r.y)*We,q(e.z,e.y))},s.at=ir,s.au=Ri,s.av=Kt,s.aw=jg,s.ax=function(r){let e=1/0,i=1/0,o=-1/0,a=-1/0;for(const h of r)e=Math.min(e,h.x),i=Math.min(i,h.y),o=Math.max(o,h.x),a=Math.max(a,h.y);return{min:new ke(e,i),max:new ke(o,a)}},s.ay=W,s.az=Gi,s.b=function(r){return Ar.API_FONTS_REGEX.test(r)},s.b$=Fm,s.b0=ep,s.b1=Wp,s.b2=function(){eo.isLoading()||eo.isLoaded()||eu()!=="deferred"||Zd()},s.b3=ca,s.b4=we,s.b5=oh,s.b6=ri,s.b7=Sm,s.b8=im,s.b9=oe,s.bA=function(r,e){const{x:i,y:o}=r.point,a=u_(i,o,r.worldSize/r._pixelsPerMercatorPixel,0,0);return Gi(a,a,$f(ns(e)))},s.bB=so,s.bC=La,s.bD=function(r,e){return Math.hypot(e[0]-r[0],e[1]-r[1],e[2]-r[2])},s.bE=Hr,s.bF=cr,s.bG=er,s.bH=Hu,s.bI=Dn,s.bJ=zm,s.bK=function(r,e,i,o,a){const h=5*e+2;r.float32[h+0]=i,r.float32[h+1]=o,r.float32[h+2]=a},s.bL=Zp,s.bM=xn,s.bN=Fo,s.bO=Lo,s.bP=vn,s.bQ=ve,s.bR=function(r,e,i,o){var a=new $i(4);return a[0]=r,a[1]=e,a[2]=i,a[3]=o,a},s.bS=Ip,s.bT=yi,s.bU=Ir,s.bV=j_,s.bW=Qy,s.bX=$_,s.bY=om,s.bZ=Pm,s.b_=Sy,s.ba=ln,s.bb=fu,s.bc=o_,s.bd=Ni,s.be=Gc,s.bf=jm,s.bg=function(r,e){const i=Sa(e.zoom);if(i===0)return ns(r);const o=mp(r),a=Hf(o),h=z(o.getWest())*e.worldSize,u=z(o.getEast())*e.worldSize,f=F(o.getNorth())*e.worldSize,_=F(o.getSouth())*e.worldSize,g=[h,f,0],v=[u,f,0],b=[h,_,0],w=[u,_,0],I=Jr([],e.globeMatrix);return tr(g,g,I),tr(v,v,I),tr(b,b,I),tr(w,w,I),a[0]=Rs(a[0],b,i),a[1]=Rs(a[1],w,i),a[2]=Rs(a[2],v,i),a[3]=Rs(a[3],g,i),kt.fromPoints(a)},s.bh=gp,s.bi=Jr,s.bj=Su,s.bk=Rs,s.bl=da,s.bm=Q0,s.bn=Ls,s.bo=qr,s.bp=af,s.bq=Lp,s.br=Xa,s.bs=function(r,e){const i=[];for(const o in r)o in e||i.push(o);return i},s.bt=he,s.bu=["type","source","source-layer","minzoom","maxzoom","filter","layout"],s.bv=mo,s.bw=function(r){var e=new $i(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},s.bx=Bt,s.by=Mo,s.bz=cs,s.c=Ul,s.c$=45,s.c0=t_,s.c1=Fi,s.c2=Do,s.c3=uo,s.c4=function(r,e,i){i*=.5;var o=e[0],a=e[1],h=e[2],u=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_+a*f,r[1]=a*_-o*f,r[2]=h*_+u*f,r[3]=u*_-h*f,r},s.c5=hs,s.c6=qi,s.c7=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},s.c8=Co,s.c9=function(r,e,i,o,a){var h,u=1/Math.tan(e/2);return r[0]=u/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0?(r[10]=(a+o)*(h=1/(o-a)),r[14]=2*a*o*h):(r[10]=-1,r[14]=-2*o),r},s.cA=Pn,s.cB=l_,s.cC=function(r,e,i,o,a,h,u,f,_){if(_.name==="globe")return l_(r,e,new Pn(i,o,a),!1);const g=Xu({z:i,x:o,y:a},_);return new kt([(h+g.x/g.scale)*e,e*(g.y/g.scale),u],[(h+g.x2/g.scale)*e,e*(g.y2/g.scale),f])},s.cD=function(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r[3]=Math.min(e[3],i[3]),r},s.cE=function(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r[3]=Math.max(e[3],i[3]),r},s.cF=function(r){const e=Math.round((r+45+360)%360/90)%4;return k[e]},s.cG=X,s.cH=co,s.cI=l,s.cJ=function(r){const e=Bt(new Float64Array(16));Gi(e,r.pixelMatrix,r.globeMatrix);const i=[0,d,0],o=[0,p,0];return tr(i,i,e),tr(o,o,e),[i[0]>0&&i[0]<=r.width&&i[1]>0&&i[1]<=r.height&&!Wf(r,new S(r.center.lat,90)),o[0]>0&&o[0]<=r.width&&o[1]>0&&o[1]<=r.height&&!Wf(r,new S(r.center.lat,-90))]},s.cK=function(r,e){const{scale:i}=r.tileTransform,o=i*We/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return function(a,h,u){var f=h[1],_=h[2],g=h[3],v=u[0],b=u[1];return a[0]=h[0]*v,a[1]=f*v,a[2]=_*b,a[3]=g*b,a}(new Float32Array(4),e.inverseAdjustmentMatrix,[o,o])},s.cL=zp,s.cM=Nl,s.cN=Sg,s.cO=function(r){const e=Sg(r,!0);return so([],[e[0],e[1],e[4],e[5]])},s.cP=Fr,s.cQ=ti,s.cR=Ao,s.cS=function(r){const{x:e,y:i}=r.point,{lng:o,lat:a}=r._center;return u_(e,i,r.worldSize,o,a)},s.cT=Da,s.cU=ge,s.cV=zn,s.cW=Zi,s.cX=dp,s.cY=function(r,e,i){let o=0;for(let a=0;a<2;++a)r[a]>0&&(o+=(r[a]-0)*(r[a]-0)),e[a]<0&&(o+=(0-e[a])*(0-e[a]));return o},s.cZ=function(r){return r*r*r*r*r},s.c_=D,s.ca=function(r,e,i,o,a,h,u){var f=1/(e-i),_=1/(o-a),g=1/(h-u);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*_,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*g,r[11]=0,r[12]=(e+i)*f,r[13]=(a+o)*_,r[14]=(u+h)*g,r[15]=1,r},s.cb=L,s.cc=function(r,e,i){r[4*e+0]=i[0],r[4*e+1]=i[1],r[4*e+2]=i[2],r[4*e+3]=i[3]},s.cd=jc,s.ce=va,s.cf=or,s.cg=ro,s.ch=Ml,s.ci=S,s.cj=Oy,s.ck=function(){var r=new $i(4);return $i!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r},s.cl=function(r,e,i){var o=e[0],a=e[1],h=e[2],u=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_+h*f,r[1]=a*_+u*f,r[2]=o*-f+h*_,r[3]=a*-f+u*_,r},s.cm=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},s.cn=Fn,s.co=function(r){return Math.hypot(r[0],r[1],r[2],r[3])},s.cp=po,s.cq=Ro,s.cr=no,s.cs=3,s.ct=2,s.cu=7,s.cv=6,s.cw=Qr,s.cx=ui,s.cy=ni,s.cz=Eg,s.d=function(r){return Ar.API_TILEJSON_REGEX.test(r)},s.d$=(r,e,i,o,a,h,u,f,_,g)=>{const v=r.transform,b=v.calculatePixelsToTileUnitsMatrix(e),w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",I=v.pitch<15?Gg(.07,.7,W((14-v.zoom)/5,0,1)):.07;return{u_matrix:Hg(r,e,i,o),u_pixels_to_tile_units:b,u_device_pixel_ratio:h,u_width_scale:u,u_floor_width_scale:f,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:a,u_texsize:Zg(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:qg(e,r.transform),u_alpha_discard_threshold:0,u_trim_offset:_,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:I,u_tile_to_meter:K(e.tileID.canonical,0),u_ground_shadow_factor:g}},s.d0=Al,s.d1=function(r,e,i){const o=Math.sqrt(r*r+e*e+i*i),a=o>0?Math.acos(i/o)*Va:0;let h=r!==0||e!==0?Math.atan2(-e,-r)*Va+90:0;return h<0&&(h+=360),[o,h,a]},s.d2=lr,s.d3=dr,s.d4=K,s.d5=ki,s.d6=kt,s.d7=cn,s.d8=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},s.d9=qm,s.dA=mp,s.dB=function(r){const e=X-5;r=W(r,-e,e)/e*90;const i=Math.pow(Math.abs(Math.sin(ei(r))),3);return Math.round(i*(c.length-1))},s.dC=function(r,e,i,o){const a=e.getNorth(),h=e.getSouth(),u=e.getWest(),f=e.getEast(),_=1<<r.z,g=f-u,v=a-h,b=g/n,w=-v/c[i],I=[0,b,0,w,0,0,a,u,0];if(r.z>0){const A=180/o;Kn(I,I,[A/g+1,0,0,0,A/v+1,0,-.5*A/b,.5*A/w,1])}return I[2]=_,I[5]=r.x,I[8]=r.y,I},s.dD=ns,s.dE=function(r,e,i){const o=Bt(new Float64Array(16)),a=(e/(1<<r)-.5)*Math.PI*2;return ao(o,i.globeMatrix,a),Float32Array.from(o)},s.dF=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const i=e.getSource().maxzoom,o=1<<i,a=Math.floor(r.x),h=Math.floor((r.x-a)*o),u=Math.floor(r.y*o),f=this.findDEMTileFor(new mr(i,a,i,h,u));return!(!f||!f.dem)}getAtPointOrZero(r,e=0){return this.getAtPoint(r,e)||0}getAtPoint(r,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const o=this._source();if(!o||r.y<0||r.y>1)return e;const a=o.getSource().maxzoom,h=1<<a,u=Math.floor(r.x),f=r.x-u,_=new mr(a,u,a,Math.floor(f*h),Math.floor(r.y*h)),g=this.findDEMTileFor(_);if(!g||!g.dem)return e;const v=g.dem,b=1<<g.tileID.canonical.z,w=(f*b-g.tileID.canonical.x)*v.dim,I=(r.y*b-g.tileID.canonical.y)*v.dim,A=Math.floor(w),P=Math.floor(I);return(i?this.exaggeration():1)*ft(ft(v.get(A,P),v.get(A,P+1),I-P),ft(v.get(A+1,P),v.get(A+1,P+1),I-P),w-A)}getAtTileOffset(r,e,i){const o=1<<r.canonical.z;return this.getAtPointOrZero(new J(r.wrap+(r.canonical.x+e/We)/o,(r.canonical.y+i/We)/o))}getAtTileOffsetFunc(r,e,i,o){return a=>{const h=this.getAtTileOffset(r,a.x,a.y),u=o.upVector(r.canonical,a.x,a.y);return Fi(u,u,h*o.upVectorScale(r.canonical,e,i).metersToTile),u}}getForTilePoints(r,e,i,o){if(this.isUsingMockSource())return!1;const a=th.create(this,r,o);return!!a&&(e.forEach(h=>{h[2]=this.exaggeration()*a.getElevationAt(h[0],h[1],i)}),!0)}getMinMaxForTile(r){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(r);if(!e||!e.dem)return null;const i=e.dem.tree,o=e.tileID,a=1<<r.canonical.z-o.canonical.z;let h=r.canonical.x/a-o.canonical.x,u=r.canonical.y/a-o.canonical.y,f=0;for(let _=0;_<r.canonical.z-o.canonical.z&&!i.leaves[f];_++){h*=2,u*=2;const g=2*Math.floor(u)+Math.floor(h);f=i.childOffsets[f]+g,h%=1,u%=1}return{min:this.exaggeration()*i.minimums[f],max:this.exaggeration()*i.maximums[f]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(r,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(r){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(r){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const r=this.visibleDemTiles;if(r.length===0)return null;let e=!1,i=Number.MAX_VALUE,o=Number.MIN_VALUE;for(const a of r){const h=this.getMinMaxForTile(a.tileID);h&&(i=Math.min(i,h.min),o=Math.max(o,h.max),e=!0)}return e?{min:i,max:o}:null}},s.dG=S_,s.dH=fp,s.dI=function(r,e){return[Math.pow(r[0],2.2)*e,Math.pow(r[1],2.2)*e,Math.pow(r[2],2.2)*e]},s.dJ=Bl,s.dK=function(r,e){var i=Math.sin(e),o=Math.cos(e);return r[0]=o,r[1]=i,r[2]=0,r[3]=-i,r[4]=o,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},s.dL=zo,s.dM=h_,s.dN=rn,s.dO=kr,s.dP=256,s.dQ=function(r,e){const i=[0,0,0];return tr(i,i,gp(ns(e.canonical))),tr(i,i,r),i},s.dR=r=>({u_matrix:new Ml(r),u_texsize:new ro(r),u_pixels_to_tile_units:new wu(r),u_device_pixel_ratio:new or(r),u_width_scale:new or(r),u_floor_width_scale:new or(r),u_image:new jc(r),u_units_to_pixels:new ro(r),u_tile_units_to_pixels:new or(r),u_alpha_discard_threshold:new or(r),u_trim_offset:new ro(r),u_trim_fade_range:new ro(r),u_trim_color:new Al(r),u_emissive_strength:new or(r),u_zbias_factor:new or(r),u_tile_to_meter:new or(r),u_ground_shadow_factor:new va(r),u_pattern_transition:new or(r)}),s.dS=r=>({u_matrix:new Ml(r),u_pixels_to_tile_units:new wu(r),u_device_pixel_ratio:new or(r),u_width_scale:new or(r),u_floor_width_scale:new or(r),u_units_to_pixels:new ro(r),u_dash_image:new jc(r),u_gradient_image:new jc(r),u_image_height:new or(r),u_texsize:new ro(r),u_tile_units_to_pixels:new or(r),u_alpha_discard_threshold:new or(r),u_trim_offset:new ro(r),u_trim_fade_range:new ro(r),u_trim_color:new Al(r),u_emissive_strength:new or(r),u_zbias_factor:new or(r),u_tile_to_meter:new or(r),u_ground_shadow_factor:new va(r)}),s.dT=r=>({u_camera_to_center_distance:new or(r),u_extrude_scale:new wu(r),u_device_pixel_ratio:new or(r),u_matrix:new Ml(r),u_inv_rot_matrix:new Ml(r),u_merc_center:new ro(r),u_tile_id:new va(r),u_zoom_transition:new or(r),u_up_dir:new va(r),u_emissive_strength:new or(r)}),s.dU=_a,s.dV=Lv,s.dW=f_,s.dX=(r,e,i,o,a,h)=>{const u=r.transform,f=u.projection.name==="globe";let _;if(h.paint.get("circle-pitch-alignment")==="map")if(f){const v=h_(u.zoom,e.canonical)*u._pixelsPerMercatorPixel;_=Float32Array.from([v,0,0,v])}else _=u.calculatePixelsToTileUnitsMatrix(i);else _=new Float32Array([u.pixelsToGLUnits[0],0,0,u.pixelsToGLUnits[1]]);const g={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(u.projection),u_matrix:r.translatePosMatrix(e.projMatrix,i,h.paint.get("circle-translate"),h.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Hn.devicePixelRatio,u_extrude_scale:_,u_inv_rot_matrix:nx,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:h.paint.get("circle-emissive-strength")};if(f){g.u_inv_rot_matrix=o,g.u_merc_center=a,g.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],g.u_zoom_transition=Sa(u.zoom);const v=a[0]*We,b=a[1]*We;g.u_up_dir=u.projection.upVector(new Pn(0,0,0),v,b)}return g},s.dY=$g,s.dZ=on,s.d_=(r,e,i,o,a,h,u,f,_,g)=>{const v=r.transform,b=v.pitch<15?Gg(.07,.7,W((14-v.zoom)/5,0,1)):.07,w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:Hg(r,e,i,o),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:v.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:a,u_width_scale:h,u_floor_width_scale:u,u_image:0,u_tile_units_to_pixels:qg(e,v),u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:f,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:b,u_tile_to_meter:K(e.tileID.canonical,0),u_ground_shadow_factor:_,u_pattern_transition:g}},s.da=function(r,e){return r.readFields(C1,{icons:[]},e)},s.db=Ap,s.dc=Jc,s.dd=Dm,s.de=Hl,s.df=$d,s.dg=On,s.dh=Hs,s.di=Ft,s.dj=function(r){const e=r.indexOf(bl);return e>=0?r.slice(0,e):r},s.dk=function(r){return r.indexOf(bl)>=0},s.dl=function(r){const e=r.lastIndexOf(bl);return e>=0?r.slice(e+1):""},s.dm=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},s.dn=function(r,e,i,o){return r.type==="custom"?new T1(r,e):new A1[r.type](r,e,i,o)},s.dp=Ut,s.dq=function(r){const e=r.indexOf(bl);return e>=0?r.slice(e+1):""},s.dr=class extends oh{constructor(r,e){super(r._vectorTileFeature,r._z,r._x,r._y,r.id),r.state&&(this.state=Object.assign({},r.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=r.source,this.sourceLayer=r.sourceLayer,this.layer=r.layer)}toJSON(){const r=super.toJSON();return r.target=this.target,r.namespace=this.namespace,r}},s.ds=Qh,s.dt=Gs,s.du=function(r){return r({pluginStatus:Wr,pluginURL:Jo}),Qh.on("pluginStateChange",r),r},s.dv=bu,s.dw=class extends Un{constructor(r){super(r),this.current=Nf}set(r,e,i){if(this.fetchUniformLocation(r,e)){for(let o=0;o<9;o++)if(i[o]!==this.current[o]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},s.dx=B,s.dy=function(r,e,i){const o=Sa(i.zoom),a=r.style.map._antialias,h=r.terrain&&r.terrain.exaggeration()>0;return o===0&&!a&&!h},s.dz=function(r){const e=r.pixelsPerMeter,i=e/L(1,r.center.lat),o=Bt(new Float64Array(16));return qr(o,o,[r.point.x,r.point.y,0]),Fr(o,o,[i,i,e]),Float32Array.from(o)},s.e=Ar,s.e$=eu,s.e0=pt,s.e1=Eu,s.e2=q,s.e3=zs,s.e4=Ep,s.e5=ng,s.e6=Ia,s.e7=450,s.e8=7,s.e9=ie,s.eA=function(r,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P){var R=new $i(16);return R[0]=r,R[1]=e,R[2]=i,R[3]=o,R[4]=a,R[5]=h,R[6]=u,R[7]=f,R[8]=_,R[9]=g,R[10]=v,R[11]=b,R[12]=w,R[13]=I,R[14]=A,R[15]=P,R},s.eB=x,s.eC=du,s.eD=Tl,s.eE=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new ke(1/0,1/0),max:new ke(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(r,e=!1){const i=q_(new ke(0,0),new ke(We,We),r),o=[];if(e&&!rm(i,this._globalClipBounds))return o;for(const a of this._activeRegions){if(a.hiddenByOverlap||!rm(i,a))continue;const h=Rx(a.min,a.max,r);o.push({min:h.min,max:h.max,sourceId:this._sourceIds[a.priority],footprint:a.footprint,footprintTileId:a.tileId,order:a.order,clipMask:a.clipMask,clipScope:a.clipScope})}return o}setSources(r){this._setSources(r.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const o of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(o).buckets[e.layer];a&&a.updateFootprints(o.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(r){const e=r.getFootprints();if(e.length===0)return;const i=r.getOrder(),o=r.getClipMask(),a=r.getClipScope();for(const h of e){if(!h.footprint)continue;const u=q_(h.footprint.min,h.footprint.max,h.id);this._activeRegions.push({min:u.min,max:u.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:h.id,footprint:h.footprint,order:i,clipMask:o,clipScope:a})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||wp(e.min,i.min)||wp(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(o,a){const h=(u,f)=>u+f;return o.length-a.length||o.reduce(h,"").localeCompare(a.reduce(h,""))}(e.clipScope,i.clipScope));let r=this._activeRegions.length!==this._prevRegions.length;if(!r){let e=0;for(;!r&&e!==this._activeRegions.length;){const i=this._activeRegions[e],o=this._prevRegions[e];r=i.priority!==o.priority||!G_(i,o)||i.order!==o.order||i.clipMask!==o.clipMask||!mo(i.clipScope,o.clipScope),++e}}if(r){++this._updateTime;for(const i of this._activeRegions)i.order!==zu&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const o=this._activeRegions;if(i>=o.length)return i;const a=o[i].priority;for(;i<o.length&&o[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,o=e(i);for(;i!==o;){let a=i;const h=i;for(;a!==o;){const u=this._activeRegions[a];u.hiddenByOverlap=!1;for(let f=0;f<h;f++){const _=this._activeRegions[f];if(!_.hiddenByOverlap&&u.order===zu&&rm(u,_)&&(u.hiddenByOverlap=H_(u.footprint,u.tileId,_.footprint,_.tileId),u.hiddenByOverlap))break}++a}i=o,o=e(i)}}}}_setSources(r){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=r.length-1;e>=0;e--)this._addSource(r[e]);this._computeReplacement()}},s.eF=zu,s.eG=class{constructor(r){this._createGrid(r),this._createPoles(r)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const r of this._poleSegments)r.destroy();for(const r of this._gridSegments)r.withSkirts.destroy(),r.withoutSkirts.destroy()}_fillGridMeshWithLods(r,e){const i=new ln,o=new Li,a=[],h=r+1+2,u=e[0]+1,f=e[0]+1+(1+e.length),_=(g,v,b)=>{let w=g===h-1?g-2:g===0?g:g-1;return w+=b?24575:0,[w,v]};for(let g=0;g<h;++g)i.emplaceBack(..._(g,0,!0));for(let g=0;g<u;++g)for(let v=0;v<h;++v)i.emplaceBack(..._(v,g,(v===0||v===h-1)&&!0));for(let g=0;g<e.length;++g){const v=e[g];for(let b=0;b<h;++b)i.emplaceBack(..._(b,v,!0))}for(let g=0;g<e.length;++g){const v=o.length,b=e[g]+1+2,w=new Li;for(let P=0;P<b-1;P++){const R=P===b-2,O=R?h*(f-e.length+g-P):h;for(let U=0;U<h-1;U++){const V=P*h+U;P===0||R||U===0||U===h-2?(w.emplaceBack(V+1,V,V+O),w.emplaceBack(V+O,V+O+1,V+1)):(o.emplaceBack(V+1,V,V+O),o.emplaceBack(V+O,V+O+1,V+1))}}const I=Ni.simpleSegment(0,v,i.length,o.length-v);for(let P=0;P<w.uint16.length;P+=3)o.emplaceBack(w.uint16[P],w.uint16[P+1],w.uint16[P+2]);const A=Ni.simpleSegment(0,v,i.length,o.length-v);a.push({withoutSkirts:I,withSkirts:A})}return{vertices:i,indices:o,segments:a}}_createGrid(r){const e=this._fillGridMeshWithLods(n,c);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,o_.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new Li;for(let u=0;u<=n;u++)e.emplaceBack(0,u+1,u+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const i=new Cs,o=new Cs,a=new Cs,h=new Cs;this._poleSegments=[];for(let u=0,f=0;u<dp;u++){const _=360/(1<<u);i.emplaceBack(0,-Ur,0,.5,0),o.emplaceBack(0,-Ur,0,.5,1),a.emplaceBack(0,-Ur,0,.5,.5),h.emplaceBack(0,-Ur,0,.5,.5);for(let g=0;g<=n;g++){let v=g/n,b=0;const w=ft(0,_,v),[I,A,P]=m(ix,rx,w,Ur);i.emplaceBack(I,A,P,v,b),o.emplaceBack(I,A,P,v,1-b);const R=ei(w);v=.5+.5*Math.sin(R),b=.5+.5*Math.cos(R),a.emplaceBack(I,A,P,v,b),h.emplaceBack(I,A,P,v,1-b)}this._poleSegments.push(Ni.simpleSegment(f,0,66,64)),f+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(i,pp,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(o,pp,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(a,pp,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(h,pp,!1)}getGridBuffers(r,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[r].withSkirts:this._gridSegments[r].withoutSkirts]}getPoleBuffers(r,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[r]]}},s.eH=U_,s.eI=Z,s.eJ=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},s.eK=ne,s.eL=Y,s.eM=function(r,e,i){return r[0]=e[0]/i[0],r[1]=e[1]/i[1],r[2]=e[2]/i[2],r},s.eN=en,s.eO=y,s.eP=Vl,s.eQ=nr,s.eR=function([r,e,i]){const o=Math.hypot(r,e,i),a=Math.atan2(r,i),h=.5*Math.PI-Math.acos(-e/o);return new S(ge(a),ge(h))},s.eS=gn,s.eT=ym,s.eU=function(r){const e=r.navigator?r.navigator.userAgent:null;return!!function(i){if(Xi==null){const o=i.navigator?i.navigator.userAgent:null;Xi=!!i.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return Xi}(r)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},s.eV=function(r,e){$n=r,go=e},s.eW=Wf,s.eX=d_,s.eY=function(r){const e=[0,0,0],i=Bt(new Float64Array(16));return Gi(i,r.pixelMatrix,r.globeMatrix),tr(e,e,i),new ke(e[0],e[1])},s.eZ=function(){const r=ku;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(hm),ku=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()"))},s.e_=function(){Ap().acquire(hm)},s.ea=function(r,e){if(r===e){var i=e[1],o=e[2],a=e[3],h=e[6],u=e[7],f=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=i,r[6]=e[9],r[7]=e[13],r[8]=o,r[9]=h,r[11]=e[14],r[12]=a,r[13]=u,r[14]=f}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r},s.eb=w1,s.ec=$t,s.ed=mu,s.ee=256,s.ef=$f,s.eg=En,s.eh=ao,s.ei=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r},s.ej=Cs,s.ek=uu,s.el=Od,s.em=function(r,e,i,o,a){return W((r-e)/(i-e)*(a-o)+o,o,a)},s.en=ks,s.eo=function(r,e){var i=e[0],o=e[1],a=e[2],h=e[3],u=e[4],f=e[5],_=e[6],g=e[7],v=e[8],b=v*u-f*g,w=-v*h+f*_,I=g*h-u*_,A=i*b+o*w+a*I;return A?(r[0]=b*(A=1/A),r[1]=(-v*o+a*g)*A,r[2]=(f*o-a*u)*A,r[3]=w*A,r[4]=(v*i-a*_)*A,r[5]=(-f*i+a*h)*A,r[6]=I*A,r[7]=(-g*i+o*_)*A,r[8]=(u*i-o*h)*A,r):null},s.ep=2,s.eq=Po,s.er=xm,s.es=[1,1,1],s.et=class{constructor(r,e,i,o){this.context=r,this.format=o,this.size=i,this.texture=r.gl.createTexture();const[a,h,u]=this.size,{gl:f}=r;f.bindTexture(f.TEXTURE_3D,this.texture),r.pixelStoreUnpackFlipY.set(!1),r.pixelStoreUnpack.set(1),r.pixelStoreUnpackPremultiplyAlpha.set(!1),f.texImage3D(f.TEXTURE_3D,0,this.format,a,h,u,0,mm(this.format),_m(this.format),e.data)}bind(r,e){const{context:i}=this,{gl:o}=i;
14o.bindTexture(o.TEXTURE_3D,this.texture),r!==this.minFilter&&(o.texParameteri(o.TEXTURE_3D,o.TEXTURE_MAG_FILTER,r),o.texParameteri(o.TEXTURE_3D,o.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(o.texParameteri(o.TEXTURE_3D,o.TEXTURE_WRAP_S,e),o.texParameteri(o.TEXTURE_3D,o.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},s.eu=th,s.ev=Fa,s.ew=function(r,e,i,o){var a=e[0],h=e[1],u=e[2],f=e[3];return r[0]=a+o*(i[0]-a),r[1]=h+o*(i[1]-h),r[2]=u+o*(i[2]-u),r[3]=f+o*(i[3]-f),r},s.ex=Xc,s.ey=io,s.ez=is,s.f=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},s.f0=function(r,e,i=!1){if(Wr===pn.deferred||Wr===pn.loading||Wr===pn.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Jo=Hn.resolveURL(r),Wr=pn.deferred,Kh=e,Jh(),i||Zd()},s.f1=function(r){$c=Hn.resolveURL(r),Zc||(Zc=new Hc(Ap(),new _s)),Zc.broadcast("setMeshoptUrl",$c)},s.f2=gg,s.f3=function(r){dm=Hn.resolveURL(r),Zc||(Zc=new Hc(Ap(),new _s)),Zc.broadcast("setDracoUrl",dm)},s.f4=_g,s.f5=Ou,s.f6=function(r){const e=ds();if(!e)return;const i=e.delete(_o);r&&i.then(()=>r()).catch(r)},s.f7=Dl,s.f8=rt,s.f9=Ea,s.fa=So,s.fb=V0,s.fc=U0,s.fd=Ng,s.fe=Qe,s.ff="hd_road_elevation",s.fg=Vi,s.fh=St,s.fi=zl,s.fj=Rm,s.fk=Ol,s.fl=function(r,e,i,o,a,h,u,f=1,_,g,v){r.createArrays(),r.tilePixelRatio=We/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const b=r.layers[0].layout,w=r.layers[0]._unevaluatedLayout._values,I={};I.scaleFactor=f,I.textSizeScaleRange=b.get("text-size-scale-range"),I.iconSizeScaleRange=b.get("icon-size-scale-range");const[A,P]=I.textSizeScaleRange,[R,O]=I.iconSizeScaleRange;I.textScaleFactor=W(I.scaleFactor,A,P),I.iconScaleFactor=W(I.scaleFactor,R,O);const U=w["text-size"],V=w["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:ce,maxZoom:Ee}=r.textSizeData;I.compositeTextSizes=[U.possiblyEvaluate(new fi(ce,{worldview:v}),h),U.possiblyEvaluate(new fi(Ee,{worldview:v}),h)]}if(r.iconSizeData.kind==="composite"){const{minZoom:ce,maxZoom:Ee}=r.iconSizeData;I.compositeIconSizes=[V.possiblyEvaluate(new fi(ce,{worldview:v}),h),V.possiblyEvaluate(new fi(Ee,{worldview:v}),h)]}I.layoutTextSize=U.possiblyEvaluate(new fi(u+1,{worldview:v}),h),I.layoutIconSize=V.possiblyEvaluate(new fi(u+1,{worldview:v}),h),I.textMaxSize=U.possiblyEvaluate(new fi(18,{worldview:v}),h);const G=b.get("symbol-placement"),re=b.get("text-rotation-alignment")==="map"&&G!=="point",Q=b.get("text-size");let te=!1;const ae=[];for(const ce of r.features){const Ee=b.get("text-font").evaluate(ce,{},h).join(","),de=Q.evaluate(ce,{},h)*I.textScaleFactor,Ae=I.layoutTextSize.evaluate(ce,{},h)*I.textScaleFactor,je=I.layoutIconSize.evaluate(ce,{},h)*I.iconScaleFactor,Ce={horizontal:{},vertical:void 0},Fe=ce.text;let Ve,Te=[0,0];if(Fe){const tt=Fe.toString(),_t=b.get("text-letter-spacing").evaluate(ce,{},h)*Ir,Tt=b.get("text-line-height").evaluate(ce,{},h)*Ir,Mt=Mf(tt)?_t:0,It=b.get("text-anchor").evaluate(ce,{},h),qt=b.get("text-variable-anchor");if(!qt){const be=b.get("text-radial-offset").evaluate(ce,{},h);if(be)Te=Sy(It,[be*Ir,Lm]);else{const $e=b.get("text-offset").evaluate(ce,{},h);Te=[$e[0]*Ir,$e[1]*Ir]}}let Lt=re?"center":b.get("text-justify").evaluate(ce,{},h);const Ii=G==="point",H=Ii?b.get("text-max-width").evaluate(ce,{},h)*Ir:1/0,$=be=>{r.allowVerticalPlacement&&Yh(tt)&&(Ce.vertical=Cm(Fe,e,i,a,Ee,H,Tt,It,be,Mt,Te,Dn.vertical,!0,Ae,de,_))};if(!re&&qt){const be=Lt==="auto"?qt.map(Ke=>Fm(Ke)):[Lt];let $e=!1;for(let Ke=0;Ke<be.length;Ke++){const Ye=be[Ke];if(!Ce.horizontal[Ye])if($e)Ce.horizontal[Ye]=Ce.horizontal[0];else{const ot=Cm(Fe,e,i,a,Ee,H,Tt,"center",Ye,Mt,Te,Dn.horizontal,!1,Ae,de,_);ot&&(Ce.horizontal[Ye]=ot,$e=ot.positionedLines.length===1)}}$("left")}else{if(Lt==="auto"&&(Lt=Fm(It)),Ii||b.get("text-writing-mode").indexOf("horizontal")>=0||!Yh(tt)){const be=Cm(Fe,e,i,a,Ee,H,Tt,It,Lt,Mt,Te,Dn.horizontal,!1,Ae,de,_);be&&(Ce.horizontal[Lt]=be)}$(Ii?"left":Lt)}}let Oe,pe,Se,He,Be,ct,nt=!1;const De=b.get("icon-text-fit").evaluate(ce,{},h);if(ce.icon&&ce.icon.hasPrimary()){const tt=Iy(ce.icon,r.iconSizeData,w["icon-size"],h,r.zoom,ce,_,I.iconScaleFactor,v);Oe=tt.iconPrimary,Se=tt.iconSecondary;const _t=Oe.toString();if(pe=o.get(_t),pe&&(Be=b.get("icon-offset").evaluate(ce,{},h),ct=b.get("icon-anchor").evaluate(ce,{},h),Ve=Jv(a.get(_t),Se?a.get(Se.toString()):void 0,Be,ct),nt=pe.sdf,r.sdfIcons===void 0?r.sdfIcons=pe.sdf:r.sdfIcons!==pe.sdf&&Gt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(pe.pixelRatio!==r.pixelRatio||b.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),Se){const Tt=Se.toString();He=o.get(Tt)}}te=te||!(!ce.icon||!ce.icon.hasSecondary());const Ne=Om(Ce.horizontal)||Ce.vertical;r.iconsInText||(r.iconsInText=!!Ne&&Ne.iconsInText);const st=Ae*I.textScaleFactor/Ir,{defaultShapedIcon:et,verticallyShapedIcon:Xe}=l1(r,Ve,b,ce,h,Ce,st,Be,De);De!=="none"&&Ve&&(ly(Ve)||cy(Ve))&&(Np(0,pe,Oe,Ve,et,De,g,o,a),Np(0,He,Se,Ve,et,De,g,o,a),Xe&&(Np(0,pe,Oe,Ve,Xe,De,g,o,a),Np(0,He,Se,Ve,Xe,De,g,o,a))),Ve=et,ae.push({feature:ce,shapedTextOrientations:Ce,shapedText:Ne,shapedIcon:Ve,iconPrimary:Oe,iconSecondary:Se,iconOffset:Be,iconAnchor:ct,verticallyShapedIcon:Xe,layoutTextSize:Ae,layoutIconSize:je,textOffset:Te,isSDFIcon:nt,iconTextFit:De})}return{featureData:ae,sizes:I,hasAnySecondaryIcon:te,textAlongLine:re,symbolPlacement:G}},s.fm=yy,s.fn=function(r,e,i,o,a,h,u,f,_,g){const{featureData:v,hasAnySecondaryIcon:b,sizes:w,textAlongLine:I,symbolPlacement:A}=e;for(const P of v){const{shapedIcon:R,verticallyShapedIcon:O,feature:U,shapedTextOrientations:V,shapedText:G,layoutTextSize:re,textOffset:Q,isSDFIcon:te,iconPrimary:ae,iconSecondary:ce,iconTextFit:Ee,iconOffset:de}=P;Ay(R,g.iconPositions,ae,ce),Ay(O,g.iconPositions,ae,ce),a1(V,g.iconPositions),s1(ae,ce,g.iconPositions),(G||R)&&c1(r,U,V,R,O,_,w,re,0,Q,te,o,a,u,f,b,Ee,de,I,A)}i&&r.generateCollisionDebugBuffers(h,r.collisionBoxArray,w.textScaleFactor)},s.fo=at,s.fp=sf,s.fq=_e,s.fr=function(r){let e=0;
14if(new Uint32Array(r,0,1)[0]!==xg){const i=new Uint32Array(r,0,7),[,,o,a,h,u]=i;e=i.byteLength+a+h+u+h,(o!==r.byteLength||e>=r.byteLength)&&Gt("Invalid b3dm header information.")}return Tg(r,e)},s.fs=function(r,e){const i=zg(r);for(const o of i){for(const a of o.meshes)cv(a);o.lights&&(o.lightMeshIndex=o.meshes.length,o.meshes.push(hv(o.lights,e)))}return i},s.ft=Qp,s.fu=gi,s.fv=fg,s.fw=eo,s.fx=pn,s.fy=function(r){Us(),Jn!=null&&Jn.then(e=>{e.keys().then(i=>{for(let o=0;o<i.length-r;o++)e.delete(i[o]).catch(a=>Gt(a.message))}).catch(i=>Gt(i.message))}).catch(e=>Gt(e.message))},s.g=function(r,e){return Gs(ye(r,{method:"GET"}),e)},s.h=ye,s.i=function(r){return Ar.API_STYLE_REGEX.test(r)&&!Ul(r)},s.j=function(r){return r.indexOf("mapbox:")===0},s.k=ko,s.l=uh,s.m=function(r){return decodeURIComponent(atob(r).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},s.n=function(r,e){return Gs(ye(r,{type:"json"}),e)},s.o=Ka,s.p=function(r,e){return Gs(ye(r,{method:"POST"}),e)},s.q=Hn,s.r=Rr,s.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},s.t=ql,s.u=function(){return function r(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,r)}()},s.v=function(r){return!!r&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r)},s.w=Gt,s.x=function(){return um||(um=new Dl),um},s.y=Km,s.z=wn}),cf(["./shared"],function(s){function Gr(ge){const k=ge?ge.url.toString():void 0;return k?performance.getEntriesByName(k):[]}function $i(ge){if(typeof ge=="number"||typeof ge=="boolean"||typeof ge=="string"||ge==null)return JSON.stringify(ge);if(Array.isArray(ge)){let B="[";for(const Z of ge)B+=`${$i(Z)},`;return`${B}]`}let k="{";for(const B of Object.keys(ge).sort())k+=`${B}:${$i(ge[B])},`;return`${k}}`}function so(ge){let k="";for(const B of s.bu)k+=`/${$i(ge[B])}`;return k}class Bl{constructor(k){this.keyCache={},this._layers={},this._layerConfigs={},k&&this.replace(k)}replace(k,B){this._layerConfigs={},this._layers={},this.update(k,[],B)}update(k,B,Z){this._options=Z;for(const W of k)this._layerConfigs[W.id]=W,(this._layers[W.id]=s.dn(W,this.scope,null,this._options)).compileFilter(Z),this.keyCache[W.id]&&delete this.keyCache[W.id];for(const W of B)delete this.keyCache[W],delete this._layerConfigs[W],delete this._layers[W];this.familiesBySource={};const ne=function(W,le){const ve={};for(let ye=0;ye<W.length;ye++){const qe=W[ye];let Pe=le&&le[qe.id];Pe||(qe.type==="symbol"?Pe=qe.id:(Pe=so(qe),qe.type==="line"&&qe.paint&&function bt(St){return typeof St=="string"&&St==="line-progress"||(Array.isArray(St)?St.some(bt):!(!St||typeof St!="object")&&Object.values(St).some(bt))}(qe.paint["line-width"])&&(Pe+=`/${$i(qe.paint["line-width"])}`))),le&&(le[qe.id]=Pe);let pt=ve[Pe];pt||(pt=ve[Pe]=[]),pt.push(qe)}const he=[];for(const ye in ve)he.push(ve[ye]);return he}(Object.values(this._layerConfigs),this.keyCache);for(const W of ne){const le=W.map(pt=>this._layers[pt.id]),ve=le[0];if(ve.visibility==="none")continue;const he=ve.source||"";let ye=this.familiesBySource[he];ye||(ye=this.familiesBySource[he]={});const qe=ve.sourceLayer||"_geojsonTileLayer";let Pe=ye[qe];Pe||(Pe=ye[qe]=[]),Pe.push(le)}}}const ls=1*s.fa;class Kn{constructor(k){const B={},Z=[];for(const ve in k){const he=k[ve],ye=B[ve]={};for(const qe in he.glyphs){const Pe=he.glyphs[+qe];if(!Pe||Pe.bitmap.width===0||Pe.bitmap.height===0)continue;const pt=Pe.metrics.localGlyph?ls:1,bt={x:0,y:0,w:Pe.bitmap.width+2*pt,h:Pe.bitmap.height+2*pt};Z.push(bt),ye[qe]=bt}}const{w:ne,h:W}=s.H(Z),le=new s.f9({width:ne||1,height:W||1});for(const ve in k){const he=k[ve];for(const ye in he.glyphs){const qe=he.glyphs[+ye];if(!qe||qe.bitmap.width===0||qe.bitmap.height===0)continue;const Pe=B[ve][ye],pt=qe.metrics.localGlyph?ls:1;s.f9.copy(qe.bitmap,le,{x:0,y:0},{x:Pe.x+pt,y:Pe.y+pt},qe.bitmap)}}this.image=le,this.positions=B}}s.f8(Kn,"GlyphAtlas");class cs{constructor(k){this.tileID=new s.aM(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.tileZoom=k.tileZoom,this.uid=k.uid,this.zoom=k.zoom,this.lut=k.lut,this.canonical=k.tileID.canonical,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.scope=k.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=k.showCollisionBoxes,this.collectResourceTiming=!!k.request&&k.request.collectResourceTiming,this.promoteId=k.promoteId,this.isSymbolTile=k.isSymbolTile,this.tileTransform=s.aW(k.tileID.canonical,k.projection),this.projection=k.projection,this.worldview=k.worldview,this.localizableLayerIds=k.localizableLayerIds,this.brightness=k.brightness,this.extraShadowCaster=!!k.extraShadowCaster,this.tessellationStep=k.tessellationStep,this.scaleFactor=k.scaleFactor,this.worldview=k.worldview}parse(k,B,Z,ne,W,le){this.status="parsing",this.data=k,this.collisionBoxArray=new s.b0;const ve=new s.fb(Object.keys(k.layers).sort()),he=new s.fc(this.tileID,this.promoteId);he.bucketLayerIDs=[];const ye={},qe=new s.fd(256,256),Pe={featureIndex:he,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:qe,availableImages:Z,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},pt=[],bt=B.familiesBySource[this.source];for(const Ut in bt){const Ft=k.layers[Ut];if(!Ft)continue;let jt=!1,bi=!1,Gt=!1;for(const gi of bt[Ut])gi[0].type==="symbol"?jt=!0:bi=!0,gi[0].is3D()&&gi[0].type!=="model"&&(Gt=!0);if(this.extraShadowCaster&&!Gt||this.isSymbolTile===!0&&!jt||this.isSymbolTile===!1&&!bi)continue;Ft.version===1&&s.w(`Vector tile source "${this.source}" layer "${Ut}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ki=ve.encode(Ut),yr=[];let dr=!1;for(let gi=0,ri=0;gi<Ft.length;gi++){const Xi=Ft.feature(gi),qi=he.getId(Xi,Ut);if(this.localizableLayerIds&&this.localizableLayerIds.has(Ut)){const Bi=Xi.properties?Xi.properties.worldview:null;if(this.worldview&&typeof Bi=="string")if(Bi==="all")Xi.properties.$localized=!0;else{if(!Bi.split(",").includes(this.worldview))continue;Xi.properties.$localized=!0,Xi.properties.worldview=this.worldview}}!dr&&Xi.properties&&Xi.properties.hasOwnProperty(s.fe)&&(dr=!0),yr.push({feature:Xi,id:qi,index:ri,sourceLayerIndex:Ki}),ri++}dr&&!Pe.elevationFeatures&&k.layers.hasOwnProperty(s.ff)&&(Pe.elevationFeatures=s.fg.parseFrom(k.layers[s.ff],this.canonical));for(const gi of bt[Ut]){const ri=gi[0];if(this.extraShadowCaster&&(!ri.is3D()||ri.type==="model")||this.isSymbolTile!==void 0&&ri.type==="symbol"!==this.isSymbolTile||ri.minzoom&&this.zoom<Math.floor(ri.minzoom)||ri.maxzoom&&this.zoom>=ri.maxzoom||ri.visibility==="none")continue;Bt(gi,this.zoom,Pe.brightness,Z,this.worldview);const Xi=ye[ri.id]=ri.createBucket({index:he.bucketLayerIDs.length,layers:gi,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ki,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:ne,worldview:this.worldview});he.bucketLayerIDs.push(gi.map(Bi=>s.C(Bi.id,Bi.scope)));let qi=Xi.prepare?Xi.prepare():null;qi!=null?(qi=qi.then(()=>Xi.populate(yr,Pe,this.tileID.canonical,this.tileTransform)),pt.push(qi)):Xi.populate(yr,Pe,this.tileID.canonical,this.tileTransform)}}const St=()=>{let Ut,Ft,jt,bi,Gt,Ki;qe.trim();const yr={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},dr=()=>{if(Ut)return this.status="done",le(Ut);if(this.extraShadowCaster)this.status="done",le(null,{buckets:Object.values(ye).filter(ri=>!ri.isEmpty()),featureIndex:he,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Pe.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Ft&&jt&&bi){const ri=new Kn(Ft),Xi=new Map;for(const[wr,rn]of jt.entries()){const{imagePosition:kr}=s.fj(wr,rn,s.fk);Xi.set(wr,kr)}const qi={};for(const wr in ye){const rn=ye[wr];rn instanceof s.b1&&(Bt(rn.layers,this.zoom,Pe.brightness,Z,this.worldview),qi[wr]=s.fl(rn,Ft,ri.positions,jt,Xi,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Gt,this.worldview))}const Bi={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(W,jt,Gt,()=>{Bi.iconsPending=!1,gi(qi,ri,Bi)}),this.rasterizeIfNeeded(W,bi,Ki,()=>{Bi.patternsPending=!1,gi(qi,ri,Bi)})}},gi=(ri,Xi,qi,Bi)=>{if(qi.iconsPending||qi.patternsPending)return;const wr=new s.fm(jt,bi,this.lut);for(const rn in ye){const kr=ye[rn];if(rn in ri)s.fn(kr,ri[rn],this.showCollisionBoxes,Z,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,jt,wr);else if(kr.hasPattern&&(kr instanceof s.b7||kr instanceof s.b8||kr instanceof s.e4)){Bt(kr.layers,this.zoom,Pe.brightness,Z,this.worldview);const Ua=Object.fromEntries(wr.patternPositions);kr.addFeatures(Pe,this.tileID.canonical,Ua,Z,this.tileTransform,this.brightness)}}this.status="done",le(null,{buckets:Object.values(ye).filter(rn=>!rn.isEmpty()),featureIndex:he,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Xi.image,lineAtlas:qe,imageAtlas:wr,brightness:Pe.brightness})};if(!this.extraShadowCaster){const ri=s.fh(Pe.glyphDependencies,Bi=>Object.keys(Bi).map(Number));Object.keys(ri).length?W.send("getGlyphs",{uid:this.uid,stacks:ri},(Bi,wr)=>{Ut||(Ut=Bi,Ft=wr,dr())},void 0,!1,yr):Ft={};const Xi=Array.from(Pe.iconDependencies.keys()).map(Bi=>s.I.parse(Bi));Xi.length?W.send("getImages",{images:Xi,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Bi,wr)=>
14{Ut||(Ut=Bi,jt=new Map,Gt=this.updateImageMapAndGetImageTaskQueue(jt,wr,Pe.iconDependencies),dr())},void 0,!1,yr):(jt=new Map,Gt=new Map);const qi=Array.from(Pe.patternDependencies.keys()).map(Bi=>s.I.parse(Bi));qi.length?W.send("getImages",{images:qi,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Bi,wr)=>{Ut||(Ut=Bi,bi=new Map,Ki=this.updateImageMapAndGetImageTaskQueue(bi,wr,Pe.patternDependencies),dr())},void 0,!1,yr):(bi=new Map,Ki=new Map)}if(Pe.elevationFeatures&&Pe.elevationFeatures.length>0){const ri=[];for(const qi of Object.values(ye))if(qi instanceof s.b8){const Bi=qi.getUnevaluatedPortalGraph();Bi&&ri.push(Bi)}const Xi=s.fi.evaluate(ri);for(const qi of Object.values(ye))if(qi instanceof s.b8){const Bi=k.layers[ve.decode(qi.sourceLayerIndex)];qi.setEvaluatedPortalGraph(Xi,Bi,this.tileID.canonical,Pe.availableImages,Pe.brightness)}}dr()};pt.length>0?Promise.allSettled(pt).then(St).catch(le):St()}rasterizeIfNeeded(k,B,Z,ne){Array.from(B.values()).some(W=>W.usvg)?this.rasterize(k,B,Z,ne):ne()}updateImageMapAndGetImageTaskQueue(k,B,Z){const ne=new Map;for(const W of B.keys()){const le=Z.get(W)||[];for(const ve of le){const he=ve.toString(),ye=B.get(ve.id.toString());ye.usvg?ne.has(he)||(ne.set(he,ve),k.set(he,Object.assign({},ye))):k.set(he,ye)}}return ne}rasterize(k,B,Z,ne){this.rasterizeTask=k.send("rasterizeImages",{scope:this.scope,tasks:Z},(W,le)=>{if(!W)for(const[ve,he]of le.entries()){const ye=Object.assign(B.get(ve),{data:he});B.set(ve,ye)}ne()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function Bt(ge,k,B,Z,ne){const W=new s.aa(k,{brightness:B,worldview:ne});for(const le of ge)le.recalculate(W,Z)}class Jr extends s.E{constructor(k,B,Z,ne,W,le,ve){super(),this.actor=k,this.layerIndex=B,this.availableImages=Z,this.availableModels=ne,this.loadVectorData=le||s.aJ,this.loading={},this.loaded={},this.deduped=new s.aI(k.scheduler),this.isSpriteLoaded=W,this.scheduler=k.scheduler,this.brightness=ve}loadTile(k,B){const Z=k.uid,ne=k&&k.request,W=ne&&ne.collectResourceTiming,le=this.loading[Z]=new cs(k);le.abort=this.loadVectorData(k,(ve,he)=>{const ye=!this.loading[Z];if(delete this.loading[Z],le.cancelRasterize(),ye||ve||!he)return le.status="done",ye||(this.loaded[Z]=le),B(ve);const qe=he.rawData,Pe={};he.expires&&(Pe.expires=he.expires),he.cacheControl&&(Pe.cacheControl=he.cacheControl),le.vectorTile=he.vectorTile||new s.fo(new s.bq(qe));const pt=()=>{le.parse(le.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(bt,St)=>{if(bt||!St)return B(bt);const Ut={};if(W){const Ft=Gr(ne);Ft.length>0&&(Ut.resourceTiming=JSON.parse(JSON.stringify(Ft)))}B(null,s.h({rawTileData:qe.slice(0)},St,Pe,Ut))})};this.isSpriteLoaded?pt():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(pt,{type:"parseTile",isSymbolTile:k.isSymbolTile,zoom:k.tileZoom}):pt()}),this.loaded=this.loaded||{},this.loaded[Z]=le})}reloadTile(k,B){const Z=this.loaded,ne=k.uid;if(Z&&Z[ne]){const W=Z[ne];W.scaleFactor=k.scaleFactor,W.showCollisionBoxes=k.showCollisionBoxes,W.projection=k.projection,W.brightness=k.brightness,W.tileTransform=s.aW(k.tileID.canonical,k.projection),W.extraShadowCaster=k.extraShadowCaster,W.lut=k.lut,W.worldview=k.worldview;const le=(ve,he)=>{const ye=W.reloadCallback;ye&&(delete W.reloadCallback,W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ye)),B(ve,he)};W.status==="parsing"?W.reloadCallback=le:W.status==="done"&&(W.vectorTile?W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,le):le())}else B(null,void 0)}abortTile(k,B){const Z=k.uid,ne=this.loading[Z];ne&&(ne.abort&&ne.abort(),delete this.loading[Z]),B()}removeTile(k,B){const Z=this.loaded,ne=k.uid;Z&&Z[ne]&&delete Z[ne],B()}}class Gi{loadTile(k,B){const{uid:Z,encoding:ne,rawImageData:W,padding:le}=k,ve=ImageBitmap&&W instanceof ImageBitmap?this.getImageData(W,le):W;B(null,new s.fp(Z,ve,ne,le<1))}reloadTile(k,B){B(null,null)}abortTile(k,B){B()}removeTile(k,B){B()}getImageData(k,B){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(k.width,k.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=k.width,this.offscreenCanvas.height=k.height,this.offscreenCanvasContext.drawImage(k,0,0,k.width,k.height);const Z=this.offscreenCanvasContext.getImageData(-B,-B,k.width+2*B,k.height+2*B);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Z}}s.bp.setPbf(s.bq);class qr{constructor(k){this._mrt=new s.bp(k.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=k.uid,this.tileID=k.tileID,this.source=k.source}
14parse(k,B){const Z=this._mrt;this.status="parsing",this._entireBuffer=k;try{Z.parseHeader(k),this._isHeaderLoaded=!0;const ne=[];for(const W in Z.layers){const le=Z.getLayer(W),ve=le.getDataRange(le.getBandList()),he=Z.createDecodingTask(ve),ye=k.slice(ve.firstByte,ve.lastByte+1),qe=s.bp.performDecoding(ye,he).then(Pe=>he.complete(null,Pe)).catch(Pe=>he.complete(Pe,null));ne.push(qe)}Promise.allSettled(ne).then(()=>B(null,Z)).catch(W=>B(W))}catch(ne){B(ne)}}}class Fr{constructor(k){this.actor=k,this.loading={},this.loaded={}}loadTile(k,B){const Z=k.uid,ne=k.request,W=this.loading[Z]=new qr(k),{cancel:le}=s.br(ne,(ve,he,ye,qe)=>{const Pe=!this.loading[Z];if(delete this.loading[Z],Pe||ve||!he)return W.status="done",Pe||(this.loaded[Z]=W),B(ve);W.parse(he,(pt,bt)=>{if(pt||!bt)return B(pt);B(null,bt,ye,qe)}),this.loaded[Z]=W});W.abort=le}reloadTile(k,B){B(null,void 0)}abortTile(k,B){const Z=k.uid,ne=this.loading[Z];ne&&(ne.abort&&ne.abort(),delete this.loading[Z]),B()}removeTile(k,B){const Z=k.uid;this.loaded[Z]&&delete this.loaded[Z],B()}decodeRasterArray(k,B){s.bp.performDecoding(k.buffer,k.task).then(Z=>B(null,Z)).catch(Z=>B(Z))}}const Ao=s.fq.prototype.toGeoJSON;class ao{constructor(k){this._feature=k,this.extent=s.aj,this.type=k.type,this.properties=k.tags,"id"in k&&!isNaN(k.id)&&(this.id=parseInt(k.id,10))}loadGeometry(){if(this._feature.type===1){const k=[];for(const B of this._feature.geometry)k.push([new s.P(B[0],B[1])]);return k}{const k=[];for(const B of this._feature.geometry){const Z=[];for(const ne of B)Z.push(new s.P(ne[0],ne[1]));k.push(Z)}return k}}toGeoJSON(k,B,Z){return Ao.call(this,k,B,Z)}}class Mo{constructor(k,B){this.name=k,this.extent=s.aj,this.length=B.length,this._jsonFeatures=B}feature(k){return new ao(this._jsonFeatures[k])}}class Ls{constructor(k){this.layers={},this.extent=s.aj;for(const B of Object.keys(k))this.layers[B]=new Mo(B,k[B])}}const qn=64/4096,Co=128;class Nl{constructor(){this.features=new Map}clear(){this.features.clear()}load(k=[],B){for(const Z of k){const ne=Z.id;if(ne==null)continue;let W=this.features.get(ne);W&&this.updateCache(W,B),Z.geometry?(W=Fs(Z),this.updateCache(W,B),this.features.set(ne,W)):this.features.delete(ne),this.updateCache(W,B)}}updateCache(k,B){for(const{canonical:Z,uid:ne}of Object.values(B)){const{z:W,x:le,y:ve}=Z;ui(k,Math.pow(2,W),le,ve)&&delete B[ne]}}getTile(k,B,Z){const ne=Math.pow(2,k),W=[];for(const le of this.features.values())ui(le,ne,B,Z)&&W.push(ki(le,ne,B,Z));return{features:W}}getFeatures(){return[...this.features.values()]}}function ui({minX:ge,minY:k,maxX:B,maxY:Z},ne,W,le){return ge<(W+1+qn)/ne&&k<(le+1+qn)/ne&&B>(W-qn)/ne&&Z>(le-qn)/ne}function Fs(ge){const{id:k,geometry:B,properties:Z}=ge;if(!B)return;if(B.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:ne,coordinates:W}=B,le={id:k,type:1,geometry:[],tags:Z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},ve=le.geometry;if(ne==="Point")Cr(W,ve,le);else if(ne==="MultiPoint")for(const he of W)Cr(he,ve,le);else if(ne==="LineString")le.type=2,lr(W,ve,le);else if(ne==="MultiLineString")le.type=2,nr(W,ve,le);else if(ne==="Polygon")le.type=3,nr(W,ve,le,!0);else{if(ne!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");le.type=3;for(const he of W)nr(he,ve,le,!0)}return le}function Cr([ge,k],B,Z){const ne=s.aD(ge);let W=s.aH(k);W=W<0?0:W>1?1:W,B.push(ne,W),Z.minX=Math.min(Z.minX,ne),Z.minY=Math.min(Z.minY,W),Z.maxX=Math.max(Z.maxX,ne),Z.maxY=Math.max(Z.maxY,W)}function lr(ge,k,B,Z=!1,ne=!1){const W=[];for(const le of ge)Cr(le,W,B);k.push(W),Z&&function(le,ve){let he=0;for(let ye=0,qe=le.length,Pe=qe-2;ye<qe;Pe=ye,ye+=2)he+=(le[ye]-le[Pe])*(le[ye+1]+le[Pe+1]);if(he>0===ve)for(let ye=0,qe=le.length;ye<qe/2;ye+=2){const Pe=le[ye],pt=le[ye+1];le[ye]=le[qe-2-ye],le[ye+1]=le[qe-1-ye],le[qe-2-ye]=Pe,le[qe-1-ye]=pt}}(W,ne)}function nr(ge,k,B,Z=!1){for(let ne=0;ne<ge.length;ne++)lr(ge[ne],k,B,Z,ne===0)}function ki(ge,k,B,Z){const{id:ne,type:W,geometry:le,tags:ve}=ge,he=[];if(W===1)(function(ye,qe,Pe,pt,bt){for(let St=0;St<ye.length;St+=2){const Ut=Math.round(s.aj*(ye[St+0]*qe-Pe)),Ft=Math.round(s.aj*(ye[St+1]*qe-pt));bt.push([Ut,Ft])}})(le,k,B,Z,he);else for(const ye of le)cn(ye,k,B,Z,he);return{id:ne,type:W,geometry:he,tags:ve}}function cn(ge,k,B,Z,ne){const W=-Co,le=s.aj+Co;let ve;
14for(let he=0;he<ge.length-2;he+=2){let ye=Math.round(s.aj*(ge[he+0]*k-B)),qe=Math.round(s.aj*(ge[he+1]*k-Z)),Pe=Math.round(s.aj*(ge[he+2]*k-B)),pt=Math.round(s.aj*(ge[he+3]*k-Z));const bt=Pe-ye,St=pt-qe;ye<W&&Pe<W||(ye<W?(qe+=Math.round(St*((W-ye)/bt)),ye=W):Pe<W&&(pt=qe+Math.round(St*((W-ye)/bt)),Pe=W),qe<W&&pt<W||(qe<W?(ye+=Math.round(bt*((W-qe)/St)),qe=W):pt<W&&(Pe=ye+Math.round(bt*((W-qe)/St)),pt=W),ye>=le&&Pe>=le||(ye>=le?(qe+=Math.round(St*((le-ye)/bt)),ye=le):Pe>=le&&(pt=qe+Math.round(St*((le-ye)/bt)),Pe=le),qe>=le&&pt>=le||(qe>=le?(ye+=Math.round(bt*((le-qe)/St)),qe=le):pt>=le&&(Pe=ye+Math.round(bt*((le-qe)/St)),pt=le),ve&&ye===ve[ve.length-1][0]&&qe===ve[ve.length-1][1]||(ve=[[ye,qe]],ne.push(ve)),ve.push([Pe,pt])))))}}function Da({name:ge,features:k},B){B.writeStringField(1,ge),B.writeVarintField(5,s.aj);const Z=new Map,ne=new Map,W={keys:Z,values:ne,feature:null};for(const le of k)W.feature=le,B.writeMessage(2,lo,W);for(const le of Z.keys())B.writeStringField(3,le);for(const le of ne.keys())B.writeMessage(4,Vl,le)}function lo(ge,k){const B=ge.feature;B.id===void 0||isNaN(+B.id)||k.writeVarintField(1,+B.id),B.tags&&k.writeMessage(2,Ln,ge),k.writeVarintField(3,B.type),k.writeMessage(4,Os,B)}function Ln({keys:ge,values:k,feature:B},Z){for(const ne of Object.keys(B.tags)){let W=B.tags[ne];if(W===null)continue;let le=ge.get(ne);le===void 0&&(le=ge.size,ge.set(ne,le)),Z.writeVarint(le);const ve=typeof W;ve!=="string"&&ve!=="boolean"&&ve!=="number"&&(W=JSON.stringify(W));let he=k.get(W);he===void 0&&(he=k.size,k.set(W,he)),Z.writeVarint(he)}}function Fi(ge,k){return(k<<3)+(7&ge)}function Hr(ge){return ge<<1^ge>>31}function Os(ge,k){const{geometry:B,type:Z}=ge;let ne=0,W=0;if(Z===1){k.writeVarint(Fi(1,B.length));for(const le of B){const ve=le[0]-ne,he=le[1]-W;k.writeVarint(Hr(ve)),k.writeVarint(Hr(he)),ne+=ve,W+=he}}else for(const le of B){k.writeVarint(Fi(1,1));const ve=le.length-(Z===3?1:0);for(let he=0;he<ve;he++){he===1&&k.writeVarint(Fi(2,ve-1));const ye=le[he][0]-ne,qe=le[he][1]-W;k.writeVarint(Hr(ye)),k.writeVarint(Hr(qe)),ne+=ye,W+=qe}Z===3&&k.writeVarint(Fi(7,1))}}function Vl(ge,k){const B=typeof ge;B==="string"?k.writeStringField(1,ge):B==="boolean"?k.writeBooleanField(7,ge):B==="number"&&(ge%1!=0?k.writeDoubleField(3,ge):ge<0?k.writeSVarintField(6,ge):k.writeVarintField(5,ge))}const Po={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ge=>ge},Ri=Math.fround||(er=new Float32Array(1),ge=>(er[0]=+ge,er[0]));var er;const cr=3,Qr=5,tr=6;class zo{constructor(k){this.options=Object.assign(Object.create(Po),k),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(k){const{log:B,minZoom:Z,maxZoom:ne}=this.options;B&&console.time("total time");const W=`prepare ${k.length} points`;B&&console.time(W),this.points=k;const le=[];for(let he=0;he<k.length;he++){const ye=k[he];if(!ye.geometry)continue;const[qe,Pe]=ye.geometry.coordinates,pt=Ri(Fn(qe)),bt=Ri(ir(Pe));le.push(pt,bt,1/0,he,-1,1),this.options.reduce&&le.push(0)}let ve=this.trees[ne+1]=this._createTree(le);B&&console.timeEnd(W);for(let he=ne;he>=Z;he--){const ye=+Date.now();ve=this.trees[he]=this._createTree(this._cluster(ve,he)),B&&console.log("z%d: %d clusters in %dms",he,ve.numItems,+Date.now()-ye)}return B&&console.timeEnd("total time"),this}getClusters(k,B){let Z=((k[0]+180)%360+360)%360-180;const ne=Math.max(-90,Math.min(90,k[1]));let W=k[2]===180?180:((k[2]+180)%360+360)%360-180;const le=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)Z=-180,W=180;else if(Z>W){const Pe=this.getClusters([Z,ne,180,le],B),pt=this.getClusters([-180,ne,W,le],B);return Pe.concat(pt)}const ve=this.trees[this._limitZoom(B)],he=ve.range(Fn(Z),ir(le),Fn(W),ir(ne)),ye=ve.data,qe=[];for(const Pe of he){const pt=this.stride*Pe;qe.push(ye[pt+Qr]>1?Ro(ye,pt,this.clusterProps):this.points[ye[pt+cr]])}return qe}getChildren(k){const B=this._getOriginId(k),Z=this._getOriginZoom(k),ne="No cluster with the specified id.",W=this.trees[Z];if(!W)throw new Error(ne);const le=W.data;if(B*this.stride>=le.length)throw new Error(ne);const ve=this.options.radius/(this.options.extent*Math.pow(2,Z-1)),he=W.within(le[B*this.stride],le[B*this.stride+1],ve),ye=[];for(const qe of he){const Pe=qe*this.stride;le[Pe+4]===k&&ye.push(le[Pe+Qr]>1?Ro(le,Pe,this.clusterProps):this.points[le[Pe+cr]])}if(ye.length===0)throw new Error(ne);return ye}getLeaves(k,B,Z){const ne=[];return this._appendLeaves(ne,k,B=B||10,Z=Z||0,0),ne}getTile(k,B,Z){const ne=this.trees[this._limitZoom(k)],W=Math.pow(2,k),{extent:le,radius:ve}=this.options,he=ve/le,ye=(Z-he)/W,qe=(Z+1+he)/W,Pe={features:[]};return this._addTileFeatures(ne.range((B-he)/W,ye,(B+1+he)/W,qe),ne.data,B,Z,W,Pe),B===0&&this._addTileFeatures(ne.range(1-he/W,ye,1,qe),ne.data,W,Z,W,Pe),B===W-1&&this._addTileFeatures(ne.range(0,ye,he/W,qe),ne.data,-1,Z,W,Pe),Pe.features.length?Pe:null}getClusterExpansionZoom(k){let B=this._getOriginZoom(k)-1;for(;B<=this.options.maxZoom;){const Z=this.getChildren(k);if(B++,Z.length!==1)break;k=Z[0].properties.cluster_id}return B}_appendLeaves(k,B,Z,ne,W){const le=this.getChildren(B);for(const ve of le){const he=ve.properties;if(he&&he.cluster?W+he.point_count<=ne?W+=he.point_count:W=this._appendLeaves(k,he.cluster_id,Z,ne,W):W<ne?W++:k.push(ve),k.length===Z)break}return W}_createTree(k){const B=new s.c0(k.length/this.stride|0,this.options.nodeSize,Float32Array);for(let Z=0;Z<k.length;Z+=this.stride)B.add(k[Z],k[Z+1]);return B.finish(),B.data=k,B}_addTileFeatures(k,B,Z,ne,W,le){for(const ve of k){const he=ve*this.stride,ye=B[he+Qr]>1;let qe,Pe,pt;if(ye)qe=La(B,he,this.clusterProps),Pe=B[he],pt=B[he+1];else{const Ut=this.points[B[he+cr]];qe=Ut.properties;const[Ft,jt]=Ut.geometry.coordinates;Pe=Fn(Ft),pt=ir(jt)}const bt={type:1,geometry:[[Math.round(this.options.extent*(Pe*W-Z)),Math.round(this.options.extent*(pt*W-ne))]],tags:qe};let St;St=ye||this.options.generateId?B[he+cr]:this.points[B[he+cr]].id,St!==void 0&&(bt.id=St),le.features.push(bt)}}_limitZoom(k){return Math.max(this.options.minZoom,Math.min(Math.floor(+k),this.options.maxZoom+1))}_cluster(k,B){const{radius:Z,extent:ne,reduce:W,minPoints:le}=this.options,ve=Z/(ne*Math.pow(2,B)),he=k.data,ye=[],qe=this.stride;for(let Pe=0;Pe<he.length;Pe+=qe){if(he[Pe+2]<=B)continue;he[Pe+2]=B;const pt=he[Pe],bt=he[Pe+1],St=k.within(he[Pe],he[Pe+1],ve),Ut=he[Pe+Qr];let Ft=Ut;
vendor: 9,620 bytes, line 14
14for(const jt of St){const bi=jt*qe;he[bi+2]>B&&(Ft+=he[bi+Qr])}if(Ft>Ut&&Ft>=le){let jt,bi=pt*Ut,Gt=bt*Ut,Ki=-1;const yr=(Pe/qe<<5)+(B+1)+this.points.length;for(const dr of St){const gi=dr*qe;if(he[gi+2]<=B)continue;he[gi+2]=B;const ri=he[gi+Qr];bi+=he[gi]*ri,Gt+=he[gi+1]*ri,he[gi+4]=yr,W&&(jt||(jt=this._map(he,Pe,!0),Ki=this.clusterProps.length,this.clusterProps.push(jt)),W(jt,this._map(he,gi)))}he[Pe+4]=yr,ye.push(bi/Ft,Gt/Ft,1/0,yr,-1,Ft),W&&ye.push(Ki)}else{for(let jt=0;jt<qe;jt++)ye.push(he[Pe+jt]);if(Ft>1)for(const jt of St){const bi=jt*qe;if(!(he[bi+2]<=B)){he[bi+2]=B;for(let Gt=0;Gt<qe;Gt++)ye.push(he[bi+Gt])}}}}return ye}_getOriginId(k){return k-this.points.length>>5}_getOriginZoom(k){return(k-this.points.length)%32}_map(k,B,Z){if(k[B+Qr]>1){const le=this.clusterProps[k[B+tr]];return Z?Object.assign({},le):le}const ne=this.points[k[B+cr]].properties,W=this.options.map(ne);return Z&&W===ne?Object.assign({},W):W}}function Ro(ge,k,B){return{type:"Feature",id:ge[k+cr],properties:La(ge,k,B),geometry:{type:"Point",coordinates:[(Z=ge[k],360*(Z-.5)),en(ge[k+1])]}};var Z}function La(ge,k,B){const Z=ge[k+Qr],ne=Z>=1e4?`${Math.round(Z/1e3)}k`:Z>=1e3?Math.round(Z/100)/10+"k":Z,W=ge[k+tr],le=W===-1?{}:Object.assign({},B[W]);return Object.assign(le,{cluster:!0,cluster_id:ge[k+cr],point_count:Z,point_count_abbreviated:ne})}function Fn(ge){return ge/360+.5}function ir(ge){const k=Math.sin(ge*Math.PI/180),B=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return B<0?0:B>1?1:B}function en(ge){const k=(180-360*ge)*Math.PI/180;return 360*Math.atan(Math.exp(k))/Math.PI-90}function Do(ge,k,B,Z){let ne=Z;const W=k+(B-k>>1);let le,ve=B-k;const he=ge[k],ye=ge[k+1],qe=ge[B],Pe=ge[B+1];for(let pt=k+3;pt<B;pt+=3){const bt=Fa(ge[pt],ge[pt+1],he,ye,qe,Pe);if(bt>ne)le=pt,ne=bt;else if(bt===ne){const St=Math.abs(pt-W);St<ve&&(le=pt,ve=St)}}ne>Z&&(le-k>3&&Do(ge,k,le,Z),ge[le+2]=ne,B-le>3&&Do(ge,le,B,Z))}function Fa(ge,k,B,Z,ne,W){let le=ne-B,ve=W-Z;if(le!==0||ve!==0){const he=((ge-B)*le+(k-Z)*ve)/(le*le+ve*ve);he>1?(B=ne,Z=W):he>0&&(B+=le*he,Z+=ve*he)}return le=ge-B,ve=k-Z,le*le+ve*ve}function co(ge,k,B,Z){const ne={id:ge??null,type:k,geometry:B,tags:Z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(k==="Point"||k==="MultiPoint"||k==="LineString")gn(ne,B);else if(k==="Polygon")gn(ne,B[0]);else if(k==="MultiLineString")for(const W of B)gn(ne,W);else if(k==="MultiPolygon")for(const W of B)gn(ne,W[0]);return ne}function gn(ge,k){for(let B=0;B<k.length;B+=3)ge.minX=Math.min(ge.minX,k[B]),ge.minY=Math.min(ge.minY,k[B+1]),ge.maxX=Math.max(ge.maxX,k[B]),ge.maxY=Math.max(ge.maxY,k[B+1])}function hn(ge,k,B,Z){if(!k.geometry)return;const ne=k.geometry.coordinates;if(ne&&ne.length===0)return;const W=k.geometry.type,le=Math.pow(B.tolerance/((1<<B.maxZoom)*B.extent),2);let ve=[],he=k.id;if(B.promoteId?he=k.properties[B.promoteId]:B.generateId&&(he=Z||0),W==="Point")ho(ne,ve);else if(W==="MultiPoint")for(const ye of ne)ho(ye,ve);else if(W==="LineString")uo(ne,ve,le,!1);else if(W==="MultiLineString"){if(B.lineMetrics){for(const ye of ne)ve=[],uo(ye,ve,le,!1),ge.push(co(he,"LineString",ve,k.properties));return}hs(ne,ve,le,!1)}else if(W==="Polygon")hs(ne,ve,le,!0);else{if(W!=="MultiPolygon"){if(W==="GeometryCollection"){for(const ye of k.geometry.geometries)hn(ge,{id:he,geometry:ye,properties:k.properties},B,Z);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ye of ne){const qe=[];hs(ye,qe,le,!0),ve.push(qe)}}ge.push(co(he,W,ve,k.properties))}function ho(ge,k){k.push(ks(ge[0]),tn(ge[1]),0)}function uo(ge,k,B,Z){let ne,W,le=0;for(let he=0;he<ge.length;he++){const ye=ks(ge[he][0]),qe=tn(ge[he][1]);k.push(ye,qe,0),he>0&&(le+=Z?(ne*qe-ye*W)/2:Math.sqrt(Math.pow(ye-ne,2)+Math.pow(qe-W,2))),ne=ye,W=qe}const ve=k.length-3;k[2]=1,Do(k,0,ve,B),k[ve+2]=1,k.size=Math.abs(le),k.start=0,k.end=k.size}function hs(ge,k,B,Z){for(let ne=0;ne<ge.length;ne++){const W=[];uo(ge[ne],W,B,Z),k.push(W)}}function ks(ge){return ge/360+.5}function tn(ge){const k=Math.sin(ge*Math.PI/180),B=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return B<0?0:B>1?1:B}function yn(ge,k,B,Z,ne,W,le,ve){if(Z/=k,W>=(B/=k)&&le<Z)return ge;if(le<B||W>=Z)return null;const he=[];for(const ye of ge){const qe=ye.geometry;let Pe=ye.type;const pt=ne===0?ye.minX:ye.minY,bt=ne===0?ye.maxX:ye.maxY;if(pt>=B&&bt<Z){he.push(ye);continue}if(bt<B||pt>=Z)continue;let St=[];if(Pe==="Point"||Pe==="MultiPoint")Oa(qe,St,B,Z,ne);else if(Pe==="LineString")po(qe,St,B,Z,ne,!1,ve.lineMetrics);else if(Pe==="MultiLineString")Or(qe,St,B,Z,ne,!1);else if(Pe==="Polygon")Or(qe,St,B,Z,ne,!0);else if(Pe==="MultiPolygon")for(const Ut of qe){const Ft=[];Or(Ut,Ft,B,Z,ne,!0),Ft.length&&St.push(Ft)}if(St.length){if(ve.lineMetrics&&Pe==="LineString"){for(const Ut of St)he.push(co(ye.id,Pe,Ut,ye.tags));continue}Pe!=="LineString"&&Pe!=="MultiLineString"||(St.length===1?(Pe="LineString",St=St[0]):Pe="MultiLineString"),Pe!=="Point"&&Pe!=="MultiPoint"||(Pe=St.length===3?"Point":"MultiPoint"),he.push(co(ye.id,Pe,St,ye.tags))}}return he.length?he:null}function Oa(ge,k,B,Z,ne){for(let W=0;W<ge.length;W+=3){const le=ge[W+ne];le>=B&&le<=Z&&xn(k,ge[W],ge[W+1],ge[W+2])}}function po(ge,k,B,Z,ne,W,le){let ve=Bs(ge);const he=ne===0?Lo:fo;let ye,qe,Pe=ge.start;for(let Ft=0;Ft<ge.length-3;Ft+=3){const jt=ge[Ft],bi=ge[Ft+1],Gt=ge[Ft+2],Ki=ge[Ft+3],yr=ge[Ft+4],dr=ne===0?jt:bi,gi=ne===0?Ki:yr;let ri=!1;le&&(ye=Math.sqrt(Math.pow(jt-Ki,2)+Math.pow(bi-yr,2))),dr<B?gi>B&&(qe=he(ve,jt,bi,Ki,yr,B),le&&(ve.start=Pe+ye*qe)):dr>Z?gi<Z&&(qe=he(ve,jt,bi,Ki,yr,Z),le&&(ve.start=Pe+ye*qe)):xn(ve,jt,bi,Gt),gi<B&&dr>=B&&(qe=he(ve,jt,bi,Ki,yr,B),ri=!0),gi>Z&&dr<=Z&&(qe=he(ve,jt,bi,Ki,yr,Z),ri=!0),!W&&ri&&(le&&(ve.end=Pe+ye*qe),k.push(ve),ve=Bs(ge)),le&&(Pe+=ye)}let pt=ge.length-3;const bt=ge[pt],St=ge[pt+1],Ut=ne===0?bt:St;Ut>=B&&Ut<=Z&&xn(ve,bt,St,ge[pt+2]),pt=ve.length-3,W&&pt>=3&&(ve[pt]!==ve[0]||ve[pt+1]!==ve[1])&&xn(ve,ve[0],ve[1],ve[2]),ve.length&&k.push(ve)}function Bs(ge){const k=[];return k.size=ge.size,k.start=ge.start,k.end=ge.end,k}function Or(ge,k,B,Z,ne,W){for(const le of ge)po(le,k,B,Z,ne,W,!1)}function xn(ge,k,B,Z){ge.push(k,B,Z)}function Lo(ge,k,B,Z,ne,W){const le=(W-k)/(Z-k);return xn(ge,W,B+(ne-B)*le,1),le}function fo(ge,k,B,Z,ne,W){const le=(W-B)/(ne-B);return xn(ge,k+(Z-k)*le,W,1),le}function Fo(ge,k){const B=[];for(let Z=0;Z<ge.length;Z++){const ne=ge[Z],W=ne.type;let le;if(W==="Point"||W==="MultiPoint"||W==="LineString")le=Oo(ne.geometry,k);else if(W==="MultiLineString"||W==="Polygon"){le=[];for(const ve of ne.geometry)le.push(Oo(ve,k))}else if(W==="MultiPolygon"){le=[];for(const ve of ne.geometry){const he=[];for(const ye of ve)he.push(Oo(ye,k));le.push(he)}}B.push(co(ne.id,W,le,ne.tags))}return B}function Oo(ge,k){const B=[];B.size=ge.size,ge.start!==void 0&&(B.start=ge.start,B.end=ge.end);for(let Z=0;Z<ge.length;Z+=3)B.push(ge[Z]+k,ge[Z+1],ge[Z+2]);return B}function Ns(ge,k){if(ge.transformed)return ge;const B=1<<ge.z,Z=ge.x,ne=ge.y;for(const W of ge.features){const le=W.geometry,ve=W.type;if(W.geometry=[],ve===1)for(let he=0;he<le.length;he+=2)W.geometry.push(Di(le[he],le[he+1],k,B,Z,ne));else for(let he=0;he<le.length;he++){const ye=[];for(let qe=0;qe<le[he].length;qe+=2)ye.push(Di(le[he][qe],le[he][qe+1],k,B,Z,ne));W.geometry.push(ye)}}return ge.transformed=!0,ge}function Di(ge,k,B,Z,ne,W){return[Math.round(B*(ge*Z-ne)),Math.round(B*(k*Z-W))]}function ka(ge,k,B,Z,ne){const W=k===ne.maxZoom?0:ne.tolerance/((1<<k)*ne.extent),le={features:[],numPoints:0,numSimplified:0,numFeatures:ge.length,source:null,x:B,y:Z,z:k,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ve of ge)Ba(le,ve,W,ne);return le}function Ba(ge,k,B,Z){const ne=k.geometry,W=k.type,le=[];if(ge.minX=Math.min(ge.minX,k.minX),ge.minY=Math.min(ge.minY,k.minY),ge.maxX=Math.max(ge.maxX,k.maxX),ge.maxY=Math.max(ge.maxY,k.maxY),W==="Point"||W==="MultiPoint")for(let ve=0;ve<ne.length;ve+=3)le.push(ne[ve],ne[ve+1]),ge.numPoints++,ge.numSimplified++;else if(W==="LineString")vn(le,ne,ge,B,!1,!1);else if(W==="MultiLineString"||W==="Polygon")for(let ve=0;ve<ne.length;ve++)vn(le,ne[ve],ge,B,W==="Polygon",ve===0);else if(W==="MultiPolygon")for(let ve=0;ve<ne.length;ve++){const he=ne[ve];for(let ye=0;ye<he.length;ye++)vn(le,he[ye],ge,B,!0,ye===0)}if(le.length){let ve=k.tags||null;if(W==="LineString"&&Z.lineMetrics){ve={};for(const ye in k.tags)ve[ye]=k.tags[ye];ve.mapbox_clip_start=ne.start/ne.size,ve.mapbox_clip_end=ne.end/ne.size}const he={geometry:le,type:W==="Polygon"||W==="MultiPolygon"?3:W==="LineString"||W==="MultiLineString"?2:1,tags:ve};k.id!==null&&(he.id=k.id),ge.features.push(he)}}function vn(ge,k,B,Z,ne,W){const le=Z*Z;if(Z>0&&k.size<(ne?le:Z))return void(B.numPoints+=k.length/3);const ve=[];for(let he=0;he<k.length;he+=3)(Z===0||k[he+2]>le)&&(B.numSimplified++,ve.push(k[he],k[he+1])),B.numPoints++;ne&&function(he,ye){let qe=0;for(let Pe=0,pt=he.length,bt=pt-2;Pe<pt;bt=Pe,Pe+=2)qe+=(he[Pe]-he[bt])*(he[Pe+1]+he[bt+1]);if(qe>0===ye)for(let Pe=0,pt=he.length;Pe<pt/2;Pe+=2){const bt=he[Pe],St=he[Pe+1];he[Pe]=he[pt-2-Pe],he[Pe+1]=he[pt-1-Pe],he[pt-2-Pe]=bt,he[pt-1-Pe]=St}}(ve,W),ge.push(ve)}const Na={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class lh{constructor(k,B){const Z=(B=this.options=function(W,le){for(const ve in le)W[ve]=le[ve];return W}(Object.create(Na),B)).debug;if(Z&&console.time("preprocess data"),B.maxZoom<0||B.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(B.promoteId&&B.generateId)throw new Error("promoteId and generateId cannot be used together.");let ne=function(W,le){const ve=[];
14if(W.type==="FeatureCollection")for(let he=0;he<W.features.length;he++)hn(ve,W.features[he],le,he);else hn(ve,W.type==="Feature"?W:{geometry:W},le);return ve}(k,B);this.tiles={},this.tileCoords=[],Z&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",B.indexMaxZoom,B.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ne=function(W,le){const ve=le.buffer/le.extent;let he=W;const ye=yn(W,1,-1-ve,ve,0,-1,2,le),qe=yn(W,1,1-ve,2+ve,0,-1,2,le);return(ye||qe)&&(he=yn(W,1,-ve,1+ve,0,-1,2,le)||[],ye&&(he=Fo(ye,1).concat(he)),qe&&(he=he.concat(Fo(qe,-1)))),he}(ne,B),ne.length&&this.splitTile(ne,0,0,0),Z&&(ne.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(k,B,Z,ne,W,le,ve){const he=[k,B,Z,ne],ye=this.options,qe=ye.debug;for(;he.length;){ne=he.pop(),Z=he.pop(),B=he.pop(),k=he.pop();const Pe=1<<B,pt=Vs(B,Z,ne);let bt=this.tiles[pt];if(!bt&&(qe>1&&console.time("creation"),bt=this.tiles[pt]=ka(k,B,Z,ne,ye),this.tileCoords.push({z:B,x:Z,y:ne}),qe)){qe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",B,Z,ne,bt.numFeatures,bt.numPoints,bt.numSimplified),console.timeEnd("creation"));const ri=`z${B}`;this.stats[ri]=(this.stats[ri]||0)+1,this.total++}if(bt.source=k,W==null){if(B===ye.indexMaxZoom||bt.numPoints<=ye.indexMaxPoints)continue}else{if(B===ye.maxZoom||B===W)continue;if(W!=null){const ri=W-B;if(Z!==le>>ri||ne!==ve>>ri)continue}}if(bt.source=null,k.length===0)continue;qe>1&&console.time("clipping");const St=.5*ye.buffer/ye.extent,Ut=.5-St,Ft=.5+St,jt=1+St;let bi=null,Gt=null,Ki=null,yr=null,dr=yn(k,Pe,Z-St,Z+Ft,0,bt.minX,bt.maxX,ye),gi=yn(k,Pe,Z+Ut,Z+jt,0,bt.minX,bt.maxX,ye);k=null,dr&&(bi=yn(dr,Pe,ne-St,ne+Ft,1,bt.minY,bt.maxY,ye),Gt=yn(dr,Pe,ne+Ut,ne+jt,1,bt.minY,bt.maxY,ye),dr=null),gi&&(Ki=yn(gi,Pe,ne-St,ne+Ft,1,bt.minY,bt.maxY,ye),yr=yn(gi,Pe,ne+Ut,ne+jt,1,bt.minY,bt.maxY,ye),gi=null),qe>1&&console.timeEnd("clipping"),he.push(bi||[],B+1,2*Z,2*ne),he.push(Gt||[],B+1,2*Z,2*ne+1),he.push(Ki||[],B+1,2*Z+1,2*ne),he.push(yr||[],B+1,2*Z+1,2*ne+1)}}getTile(k,B,Z){k=+k,B=+B,Z=+Z;const ne=this.options,{extent:W,debug:le}=ne;if(k<0||k>24)return null;const ve=1<<k,he=Vs(k,B=B+ve&ve-1,Z);if(this.tiles[he])return Ns(this.tiles[he],W);le>1&&console.log("drilling down to z%d-%d-%d",k,B,Z);let ye,qe=k,Pe=B,pt=Z;for(;!ye&&qe>0;)qe--,Pe>>=1,pt>>=1,ye=this.tiles[Vs(qe,Pe,pt)];return ye&&ye.source?(le>1&&(console.log("found parent tile z%d-%d-%d",qe,Pe,pt),console.time("drilling down")),this.splitTile(ye.source,qe,Pe,pt,k,B,Z),le>1&&console.timeEnd("drilling down"),this.tiles[he]?Ns(this.tiles[he],W):null):null}}function Vs(ge,k,B){return 32*((1<<ge)*B+k)+ge}function ke(ge,k){const B=ge.tileID.canonical;if(!this._geoJSONIndex)return void k(null,null);const Z=this._geoJSONIndex.getTile(B.z,B.x,B.y);if(!Z)return void k(null,null);const ne=ye=>ye.tags&&"3d_elevation_id"in ye.tags&&"source"in ye.tags&&ye.tags.source==="elevation",W=Z.features.filter(ye=>ne(ye));let le={_geojsonTileLayer:Z.features};W.length>0&&(le={_geojsonTileLayer:Z.features.filter(ye=>!ne(ye)),hd_road_elevation:W});const ve=new Ls(le),he=function(ye){const qe=new s.bq;for(const Pe of Object.keys(ye))qe.writeMessage(3,Da,{name:Pe,features:ye[Pe]});return qe.finish()}(le).buffer;k(null,{vectorTile:ve,rawData:he})}class mo extends Jr{constructor(k,B,Z,ne,W,le,ve){super(k,B,Z,ne,W,ke,ve),le&&(this.loadGeoJSON=le),this._dynamicIndex=new Nl}loadData(k,B){const Z=k&&k.request,ne=Z&&Z.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(k,(W,le)=>{if(W||!le)return B(W);if(typeof le!="object")return B(new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`));{try{if(k.filter){const he=s.X(k.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(he.result==="error")throw new Error(he.value.map(ye=>`${ye.key}: ${ye.message}`).join(", "));le.features=le.features.filter(ye=>he.value.evaluate({zoom:0},ye))}k.dynamic?(le.type==="Feature"&&(le={type:"FeatureCollection",features:[le]}),k.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(le.features,this.loaded),k.cluster&&(le.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=k.cluster?new zo(function({superclusterOptions:he,clusterProperties:ye}){if(!ye||!he)return he;const qe={},Pe={},pt={accumulated:null,zoom:0},bt={properties:null},St=Object.keys(ye);for(const Ut of St){const[Ft,jt]=ye[Ut],bi=s.X(jt),Gt=s.X(typeof Ft=="string"?[Ft,["accumulated"],["get",Ut]]:Ft);qe[Ut]=bi.value,Pe[Ut]=Gt.value}return he.map=Ut=>{bt.properties=Ut;const Ft={};for(const jt of St)Ft[jt]=qe[jt].evaluate(pt,bt);return Ft},he.reduce=(Ut,Ft)=>{bt.properties=Ft;for(const jt of St)pt.accumulated=Ut[jt],Ut[jt]=Pe[jt].evaluate(pt,bt)},he}(k)).load(le.features):k.dynamic?this._dynamicIndex:function(he,ye){return new lh(he,ye)}(le,k.geojsonVtOptions)}catch(he){return B(he)}const ve={};if(ne){const he=Gr(Z);he&&(ve.resourceTiming={},ve.resourceTiming[k.source]=JSON.parse(JSON.stringify(he)))}B(null,ve)}})}reloadTile(k,B){const Z=this.loaded;return Z&&Z[k.uid]?k.partial?B(null,void 0):super.reloadTile(k,B):this.loadTile(k,B)}loadGeoJSON(k,B){if(k.request)s.n(k.request,B);else{if(typeof k.data!="string")return B(new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return B(null,JSON.parse(k.data))}catch{return B(new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(k,B){try{B(null,this._geoJSONIndex.getClusterExpansionZoom(k.clusterId))}catch(Z){B(Z)}}getClusterChildren(k,B){try{B(null,this._geoJSONIndex.getChildren(k.clusterId))}catch(Z){B(Z)}}getClusterLeaves(k,B){try{B(null,this._geoJSONIndex.getLeaves(k.clusterId,
14k.limit,k.offset))}catch(Z){B(Z)}}}class ch{constructor(k,B,Z){this.tileID=new s.aM(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.tileZoom=k.tileZoom,this.uid=k.uid,this.zoom=k.zoom,this.canonical=k.tileID.canonical,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=k.projection,this.brightness=B,this.worldview=Z}parse(k,B,Z,ne){this.status="parsing";const W=new s.aM(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),le=[],ve=B.familiesBySource[Z.source],he=new s.fc(W,Z.promoteId);he.bucketLayerIDs=[],he.is3DTile=!0,s.fr(k).then(ye=>{if(!ye)return ne(new Error("Could not parse tile"));const qe=ye.json.extensionsUsed&&ye.json.extensionsUsed.includes("MAPBOX_mesh_features")||ye.json.asset.extras&&ye.json.asset.extras.MAPBOX_mesh_features,Pe=ye.json.extensionsUsed&&ye.json.extensionsUsed.includes("EXT_meshopt_compression"),pt=new s.aa(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const bt in ve)for(const St of ve[bt]){const Ut=St[0];he.bucketLayerIDs.push(St.map(bi=>s.C(bi.id,bi.scope))),Ut.recalculate(pt,[]);const Ft=s.fs(ye,1/s.d4(Z.tileID.canonical)),jt=new s.ft(St,Ft,W,qe,Pe,this.brightness,he,this.worldview);qe||(jt.needsUpload=!0),le.push(jt),jt.evaluate(Ut)}this.status="done",ne(null,{buckets:le,featureIndex:he,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(ye=>ne(new Error(ye.message)))}}class Va{constructor(k,B,Z,ne,W,le,ve,he){this.actor=k,this.layerIndex=B,this.availableImages=Z,this.availableModels=ne,this.brightness=ve,this.loading={},this.loaded={},this.worldview=he}loadTile(k,B){const Z=k.uid,ne=this.loading[Z]=new ch(k,this.brightness,this.worldview);s.br(k.request,(W,le)=>{const ve=!this.loading[Z];return delete this.loading[Z],ve||W?(ne.status="done",ve||(this.loaded[Z]=ne),B(W)):le&&le.byteLength!==0?void ne.parse(le,this.layerIndex,k,(he,ye)=>{ne.status="done",this.loaded=this.loaded||{},this.loaded[Z]=ne,he||!ye?B(he):B(null,ye)}):(ne.status="done",this.loaded[Z]=ne,B())})}reloadTile(k,B){const Z=this.loaded,ne=k.uid;if(Z&&Z[ne]){const W=Z[ne];W.projection=k.projection,W.brightness=k.brightness;const le=(ve,he)=>{W.reloadCallback&&(delete W.reloadCallback,this.loadTile(k,B)),B(ve,he)};W.status==="parsing"?W.reloadCallback=le:W.status==="done"&&this.loadTile(k,B)}}abortTile(k,B){const Z=k.uid;this.loading[Z]&&delete this.loading[Z],B()}removeTile(k,B){const Z=this.loaded,ne=k.uid;Z&&Z[ne]&&delete Z[ne],B()}}class ei{constructor(k){this.self=k,this.actor=new s.fv(k,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new s.y,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=s.cj({name:"mercator"}),this.workerSourceTypes={vector:Jr,geojson:mo,"raster-dem":Gi,"raster-array":Fr,"batched-model":Va},this.workerSources={},this.self.registerWorkerSource=(B,Z)=>{if(this.workerSourceTypes[B])throw new Error(`Worker source with name "${B}" already registered.`);this.workerSourceTypes[B]=Z},this.self.registerRTLTextPlugin=B=>{if(s.fw.isParsed())throw new Error("RTL text plugin already registered.");s.fw.setState({pluginStatus:s.fx.parsed,pluginURL:s.fw.getPluginURL()}),s.fw.applyArabicShaping=B.applyArabicShaping,s.fw.processBidirectionalText=B.processBidirectionalText,s.fw.processStyledBidirectionalText=B.processStyledBidirectionalText;for(const Z of this.rtlPluginParsingListeners)Z(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(k,B,Z){delete this.layerIndexes[k],delete this.availableImages[k],delete this.availableModels[k],delete this.workerSources[k],Z()}checkIfReady(k,B,Z){Z()}setReferrer(k,B){this.referrer=B}spriteLoaded(k,B){this.isSpriteLoaded[k]||(this.isSpriteLoaded[k]={});const{scope:Z,isLoaded:ne}=B;if(this.isSpriteLoaded[k][Z]=ne,this.workerSources[k]&&this.workerSources[k][Z])for(const W in this.workerSources[k][Z]){const le=this.workerSources[k][Z][W];for(const ve in le){const he=le[ve];he instanceof Jr&&(he.isSpriteLoaded=ne,he.fire(new s.A("isSpriteLoaded")))}}}setImages(k,B,Z){this.availableImages[k]||(this.availableImages[k]={});const{scope:ne,images:W}=B;if(this.availableImages[k][ne]=W,this.workerSources[k]&&this.workerSources[k][ne]){for(const le in this.workerSources[k][ne]){const ve=this.workerSources[k][ne][le];for(const he in ve)ve[he].availableImages=W}Z()}else Z()}setModels(k,{scope:B,models:Z},ne){if(this.availableModels[k]||(this.availableModels[k]={}),this.availableModels[k][B]=Z,this.workerSources[k]&&this.workerSources[k][B]
14){for(const W in this.workerSources[k][B]){const le=this.workerSources[k][B][W];for(const ve in le)le[ve].availableModels=Z}ne()}else ne()}setProjection(k,B){this.projections[k]=s.cj(B)}setBrightness(k,B,Z){this.brightness=B,Z()}setWorldview(k,B,Z){this.worldview=B,Z()}setLayers(k,B,Z){this.getLayerIndex(k,B.scope).replace(B.layers,B.options),Z()}updateLayers(k,B,Z){this.getLayerIndex(k,B.scope).update(B.layers,B.removedIds,B.options),Z()}loadTile(k,B,Z){B.projection=this.projections[k]||this.defaultProjection,this.getWorkerSource(k,B.type,B.source,B.scope).loadTile(B,Z)}decodeRasterArray(k,B,Z){this.getWorkerSource(k,B.type,B.source,B.scope).decodeRasterArray(B,Z)}reloadTile(k,B,Z){B.projection=this.projections[k]||this.defaultProjection,this.getWorkerSource(k,B.type,B.source,B.scope).reloadTile(B,Z)}abortTile(k,B,Z){this.getWorkerSource(k,B.type,B.source,B.scope).abortTile(B,Z)}removeTile(k,B,Z){this.getWorkerSource(k,B.type,B.source,B.scope).removeTile(B,Z)}removeSource(k,B,Z){if(!(this.workerSources[k]&&this.workerSources[k][B.scope]&&this.workerSources[k][B.scope][B.type]&&this.workerSources[k][B.scope][B.type][B.source]))return;const ne=this.workerSources[k][B.scope][B.type][B.source];delete this.workerSources[k][B.scope][B.type][B.source],ne.removeSource!==void 0?ne.removeSource(B,Z):Z()}loadWorkerSource(k,B,Z){try{this.self.importScripts(B.url),Z()}catch(ne){Z(ne.toString())}}syncRTLPluginState(k,B,Z){if(s.fw.isParsed())Z(null,!0);else if(s.fw.isParsing())this.rtlPluginParsingListeners.push(Z);else try{s.fw.setState(B);const ne=s.fw.getPluginURL();!s.fw.isLoaded()||s.fw.isParsed()||s.fw.isParsing()||ne==null||(s.fw.setState({pluginStatus:s.fx.parsing,pluginURL:s.fw.getPluginURL()}),this.self.importScripts(ne),s.fw.isParsed()?Z(null,!0):this.rtlPluginParsingListeners.push(Z))}catch(ne){Z(ne.toString())}}setDracoUrl(k,B){this.dracoUrl=B}getAvailableImages(k,B){this.availableImages[k]||(this.availableImages[k]={});let Z=this.availableImages[k][B];return Z||(Z=[]),Z}getAvailableModels(k,B){this.availableModels[k]||(this.availableModels[k]={});let Z=this.availableModels[k][B];return Z||(Z={}),Z}getLayerIndex(k,B){this.layerIndexes[k]||(this.layerIndexes[k]={});let Z=this.layerIndexes[k][B];return Z||(Z=this.layerIndexes[k][B]=new Bl,Z.scope=B),Z}getWorkerSource(k,B,Z,ne){const W=this.workerSources;return W[k]||(W[k]={}),W[k][ne]||(W[k][ne]={}),W[k][ne][B]||(W[k][ne][B]={}),this.isSpriteLoaded[k]||(this.isSpriteLoaded[k]={}),W[k][ne][B][Z]||(W[k][ne][B][Z]=new this.workerSourceTypes[B]({send:(le,ve,he,ye,qe,Pe)=>this.actor.send(le,ve,he,k,qe,Pe),scheduler:this.actor.scheduler},this.getLayerIndex(k,ne),this.getAvailableImages(k,ne),this.getAvailableModels(k,ne),this.isSpriteLoaded[k][ne],void 0,this.brightness,this.worldview)),W[k][ne][B][Z]}rasterizeImagesWorker(k,B,Z){const ne=new Map;for(const[W,{image:le,imageVariant:ve}]of B.tasks.entries()){const he=this.imageRasterizer.rasterize(ve,le,B.scope,k);ne.set(W,he)}Z(void 0,ne)}removeRasterizedImages(k,B,Z){this.imageRasterizer.removeImagesFromCacheByIds(B.imageIds,B.scope,k),Z()}enforceCacheSizeLimit(k,B){s.fy(B)}getWorkerPerformanceMetrics(k,B,Z){Z(void 0,void 0)}}return s.fu(self)&&(self.worker=new ei(self)),ei}),cf(["./shared"],function(s){var Gr="3.14.0";const $i={create:"create",load:"load",fullLoad:"fullLoad"},so={mark(l){performance.mark(l)},measure(l,t,n){performance.measure(l,t,n)}};function Bl(l){const t=l.name.split("?")[0];return s.a(t)&&t.includes("mapbox-gl.js")?"javascript":s.a(t)&&t.includes("mapbox-gl.css")?"css":s.b(t)?"fontRange":s.c(t)?"sprite":s.i(t)?"style":s.d(t)?"tilejson":"other"}var ls,Kn={},cs=function(){if(ls)return Kn;function l(c){return!t(c)}function t(c){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var p,m,y=new Blob([""],{type:"text/javascript"}),x=URL.createObjectURL(y);try{m=new Worker(x),p=!0}catch{p=!1}return m&&m.terminate(),URL.revokeObjectURL(x),p}()?function(){var p=document.createElement("canvas");p.width=p.height=1;var m=p.getContext("2d");if(!m)return!1;var y=m.getImageData(0,0,1,1);return y&&y.width===p.width}()?(n[d=c&&c.failIfMajorPerformanceCaveat]===void 0&&(n[d]=function(p){var m,y=function(x){var T=document.createElement("canvas"),S=Object.create(l.webGLContextAttributes);return S.failIfMajorPerformanceCaveat=x,T.getContext("webgl2",S)}(p);if(!y)return!1;try{m=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!m||y.isContextLost())&&(y.shaderSource(m,"void main() {}"),y.compileShader(m),y.getShaderParameter(m,y.COMPILE_STATUS)===!0)}(d)),n[d]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var d}ls=1,Kn.supported=l,Kn.notSupportedReason=t;var n={};return l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},Kn}();function Bt(l,t,n){const c=document.createElement(l);return t!=null&&(c.className=t),n&&n.appendChild(c),c}function Jr(l,t,n){const c=document.createElementNS("http://www.w3.org/2000/svg",l);for(const d of Object.keys(t))c.setAttributeNS(null,d,String(t[d]));return n&&n.appendChild(c),c}const Gi=typeof document<"u"?document.documentElement&&document.documentElement.style:null,qr=Gi&&Gi.userSelect!==void 0?"userSelect":"WebkitUserSelect";let Fr;function Ao(){Gi&&qr&&(Fr=Gi[qr],Gi[qr]="none")}function ao(){Gi&&qr&&(Gi[qr]=Fr)}function Mo(l){l.preventDefault(),l.stopPropagation(),window.removeEventListener("click",Mo,!0)}function Ls(){window.addEventListener("click",Mo,!0),window.setTimeout(()=>{window.removeEventListener("click",Mo,!0)},0)}function qn(l,t){const n=l.getBoundingClientRect();return ui(l,n,t)}function Co(l,t){const n=l.getBoundingClientRect(),c=[];for(let d=0;d<t.length;
14d++)c.push(ui(l,n,t[d]));return c}function Nl(l){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&l.button===2&&l.ctrlKey?0:l.button}function ui(l,t,n){const c=l.offsetWidth===t.width?1:l.offsetWidth/t.width;return new s.P((n.clientX-t.left)*c,(n.clientY-t.top)*c)}const Fs="01",Cr="NO_ACCESS_TOKEN";class lr{constructor(t,n,c){this._transformRequestFn=t,this._customAccessToken=n,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const t=function(){let n="";for(let c=0;c<10;c++)n+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Fs,n].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeStyleURL(t,n){if(!s.j(t))return t;const c=ki(t);return c.params.push(`sdk=js-${Gr}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeGlyphsURL(t,n){if(!s.j(t))return t;const c=ki(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeModelURL(t,n){if(!s.j(t))return t;const c=ki(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeSourceURL(t,n,c,d){if(!s.j(t))return t;const p=ki(t);return p.path=`/v4/${p.authority}.json`,p.params.push("secure"),c&&p.params.push(`language=${c}`),d&&p.params.push(`worldview=${d}`),this._makeAPIURL(p,this._customAccessToken||n)}normalizeIconsetURL(t,n){const c=ki(t);return s.j(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||n)):cn(c)}normalizeSpriteURL(t,n,c,d){const p=ki(t);return s.j(t)?(p.path=`/styles/v1${p.path}/sprite${n}${c}`,this._makeAPIURL(p,this._customAccessToken||d)):(p.path+=`${n}${c}`,cn(p))}normalizeTileURL(t,n,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!s.j(t))return t;const d=ki(t);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${n||c&&d.authority!=="raster"&&c===512?"@2x":""}${s.l.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${s.e.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${s.e.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${s.e.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${s.e.TILE_URL_VERSION}${d.path}`);const p=this._customAccessToken||function(m){for(const y of m){const x=y.match(/^access_token=(.*)$/);if(x)return x[1]}return null}(d.params)||s.e.ACCESS_TOKEN;return s.e.REQUIRE_ACCESS_TOKEN&&p&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,p)}canonicalizeTileURL(t,n){const c=ki(t);if(!c.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!c.path.match(/\.[\w]+$/))return t;let d="mapbox://";c.path.match(/^\/raster\/v1\//)?d+=`raster/${c.path.replace(`/${s.e.RASTER_URL_PREFIX}/`,"")}`:c.path.match(/^\/rasterarrays\/v1\//)?d+=`rasterarrays/${c.path.replace(`/${s.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${s.e.TILE_URL_VERSION}/`,"")}`;let p=c.params;return n&&(p=p.filter(m=>!m.match(/^access_token=/))),p.length&&(d+=`?${p.join("&")}`),d}canonicalizeTileset(t,n){const c=!!n&&s.j(n),d=[];for(const p of t.tiles||[])s.k(p)?d.push(this.canonicalizeTileURL(p,c)):d.push(p);return d}_makeAPIURL(t,n){const c="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=ki(s.e.API_URL);if(t.protocol=d.protocol,t.authority=d.authority,t.protocol==="http"){const p=t.params.indexOf("secure");p>=0&&t.params.splice(p,1)}if(d.path!=="/"&&(t.path=`${d.path}${t.path}`),!s.e.REQUIRE_ACCESS_TOKEN)return cn(t);if(n=n||s.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!n)throw new Error(`An API access token is required to use Mapbox GL. ${c}`);if(n[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return t.params=t.params.filter(p=>p.indexOf("access_token")===-1),t.params.push(`access_token=${n||""}`),cn(t)}}const nr=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ki(l){const t=l.match(nr);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function cn(l){const t=l.params.length?`?${l.params.join("&")}`:"";return`${l.protocol}://${l.authority}${l.path}${t}`}const Da="mapbox.eventData";function lo(l){if(!l)return null;const t=l.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(s.m(t[1]))}catch{return null}}class Ln{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const n=lo(s.e.ACCESS_TOKEN);let c="";return c=n&&n.u?s.f(n.u):s.e.ACCESS_TOKEN||"",t?`${Da}.${t}:${c}`:`${Da}:${c}`}fetchEventData(){const t=s.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid");if(t)try{const d=localStorage.getItem(n);d&&(this.eventData=JSON.parse(d));const p=localStorage.getItem(c);p&&(this.anonId=p)}catch{s.w("Unable to read from LocalStorage")}}saveEventData(){const t=s.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.anonId;if(t&&d)try{localStorage.setItem(c,d),Object.keys(this.eventData).length>=1&&localStorage.setItem(n,JSON.stringify(this.eventData))}catch{s.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,n,c,d){if(!s.e.EVENTS_URL)return;const p=ki(s.e.EVENTS_URL);p.params.push(`access_token=${d||s.e.ACCESS_TOKEN||""}`);const m={event:this.type,created:new Date(t).toISOString()},y=n?s.h(m,n):m,x={url:cn(p),headers:{"Content-Type":"text/plain"},body:JSON.stringify([y])};this.pendingRequest=s.p(x,T=>{this.pendingRequest=null,c(T),this.saveEventData(),this.processRequests(d)})}queueRequest(t,n){this.queue.push(t),this.processRequests(n)}}const Fi=new class extends Ln{constructor(l){super("appUserTurnstile"),this._customAccessToken=l}postTurnstileEvent(l,t){s.e.EVENTS_URL&&s.e.ACCESS_TOKEN&&Array.isArray(l)&&l.some(n=>s.j(n)||s.k(n))&&this.queueRequest(Date.now(),t)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=lo(s.e.ACCESS_TOKEN),n=t?t.u:s.e.ACCESS_TOKEN;let c=n!==this.eventData.tokenU;s.v(this.anonId)||(this.anonId=s.u(),c=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const p=new Date(this.eventData.lastSuccess),m=new Date(d),y=(d-this.eventData.lastSuccess)/864e5;c=c||y>=1||y<-1||p.getDate()!==m.getDate()}else c=!0;c?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Gr,skuId:Fs,"enabled.telemetry":!1,userId:this.anonId},p=>{p||(this.eventData.lastSuccess=d,this.eventData.tokenU=n)},l):this.processRequests()}},Hr=Fi.postTurnstileEvent.bind(Fi),Os=new class extends Ln{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(l,t,n,c){this.skuToken=t,this.errorCb=c,s.e.EVENTS_URL&&(n||s.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(Cr)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),s.v(this.anonId)||(this.anonId=s.u()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:Gr,skuId:Fs,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l))}remove(){this.errorCb=null}},Vl=Os.postMapLoadEvent.bind(Os),Po=new class extends Ln{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(l){let t=this.mapInstanceIdMap.get(l);return t||(t=s.u(),this.mapInstanceIdMap.set(l,t)),t}getEventId(l){const t=this.eventIdPerMapInstanceMap.get(l)||0;return this.eventIdPerMapInstanceMap.set(l,t+1),t}postStyleLoadEvent(l,t){const{map:n,style:c,importedStyles:d}=t;if(!s.e.EVENTS_URL||!l&&!s.e.ACCESS_TOKEN)return;const p=this.getMapInstanceId(n),m={mapInstanceId:p,eventId:this.getEventId(p),style:c};d.length&&(m.importedStyles=d),this.queueRequest({timestamp:Date.now(),payload:m},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:n}=this.queue.shift();this.postEvent(t,n,()=>{},l)}},Ri=Po.postStyleLoadEvent.bind(Po),er=new class extends Ln{constructor(){super("gljs.performance")}postPerformanceEvent(l,t){s.e.EVENTS_URL&&(l||s.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:n}=this.queue.shift(),c=function(d){const p=performance.getEntriesByType("resource"),m=performance.getEntriesByType("mark"),y=function(C){const D={};if(C){for(const z in C)if(z!=="other")for(const F of C[z]){const L=`${z}ResolveRangeMin`,N=`${z}ResolveRangeMax`,j=`${z}RequestCount`,q=`${z}RequestCachedCount`;D[L]=Math.min(D[L]||1/0,F.startTime),D[N]=Math.max(D[N]||-1/0,F.responseEnd);const X=ee=>{D[ee]===void 0&&(D[ee]=0),++D[ee]};F.transferSize!==void 0&&F.transferSize===0&&X(q),X(j)}}return D}(function(C,D){const z={};if(C)for(const F of C){const L=D(F);z[L]===void 0&&(z[L]=[]),z[L].push(F)}return z}(p,Bl)),x=window.devicePixelRatio,T=navigator.connection||navigator.mozConnection||navigator.webkitConnection,S=T?T.effectiveType:void 0,M={counters:[],metadata:[],attributes:[]},E=(C,D,z)=>
vendor: 12,056 bytes, line 14
14{z!=null&&C.push({name:D,value:z.toString()})};for(const C in y)E(M.counters,C,y[C]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(E(M.counters,"interactionRangeMin",d.interactionRange[0]),E(M.counters,"interactionRangeMax",d.interactionRange[1])),m)for(const C of Object.keys($i)){const D=$i[C],z=m.find(F=>F.name===D);z&&E(M.counters,D,z.startTime)}return E(M.counters,"visibilityHidden",d.visibilityHidden),E(M.attributes,"style",function(C){if(C)for(const D of C){const z=D.name.split("?")[0];if(s.i(z)){const F=z.split("/").slice(-2);if(F.length===2)return`mapbox://styles/${F[0]}/${F[1]}`}}}(p)),E(M.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),E(M.attributes,"fogEnabled",d.fogEnabled?"true":"false"),E(M.attributes,"projection",d.projection),E(M.attributes,"zoom",d.zoom),E(M.metadata,"devicePixelRatio",x),E(M.metadata,"connectionEffectiveType",S),E(M.metadata,"navigatorUserAgent",navigator.userAgent),E(M.metadata,"screenWidth",window.screen.width),E(M.metadata,"screenHeight",window.screen.height),E(M.metadata,"windowWidth",window.innerWidth),E(M.metadata,"windowHeight",window.innerHeight),E(M.metadata,"mapWidth",d.width/x),E(M.metadata,"mapHeight",d.height/x),E(M.metadata,"webglRenderer",d.renderer),E(M.metadata,"webglVendor",d.vendor),E(M.metadata,"sdkVersion",Gr),E(M.metadata,"sdkIdentifier","mapbox-gl-js"),M}(n);for(const d of c.metadata);for(const d of c.counters);for(const d of c.attributes);this.postEvent(t,c,()=>{},l)}},cr=er.postPerformanceEvent.bind(er),Qr=new class extends Ln{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(l,t,n,c){if(!s.e.API_URL||!s.e.SESSION_PATH)return;const d=ki(s.e.API_URL+s.e.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${c||s.e.ACCESS_TOKEN||""}`);const p={url:cn(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=s.g(p,m=>{this.pendingRequest=null,n(m),this.saveEventData(),this.processRequests(c)})}getSessionAPI(l,t,n,c){this.skuToken=t,this.errorCb=c,s.e.SESSION_PATH&&s.e.API_URL&&(n||s.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(Cr)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||this.getSession(n,this.skuToken,c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l)}remove(){this.errorCb=null}},tr=Qr.getSessionAPI.bind(Qr),zo=new Set;function Ro(l,t){t?zo.add(l):zo.delete(l)}class La{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,n){this._updatedSourceCaches[t]=n,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const n=t.scope;this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._updatedLayers[n].add(t.id),this.setDirty()}removeLayer(t){const n=t.scope;this._removedLayers[n]=this._removedLayers[n]||{},this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._removedLayers[n][t.id]=t,this._updatedLayers[n].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&&delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const n in this._updatedLayers)t[n]=t[n]||{},t[n].updatedIds=Array.from(this._updatedLayers[n].values());for(const n in this._removedLayers)t[n]=t[n]||{},t[n].removedIds=Object.keys(this._removedLayers[n]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(t){return this._updatedImages[t]?Array.from(this._updatedImages[t].values()):[]}updateImage(t,n){this._updatedImages[n]=this._updatedImages[n]||new Set,this._updatedImages[n].add(s.I.toString(t)),this.setDirty()}resetUpdatedImages(t){this._updatedImages[t]&&this._updatedImages[t].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function Fn(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class ir extends s.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=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.dirty=!0,this.spriteFormat=t,t!=="raster"&&s.t()&&(this.imageRasterizerDispatcher=new s.D(s.x(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new s.r({width:1,height:1}))}removeScope(t){this.loaded.delete(t),this.imageProviders.delete(t),this.images.delete(t),this.updatedImages.delete(t),this.callbackDispatchedThisFrame.delete(t),this.patterns.delete(t),this.atlasImage.delete(t);const n=this.atlasTexture.get(t);n&&(n.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,n){this.imageProviders.has(n)||this.imageProviders.set(n,new Map),this.imageProviders.get(n).set(t.id,t)}removeImageProvider(t,n){this.imageProviders.has(n)&&this.imageProviders.get(n).delete(t)}getPendingImageProviders(){const t=[];for(const n of this.imageProviders.values())for(const c of n.values())c.hasPendingRequests()&&t.push(c);return t}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new s.y),this._imageRasterizer}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,n){if(this.loaded.get(n)!==t&&(this.loaded.set(n,t),t)){for(const{ids:c,callback:d}of this.requestors)this._notify(c,n,d);this.requestors=[]}}hasImage(t,n){return!!this.getImage(t,n)}getImage(t,n){return this.images.get(n).get(t.toString())}addImage(t,n,c){this._validate(t,c)&&this.images.get(n).set(t.toString(),c)}_validate(t,n){let c=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new s.z(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new s.z(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(n.content,n)||(this.fire(new s.z(new Error(`Image "${t.name}" has invalid "content" value`))),c=!1),c}_validateStretch(t,n){if(!t)return!0;let c=0;for(const d of t){if(d[0]<c||d[1]<d[0]||n<d[1])return!1;c=d[1]}return!0}_validateContent(t,n){return t?t.length!==4||!n.usvg&&(t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,n,c){const d=this.images.get(n).get(t.toString());c.version=d.version+1,this.images.get(n).set(t.toString(),c),this.updatedImages.get(n).add(t),this.removeFromImageRasterizerCache(t,n)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,n){this.spriteFormat!=="raster"&&(s.t()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[t],scope:n}):this.imageRasterizer.removeImagesFromCacheByIds([t],n))}removeImage(t,n){const c=this.images.get(n),d=c.get(t.toString());c.delete(t.toString()),this.patterns.get(n).delete(t.toString()),this.removeFromImageRasterizerCache(t,n),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(n=>s.I.from(n))}getImages(t,n,c){const d=[],p=[],m=this.imageProviders.get(n);for(const S of t){if(!S.iconsetId){d.push(S);continue}const M=m.get(S.iconsetId);M&&(this.getImage(S,n)?p.push(S):M.addPendingRequest(S))}if(d.length===0)return void this._notify(p,n,c);let y=!0;const x=!!this.loaded.get(n),T=this.images.get(n);if(!x)for(const S of d)T.has(S.toString())||(y=!1);x||y?this._notify(d,n,c):this.requestors.push({ids:d,scope:n,callback:c})}rasterizeImages(t,n){const c=new Map,{tasks:d,scope:p}=t;for(const[m,y]of d.entries()){const x=this.getImage(y.id,p);x&&c.set(m,{image:x,imageVariant:y})}this._rasterizeImages(p,c,n)}_rasterizeImages(t,n,c){if(s.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:n,scope:t},c);else{const d=new Map;for(const[p,{image:m,imageVariant:y}]of n.entries())d.set(p,this.imageRasterizer.rasterize(y,m,t,0));c(void 0,d)}}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,n,c){const d=this.images.get(n),p=new Map;for(const m of t){if(!d.get(m.toString())){if(m.iconsetId)continue;this.fire(new s.A("styleimagemissing",{id:m.name}))}const y=d.get(m.toString());if(!y){s.w(`Image "${m.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 x={data:y.usvg?null:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,usvg:y.usvg,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:!!(y.userImage&&y.userImage.render)};y.usvg&&Object.assign(x,{width:y.icon.usvg_tree.width,height:y.icon.usvg_tree.height}),p.set(s.I.toString(m),x)}c(null,p)}getPixelSize(t){const{width:n,height:c}=this.atlasImage.get(t);return{width:n,height:c}}getPattern(t,n,c){const d=t.toString(),p=this.patterns.get(n),m=p.get(d),y=this.getImage(t,n);if(!y)return null;if(m){if(m.position.version===y.version)return m.position;m.position.version=y.version}else{if(y.usvg&&!y.data){const x=this.getPatternInFlightId(d,n);if(this.patternsInFlight.has(x))return null;this.patternsInFlight.add(x);const T=new s.B(t).scaleSelf(s.q.devicePixelRatio),S=new Map([[T.toString(),{image:y,imageVariant:T}]]);return this._rasterizeImages(n,S,(M,E)=>this.storePatternImage(T,n,y,c,E)),null}this.storePattern(t,n,y)}return this._updatePatternAtlas(n,c),p.get(d).position}getPatternInFlightId(t,n){return s.C(t,n)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,n,c,d,p){const m=t.toString(),y=p?p.get(m):void 0;y&&(c.data=y,this.storePattern(t.id,n,c),this._updatePatternAtlas(n,d),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),n)))}storePattern(t,n,c){const d={w:c.data.width+2*s.F,h:c.data.height+2*s.F,x:0,y:0},p=new s.G(d,c,s.F);this.patterns.get(n).set(t.toString(),{bin:d,position:p})}destroyAtlasTextures(){for(const t of this.atlasTexture.values())t&&t.destroy();this.atlasTexture.clear()}bind(t,n){const c=t.gl;let d=this.atlasTexture.get(n);d?this.dirty&&(d.update(this.atlasImage.get(n)),this.dirty=!1):(d=new s.T(t,this.atlasImage.get(n),c.RGBA8),this.atlasTexture.set(n,d)),d.bind(c.LINEAR,c.CLAMP_TO_EDGE)}_updatePatternAtlas(t,n){const c=this.patterns.get(t),d=Array.from(c.values()).map(({bin:T})=>T),{w:p,h:m}=s.H(d),y=this.atlasImage.get(t);y.resize({width:p||1,height:m||1});const x=this.images.get(t);for(const[T,{bin:S,position:M}]of c.entries()){let E=M.padding;const C=S.x+E,D=S.y+E,z=x.get(T).data,F=z.width,L=z.height;E=E>1?E-1:E,s.r.copy(z,y,{x:0,y:0},{x:C,y:D},{width:F,height:L},n),s.r.copy(z,y,{x:0,y:L-E},{x:C,y:D-E},{width:F,height:E},n),s.r.copy(z,y,{x:0,y:0},{x:C,y:D+L},{width:F,height:E},n),s.r.copy(z,y,{x:F-E,y:0},{x:C-E,y:D},{width:E,height:L},n),s.r.copy(z,y,{x:0,y:0},{x:C+F,y:D},{width:E,height:L},n),s.r.copy(z,y,{x:F-E,y:L-E},{x:C-E,y:D-E},{width:E,height:E},n),s.r.copy(z,y,{x:0,y:L-E},{x:C+F,y:D-E},{width:E,height:E},n),s.r.copy(z,y,{x:0,y:0},{x:C+F,y:D+L},{width:E,height:E},n),s.r.copy(z,y,{x:F-E,y:0},{x:C-E,y:D+L},{width:E,height:E},n)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}
14dispatchRenderCallbacks(t,n){const c=this.images.get(n);for(const d of t){if(this.callbackDispatchedThisFrame.get(n).has(d.toString()))continue;this.callbackDispatchedThisFrame.get(n).add(d.toString());const p=c.get(d.toString());Fn(p)&&this.updateImage(d,n,p)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function en(l){const t=l.key,n=l.value,c=l.valueSpec||{},d=l.objectElementValidators||{},p=l.style,m=l.styleSpec;let y=[];const x=s.J(n);if(x!=="object")return[new s.V(t,n,`object expected, ${x} found`)];for(const T in n){const S=T.split(".")[0];let M;d[S]?M=d[S]:c[S]?M=Di:d["*"]?M=d["*"]:c["*"]&&(M=Di),M?y=y.concat(M({key:(t&&`${t}.`)+T,value:n[T],valueSpec:c[S]||c["*"],style:p,styleSpec:m,object:n,objectKey:T},n)):y.push(new s.K(t,n[T],`unknown property "${T}"`))}for(const T in c)d[T]||c[T].required&&c[T].default===void 0&&n[T]===void 0&&y.push(new s.V(t,n,`missing required property "${T}"`));return y}function Do(l){const t=l.value,n=l.valueSpec,c=l.style,d=l.styleSpec,p=l.key,m=l.arrayElementValidator||Di;if(s.J(t)!=="array")return[new s.V(p,t,`array expected, ${s.J(t)} found`)];if(n.length&&t.length!==n.length)return[new s.V(p,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new s.V(p,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let y={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};d.$version<7&&(y.function=n.function),s.J(n.value)==="object"&&(y=n.value);let x=[];for(let T=0;T<t.length;T++)x=x.concat(m({array:t,arrayIndex:T,value:t[T],valueSpec:y,style:c,styleSpec:d,key:`${p}[${T}]`},!0));return x}function Fa(l){const t=l.key,n=l.value,c=l.valueSpec;let d=s.J(n);if(d==="number"&&n!=n&&(d="NaN"),d!=="number")return[new s.V(t,n,`number expected, ${d} found`)];if("minimum"in c){let p=c.minimum;if(s.J(c.minimum)==="array"&&(p=c.minimum[l.arrayIndex]),n<p)return[new s.V(t,n,`${n} is less than the minimum value ${p}`)]}if("maximum"in c){let p=c.maximum;if(s.J(c.maximum)==="array"&&(p=c.maximum[l.arrayIndex]),n>p)return[new s.V(t,n,`${n} is greater than the maximum value ${p}`)]}return[]}function co(l){const t=l.valueSpec,n=s.M(l.value.type);let c,d,p,m={};const y=n!=="categorical"&&l.value.property===void 0,x=!y,T=s.J(l.value.stops)==="array"&&s.J(l.value.stops[0])==="array"&&s.J(l.value.stops[0][0])==="object",S=en({key:l.key,value:l.value,valueSpec:l.styleSpec.function,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(C){if(n==="identity")return[new s.V(C.key,C.value,'identity function may not have a "stops" property')];let D=[];const z=C.value;return D=D.concat(Do({key:C.key,value:z,valueSpec:C.valueSpec,style:C.style,styleSpec:C.styleSpec,arrayElementValidator:M})),s.J(z)==="array"&&z.length===0&&D.push(new s.V(C.key,z,"array must have at least one stop")),D},default:function(C){return Di({key:C.key,value:C.value,valueSpec:t,style:C.style,styleSpec:C.styleSpec})}}});return n==="identity"&&y&&S.push(new s.V(l.key,l.value,'missing required property "property"')),n==="identity"||l.value.stops||S.push(new s.V(l.key,l.value,'missing required property "stops"')),n==="exponential"&&l.valueSpec.expression&&!s.N(l.valueSpec)&&S.push(new s.V(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(x&&!s.O(l.valueSpec)?S.push(new s.V(l.key,l.value,"property functions not supported")):y&&!s.Q(l.valueSpec)&&S.push(new s.V(l.key,l.value,"zoom functions not supported"))),n!=="categorical"&&!T||l.value.property!==void 0||S.push(new s.V(l.key,l.value,'"property" property is required')),S;function M(C){let D=[];const z=C.value,F=C.key;if(s.J(z)!=="array")return[new s.V(F,z,`array expected, ${s.J(z)} found`)];if(z.length!==2)return[new s.V(F,z,`array length 2 expected, length ${z.length} found`)];if(T){if(s.J(z[0])!=="object")return[new s.V(F,z,`object expected, ${s.J(z[0])} found`)];if(z[0].zoom===void 0)return[new s.V(F,z,"object stop key must have zoom")];if(z[0].value===void 0)return[new s.V(F,z,"object stop key must have value")];const L=s.M(z[0].zoom);if(typeof L!="number")return[new s.V(F,z[0].zoom,"stop zoom values must be numbers")];if(p&&p>L)return[new s.V(F,z[0].zoom,"stop zoom values must appear in ascending order")];L!==p&&(p=L,d=void 0,m={}),D=D.concat(en({key:`${F}[0]`,value:z[0],valueSpec:{zoom:{}},style:C.style,styleSpec:C.styleSpec,objectElementValidators:{zoom:Fa,value:E}}))}else D=D.concat(E({key:`${F}[0]`,value:z[0],style:C.style,styleSpec:C.styleSpec},z));return s.S(s.U(z[1]))?D.concat([new s.V(`${F}
14[1]`,z[1],"expressions are not allowed in function stops.")]):D.concat(Di({key:`${F}[1]`,value:z[1],valueSpec:t,style:C.style,styleSpec:C.styleSpec}))}function E(C,D){const z=s.J(C.value),F=s.M(C.value),L=C.value!==null?C.value:D;if(c){if(z!==c)return[new s.V(C.key,L,`${z} stop domain type must match previous stop domain type ${c}`)]}else c=z;if(z!=="number"&&z!=="string"&&z!=="boolean"&&typeof F!="number"&&typeof F!="string"&&typeof F!="boolean")return[new s.V(C.key,L,"stop domain value must be a number, string, or boolean")];if(z!=="number"&&n!=="categorical"){let N=`number expected, ${z} found`;return s.O(t)&&n===void 0&&(N+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new s.V(C.key,L,N)]}return n!=="categorical"||z!=="number"||typeof F=="number"&&isFinite(F)&&Math.floor(F)===F?n!=="categorical"&&z==="number"&&typeof F=="number"&&typeof d=="number"&&d!==void 0&&F<d?[new s.V(C.key,L,"stop domain values must appear in ascending order")]:(d=F,n==="categorical"&&F in m?[new s.V(C.key,L,"stop domain values must be unique")]:(m[F]=!0,[])):[new s.V(C.key,L,`integer expected, found ${String(F)}`)]}}function gn(l){const t=(l.expressionContext==="property"?s.W:s.X)(s.U(l.value),l.valueSpec);if(t.result==="error")return t.value.map(c=>new s.V(`${l.key}${c.key}`,l.value,c.message));const n=t.value.expression||t.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!n.outputDefined())return[new s.V(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!s.Y(n))return[new s.V(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter")return hn(n,l);if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!s.Z(n,["zoom","feature-state"]))return[new s.V(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!s._(n))return[new s.V(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function hn(l,t){const n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)n.delete(
14d);if(n.size===0)return[];const c=[];return l instanceof s.$&&n.has(l.name)?[new s.V(t.key,t.value,`["${l.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(l.eachChild(d=>{c.push(...hn(d,t))}),c)}function ho(l){const t=l.key,n=l.value,c=l.valueSpec,d=[];return Array.isArray(c.values)?c.values.indexOf(s.M(n))===-1&&d.push(new s.V(t,n,`expected one of [${c.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(c.values).indexOf(s.M(n))===-1&&d.push(new s.V(t,n,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(n)} found`)),d}function uo(l){return s.a1(s.U(l.value))?gn(s.L({},l,{expressionContext:"filter",valueSpec:l.styleSpec[`filter_${l.layerType||"fill"}`]})):hs(l)}function hs(l){const t=l.value,n=l.key;if(s.J(t)!=="array")return[new s.V(n,t,`array expected, ${s.J(t)} found`)];const c=l.styleSpec;let d,p=[];if(t.length<1)return[new s.V(n,t,"filter array must have at least 1 element")];switch(p=p.concat(ho({key:`${n}[0]`,value:t[0],valueSpec:c.filter_operator,style:l.style,styleSpec:l.styleSpec})),s.M(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&s.M(t[1])==="$type"&&p.push(new s.V(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&p.push(new s.V(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(d=s.J(t[1]),d!=="string"&&p.push(new s.V(`${n}[1]`,t[1],`string expected, ${d} found`)));for(let m=2;m<t.length;m++)d=s.J(t[m]),s.M(t[1])==="$type"?p=p.concat(ho({key:`${n}[${m}]`,value:t[m],valueSpec:c.geometry_type,style:l.style,styleSpec:l.styleSpec})):d!=="string"&&d!=="number"&&d!=="boolean"&&p.push(new s.V(`${n}[${m}]`,t[m],`string, number, or boolean expected, ${d} found`));break;case"any":case"all":case"none":for(let m=1;m<t.length;m++)p=p.concat(hs({key:`${n}[${m}]`,value:t[m],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":d=s.J(t[1]),t.length!==2?p.push(new s.V(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):d!=="string"&&p.push(new s.V(`${n}[1]`,t[1],`string expected, ${d} found`))}return p}function ks(l,t){const n=l.key,c=l.style,d=l.layer,p=l.styleSpec,m=l.value,y=l.objectKey,x=p[`${t}_${l.layerType}`];if(!x)return[];const T=y.match(/^(.*)-use-theme$/);if(t==="paint"&&T&&x[T[1]])return s.S(m)?[].concat(Di({key:l.key,value:m,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:y})):Di({key:n,value:m,valueSpec:{type:"string"},style:c,styleSpec:p});const S=y.match(/^(.*)-transition$/);if(t==="paint"&&S&&x[S[1]]&&x[S[1]].transition)return Di({key:n,value:m,valueSpec:p.transition,style:c,styleSpec:p});const M=l.valueSpec||x[y];if(!M)return[new s.K(n,m,`unknown property "${y}"`)];let E;if(s.J(m)==="string"&&s.O(M)&&!M.tokens&&(E=/^{([^}]+)}$/.exec(m))){const D=`\`{ "type": "identity", "property": ${E?JSON.stringify(E[1]):'"_"'} }\``;return[new s.V(n,m,`"${y}" does not support interpolation syntax
15Use an identity property function instead: ${D}.`)]}const C=[];if(l.layerType==="symbol")y!=="text-field"||!c||c.glyphs||c.imports||C.push(new s.V(n,m,'use of "text-field" requires a style "glyphs" property')),y==="text-font"&&s.a2(s.U(m))&&s.M(m.type)==="identity"&&C.push(new s.V(n,m,'"text-font" does not support identity functions'));else if(l.layerType==="model"&&t==="paint"&&d&&d.layout&&d.layout.hasOwnProperty("model-id")&&s.O(M)&&(s.a3(M)||s.Q(M))){const D=s.W(s.U(m),M),z=D.value.expression||D.value._styleExpression.expression;z&&!s.Z(z,["measure-light"])&&(y==="model-emissive-strength"&&s._(z)&&s.Y(z)||C.push(new s.V(n,m,`${y} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return C.concat(Di({key:l.key,value:m,valueSpec:M,style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:y}))}function tn(l){return ks(l,"paint")}function yn(l){return ks(l,"layout")}function Oa(l){let t=[];const n=l.value,c=l.key,d=l.style,p=l.styleSpec;n.type||n.ref||t.push(new s.V(c,n,'either "type" or "ref" is required'));let m=s.M(n.type);const y=s.M(n.ref);
15if(n.id){const x=s.M(n.id);for(let T=0;T<l.arrayIndex;T++){const S=d.layers[T];s.M(S.id)===x&&t.push(new s.V(c,n.id,`duplicate layer id "${n.id}", previously used at line ${S.id.__line__}`))}}if("ref"in n){let x;["type","source","source-layer","filter","layout"].forEach(T=>{T in n&&t.push(new s.V(c,n[T],`"${T}" is prohibited for ref layers`))}),d.layers.forEach(T=>{s.M(T.id)===y&&(x=T)}),x?x.ref?t.push(new s.V(c,n.ref,"ref cannot reference another ref layer")):m=s.M(x.type):typeof y=="string"&&t.push(new s.V(c,n.ref,`ref layer "${y}" not found`))}else if(m!=="background"&&m!=="sky"&&m!=="slot")if(n.source){const x=d.sources&&d.sources[n.source],T=x&&s.M(x.type);x?T==="vector"&&m==="raster"?t.push(new s.V(c,n.source,`layer "${n.id}" requires a raster source`)):T==="raster"&&m!=="raster"?t.push(new s.V(c,n.source,`layer "${n.id}" requires a vector source`)):T!=="vector"||n["source-layer"]?T==="raster-dem"&&m!=="hillshade"?t.push(new s.V(c,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(m)?m==="line"&&n.paint&&(n.paint["line-gradient"]||n.paint["line-trim-offset"])&&T==="geojson"&&!x.lineMetrics?t.push(new s.V(c,n,`layer "${n.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):m==="raster-particle"&&T!=="raster-array"&&t.push(new s.V(c,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):t.push(new s.V(c,n.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new s.V(c,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new s.V(c,n.source,`source "${n.source}" not found`))}else t.push(new s.V(c,n,'missing required property "source"'));return t=t.concat(en({key:c,value:n,valueSpec:p.layer,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Di({key:`${c}.type`,value:n.type,valueSpec:p.layer.type,style:l.style,styleSpec:l.styleSpec,object:n,objectKey:"type"}),filter:x=>uo(s.L({layerType:m},x)),layout:x=>en({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>yn(s.L({layerType:m},T))}}),paint:x=>en({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>tn(s.L({layerType:m,layer:n},T))}})}})),t}function po(l){const t=l.value,n=l.key,c=s.J(t);return c!=="string"?[new s.V(n,t,`string expected, ${c} found`)]:[]}const Bs={promoteId:function l({key:t,value:n}){if(s.J(n)==="string")return po({key:t,value:n});if(Array.isArray(n)){const c=[],d=s.U(n),p=s.X(d);return p.result==="error"&&p.value.forEach(m=>{c.push(new s.V(`${t}${m.key}`,null,`${m.message}`))}),s.Z(p.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"])||c.push(new s.V(`${t}`,null,"promoteId expression should be only feature dependent")),c}{const c=[];for(const d in n)c.push(...l({key:`${t}.${d}`,value:n[d]}));return c}}};function Or(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!t.type)return[new s.V(n,t,'"type" is required')];const p=s.M(t.type);let m=[];switch(["vector","raster","raster-dem","raster-array"].includes(p)&&(t.url||t.tiles||m.push(new s.K(n,t,'Either "url" or "tiles" is required.'))),p){case"vector":case"raster":case"raster-dem":case"raster-array":return m=m.concat(en({key:n,value:t,valueSpec:c[`source_${p.replace("-","_")}`],style:l.style,styleSpec:c,objectElementValidators:Bs})),m;case"geojson":if(m=en({key:n,value:t,valueSpec:c.source_geojson,style:d,styleSpec:c,objectElementValidators:Bs}),t.cluster)for(const y in t.clusterProperties){const[x,T]=t.clusterProperties[y],S=typeof x=="string"?[x,["accumulated"],["get",y]]:x;m.push(...gn({key:`${n}.${y}.map`,value:T,expressionContext:"cluster-map"})),m.push(...gn({key:`${n}.${y}.reduce`,value:S,expressionContext:"cluster-reduce"}))}return m;case"video":return en({key:n,value:t,valueSpec:c.source_video,style:d,styleSpec:c});case"image":return en({key:n,value:t,valueSpec:c.source_image,style:d,styleSpec:c});case"canvas":return[new s.V(n,null,"Please use runtime APIs to add canvas sources, rather than 
15including them in stylesheets.","source.canvas")];default:return ho({key:`${n}.type`,value:t.type,valueSpec:{values:xn(c)}})}}function xn(l){return l.source.reduce((t,n)=>{const c=l[n];return c.type.type==="enum"&&(t=t.concat(Object.keys(c.type.values))),t},[])}function Lo(l){const t=l.value,n=l.styleSpec,c=n.light,d=l.style;let p=[];const m=s.J(t);if(t===void 0)return p;if(m!=="object")return p=p.concat([new s.V("light",t,`object expected, ${m} found`)]),p;for(const y in t){const x=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);p=p.concat(T&&c[T[1]]?Di({key:y,value:t[y],valueSpec:{type:"string"},style:d,styleSpec:n}):x&&c[x[1]]&&c[x[1]].transition?Di({key:y,value:t[y],valueSpec:n.transition,style:d,styleSpec:n}):c[y]?Di({key:y,value:t[y],valueSpec:c[y],style:d,styleSpec:n}):[new s.V(y,t[y],`unknown property "${y}"`)])}return p}function fo(l){const t=l.value;let n=[];if(!t)return n;const c=s.J(t);if(c!=="object")return n=n.concat([new s.V("light-3d",t,`object expected, ${c} found`)]),n;const d=l.styleSpec,p=d["light-3d"],m=l.key,y=l.style,x=l.style.lights;for(const M of["type","id"])if(!(M in t))return n=n.concat([new s.V("light-3d",t,`missing property ${M} on light`)]),n;if(t.type&&x)for(let M=0;M<l.arrayIndex;M++){const E=s.M(t.type),C=x[M];s.M(C.type)===E&&n.push(new s.V(m,t.id,`duplicate light type "${t.type}", previously defined at line ${C.id.__line__}`))}const T=`properties_light_${t.type}`;if(!(T in d))return n=n.concat([new s.V("light-3d",t,`Invalid light type ${t.type}`)]),n;const S=d[T];for(const M in t)if(M==="properties"){const E=t[M],C=s.J(E);if(C!=="object")return n=n.concat([new s.V("properties",E,`object expected, ${C} found`)]),n;for(const D in E){const z=D.match(/^(.*)-transition$/),F=D.match(/^(.*)-use-theme$/);n=n.concat(F&&S[F[1]]?Di({key:M,value:E[D],valueSpec:{type:"string"},style:y,styleSpec:d}):z&&S[z[1]]&&S[z[1]].transition?Di({key:M,value:t[M],valueSpec:d.transition,style:y,styleSpec:d}):S[D]?Di({key:D,value:E[D],valueSpec:S[D],style:y,styleSpec:d}):[new s.K(l.key,E[D],`unknown property "${D}"`)])}}else n=n.concat(p[M]?Di({key:M,value:t[M],valueSpec:p[M],style:y,styleSpec:d}):[new s.K(M,t[M],`unknown property "${M}"`)]);return n}function Fo(l){const t=l.value,n=l.key,c=l.style,d=l.styleSpec,p=d.terrain;let m=[];const y=s.J(t);if(t===void 0||y==="null")return m;if(y!=="object")return m=m.concat([new s.V("terrain",t,`object expected, ${y} found`)]),m;for(const x in t){const T=x.match(/^(.*)-transition$/),S=x.match(/^(.*)-use-theme$/);m=m.concat(S&&p[S[1]]?Di({key:x,value:t[x],valueSpec:{type:"string"},style:c,styleSpec:d}):T&&p[T[1]]&&p[T[1]].transition?Di({key:x,value:t[x],valueSpec:d.transition,style:c,styleSpec:d}):p[x]?Di({key:x,value:t[x],valueSpec:p[x],style:c,styleSpec:d}):[new s.K(x,t[x],`unknown property "${x}"`)])}if(t.source){const x=c.sources&&c.sources[t.source],T=x&&s.M(x.type);x?T!=="raster-dem"&&m.push(new s.V(n,t.source,`terrain cannot be used with a source of type ${String(T)}, it only be used with a "raster-dem" source type`)):m.push(new s.V(n,t.source,`source "${t.source}" not found`))}else m.push(new s.V(n,t,'terrain is missing required property "source"'));return m}function Oo(l){const t=l.value,n=l.style,c=l.styleSpec,d=c.fog;let p=[];const m=s.J(t);if(t===void 0)return p;if(m!=="object")return p=p.concat([new s.V("fog",t,`object expected, ${m} found`)]),p;for(const y in t){const x=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);p=p.concat(T&&d[T[1]]?Di({key:y,value:t[y],valueSpec:{type:"string"},style:n,styleSpec:c}):x&&d[x[1]]&&d[x[1]].transition?Di({key:y,value:t[y],valueSpec:c.transition,style:n,styleSpec:c}):d[y]?Di({key:y,value:t[y],valueSpec:d[y],style:n,styleSpec:c}):[new s.K(y,t[y],`unknown property "${y}"`)])}return p}const Ns={"*":()=>[],array:Do,boolean:function(l){const t=l.value,n=l.key,c=s.J(t);return c!=="boolean"?[new s.V(n,t,`boolean expected, ${c} found`)]:[]},number:Fa,color:function(l){const t=l.key,n=l.value,c=s.J(n);return c!=="string"?[new s.V(t,n,`color expected, ${c} found`)]:s.a0.parseCSSColor(n)===null?[new s.V(t,n,`color expected, "${n}" found`)]:[]},enum:ho,filter:uo,function:co,layer:Oa,object:en,source:Or,model:s.a4,light:Lo,"light-3d":fo,terrain:Fo,fog:Oo,string:po,formatted:function(l){return po(l).length===0?[]:gn(l)},resolvedImage:function(l){return po(l).length===0?[]:gn(l)},projection:function(l){const t=l.value,n=l.styleSpec,c=n.projection,d=l.style;let p=[];const m=s.J(t);if(m==="object")for(const y in t)p=p.concat(Di({key:y,value:t[y],valueSpec:c[y],style:d,styleSpec:n}));else m!=="string"&&(p=p.concat([new s.V("projection",t,`object or string expected, ${m}
15 found`)]));return p},import:function(l){const{value:t,styleSpec:n}=l,{data:c,...d}=t;Object.defineProperty(d,"__line__",{value:t.__line__,enumerable:!1});let p=en(s.L({},l,{value:d,valueSpec:n.import}));return s.M(d.id)===""&&p.push(new s.V(`${l.key}.id`,d,"import id can't be an empty string")),c&&(p=p.concat(Ba(c,n,{key:`${l.key}.data`}))),p},iconset:function(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!t.type)return[new s.V(n,t,'"type" is required')];const p=s.M(t.type);let m=[];if(m=m.concat(en({key:n,value:t,valueSpec:c[`iconset_${p}`],style:d,styleSpec:c})),p==="source"&&t.source){const y=d.sources&&d.sources[t.source],x=y&&s.M(y.type);y?x!=="raster-array"&&m.push(new s.V(n,t.source,`iconset cannot be used with a source of type ${String(x)}, it only be used with a "raster-array" source type`)):m.push(new s.V(n,t.source,`source "${t.source}" not found`))}return m}};function Di(l,t=!1){const n=l.value,c=l.valueSpec,d=l.styleSpec;if(c.expression&&s.a2(s.M(n)))return co(l);if(c.expression&&s.S(s.U(n)))return gn(l);if(c.type&&Ns[c.type]){const p=Ns[c.type](l);return t===!0&&p.length>0&&s.J(l.value)==="array"?gn(l):p}return en(s.L({},l,{valueSpec:c.type?d[c.type]:c}))}function ka(l){const t=l.value,n=l.key,c=po(l);return c.length||(t.indexOf("{fontstack}")===-1&&c.push(new s.V(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&c.push(new s.V(n,t,'"glyphs" url must include a "{range}" token'))),c}function Ba(l,t=s.a5,n={}){return Di({key:n.key||"",value:l,valueSpec:t.$root,styleSpec:t,style:l,objectElementValidators:{glyphs:ka,"*":()=>[]}})}function vn(l,t=s.a5){return ne(Ba(l,t))}const Na=l=>ne(Or(l)),lh=l=>ne(Lo(l)),Vs=l=>ne(fo(l)),ke=l=>ne(Fo(l)),mo=l=>ne(Oo(l)),ch=l=>ne(function(t){const n=t.value,c=t.style,d=t.styleSpec,p=d.snow;let m=[];const y=s.J(n);if(n===void 0)return m;if(y!=="object")return m=m.concat([new s.V("snow",n,`object expected, ${y} found`)]),m;for(const x in n){const T=x.match(/^(.*)-transition$/);m=m.concat(T&&p[T[1]]&&p[T[1]].transition?Di({key:x,value:n[x],valueSpec:d.transition,style:c,styleSpec:d}):p[x]?Di({key:x,value:n[x],valueSpec:p[x],style:c,styleSpec:d}):[new s.K(x,n[x],`unknown property "${x}"`)])}return m}(l)),Va=l=>ne(function(t){const n=t.value,c=t.style,d=t.styleSpec,p=d.rain;let m=[];const y=s.J(n);if(n===void 0)return m;if(y!=="object")return m=m.concat([new s.V("rain",n,`object expected, ${y} found`)]),m;for(const x in n){const T=x.match(/^(.*)-transition$/);m=m.concat(T&&p[T[1]]&&p[T[1]].transition?Di({key:x,value:n[x],valueSpec:d.transition,style:c,styleSpec:d}):p[x]?Di({key:x,value:n[x],valueSpec:p[x],style:c,styleSpec:d}):[new s.K(x,n[x],`unknown property "${x}"`)])}return m}(l)),ei=l=>ne(Oa(l)),ge=l=>ne(uo(l)),k=l=>ne(tn(l)),B=l=>ne(yn(l)),Z=l=>ne(s.a4(l));function ne(l){return l.slice().sort((t,n)=>t.line&&n.line?t.line-n.line:0)}function W(l,t){let n=!1;if(t&&t.length)for(const c of t)c instanceof s.K?s.w(c.message):(l.fire(new s.z(new Error(c.message))),n=!0);return n}let le;class ve extends s.E{constructor(t,n="flat"){super(),this._transitionable=new s.a6(le||(le=new s.a7({anchor:new s.a8(s.a5.light.anchor),position:new s.a9(s.a5.light.position),color:new s.a8(s.a5.light.color),intensity:new s.a8(s.a5.light.intensity)}))),this.setLight(t,n),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n,c={}){this._validate(lh,t,c)||(this._transitionable.setTransitionOrValue(t),this.id=n)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,c){return(!c||c.validate!==!1)&&W(this,t.call(vn,s.h({value:n,style:{glyphs:!0,sprite:!0},styleSpec:s.a5})))}}let he=class extends s.E{constructor(l,t,n,c,d){super(),this.scope=n,this._transitionable=new s.a6(new s.a7({source:new s.a8(s.a5.terrain.source),exaggeration:new s.a8(s.a5.terrain.exaggeration)}),n,c),this._transitionable.setTransitionOrValue(l,c),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t,this.worldview=d}get(){return this._transitionable.serialize()}set(l,t){this._transitionable.setTransitionOrValue(l,t)}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}getExaggeration(l){return this._transitioning.possiblyEvaluate(new s.aa(l,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const l=this._transitionable._values.exaggeration;if(!l)return null;const t=l.value.expression;if(!t)return null;let n=-1,c=-1,d=1;for(const p of t.zoomStops)d=t.evaluate(new s.aa(p,{worldview:this.worldview})),d>.01?(n=p,c=-1):c=p;return d<.01&&n>0&&c>n?[n,c]:null}isZoomDependent(){const l=this._transitionable._values.exaggeration;return l!=null&&l.value!=null&&l.value.expression!=null&&l.value.expression instanceof s.ab}};const ye=45,qe=65,Pe=.05;function pt(l,t,n,c){const d=s.af(ye,qe,n),[p,m]=bt(l,c);let y=1-Math.min(1,Math.exp((t-p)/(m-p)*-6));return y*=y*y,y=Math.min(1,1.00747*y),y*d*l.alpha}function bt(l,t){const n=.5/Math.tan(.5*t);return[l.range[0]+n,l.range[1]+n]}function St(l,t,n,c,d){const p=s.ad([],[t,n,c],d.mercatorFogMatrix);return pt(l,s.ae(p),d.pitch,d._fov)}function Ut(l,t,n,c,d,p,m){const y=[[n,c,0],[d,c,0],[d,p,0],[n,p,0]];let x=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const S of y){const M=s.ad([],S,t),E=s.ae(M);x=Math.min(x,E),T=Math.max(T,E)}return[pt(l,x,m.pitch,m._fov),pt(l,T,m.pitch,m._fov)]}class Ft extends s.E{constructor(t,n,c,d){super();const p=new s.a7({range:new s.a8(s.a5.fog.range),color:new s.a8(s.a5.fog.color),"color-use-theme":new s.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new s.a8(s.a5.fog["high-color"]),"high-color-use-theme":new s.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new s.a8(s.a5.fog["space-color"]),"space-color-use-theme":new s.a8({type:"string","property-type":"data-constant",default:"default"}
15),"horizon-blend":new s.a8(s.a5.fog["horizon-blend"]),"star-intensity":new s.a8(s.a5.fog["star-intensity"]),"vertical-range":new s.a8(s.a5.fog["vertical-range"])});this._transitionable=new s.a6(p,c,new Map(d)),this.set(t,d),this._transitioning=this._transitionable.untransitioned(),this._transform=n,this.properties=new s.ag(p),this.scope=c}get state(){const t=this._transform,n=t.projection.name==="globe",c=s.ah(t.zoom),d=this.properties.get("range"),p=[.5,3];return{range:n?[s.ai(p[0],d[0],c),s.ai(p[1],d[1],c)]:d,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,n,c={}){if(this._validate(mo,t,c))return;const d=s.h({},t);for(const p of Object.keys(s.a5.fog))d[p]===void 0&&(d[p]=s.a5.fog[p].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,n)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const n=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:s.af(ye,qe,t))*n.a}getOpacityAtLatLng(t,n){return this._transform.projection.supportsFog?function(c,d,p){const m=s.ac.fromLngLat(d),y=p.elevation?p.elevation.getAtPointOrZero(m):0;return St(c,m.x,m.y,y,p)}(this.state,t,n):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const n=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Ut(this.state,n,0,0,s.aj,s.aj,this._transform)}getOpacityForBounds(t,n,c,d,p){return this._transform.projection.supportsFog?Ut(this.state,t,n,c,d,p,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?bt(this.state,t):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const n=[4,5,6,7];for(const c of n){const d=t.points[c];let p;if(d[2]>=0)p=d;else{const m=t.points[c-4];p=s.ak(m,d,m[2]/(m[2]-d[2]))}if(St(this.state,p[0],p[1],0,this._transform)>=Pe)return!0}return!1}updateConfig(t){this._transitionable.setTransitionOrValue(this._options,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,c){return(!c||c.validate!==!1)&&W(this,t.call(vn,s.h({value:n,style:{glyphs:!0,sprite:!0},styleSpec:s.a5})))}}let jt,bi,Gt,Ki,yr=class extends s.E{constructor(l,t,n,c){super();const d=jt||(jt=new s.a7({density:new s.a8(s.a5.snow.density),intensity:new s.a8(s.a5.snow.intensity),color:new s.a8(s.a5.snow.color),opacity:new s.a8(s.a5.snow.opacity),vignette:new s.a8(s.a5.snow.vignette),"vignette-color":new s.a8(s.a5.snow["vignette-color"]),"center-thinning":new s.a8(s.a5.snow["center-thinning"]),direction:new s.a8(s.a5.snow.direction),"flake-size":new s.a8(s.a5.snow["flake-size"])}));this._transitionable=new s.a6(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ag(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=s.al(n[0]),d=-Math.max(s.al(n[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette"),y=this.properties.get("vignette-color");return y.a=m,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.am(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:y}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate(ch,l,n))return;const c=s.h({},l);for(const d of Object.keys(s.a5.snow))c[d]===void 0&&(c[d]=s.a5.snow[d].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,n){return(!n||n.validate!==!1)&&W(this,l.call(vn,s.h({value:t,style:{glyphs:!0,sprite:!0},styleSpec:s.a5}
vendor: 12,728 bytes, line 15
15)))}},dr=class extends s.E{constructor(l,t,n,c){super();const d=bi||(bi=new s.a7({density:new s.a8(s.a5.rain.density),intensity:new s.a8(s.a5.rain.intensity),color:new s.a8(s.a5.rain.color),opacity:new s.a8(s.a5.rain.opacity),vignette:new s.a8(s.a5.rain.vignette),"vignette-color":new s.a8(s.a5.rain["vignette-color"]),"center-thinning":new s.a8(s.a5.rain["center-thinning"]),direction:new s.a8(s.a5.rain.direction),"droplet-size":new s.a8(s.a5.rain["droplet-size"]),"distortion-strength":new s.a8(s.a5.rain["distortion-strength"])}));this._transitionable=new s.a6(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ag(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=s.al(n[0]),d=-Math.max(s.al(n[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette-color");return m.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.am(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:m}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate(Va,l,n))return;const c=s.h({},l);for(const d of Object.keys(s.a5.rain))c[d]===void 0&&(c[d]=s.a5.rain[d].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,n){return(!n||n.validate!==!1)&&W(this,l.call(vn,s.h({value:t,style:{glyphs:!0,sprite:!0},styleSpec:s.a5})))}};class gi extends s.E{constructor(t,n,c,d){super(),this.scope=c,this._options=t,this.properties=new s.ag(n),this._transitionable=new s.a6(n,c,new Map(d)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(t){this._transitionable.setTransitionOrValue(this._options.properties,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(t,n){this._options=t,this._transitionable.setTransitionOrValue(t.properties,n)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class ri{constructor(t,n,c){this.screenBounds=t,this.cameraPoint=c.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=n,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,c)}static createFromScreenPoints(t,n){let c,d;if(t instanceof s.P||typeof t[0]=="number"){const p=s.P.convert(t);c=[p],d=n.isPointAboveHorizon(p)}else{const p=s.P.convert(t[0]),m=s.P.convert(t[1]),y=p.add(m)._div(2);c=[p,m],d=s.ao(p,m).every(x=>n.isPointAboveHorizon(x))&&n.isPointAboveHorizon(y)}return new ri(c,d,n)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return s.ao(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],d=s.ao(n,c,0,!1);return this.cameraPoint.y>c.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x<c.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=c.x?d[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(d[3]=this.cameraPoint)),s.ap(d,t)}bufferedCameraGeometryGlobe(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],d=s.ao(n,c,t),p=this.cameraPoint.clone();switch(3*((p.y>n.y)+(p.y>c.y))+((p.x>n.x)+(p.x>c.x))){case 0:d[0]=p,d[4]=p.clone();break;case 1:d.splice(1,0,p);break;case 2:d[1]=p;break;case 3:d.splice(4,0,p);break;case 5:d.splice(2,0,p);break;case 6:d[3]=p;break;case 7:d.splice(3,0,p);break;case 8:d[2]=p}return d}containsTile(t,n,c,d=0){const p=t.queryPadding/n._pixelsPerMercatorPixel+1,m=c?this._bufferedCameraMercator(p,n):this._bufferedScreenMercator(p,n);let y=t.tileID.wrap+(m.unwrapped?d:0);const x=m.polygon.map(F=>s.aq(t.tileTransform,F,y));if(!s.ar(x,0,0,s.aj,s.aj))return;y=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const T=this.screenGeometryMercator.polygon.map(F=>s.as(t.tileTransform,F,y)),S=T.map(F=>new s.P(F[0],F[1])),M=n.getFreeCameraOptions().position||new s.ac(0,0,0),E=s.as(t.tileTransform,M,y),C=T.map(F=>{const L=s.at(F,F,E);return s.au(L,L),new s.av(E,L)}),D=s.aw(t,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:S,tilespaceRays:C,bufferedTilespaceGeometry:x,bufferedTilespaceBounds:(z=s.ax(x),z.min.x=s.ay(z.min.x,0,s.aj),z.min.y=s.ay(z.min.y,0,s.aj),z.max.x=s.ay(z.max.x,0,s.aj),z.max.y=s.ay(z.max.y,0,s.aj),z),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:D};var z}_bufferedScreenMercator(t,n){const c=Bi(t);if(this._screenRaycastCache[c])return this._screenRaycastCache[c];{let d;return d=n.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),n):{polygon:this.bufferedScreenGeometry(t).map(p=>n.pointCoordinate3D(p)),unwrapped:!0},this._screenRaycastCache[c]=d,d}}_bufferedCameraMercator(t,n){const c=Bi(t);if(this._cameraRaycastCache[c])return this._cameraRaycastCache[c];{let d;return d=n.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),n):{polygon:this.bufferedCameraGeometry(t).map(p=>n.pointCoordinate3D(p)),unwrapped:!0},this._cameraRaycastCache[c]=d,d}}_projectAndResample(t,n){const c=function(p,m){const y=s.az([],m.pixelMatrix,m.globeMatrix),x=[0,-s.aB,0,1],T=[0,s.aB,0,1],S=[0,0,0,1];s.aA(x,x,y),s.aA(T,T,y),s.aA(S,S,y);const M=new s.P(x[0]/x[3],x[1]/x[3]),E=new s.P(T[0]/T[3],T[1]/T[3]),C=s.aC(p,M)&&x[3]<S[3],D=s.aC(p,E)&&T[3]<S[3];if(!C&&!D)return null;const z=function(ie,Y,K){for(let J=1;J<ie.length;J++){const fe=qi(Y.pointCoordinate3D(ie[J-1]).x),se=qi(Y.pointCoordinate3D(ie[J]).x);if(K<0){if(fe<se)return{idx:J,t:-fe/(se-1-fe)}}else if(se<fe)return{idx:J,t:(1-fe)/(se+1-fe)}}return null}(p,m,C?-1:1);if(!z)return null;const{idx:F,t:L}=z;let N=F>1?Xi(p.slice(0,F),m):[],j=F<p.length?Xi(p.slice(F),m):[];N=N.map(ie=>new s.P(qi(ie.x),ie.y)),j=j.map(ie=>new s.P(qi(ie.x),ie.y));const q=[...N];q.length===0&&q.push(j[j.length-1]);const X=s.ai(q[q.length-1].y,(j.length===0?N[0]:j[0]).y,L);let ee;return ee=C?[new s.P(0,X),new s.P(0,0),new s.P(1,0),new s.P(1,X)]:[new s.P(1,X),new s.P(1,1),new s.P(0,1),new s.P(0,X)],q.push(...ee),j.length===0?q.push(N[0]):q.push(...j),{polygon:q.map(ie=>new s.ac(ie.x,ie.y)),unwrapped:!1}}(t,n);if(c)return c;const d=function(p,m){let y=!1,x=-1/0,T=0;for(let M=0;M<p.length-1;M++)p[M].x>x&&(x=p[M].x,T=M);for(let M=0;M<p.length-1;M++){const E=(T+M)%(p.length-1),C=p[E],D=p[E+1];Math.abs(C.x-D.x)>.5&&(C.x<D.x?(C.x+=1,E===0&&(p[p.length-1].x+=1)):(D.x+=1,E+1===p.length-1&&(p[0].x+=1)),y=!0)}const S=s.aD(m.center.lng);return y&&S<Math.abs(S-1)&&p.forEach(M=>{M.x-=1}),{polygon:p,unwrapped:y}}(Xi(t,n).map(p=>new s.P(qi(p.x),p.y)),n);return{polygon:d.polygon.map(p=>new s.ac(p.x,p.y)),unwrapped:d.unwrapped}}}function Xi(l,t){return s.aE(l,n=>{const c=t.pointCoordinate3D(n);n.x=c.x,n.y=c.y},1/256)}function qi(l){return l<0?1+l%1:l%1}function Bi(l){return 100*l|0}function wr(l,t,n,c,d){const p=function(y,x){if(y)return d(y);if(x){if(l.url&&x.tiles&&l.tiles&&delete l.tiles,x.variants){if(!Array.isArray(x.variants))return d(new Error("variants must be an array"));for(const S of x.variants){if(S==null||typeof S!="object"||S.constructor!==Object)return d(new Error("variant must be an object"));if(!Array.isArray(S.capabilities))return d(new Error("capabilities must be an array"));if(S.capabilities.length===1&&S.capabilities[0]==="meshopt"){x=s.h(x,S);break}}}const T=s.aF(s.h({},x,l),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);T.tiles=t.canonicalizeTileset(T,l.url),d(null,T)}},m=function(y,x,T){if(!y)return null;if(!x&&!T)return y;T=T||y.worldview_default;const S=Object.values(y.language||{});if(S.length===0)return null;const M=Object.values(y.worldview||{});if(M.length===0)return null;const E=S.every(D=>D===x),C=M.every(D=>D===T);return E&&C?y:x in(y.language_options||{})||T in(y.worldview_options||{})?null:y.language_options&&y.worldview_options?y:null}(l.data,n,c);return m?s.q.frame(()=>p(null,m)):l.url?s.n(t.transformRequest(t.normalizeSourceURL(l.url,null,n,c),s.R.Source),p):s.q.frame(()=>{const{data:y,...x}=l;p(null,x)})}function rn(l,t){const n=Math.pow(2,t.z),c=Math.floor(s.aD(l.getWest())*n),d=Math.floor(s.aH(l.getNorth())*n),p=Math.ceil(s.aD(l.getEast())*n),m=Math.ceil(s.aH(l.getSouth())*n);return t.x>=c&&t.x<p&&t.y>=d&&t.y<m}class kr{constructor(t,n,c){this.bounds=t?s.aG.convert(this.validateBounds(t)):null,this.minzoom=n||0,this.maxzoom=c||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}addExtraBounds(t){if(t){this.extraBounds||(this.extraBounds=[]);for(const n of t)this.extraBounds.push(s.aG.convert(this.validateBounds(n)))}}contains(t){if(t.z>this.maxzoom||t.z<this.minzoom||this.bounds&&!rn(this.bounds,t))return!1;if(!this.extraBounds)return!0;for(const n of this.extraBounds)if(rn(n,t))return!0;return!1}static fromTileJSON(t){if(!t.bounds&&!t.extra_bounds)return null;const n=new kr(t.bounds,t.minzoom,t.maxzoom);return n.addExtraBounds(t.extra_bounds),n}}class Ua extends s.E{constructor(t,n,c,d){if(super(),this.id=t,this.dispatcher=c,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,s.h(this,s.aF(n,["url","scheme","tileSize","promoteId"])),this._options=s.h({type:"vector"},n),this._collectResourceTiming=!!n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new s.aI}load(t){this._loaded=!1,this.fire(new s.A("dataloading",{dataType:"source"}));const n=Array.isArray(this.map._language)?this.map._language.join():this.map._language,c=this.map.getWorldview();this._tileJSONRequest=wr(this._options,this.map._requestManager,n,c,(d,p)=>{if(this._tileJSONRequest=null,this._loaded=!0,d)n&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${n}`),c&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${c}`),this.fire(new s.z(d));else if(p){if(s.h(this,p),this.hasWorldviews=!!p.worldview_options,p.worldview_default&&(this.worldviewDefault=p.worldview_default),p.vector_layers){this.vectorLayers=p.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const m of p.vector_layers)this.vectorLayerIds.push(m.id),p.worldview&&p.worldview[m.source]&&this.localizableLayerIds.add(m.id)}this.tileBounds=kr.fromTileJSON(p),Hr(p.tiles,this.map._requestManager._customAccessToken),this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))}t&&t(d)})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=s.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return s.h({},this._options)}loadTile(t,n){const c=t.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(c),p=this.map._requestManager.transformRequest(d,s.R.Tile),m=this.map.style?this.map.style.getLut(this.scope):null,y=m?{image:m.image.clone()}:null,x={request:p,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:y,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
15ype,source:this.id,scope:this.scope,pixelRatio:s.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault};if(this.hasWorldviews&&s.j(c)&&(x.localizableLayerIds=this.localizableLayerIds),x.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",x,T.bind(this));else if(t.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",x,T.bind(this),void 0,!0);else{const S=s.aJ.call({deduped:this._deduped},x,(M,E)=>{M||!E?T.call(this,M):(x.data={cacheControl:E.cacheControl,expires:E.expires,rawData:E.rawData.slice(0)},t.actor&&t.actor.send("loadTile",x,T.bind(this),void 0,!0))},!0);t.request={cancel:S}}function T(S,M){return delete t.request,t.aborted?n(null):S&&S.status!==404?n(S):(M&&M.resourceTiming&&(t.resourceTiming=M.resourceTiming),this.map._refreshExpiredTiles&&M&&t.setExpiryData(M),t.loadVectorData(M,this.map.painter),s.aK(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
15ype,source:this.id,scope:this.scope})}unloadTile(t,n){t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope}),t.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Ar extends s.E{constructor(t,n,c,d){super(),this.id=t,this.dispatcher=c,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=s.h({type:"raster"},n),s.h(this,s.aF(n,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new s.A("dataloading",{dataType:"source"}));const n=this.map.getWorldview();this._tileJSONRequest=wr(this._options,this.map._requestManager,null,n,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new s.z(c)):d&&(s.h(this,d),d.raster_layers&&(this.rasterLayers=d.raster_layers,this.rasterLayerIds=this.rasterLayers.map(p=>p.id)),this.tileBounds=kr.fromTileJSON(d),Hr(d.tiles),this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(c)})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=s.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return s.h({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const c=s.q.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);t.request=s.o(this.map._requestManager.transformRequest(d,s.R.Tile),(p,m,y,x)=>(delete t.request,t.aborted?(t.state="unloaded",n(null)):p?(t.state="errored",n(p)):m?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:y,expires:x}),t.setTexture(m,this.map.painter),t.state="loaded",s.aK(this.dispatcher),void n(null)):n(null)))}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n&&n()}unloadTile(t,n){t.texture&&t.texture instanceof s.T?(t.destroy(!0),t.texture&&t.texture instanceof s.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),n&&n()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class ko extends Ar{constructor(t,n,c,d){super(t,n,c,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._options=s.h({type:"raster-array"},n)}triggerRepaint(t){const n=this.map.painter._terrain,c=this.map.style.getSourceCache(this.id);n&&n.enabled&&c&&n._clearRenderCacheForTile(c.id,t.tileID),this.map.triggerRepaint()}loadTile(t,n){const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,s.R.Tile),p={request:d,uid:t.uid,tileID:t.tileID,type:this.t
15ype,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=d,t.actor||(t.actor=this.dispatcher.getActor());const m=(y,x,T,S)=>{if(delete t.request,t.aborted)return t.state="unloaded",n(null);if(y)return y.name==="AbortError"?void 0:(t.state="errored",n(y));if(this.map._refreshExpiredTiles&&x&&t.setExpiryData({cacheControl:T,expires:S}),this.partial)t.state="empty";else{if(!x)return n(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=x}n(null)};t.request=this.partial?t.fetchHeader(void 0,m.bind(this)):t.actor.send("loadTile",p,m.bind(this),void 0,!0)}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t,n){const c=t.texturePerLayer;if(t.flushAllQueues(),c.size){t.destroy(!0);for(const d of c.values())this.map.painter.saveTileTexture(d)}else t.destroy()}prepareTile(t,n,c,d){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBand(n,c,d,(p,m)=>{if(p)return t.state="errored",this.fire(new s.z(p)),void this.triggerRepaint(t);m&&(t._isHeaderLoaded=!0,t.setTexturePerLayer(c,m,this.map.painter),t.state="loaded",this.triggerRepaint(t))}))}getInitialBand(t){if(!this.rasterLayers)return 0;const n=this.rasterLayers.find(({id:p})=>p===t),c=n&&n.fields,d=c&&c.bands&&c.bands;return d?d[0]:0}getTextureDescriptor(t,n,c){if(!t)return;const d=n.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let p=null;n instanceof s.aN?p=n.paint.get("raster-array-band"):n instanceof s.aO&&(p=n.paint.get("raster-particle-array-band"));const m=p||this.getInitialBand(d);if(m==null)return;if(!t.textureDescriptorPerLayer.get(n.id))return void this.prepareTile(t,d,n.id,m);if(t.updateNeeded(n.id,m)&&!c)return;const y=t.textureDescriptorPerLayer.get(n.id);return Object.assign({},y,{texture:t.texturePerLayer.get(n.id)})}getImages(t,n){const c=new Map;for(const d of t)for(const p of n){const[m,y]=p.split("/"),x=d.getLayer(m);if(!x||!x.hasBand(y)||!x.hasDataForBand(y))continue;const{bytes:T,tileSize:S,buffer:M}=x.getBandView(y),E=S+2*M,C={data:new s.r({width:E,height:E},T),pixelRatio:2,sdf:!1,usvg:!1,version:0};c.set(p,C)}return c}}const Ul={vector:Ua,raster:Ar,"raster-dem":class extends Ar{constructor(l,t,n,c){super(l,t,n,c),this.type="raster-dem",this.maxzoom=22,this._options=s.h({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function c(d,p){d&&(l.state="errored",t(d)),p&&(l.dem=p,l.dem.onDeserialize(),l.needsHillshadePrepare=!0,l.needsDEMTextureUpload=!0,l.state="loaded",t(null))}l.request=s.o(this.map._requestManager.transformRequest(n,s.R.Tile),(function(d,p,m,y){if(delete l.request,l.aborted)l.state="unloaded",t(null);else if(d)l.state="errored",t(d);else if(p){this.map._refreshExpiredTiles&&l.setExpiryData({cacheControl:m,expires:y});const x=ImageBitmap&&p instanceof ImageBitmap&&s.t(),T=1-(p.width-s.aL(p.width))/2;T<1||l.neighboringTiles||(l.neighboringTiles=this._getNeighboringTiles(l.tileID));const S=x?p:s.q.getImageData(p,T),M={uid:l.uid,tileID:l.tileID,source:this.id,type:this.t
15ype,scope:this.scope,rawImageData:S,encoding:this.encoding,padding:T};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadTile",M,c.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(l){const t=l.canonical,n=Math.pow(2,t.z),c=(t.x-1+n)%n,d=t.x===0?l.wrap-1:l.wrap,p=(t.x+1+n)%n,m=t.x+1===n?l.wrap+1:l.wrap,y={};return y[new s.aM(l.overscaledZ,d,t.z,c,t.y).key]={backfilled:!1},y[new s.aM(l.overscaledZ,m,t.z,p,t.y).key]={backfilled:!1},t.y>0&&(y[new s.aM(l.overscaledZ,d,t.z,c,t.y-1).key]={backfilled:!1},y[new s.aM(l.overscaledZ,l.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},y[new s.aM(l.overscaledZ,m,t.z,p,t.y-1).key]={backfilled:!1}),t.y+1<n&&(y[new s.aM(l.overscaledZ,d,t.z,c,t.y+1).key]={backfilled:!1},y[new s.aM(l.overscaledZ,l.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},y[new s.aM(l.overscaledZ,m,t.z,p,t.y+1).key]={backfilled:!1}),y}},"raster-array":ko,geojson:class extends s.E{constructor(l,t,n,c){super(),this.id=l,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=n.getActor(),this.setEventedParent(c),this._data=t.data,this._options=s.h({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.minzoom!==void 0&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const d=s.aj/this.tileSize;this.workerOptions=s.h({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*d,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*d,extent:s.aj,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:s.aj,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*d,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic},t.workerOptions)}onAdd(l){this.map=l,this.setData(this._data)}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){if(!this._options.dynamic)return this.fire(new s.z(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof l!="string"&&(l.type==="Feature"&&(l={type:"FeatureCollection",features:[l]}),l.type!=="FeatureCollection"))return this.fire(new s.z(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof l!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const n of this._data.features)t.set(n.id,n);for(const n of l.features)t.set(n.id,n);this._data.features=[...t.values()]}else this._data=l;return this._updateWorkerData(!0),this}getClusterExpansionZoom(l,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterChildren(l,t){return this.actor.send("geojson.getClusterChildren",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterLeaves(l,t,n,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:l,limit:t,offset:n},c),this}_updateWorkerData(l=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new s.A("dataloading",{dataType:"source"})),this._loaded=!1;const t=s.h({append:l},this.workerOptions);t.scope=this.scope;const n=this._data;typeof n=="string"?(t.request=this.map._requestManager.transformRequest(s.q.resolveURL(n),s.R.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(n),this._pendingLoad=this.actor.send(`${this.type}.loadData`,t,(c,d)=>{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new s.z(c));else{const p={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(p.resourceTiming=d.resourceTiming[this.id]),l&&(this._partialReload=!0),this.fire(new s.A("data",p)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(l),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const l=s.C(this.id,this.scope);this.map.style.clearSource(l),this._updateWorkerData()}loadTile(l,t){const n=l.actor?"reloadTile":"loadTile";l.actor=this.actor;const c=this.map.style?this.map.style.getLut(this.scope):null,d=c?{image:c.image.clone()}
15:null,p=this._partialReload,m={type:this.type,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:d,scope:this.scope,pixelRatio:s.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:l.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:p,worldview:this.map.getWorldview()};l.request=this.actor.send(n,m,(y,x)=>p&&!x?(l.state="loaded",t(null)):(delete l.request,l.destroy(),l.aborted?t(null):y?t(y):(l.loadVectorData(x,this.map.painter,n==="reloadTile"),t(null))),void 0,n==="loadTile")}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l,t){this.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id,scope:this.scope}),l.destroy()}onRemove(l){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return s.h({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends s.aP{constructor(l,t,n,c){super(l,t,n,c),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const l=this.options;this.urls=[];for(const t of l.urls)this.urls.push(this.map._requestManager.transformRequest(t,s.R.Source).url);s.aQ(this.urls,(t,n)=>{this._loaded=!0,t?this.fire(new s.z(t)):n&&(this.video=n,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){const t=this.video.seekable;l<t.start(0)||l>t.end(0)?this.fire(new s.z(new s.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,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 l=this.map.painter.context,t=l.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new s.T(l,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(l)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:s.aP,model:class extends s.E{constructor(l,t,n,c){super(),this.id=l,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const l=[];for(const t in this._options.models){const n=this._options.models[t],c=s.aS(this.map._requestManager.transformRequest(n.uri,s.R.Model).url).then(d=>{if(!d)return;const p=s.aT(d),m=new s.aU(t,n.position,n.orientation,p);m.computeBoundsAndApplyParent(),this.models.push(m)}).catch(d=>{this.fire(new s.z(new Error(`Could not load model ${t} from ${n.uri}: ${d.message}`)))});l.push(c)}Promise.allSettled(l).then(()=>{this._loaded=!0,this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(t=>{this._loaded=!0,this.fire(new s.z(new Error(`Could not load models: ${t.message}`)))})}onAdd(l){this.map=l,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(l,t){}serialize(){return this._options}},"batched-model":class extends s.E{constructor(l,t,n,c){super(),this.type="batched-model",this.id=l,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=n,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(c)}onAdd(l){this.map=l,this.load()}reload(){this.cancelTileJSONRequest();const l=s.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(l))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(l){this._loaded=!1,this.fire(new s.A("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview();this._tileJSONRequest=wr(this._options,this.map._requestManager,t,n,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),n&&n.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new s.z(c))):d&&(s.h(this,d),d.bounds&&(this.tileBounds=new kr(d.bounds,this.minzoom,this.maxzoom)),Hr(d.tiles,this.map._requestManager._customAccessToken),this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))),l&&l(c)})}hasTransition(){return!1}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loaded(){return this._loaded}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(n,s.R.Tile),data:void 0,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.t
15ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:l.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:s.q.devicePixelRatio,promoteId:this.promoteId};if(l.actor&&l.state!=="expired")if(l.state==="loading")l.reloadCallback=t;else{if(l.buckets){const p=Object.values(l.buckets);for(const m of p)m.dirty=!0;return void(l.state="loaded")}l.request=l.actor.send("reloadTile",c,d.bind(this))}else l.actor=this.dispatcher.getActor(),l.request=l.actor.send("loadTile",c,d.bind(this),void 0,!0);function d(p,m){return l.aborted?t(null):p&&p.status!==404?t(p):(this.map._refreshExpiredTiles&&m&&l.setExpiryData(m),l.loadModelData(m,this.map.painter),l.state="loaded",void t(null))}}serialize(){return s.h({},this._options)}},canvas:class extends s.aP{constructor(l,t,n,c){super(l,t,n,c),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(p=>typeof p!="number"))||this.fire(new s.z(new s.V(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.z(new s.V(`sources.${l}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new s.z(new s.V(`sources.${l}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new s.z(new s.V(`sources.${l}`,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 s.z(new s.V(`sources.${l}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new s.z(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(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(l){this.pause()}prepare(){let l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!l&&!this._playing||this.texture instanceof s.aR||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new s.T(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}},custom:class extends s.E{constructor(l,t,n,c){super(),this.id=l,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=t,this.setEventedParent(c),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new s.z(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new s.z(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new kr(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.clearTiles=this._clearTiles.bind(this),t.coveringTiles=this._coveringTiles.bind(this),s.h(this,s.aF(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return s.aF(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(l){this.map=l,this._loaded=!1,this.fire(new s.A("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(l),this.load()}onRemove(l){this._implementation.onRemove&&this._implementation.onRemove(l)}hasTile(l){if(this._implementation.hasTile){const{x:t,y:n,z:c}=l.canonical;return this._implementation.hasTile({x:t,y:n,z:c})}return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,t){const{x:n,y:c,z:d}=l.tileID.canonical,p=new AbortController;l.request=Promise.resolve(this._implementation.loadTile({x:n,y:c,z:d},{signal:p.signal})).then((function(m){return delete l.request,l.aborted?(l.state="unloaded",t(null)):m===void 0?(l.state="errored",t(null)):m===null?(this.loadTileData(l,{width:this.tileSize,height:this.tileSize,data:null}),l.state="loaded",t(null)):function(y){return y instanceof ImageData||y instanceof HTMLCanvasElement||y instanceof ImageBitmap||y instanceof HTMLImageElement}(m)?(this.loadTileData(l,m),l.state="loaded",void t(null)):(l.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(m=>{m.name!=="AbortError"&&(l.state="errored",t(m))}),l.request.cancel=()=>p.abort()}loadTileData(l,t){l.setTexture(t,this.map.painter)}unloadTile(l,t){if(l.texture&&l.texture instanceof s.T?(l.destroy(!0),l.texture&&l.texture instanceof s.T&&this.map.painter.saveTileTexture(l.texture)):l.destroy(),this._implementation.unloadTile){const{x:n,y:c,z:d}=l.tileID.canonical;this._implementation.unloadTile({x:n,y:c,z:d})}t&&t()}abortTile(l,t){l.request&&l.request.cancel&&(l.request.cancel(),delete l.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}
vendor: 4,585 bytes, line 15
15).map(l=>({x:l.canonical.x,y:l.canonical.y,z:l.canonical.z}))}_clearTiles(){const l=s.C(this.id,this.scope);this.map.style.clearSource(l)}_update(){this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))}}},ja=function(l,t,n,c){const d=new Ul[t.type](l,t,n,c);if(d.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${d.id}`);return s.aV(["load","abort","unload","serialize","prepare"],d),d};function Ga(l,t,n=""){return`${n}:${t.id||""}:${t.layer.id}:${function(c){if("layerId"in c)return`layer:${c.layerId}`;{const{featuresetId:d,importId:p}=c;return`featureset:${d}${p?`:import:${p}`:""}`}}(l.target)}`}function jl(l,t,n,c=""){if(l.uniqueFeatureID){const d=Ga(l,t,c);if(n.has(d))return!0;n.add(d)}return!1}function Gl(l,t,n,c,d=!1){const p=t.sourceCache.transform,m=t.sourceCache.tilesIn(l,t.has3DLayers,d);m.sort(ql);const y=[];for(const x of m){const T=x.tile.queryRenderedFeatures(t,x,n,c,p,d);Object.keys(T).length&&y.push({wrappedTileID:x.tile.tileID.wrapped().key,queryResults:T})}return y.length===0?{}:function(x){const T={},S={};for(const M of x){const E=M.queryResults,C=M.wrappedTileID,D=S[C]=S[C]||{};for(const z in E){const F=E[z],L=D[z]=D[z]||{},N=T[z]=T[z]||[];for(const j of F)L[j.featureIndex]||(L[j.featureIndex]=!0,N.push(j))}}return T}(y)}function us(l,t,n,c,d,p){const m={},y=c.queryRenderedSymbols(l),x=[];for(const T of Object.keys(y).map(Number))x.push(d[T]);x.sort(ql);for(const T of x){const S=T.featureIndex.lookupSymbolFeatures(y[T.bucketInstanceId],T.bucketIndex,T.sourceLayerIndex,t,n,p);for(const M in S){const E=m[M]=m[M]||[],C=S[M];C.sort((D,z)=>{const F=T.featureSortOrder;if(F){const L=F.indexOf(D.featureIndex);return F.indexOf(z.featureIndex)-L}return z.featureIndex-D.featureIndex});for(const D of C)E.push(D)}}return m}function qa(l,t){const n=l.getRenderableIds().map(p=>l.getTileByID(p)),c=[],d={};for(let p=0;p<n.length;p++){const m=n[p],y=m.tileID.canonical.key;d[y]||(d[y]=!0,m.querySourceFeatures(c,t))}return c}function ql(l,t){const n=l.tileID,c=t.tileID;return n.overscaledZ-c.overscaledZ||n.canonical.y-c.canonical.y||n.wrap-c.wrap||n.canonical.x-c.canonical.x}function Hn(l,t){const n={};if(!t)return n;for(const c of l){const d=c.layerIds.map(p=>t.getLayer(p)).filter(Boolean);if(d.length!==0){c.layers=d,c.stateDependentLayerIds&&(c.stateDependentLayers=c.stateDependentLayerIds.map(p=>d.filter(m=>m.id===p)[0]));for(const p of d)n[p.fqid]=c}}return n}const bn=32,On=33,_o=new Uint16Array(8184);for(let l=0;l<2046;l++){let t=l+2,n=0,c=0,d=0,p=0,m=0,y=0;for(1&t?d=p=m=bn:n=c=y=bn;(t>>=1)>1;){const T=n+d>>1,S=c+p>>1;1&t?(d=n,p=c,n=m,c=y):(n=d,c=p,d=m,p=y),m=T,y=S}const x=4*l;_o[x+0]=n,_o[x+1]=c,_o[x+2]=d,_o[x+3]=p}const $n=new Uint16Array(2178),go=new Uint8Array(1089),Ha=new Uint16Array(1089);function Jn(l){return l===0?-.03125:l===32?.03125:0}const $a={type:2,extent:s.aj,loadGeometry:()=>[[new s.P(0,0),new s.P(s.aj+1,0),new s.P(s.aj+1,s.aj+1),new s.P(0,s.aj+1),new s.P(0,0)]]};class ds{constructor(t,n,c,d,p,m){this.tileID=t,this.uid=s.a$(),this.uses=0,this.tileSize=n,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=p,d&&d.style&&(this._lastUpdatedBrightness=d.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection),this.worldview=m}registerFadeDuration(t){const n=t+this.timeAdded;n<s.q.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=s.aW(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,n,c){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=Hn(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const p=this.buckets[d];if(p instanceof s.b1){if(this.hasSymbolBuckets=!0,!c)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const p=this.buckets[d];if(p instanceof s.b1&&p.hasRTLText){this.hasRTLText=!0,s.b2();break}}this.queryPadding=0;for(const d in this.buckets){const p=this.buckets[d],m=n.style.getOwnLayer(d);if(!m)continue;
15const y=m.queryRadius(p);this.queryPadding=Math.max(this.queryPadding,y)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new s.b0}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),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(t,n,c){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets=Object.assign({},this.buckets,Hn(t.buckets,n.style)),t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t){for(const d in this.buckets){const p=this.buckets[d];p.uploadPending()&&p.upload(t)}const n=t.gl,c=this.imageAtlas;c&&!c.uploaded&&(this.imageAtlasTexture=new s.T(t,c.image,n.RGBA8,{useMipmap:!!c.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new s.T(t,this.glyphAtlasImage,n.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new s.T(t,this.lineAtlas.image,n.R8),this.lineAtlas.uploaded=!0)}prepare(t,n,c){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,c),!n||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const d=n.style.getBrightness();(this._lastUpdatedBrightness||d)&&(this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this.updateBuckets(n,this._lastUpdatedBrightness!==d),this._lastUpdatedBrightness=d))}queryRenderedFeatures(t,n,c,d,p,m){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const y=function(x,T){const S=s.bn([],[.5*x.width,.5*-x.height,1]);return s.bo(S,S,[1,-1,0]),s.az(S,S,x.calculateProjMatrix(T.toUnwrapped())),Float32Array.from(S)}(p,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:n,pixelPosMatrix:y,transform:d,availableImages:c,tileTransform:this.tileTransform,worldview:this.worldview})}querySourceFeatures(t,n){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const d=c.loadVTLayers(),p=n?n.sourceLayer:"",m=d._geojsonTileLayer||d[p];if(!m)return;const y=s.b3(n&&n.filter),{z:x,x:T,y:S}=this.tileID.canonical,M={z:x,x:T,y:S};for(let E=0;E<m.length;E++){const C=m.feature(E);if(y.needGeometry){const F=s.b4(C,!0);if(!y.filter(new s.aa(this.tileID.overscaledZ,{worldview:this.worldview}),F,this.tileID.canonical))continue}else if(!y.filter(new s.aa(this.tileID.overscaledZ,{worldview:this.worldview}),C))continue;const D=c.getId(C,p),z=new s.b5(C,x,T,S,D);z.tile=M,t.push(z)}}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(t){const n=this.expirationTime;if(t.cacheControl){const c=s.b6(t.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const c=Date.now();let d=!1;if(this.expirationTime>c)d=!1;else if(n)if(this.expirationTime<n)d=!0;else{const p=this.expirationTime-n;p?this.expirationTime=c+Math.max(p,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}refreshFeatureState(t){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&t&&this.updateBuckets(t)}updateBuckets(t,n){if(!this.latestFeatureIndex||!t.style)return;const c=this.latestFeatureIndex.loadVTLayers(),d=t.style.listImages(),p=t.style.getBrightness();for(const m in this.buckets){if(!t.style.hasLayer(m))continue;const y=this.buckets[m],x=y.layers[0],T=x.sourceLayer||"_geojsonTileLayer",S=c[T],M=t.style.getLayerSourceCache(x);let E={};M&&(E=M._state.getState(T,void 0));const C=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},D=Object.keys(E).length>0&&!n;D&&!y.stateDependentLayers.length&&!n||y.update(E,S,d,C,D?y.stateDependentLayers:y.layers,n,p),(y instanceof s.b7||y instanceof s.b8)&&t._terrain&&t._terrain.enabled&&M&&y.uploadPending()&&t._terrain._clearRenderCacheForTile(M.id,this.tileID);const z=t&&t.style&&t.style.getOwnLayer(m);z&&(this.queryPadding=Math.max(this.queryPadding,z.queryRadius(y)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<s.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=s.q.now()+t}setTexture(t,n){const c=n.context,d=c.gl;this.texture=this.texture||n.getTileTexture(t.width),this.texture&&this.texture instanceof s.T?this.texture.update(t):(this.texture=new s.T(c,t,d.RGBA8,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}
vendor: 34,050 bytes, line 15
15setDependencies(t,n){const c={};for(const d of n)c[d]=!0;this.dependencies[t]=c}hasDependency(t,n){for(const c of t){const d=this.dependencies[c];if(d){for(const p of n)if(d[p])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,n){if(!n||n.name==="mercator"||this._tileDebugBuffer)return;const c=s.b9($a,this.tileID.canonical,this.tileTransform)[0],d=new s.ba,p=new s.bb;for(let m=0;m<c.length;m++){const{x:y,y:x}=c[m];d.emplaceBack(y,x),p.emplaceBack(m)}p.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(p),this._tileDebugBuffer=t.createVertexBuffer(d,s.bc.members),this._tileDebugSegments=s.bd.simpleSegment(0,0,d.length,p.length)}_makeTileBoundsBuffers(t,n){if(this._tileBoundsBuffer||!n||n.name==="mercator")return;const c=s.b9($a,this.tileID.canonical,this.tileTransform)[0];let d,p;if(this.isRaster){const m=function(y,x){const T=s.aW(y,x),S=Math.pow(2,y.z);for(let F=0;F<On;F++)for(let L=0;L<On;L++){const N=s.aX((y.x+(L+Jn(L))/bn)/S),j=s.aY((y.y+(F+Jn(F))/bn)/S),q=x.project(N,j),X=F*On+L;$n[2*X+0]=Math.round((q.x*T.scale-T.x)*s.aj),$n[2*X+1]=Math.round((q.y*T.scale-T.y)*s.aj)}go.fill(0),Ha.fill(0);for(let F=2045;F>=0;F--){const L=4*F,N=_o[L+0],j=_o[L+1],q=_o[L+2],X=_o[L+3],ee=N+q>>1,ie=j+X>>1,Y=ee+ie-j,K=ie+N-ee,J=j*On+N,fe=X*On+q,se=ie*On+ee,Ie=Math.hypot(($n[2*J+0]+$n[2*fe+0])/2-$n[2*se+0],($n[2*J+1]+$n[2*fe+1])/2-$n[2*se+1])>=16;go[se]=go[se]||(Ie?1:0),F<1022&&(go[se]=go[se]||go[(j+K>>1)*On+(N+Y>>1)]||go[(X+K>>1)*On+(q+Y>>1)])}const M=new s.aZ,E=new s.a_;let C=0;function D(F,L){const N=L*On+F;return Ha[N]===0&&(M.emplaceBack($n[2*N+0],$n[2*N+1],F*s.aj/bn,L*s.aj/bn),Ha[N]=++C),Ha[N]-1}function z(F,L,N,j,q,X){const ee=F+N>>1,ie=L+j>>1;if(Math.abs(F-q)+Math.abs(L-X)>1&&go[ie*On+ee])z(q,X,F,L,ee,ie),z(N,j,q,X,ee,ie);else{const Y=D(F,L),K=D(N,j),J=D(q,X);E.emplaceBack(Y,K,J)}}return z(0,0,bn,bn,bn,0),z(bn,bn,0,0,0,bn),{vertices:M,indices:E}}(this.tileID.canonical,n);d=m.vertices,p=m.indices}else{d=new s.aZ,p=new s.a_;for(const{x:y,y:x}of c)d.emplaceBack(y,x,0,0);const m=s.be(d.int16.subarray(0,4*d.length),void 0,4);for(let y=0;y<m.length;y+=3)p.emplaceBack(m[y],m[y+1],m[y+2])}this._tileBoundsBuffer=t.createVertexBuffer(d,s.bf.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(p),this._tileBoundsSegments=s.bd.simpleSegment(0,0,d.length,p.length)}_makeGlobeTileDebugBuffers(t,n){const c=n.projection;if(!c||c.name!=="globe"||n.freezeTileCoverage)return;const d=this.tileID.canonical,p=s.bg(d,n),m=s.bh(p),y=s.ah(n.zoom);let x;y>0&&(x=s.bi(new Float64Array(16),n.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,d,n,m,x,y),this._makeGlobeTileDebugTextBuffer(t,d,n,m,x,y)}_globePoint(t,n,c,d,p,m,y){let x=s.bj(t,n,c);if(m){const T=1<<c.z,S=s.aD(d.center.lng),M=s.aH(d.center.lat),E=(c.x+.5)/T-S;let C=0;E>.5?C=-1:E<-.5&&(C=1);let D=(t/s.aj+c.x)/T+C,z=(n/s.aj+c.y)/T;D=(D-S)*d._pixelsPerMercatorPixel+S,z=(z-M)*d._pixelsPerMercatorPixel+M;const F=[D*d.worldSize,z*d.worldSize,0];s.ad(F,F,m),x=s.bk(x,F,y)}return s.ad(x,x,p)}_makeGlobeTileDebugBorderBuffer(t,n,c,d,p,m){const y=new s.ba,x=new s.bb,T=new s.bl,S=(E,C,D,z,F)=>{const L=(D-E)/(F-1),N=(z-C)/(F-1),j=y.length;for(let q=0;q<F;q++){const X=E+q*L,ee=C+q*N;y.emplaceBack(X,ee);const ie=this._globePoint(X,ee,n,c,d,p,m);T.emplaceBack(ie[0],ie[1],ie[2]),x.emplaceBack(j+q)}},M=s.aj;S(0,0,M,0,16),S(M,0,M,M,16),S(M,M,0,M,16),S(0,M,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(x),this._tileDebugBuffer=t.createVertexBuffer(y,s.bc.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(T,s.bm.members),this._tileDebugSegments=s.bd.simpleSegment(0,0,y.length,x.length)}_makeGlobeTileDebugTextBuffer(t,n,c,d,p,m){const y=s.aj/4,x=new s.ba,T=new s.a_,S=new s.bl,M=25;T.reserve(32),x.reserve(M),S.reserve(M);const E=(C,D)=>M*C+D;for(let C=0;C<M;C++){const D=C*y;for(let z=0;z<M;z++){const F=z*y;x.emplaceBack(F,D);const L=this._globePoint(F,D,n,c,d,p,m);S.emplaceBack(L[0],L[1],L[2])}}for(let C=0;C<4;C++)for(let D=0;D<4;D++){const z=E(C,D),F=E(C,D+1),L=E(C+1,D),N=E(C+1,D+1);T.emplaceBack(z,F,L),T.emplaceBack(L,F,N)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(T),this._tileDebugTextBuffer=t.createVertexBuffer(x,s.bc.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(S,s.bm.members),this._tileDebugTextSegments=s.bd.simpleSegment(0,0,M,32)}destroy(t=!1){for(const n in this.buckets)this.buckets[n].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),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),!t&&this.texture&&this.texture instanceof s.T&&(this.texture.destroy(),delete this.texture),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"}}s.bp.setPbf(s.bq);class Us extends ds{constructor(t,n,c,d,p){super(t,n,c,d,p),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexturePerLayer(t,n,c){const d=c.context,p=d.gl;let m=this.texturePerLayer.get(t)||c.getTileTexture(n.width);m&&m instanceof s.T?m.update(n,{premultiply:!1}):m=new s.T(d,n,p.RGBA8,{premultiply:!1}),this.texturePerLayer.has(t)||this.texturePerLayer.set(t,m)}flushQueues(t){const n=this._workQueuePerLayer.get(t)||[],c=this._fetchQueuePerLayer.get(t)||[];for(;n.length;)n.pop()();for(;c.length;)c.pop()()}flushAllQueues(){for(const t of this._workQueuePerLayer.keys()){const n=this._workQueuePerLayer.get(t)||[];for(;n.length;)n.pop()()}for(const t of this._fetchQueuePerLayer.keys()){const n=this._fetchQueuePerLayer.get(t)||[];for(;n.length;)n.pop()()}}fetchHeader(t=16384,n){const c=this._mrt=new s.bp(30),d=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=s.br(d,(p,m,y,x)=>{if(p)n(p);else try{const T=c.getHeaderLength(m);if(T>t)return void(this.request=this.fetchHeader(T,n));c.parseHeader(m),this._isHeaderLoaded=!0;let S=0;for(const M of Object.values(c.layers))S=Math.max(S,M.dataIndex[M.dataIndex.length-1].lastByte);m.byteLength>=S&&(this.entireBuffer=m),n(null,this.entireBuffer||m,y,x)}catch(T){n(T)}}),this.request}fetchBand(t,n,c,d){const p=this._mrt;if(!this._isHeaderLoaded||!p)return void d(new Error("Tile header is not ready"));const m=this.actor;if(!m)return void d(new Error("Can't fetch tile band without an actor"));let y;const x=(E,C)=>{if(y.complete(E,C),E)return void d(E);this.updateTextureDescriptor(t,n,c);const D=this.textureDescriptorPerLayer.get(n);d(null,D&&D.img)},T=(E,C)=>{if(E)return d(E);const D=m.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:C,task:y},x,void 0,!0),z=this._workQueuePerLayer.get(n)||[];z.push(()=>{D&&D.cancel(),y.cancel()}),this._workQueuePerLayer.has(n)||this._workQueuePerLayer.set(n,z)},S=p.getLayer(t);if(!S)return void d(new Error(`Unknown sourceLayer "${t}"`));if(S.hasDataForBand(c)){this.updateTextureDescriptor(t,n,c);const E=this.textureDescriptorPerLayer.get(n);return void d(null,E?E.img:null)}const M=S.getDataRange([c]);if(y=p.createDecodingTask(M),!y||y.tasks.length)if(this.flushQueues(n),this.entireBuffer)T(null,this.entireBuffer.slice(M.firstByte,M.lastByte+1));else{const E=Object.assign({},this.requestParams,{headers:{Range:`bytes=${M.firstByte}-${M.lastByte}`}}),C=s.br(E,T),D=this._fetchQueuePerLayer.get(n)||[];D.push(()=>{C.cancel(),y.cancel()}),this._fetchQueuePerLayer.has(n)||this._fetchQueuePerLayer.set(n,D)}else d(null)}updateNeeded(t,n){return(!this.textureDescriptorPerLayer.get(t)||this.textureDescriptorPerLayer.get(t).band!==n)&&this.state!=="errored"}updateTextureDescriptor(t,n,c){if(!this._mrt)return;const d=this._mrt.getLayer(t);if(!d||!d.hasBand(c)||!d.hasDataForBand(c))return;const{bytes:p,tileSize:m,buffer:y,offset:x,scale:T}=d.getBandView(c),S=m+2*y,M=new s.r({width:S,height:S},p),E=this.texturePerLayer.get(n);E&&E instanceof s.T&&E.update(M,{premultiply:!1}),this.textureDescriptorPerLayer.set(n,{layer:t,band:c,img:M,buffer:y,offset:x,tileSize:m,format:d.pixelFormat,mix:[T,256*T,65536*T,16777216*T]})}destroy(t=!1){if(super.destroy(t),delete this._mrt,!t)for(const n of this.texturePerLayer.values())n&&n instanceof s.T&&n.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class hh{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,c){const d=t.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const p={value:n,timeout:void 0};if(c!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},c)),this.data[d].push(p),this.order.push(d),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const c=t.wrapped().key,d=n===void 0?0:this.data[c].indexOf(n),p=this.data[c][d];return this.data[c].splice(d,1),p.timeout&&clearTimeout(p.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(p.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const c in this.data)for(const d of this.data[c])t(d.value)||n.push(d);for(const c of n)this.remove(c.value.tileID,c)}}class uh{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,c){const d=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][d]=this.stateChanges[t][d]||{},s.h(this.stateChanges[t][d],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==d&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]={};for(const p in this.state[t][d])c[p]||(this.deletedStates[t][d][p]=null)}else for(const p in c)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][p]===null&&delete this.deletedStates[t][d][p]}removeFeatureState(t,n,c){if(this.deletedStates[t]===null)return;const d=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},c&&n!==void 0)this.deletedStates[t][d]!==null&&(this.deletedStates[t][d]=this.deletedStates[t][d]||{},this.deletedStates[t][d][c]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][d])for(c in this.deletedStates[t][d]={},this.stateChanges[t][d])this.deletedStates[t][d][c]=null;else this.deletedStates[t][d]=null;else this.deletedStates[t]=null}getState(t,n){const c=this.state[t]||{},d=this.stateChanges[t]||{},p=this.deletedStates[t];if(p===null)return{};if(n!==void 0){const y=String(n),x=s.h({},c[y],d[y]);if(p){const T=p[n];if(T===null)return{};for(const S in T)delete x[S]}return x}const m=s.h({},c,d);if(p)for(const y in p)delete m[y];return m}initializeTileState(t,n){t.refreshFeatureState(n)}coalesceChanges(t,n){const c={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const p={};for(const m in this.stateChanges[d])this.state[d][m]||(this.state[d][m]={}),s.h(this.state[d][m],this.stateChanges[d][m]),p[m]=this.state[d][m];c[d]=p}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const p={};if(this.deletedStates[d]===null)for(const m in this.state[d])p[m]={},this.state[d][m]={};else for(const m in this.deletedStates[d]){if(this.deletedStates[d][m]===null)this.state[d][m]={};else if(this.state[d][m])for(const y of Object.keys(this.deletedStates[d][m]))delete this.state[d][m][y];p[m]=this.state[d][m]}c[d]=c[d]||{},s.h(c[d],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(const d in t)t[d].refreshFeatureState(n)}}class nn extends s.E{constructor(t,n,c){super(),this.id=t,this._onlySymbols=c,n.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),n.on("error",()=>{this._sourceErrored=!0}),this._source=n,this._tiles={},this._cache=new hh(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=n.minTileCacheSize,this._maxTileCacheSize=n.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new uh,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(t){this.map=t,this._minTileCacheSize=this._minTileCacheSize===void 0&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles)if(!this._tiles[t].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,n){return t.isSymbolTile=this._onlySymbols,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t)}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t)}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const c=this._tiles[n];c.upload(t),c.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(ps).map(t=>t.key)}getRenderableIds(t,n){const c=[];for(const d in this._tiles)this._isIdRenderable(+d,t,n)&&c.push(this._tiles[d]);return t?c.sort((d,p)=>{const m=d.tileID,y=p.tileID,x=new s.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),T=new s.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return m.overscaledZ-y.overscaledZ||T.y-x.y||T.x-x.x}).map(d=>d.tileID.key):c.map(d=>d.tileID).sort(ps).map(d=>d.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())&&(c||!this._shadowCasterTiles[t])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(+t,"reloading")}}_reloadTile(t,n){const c=this._tiles[t];c&&(c.state!=="loading"&&(c.state=n),this._loadTile(c,this._tileLoaded.bind(this,c,t,n)))}_tileLoaded(t,n,c,d){if(d)if(t.state="errored",d.status!==404)this._source.fire(new s.z(d,{tile:t}));else{if(this._source.fire(new s.A("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const p=this.map.painter.terrain;this.update(this.transform,p.getScaledDemTileSize(),!0),p.resetTileLookupCache(this.id)}else this.update(this.transform)}else t.timeAdded=s.q.now(),c==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new s.A("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const n=this.getRenderableIds();for(let d=0;d<n.length;d++){const p=n[d];if(t.neighboringTiles&&t.neighboringTiles[p]){const m=this.getTileByID(p);c(t,m),c(m,t)}}function c(d,p){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let m=p.tileID.canonical.x-d.tileID.canonical.x;const y=p.tileID.canonical.y-d.tileID.canonical.y,x=Math.pow(2,d.tileID.canonical.z),T=p.tileID.key;m===0&&y===0||Math.abs(y)>1||(Math.abs(m)>1&&(Math.abs(m+x)===1?m+=x:Math.abs(m-x)===1&&(m-=x)),p.dem&&d.dem&&(d.dem.backfillBorder(p.dem,m,y),d.neighboringTiles&&d.neighboringTiles[T]&&(d.neighboringTiles[T].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,c,d){for(const p in this._tiles){let m=this._tiles[p];if(d[p]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>c)continue;let y=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const T=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[T.key],m&&m.hasData()&&(y=T)}let x=y;for(;x.overscaledZ>n;)if(x=x.scaledTo(x.overscaledZ-1),t[x.key]){d[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const c=this._loadedParentTiles[t.key];return c&&c.tileID.overscaledZ>=n?c:null}for(let c=t.overscaledZ-1;c>=n;c--){const d=t.scaledTo(c),p=this._getLoadedTile(d);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,n){n=n||this._source.tileSize;const c=Math.ceil(t.width/n)+1,d=Math.ceil(t.height/n)+1,p=Math.floor(c*d*5),m=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,p):p,y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(y)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const c={};for(const d in this._tiles){const p=this._tiles[d];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),c[p.tileID.key]=p}this._tiles=c;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(+d,this._tiles[d])}}update(t,n,c,d,p){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;this.updateCacheSize(t,n),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const m=this._source.type==="batched-model";let y,x=this._source.maxzoom;const T=this.map&&this.map.painter?this.map.painter._terrain:null;if(T&&T.sourceCache===this&&T.attenuationRange()){const E=T.attenuationRange()[0],C=Math.floor(E)-Math.log2(T.getDemUpscale());x>C&&(x=C)}if(this.used||this.usedForTerrain){if(this._source.tileID)y=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(E=>new s.aM(E.canonical.z,E.wrap,E.canonical.z,E.canonical.x,E.canonical.y));else if(this.tileCoverLift!==0){const E=t.clone();E.tileCoverLift=this.tileCoverLift,y=E.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.minzoom<=1&&t.projection.name==="globe"&&(y.push(new s.aM(1,0,1,0,0)),y.push(new s.aM(1,0,1,1,0)),y.push(new s.aM(1,0,1,0,1)),y.push(new s.aM(1,0,1,1,1)))}else if(y=t.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.hasTile){const E=this._source.hasTile.bind(this._source);y=y.filter(C=>E(C))}}else y=[];if(y.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Za(this._source.type)){const E=t.coveringZoomLevel({tileSize:n||this._source.tileSize,roundZoom:this._source.roundZoom&&!c}),C=Math.min(E,this._source.maxzoom);if(m){const D=t.extendTileCover(y,C);for(const z of D)y.push(z)}else if(p){const D=t.extendTileCoverToNearPlane(y,this.transform.getFrustum(C),C);for(const z of D)y.push(z)}else if(this.castsShadows&&d){const D=t.extendTileCover(y,C,d);for(const z of D)this._shadowCasterTiles[z.key]=!0,y.push(z)}}const S=this._updateRetainedTiles(y);if(Za(this._source.type)&&y.length!==0){const E={},C={},D=Object.keys(S);for(const F of D){const L=S[F],N=this._tiles[F];if(!N||N.fadeEndTime&&N.fadeEndTime<=s.q.now())continue;const j=this.findLoadedParent(L,Math.max(L.overscaledZ-nn.maxOverzooming,this._source.minzoom));j&&(this._addTile(j.tileID),E[j.tileID.key]=j.tileID),C[F]=L}const z=y[y.length-1].overscaledZ;for(const F in this._tiles){const L=this._tiles[F];if(S[F]||!L.hasData())continue;let N=L.tileID;for(;N.overscaledZ>z;){N=N.scaledTo(N.overscaledZ-1);const j=this._tiles[N.key];if(j&&j.hasData()&&C[N.key]){S[F]=L.tileID;break}}}for(const F in E)S[F]||(this._coveredTiles[F]=!0,S[F]=E[F])}for(const E in S)this._tiles[E].clearFadeHold();const M=s.bs(this._tiles,S);for(const E of M){const C=this._tiles[E];C.hasSymbolBuckets&&!C.holdingForFade()?C.setHoldDuration(this.map._fadeDuration):C.hasSymbolBuckets&&!C.symbolFadeFinished()||this._removeTile(+E)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const n={};if(t.length===0)return n;const c={},d=t.reduce((T,S)=>Math.min(T,S.overscaledZ),1/0),p=t[0].overscaledZ,m=Math.max(p-nn.maxOverzooming,this._source.minzoom),y=Math.max(p+nn.maxUnderzooming,this._source.minzoom),x={};for(const T of t){const S=this._addTile(T);n[T.key]=T,S.hasData()||d<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,d,y,n);for(const T of t){let S=this._tiles[T.key];if(S.hasData())continue;if(T.canonical.z>=this._source.maxzoom){const E=T.children(this._source.maxzoom)[0],C=this.getTile(E);if(C&&C.hasData()){n[E.key]=E;continue}}else{const E=T.children(this._source.maxzoom);if(n[E[0].key]&&n[E[1].key]&&n[E[2].key]&&n[E[3].key])continue}let M=S.wasRequested();for(let E=T.overscaledZ-1;E>=m;--E){const C=T.scaledTo(E);if(c[C.key]||(c[C.key]=!0,S=this.getTile(C),!S&&M&&(S=this._addTile(C)),S&&(n[C.key]=C,M=S.wasRequested(),S.hasData())))break}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let c,d=this._tiles[t].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}n.push(d.key);const p=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(p),c)break;d=p}for(const p of n)this._loadedParentTiles[p]=c}}_addTile(t){let n=this._tiles[t.key];if(n)return n.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const c=!!n;if(!c){const d=this.map?this.map.painter:null,p=this._source.tileSize*t.overscaleFactor();n=this._source.type==="raster-array"?new Us(t,p,this.transform.tileZoom,d,this._isRaster):new ds(t,p,this.transform.tileZoom,d,this._isRaster,this._source.worldview),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))}return n.uses++,this._tiles[t.key]=n,c||this._source.fire(new s.A("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const c=n.getExpiryTimeout();c&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},c))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"||n.state==="empty"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);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(t,n,c){const d=[],p=this.transform;if(!p)return d;const m=p.projection.name==="globe",y=s.aD(p.center.lng);for(const x in this._tiles){const T=this._tiles[x];if(c&&T.clearQueryDebugViz(),T.holdingForFade())continue;let S;if(m){const M=T.tileID.canonical;if(M.z===0){const E=[Math.abs(s.ay(y,...js(M,-1))-y),Math.abs(s.ay(y,...js(M,1))-y)];S=[0,2*E.indexOf(Math.min(...E))-1]}else{const E=[Math.abs(s.ay(y,...js(M,-1))-y),Math.abs(s.ay(y,...js(M,0))-y),Math.abs(s.ay(y,...js(M,1))-y)];S=[E.indexOf(Math.min(...E))-1]}}else S=[0];for(const M of S){const E=t.containsTile(T,p,n,M);E&&d.push(E)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,n){const c=this.getRenderableIds(t,n).map(p=>this._tiles[p].tileID),d=this.transform.projection.name==="globe";for(const p of c)p.projMatrix=this.transform.calculateProjMatrix(p.toUnwrapped()),p.expandedProjMatrix=d?this.transform.calculateProjMatrix(p.toUnwrapped(),!1,!0):p.projMatrix;return c}sortCoordinatesByDistance(t){const n=t.slice(),c=this.transform._camera.position,d=this.transform._camera.forward(),p={};for(const m of n){const y=1/(1<<m.canonical.z);p[m.key]=((m.canonical.x+.5)*y+m.wrap-c[0])*d[0]+((m.canonical.y+.5)*y-c[1])*d[1]-c[2]*d[2]}return n.sort((m,y)=>p[m.key]-p[y.key]),n}hasTransition(){if(this._source.hasTransition())return!0;if(Za(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=s.q.now())return!0}return!1}setFeatureState(t,n,c){this._state.updateState(t=t||"_geojsonTileLayer",n,c)}removeFeatureState(t,n,c){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,c)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,c){const d=this._tiles[t];d&&d.setDependencies(n,c)}reloadTilesForDependencies(t,n){for(const c in this._tiles)this._tiles[c].hasDependency(t,n)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(t,n))}_preloadTiles(t,n){if(!this._sourceLoaded){const x=()=>{this._sourceLoaded&&(this._source.off("data",x),this._preloadTiles(t,n))};return void this._source.on("data",x)}const c=new Map,d=Array.isArray(t)?t:[t],p=this.map.painter.terrain,m=this.usedForTerrain&&p?p.getScaledDemTileSize():this._source.tileSize;for(const x of d){const T=x.coveringTiles({tileSize:m,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const S of T)c.set(S.key,S);this.usedForTerrain&&x.updateElevation(!1)}const y=Array.from(c.values());s.bt(y,(x,T)=>{const S=new ds(x,this._source.tileSize*x.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(S,M=>{this._source.type==="raster-dem"&&S.dem&&this._backfillDEM(S),T(M,S)})},n)}}function ps(l,t){const n=Math.abs(2*l.wrap)-+(l.wrap<0),c=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||c-n||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function Za(l){return l==="raster"||l==="image"||l==="video"||l==="custom"}function js(l,t){const n=1<<l.z;return[l.x/n+t,(l.x+1)/n+t]}nn.maxOverzooming=10,nn.maxUnderzooming=3;class ld{constructor(t){this.style=t,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const t=!1,n=!1;for(const c in this.style._mergedLayers){const d=this.style._mergedLayers[c];if(d.type==="fill-extrusion"||d.type==="building")this.layers.push({layer:d,visible:t,visibilityChanged:n});else if(d.type==="model"){const p=this.style.getLayerSource(d);p&&p.type==="batched-model"&&this.layers.push({layer:d,visible:t,visibilityChanged:n})}}}onNewFrame(t){this.layersGotHidden=!1;for(const n of this.layers){const c=n.layer;let d=!1;c.type==="fill-extrusion"?d=!c.isHidden(t)&&c.paint.get("fill-extrusion-opacity")>0:c.type==="building"?d=!c.isHidden(t)&&c.paint.get("building-opacity")>0:c.type==="model"&&(d=!c.isHidden(t)&&c.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!d&&n.visible,n.visible=d}}updateZOffset(t,n){this.currentBuildingBuckets=[];for(const d of this.layers){const p=d.layer,m=this.style.getLayerSourceCache(p);let y=1;p.type==="fill-extrusion"?y=d.visible?p.paint.get("fill-extrusion-vertical-scale"):0:p.type==="building"&&(y=d.visible?p.paint.get("building-vertical-scale"):0);let x=m?m.getTile(n):null;if(!x&&m)for(const T in m._tiles){const S=m._tiles[T];if(n.canonical.isChildOf(S.tileID.canonical)){x=S;break}}this.currentBuildingBuckets.push({bucket:x?x.getBucket(p):null,tileID:x?x.tileID:n,verticalScale:y})}t.hasAnyZOffset=!1;let c=!1;for(let d=0;d<t.symbolInstances.length;d++){const p=t.symbolInstances.get(d),m=p.zOffset,y=this._getHeightAtTileOffset(n,p.tileAnchorX,p.tileAnchorY);p.zOffset=y!==Number.NEGATIVE_INFINITY?y:m,c||m===p.zOffset||(c=!0),t.hasAnyZOffset||p.zOffset===0||(t.hasAnyZOffset=!0)}c&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,n,c,d){let p=n,m=c;if(t.canonical.z!==d.canonical.z){const y=d.canonical,x=1/(1<<t.canonical.z-y.z);p=(n+t.canonical.x*s.aj)*x-y.x*s.aj|0,m=(c+t.canonical.y*s.aj)*x-y.y*s.aj|0}return{tileX:p,tileY:m}}_getHeightAtTileOffset(t,n,c){let d,p;for(let m=0;m<this.layers.length;++m){const y=this.layers[m].layer;if(y.type!=="fill-extrusion"&&y.type!=="building")continue;const{bucket:x,tileID:T,verticalScale:S}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:M,tileY:E}=this._mapCoordToOverlappingTile(t,n,c,T),C=x.getHeightAtTileCoord(M,E);C&&C.height!==void 0&&(C.hidden?d=C.height:p=Math.max(C.height*S,p||0))}if(p!==void 0)return p;for(let m=0;m<this.layers.length;++m){const y=this.layers[m];if(y.layer.type!=="model"||!y.visible)continue;const{bucket:x,tileID:T}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:S,tileY:M}=this._mapCoordToOverlappingTile(t,n,c,T),E=x.getHeightAtTileCoord(S,M);if(E&&!E.hidden)return E.height===void 0&&d!==void 0?Math.min(E.maxHeight,d)*E.verticalScale:E.height?E.height*E.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function cd(l,t){const n={};for(const c in l)c!=="ref"&&(n[c]=l[c]);return s.bu.forEach(c=>{c in t&&(n[c]=t[c])}),n}function Wa(l){l=l.slice();const t=Object.create(null);for(let n=0;n<l.length;n++)t[l[n].id]=l[n];for(let n=0;n<l.length;n++)"ref"in l[n]&&(l[n]=cd(l[n],t[l[n].ref]));return l}const Xt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function Hl(l,t,n){n.push({command:Xt.addSource,args:[l,t[l]]})}function Gs(l,t,n){t.push({command:Xt.removeSource,args:[l]}),n[l]=!0}function Xa(l,t,n,c){Gs(l,n,c),Hl(l,t,n)}function hf(l,t,n){let c;for(c in l[n])if(l[n].hasOwnProperty(c)&&c!=="data"&&!s.bv(l[n][c],t[n][c]))return!1;for(c in t[n])if(t[n].hasOwnProperty(c)&&c!=="data"&&!s.bv(l[n][c],t[n][c]))return!1;return!0}function Ya(l,t,n,c,d,p){let m;
vendor: 4,352 bytes, line 15
15for(m in t=t||{},l=l||{})l.hasOwnProperty(m)&&(s.bv(l[m],t[m])||n.push({command:p,args:[c,m,t[m],d]}));for(m in t)t.hasOwnProperty(m)&&!l.hasOwnProperty(m)&&(s.bv(l[m],t[m])||n.push({command:p,args:[c,m,t[m],d]}))}function fs(l){return l.id}function Bo(l,t){return l[t.id]=t,l}function Ka(l,t,n){const c=t.createTileMatrix(l,l.worldSize,n.toUnwrapped());return s.az(new Float32Array(16),l.projMatrix,c)}function hd(l,t,n){if(t.projection.name===n.projection.name)return l.projMatrix;const c=n.clone();return c.setProjection(t.projection),Ka(c,t.getProjection(),l)}function $l(l,t,n){return t.name===n.projection.name?l.projMatrix:Ka(n,t,l)}class ud{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=s.ay(t,0,1);let n=1,c=this._distances[n];const d=t*this.paddedLength+this.padding;for(;c<d&&n<this._distances.length;)c=this._distances[++n];const p=n-1,m=this._distances[p],y=c-m,x=y>0?(d-m)/y:0;return this.points[p].mult(1-x).add(this.points[n].mult(x))}}class qs{constructor(t,n,c){const d=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/c),this.yCellCount=Math.ceil(n/c);for(let m=0;m<this.xCellCount*this.yCellCount;m++)d.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,c,d,p){this._forEachCell(n,c,d,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(p)}insertCircle(t,n,c,d){this._forEachCell(n-d,c-d,n+d,c+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(c),this.circles.push(d)}_insertBoxCell(t,n,c,d,p,m){this.boxCells[p].push(m)}_insertCircleCell(t,n,c,d,p,m){this.circleCells[p].push(m)}_query(t,n,c,d,p,m){if(c<0||t>this.width||d<0||n>this.height)return!p&&[];const y=[];if(t<=0&&n<=0&&this.width<=c&&this.height<=d){if(p)return!0;for(let x=0;x<this.boxKeys.length;x++)y.push({key:this.boxKeys[x],x1:this.bboxes[4*x],y1:this.bboxes[4*x+1],x2:this.bboxes[4*x+2],y2:this.bboxes[4*x+3]});for(let x=0;x<this.circleKeys.length;x++){const T=this.circles[3*x],S=this.circles[3*x+1],M=this.circles[3*x+2];y.push({key:this.circleKeys[x],x1:T-M,y1:S-M,x2:T+M,y2:S+M})}return m?y.filter(m):y}return this._forEachCell(t,n,c,d,this._queryCell,y,{hitTest:p,seenUids:{box:{},circle:{}}},m),p?y.length>0:y}_queryCircle(t,n,c,d,p){const m=t-c,y=t+c,x=n-c,T=n+c;if(y<0||m>this.width||T<0||x>this.height)return!d&&[];const S=[];return this._forEachCell(m,x,y,T,this._queryCellCircle,S,{hitTest:d,circle:{x:t,y:n,radius:c},seenUids:{box:{},circle:{}}},p),d?S.length>0:S}query(t,n,c,d,p){return this._query(t,n,c,d,!1,p)}hitTest(t,n,c,d,p){return this._query(t,n,c,d,!0,p)}hitTestCircle(t,n,c,d){return this._queryCircle(t,n,c,!0,d)}_queryCell(t,n,c,d,p,m,y,x){const T=y.seenUids,S=this.boxCells[p];if(S!==null){const E=this.bboxes;for(const C of S)if(!T.box[C]){T.box[C]=!0;const D=4*C;if(t<=E[D+2]&&n<=E[D+3]&&c>=E[D+0]&&d>=E[D+1]&&(!x||x(this.boxKeys[C]))){if(y.hitTest)return m.push(!0),!0;m.push({key:this.boxKeys[C],x1:E[D],y1:E[D+1],x2:E[D+2],y2:E[D+3]})}}}const M=this.circleCells[p];if(M!==null){const E=this.circles;for(const C of M)if(!T.circle[C]){T.circle[C]=!0;const D=3*C;if(this._circleAndRectCollide(E[D],E[D+1],E[D+2],t,n,c,d)&&(!x||x(this.circleKeys[C]))){if(y.hitTest)return m.push(!0),!0;{const z=E[D],F=E[D+1],L=E[D+2];m.push({key:this.circleKeys[C],x1:z-L,y1:F-L,x2:z+L,y2:F+L})}}}}}_queryCellCircle(t,n,c,d,p,m,y,x){const T=y.circle,S=y.seenUids,M=this.boxCells[p];if(M!==null){const C=this.bboxes;for(const D of M)if(!S.box[D]){S.box[D]=!0;const z=4*D;if(this._circleAndRectCollide(T.x,T.y,T.radius,C[z+0],C[z+1],C[z+2],C[z+3])&&(!x||x(this.boxKeys[D])))return m.push(!0),!0}}const E=this.circleCells[p];if(E!==null){const C=this.circles;for(const D of E)if(!S.circle[D]){S.circle[D]=!0;const z=3*D;
15if(this._circlesCollide(C[z],C[z+1],C[z+2],T.x,T.y,T.radius)&&(!x||x(this.circleKeys[D])))return m.push(!0),!0}}}_forEachCell(t,n,c,d,p,m,y,x){const T=this._convertToXCellCoord(t),S=this._convertToYCellCoord(n),M=this._convertToXCellCoord(c),E=this._convertToYCellCoord(d);for(let C=T;C<=M;C++)for(let D=S;D<=E;D++)if(p.call(this,t,n,c,d,this.xCellCount*D+C,m,y,x))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,c,d,p,m){const y=d-t,x=p-n,T=c+m;return T*T>y*y+x*x}_circleAndRectCollide(t,n,c,d,p,m,y){const x=(m-d)/2,T=Math.abs(t-(d+x));if(T>x+c)return!1;const S=(y-p)/2,M=Math.abs(n-(p+S));if(M>S+c)return!1;if(T<=x||M<=S)return!0;const E=T-x,C=M-S;return E*E+C*C<=c*c}}const ms={unknown:0,flipRequired:1,flipNotRequired:2},dd=Math.tan(85*Math.PI/180);function Ja(l,t,n,c,d,p,m){const y=s.bz();if(n)if(p.name==="globe"){const x=s.bA(d,t);s.az(y,y,x)}else{const x=s.bB([],m);y[0]=x[0],y[1]=x[1],y[4]=x[2],y[5]=x[3],c||s.by(y,y,d.angle)}else s.az(y,d.labelPlaneMatrix,l);return y}function Hs(l,t,n,c,d,p,m){const y=Ja(l,t,n,c,d,p,m);return p.name==="globe"&&n||(y[2]=y[6]=y[10]=y[14]=0),y}function yo(l,t,n,c,d,p,m){if(n){if(p.name==="globe"){const y=Ja(l,t,n,c,d,p,m);return s.bi(y,y),s.az(y,l,y),y}{const y=s.bw(l),x=s.bx([]);return x[0]=m[0],x[1]=m[1],x[4]=m[2],x[5]=m[3],s.az(y,y,x),c||s.by(y,y,-d.angle),y}}return d.glCoordMatrix}function wn(l,t,n,c){const d=[l,t,n,1];n?s.aA(d,d,c):pd(d,d,c);const p=d[3];return d[0]/=p,d[1]/=p,d[2]/=p,d}function dh(l,t){return Math.min(.5+l/t*.5,1.5)}function ph(l,t){const n=l[0]/l[3],c=l[1]/l[3];return n>=-t[0]&&n<=t[0]&&c>=-t[1]&&c<=t[1]}function _s(l,t,n,c,d,p,m,y,x,T){const S=n.transform,M=c?l.textSizeData:l.iconSizeData,E=s.bH(M,n.transform.zoom),C=S.projection.name==="globe",D=[256/n.width*2+1,256/n.height*2+1],z=c?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;z.clear();let F=null;C&&(F=c?l.text.globeExtVertexArray:l.icon.globeExtVertexArray);const L=l.lineVertexArray,N=c?l.text.placedSymbolArray:l.icon.placedSymbolArray,j=n.transform.width/n.transform.height;let q,X=!1;for(let ee=0;ee<N.length;ee++){const ie=N.get(ee),{numGlyphs:Y,writingMode:K}=ie;if(K!==s.bI.vertical||X||q===s.bI.horizontal||(X=!0),q=K,(ie.hidden||K===s.bI.vertical)&&!X){$s(Y,z);continue}X=!1;const J=new s.P(ie.tileAnchorX,ie.tileAnchorY);let{x:fe,y:se,z:Ie}=S.projection.projectTilePoint(J.x,J.y,T.canonical);if(x){const[at,dt,Qe]=x(J);fe+=at,se+=dt,Ie+=Qe}const xe=[fe,se,Ie,1];if(s.aA(xe,xe,t),!ph(xe,D)){$s(Y,z);continue}const Me=xe[3],Ue=dh(n.transform.getCameraToCenterDistance(S.projection),Me),me=s.bJ(M,E,ie),oe=m?me/Ue:me*Ue,we=wn(fe,se,Ie,d);if(we[3]<=0){$s(Y,z);continue}let _e={};const ze=s.al(l.layers[0].layout.get("text-max-angle")),Re=Math.cos(ze),Le=m?null:x,Ze=Zl(ie,oe,!1,y,t,d,p,l.glyphOffsetArray,L,z,F,we,J,_e,j,Le,S.projection,T,m,Re);X=Ze.useVertical,Le&&Ze.needsFlipping&&(_e={}),(Ze.notEnoughRoom||X||Ze.needsFlipping&&Zl(ie,oe,!0,y,t,d,p,l.glyphOffsetArray,L,z,F,we,J,_e,j,Le,S.projection,T,m,Re).notEnoughRoom)&&$s(Y,z)}c?(l.text.dynamicLayoutVertexBuffer.updateData(z),F&&l.text.globeExtVertexBuffer&&l.text.globeExtVertexBuffer.updateData(F)):(l.icon.dynamicLayoutVertexBuffer.updateData(z),F&&l.icon.globeExtVertexBuffer&&l.icon.globeExtVertexBuffer.updateData(F))}function un(l,t,n,c,d,p,m,y,x,T,S,M,E,C,D,z,F){const{lineStartIndex:L,glyphStartIndex:N,segment:j}=y,q=N+y.numGlyphs,X=L+y.lineLength,ee=t.getoffsetX(N),ie=t.getoffsetX(q-1),Y=Qa(l*ee,n,c,d,p,m,j,L,X,x,T,S,M,E,!0,C,D,z,F);if(!Y)return null;const K=Qa(l*ie,n,c,d,p,m,j,L,X,x,T,S,M,E,!0,C,D,z,F);return K?{first:Y,last:K}:null}function fh(l,t,n,c){return l===s.bI.horizontal&&Math.abs(c)>Math.abs(n)?{useVertical:!0}:l===s.bI.vertical?c>0?{needsFlipping:!0}:null:t!==ms.unknown&&function(d,p){return d===0||Math.abs(p/d)>dd}(n,c)?t===ms.flipRequired?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function Zl(l,t,n,c,d,p,m,y,x,T,S,M,E,C,D,z,F,L,N,j){const q=t/24,X=l.lineOffsetX*q,ee=l.lineOffsetY*q,{lineStartIndex:ie,glyphStartIndex:Y,numGlyphs:K,segment:J,writingMode:fe,flipState:se}=l,Ie=ie+l.lineLength,xe=Me=>{if(S){const[we,_e,ze]=Me.up,Re=T.length;s.bK(S,Re+0,we,_e,ze),s.bK(S,Re+1,we,_e,ze),s.bK(S,Re+2,we,_e,ze),s.bK(S,Re+3,we,_e,ze)}const[Ue,me,oe]=Me.point;s.bL(T,Ue,me,oe,Me.angle)};if(K>1){const Me=un(q,y,X,ee,n,M,E,l,x,p,C,z,!1,F,L,N,j);if(!Me)return{notEnoughRoom:!0};if(c&&!n){let[Ue,me,oe]=Me.first.point,[we,_e,ze]=Me.last.point;[Ue,me]=wn(Ue,me,oe,m),[we,_e]=wn(we,_e,ze,m);const Re=fh(fe,se,(we-Ue)*D,_e-me);if(l.flipState=Re&&Re.needsFlipping?ms.flipRequired:ms.flipNotRequired,Re)return Re}xe(Me.first);for(let Ue=Y+1;Ue<Y+K-1;Ue++){const me=Qa(q*y.getoffsetX(Ue),X,ee,n,M,E,J,ie,Ie,x,p,C,z,!1,!1,F,L,N,j);if(!me)return T.length-=4*(Ue-Y),{notEnoughRoom:!0};xe(me)}xe(Me.last)}else{if(c&&!n){const Ue=wn(E.x,E.y,0,d),me=ie+J+1,oe=new s.P(x.getx(me),x.gety(me)),we=wn(oe.x,oe.y,0,d),_e=we[3]>0?we:li(E,oe,Ue,1,d,void 0,F,L.canonical),ze=fh(fe,se,(_e[0]-Ue[0])*D,_e[1]-Ue[1]);if(l.flipState=ze&&ze.needsFlipping?ms.flipRequired:ms.flipNotRequired,ze)return ze}const Me=Qa(q*y.getoffsetX(Y),X,ee,n,M,E,J,ie,Ie,x,p,C,z,!1,!1,F,L,N,j);if(!Me)return{notEnoughRoom:!0};xe(Me)}return{}}function mh(l,t,n,c,d){const{x:p,y:m,z:y}=c.projectTilePoint(l.x,l.y,t);if(!d)return wn(p,m,y,n);const[x,T,S]=d(l);return wn(p+x,m+T,y+S,n)}
vendor: 34,585 bytes, line 15
15function li(l,t,n,c,d,p,m,y){const x=mh(l.sub(t)._unit()._add(l),y,d,m,p);return s.at(x,n,x),s.au(x,x),s.bE(x,n,x,c)}function Qa(l,t,n,c,d,p,m,y,x,T,S,M,E,C,D,z,F,L,N){const j=c?l-t:l+t;let q=j>0?1:-1,X=0;c&&(q*=-1,X=Math.PI),q<0&&(X+=Math.PI);let ee=y+m+(q>0?0:1)|0,ie=d,Y=d,K=0,J=0;const fe=Math.abs(j),se=[],Ie=[];let xe=p,Me=xe,Ue=s.bC([]);const me=()=>li(Me,xe,Y,fe-K+1,S,E,z,F.canonical);for(;K+J<=fe;){if(ee+=q,ee<y||ee>=x)return null;if(Y=ie,Me=xe,se.push(Y),C&&Ie.push(Me),xe=new s.P(T.getx(ee),T.gety(ee)),ie=M[ee],!ie){const Qe=mh(xe,F.canonical,S,z,E);ie=Qe[3]>0?M[ee]=Qe:me()}K+=J;const at=s.at([],ie,Y),dt=s.bD(Y,ie);if(n&&dt>0&&J>0&&s.bG(Ue,at)/(J*dt)<N)return null;J=dt,Ue=at}D&&E&&(M[ee]&&(ie=me(),J=s.bD(Y,ie),Ue=s.at([],ie,Y)),M[ee]=ie);const oe=(fe-K)/J,we=xe.sub(Me)._mult(oe)._add(Me),_e=s.bE([],Y,Ue,oe);let ze=[0,0,1],Re=Ue[0],Le=Ue[1];if(L&&(ze=z.upVector(F.canonical,we.x,we.y),ze[0]!==0||ze[1]!==0||ze[2]!==1)){const at=[ze[2],0,-ze[0]],dt=s.bF([],ze,at);s.au(at,at),s.au(dt,dt),Re=s.bG(Ue,at),Le=s.bG(Ue,dt)}if(n){const at=s.bF([],ze,Ue);s.au(at,at),s.bE(_e,_e,at,n*q)}const Ze=X+Math.atan2(Le,Re);return se.push(_e),C&&Ie.push(we),{point:_e,angle:Ze,path:se,tilePath:Ie,up:ze}}function $s(l,t){const n=t.length,c=n+4*l;t.resize(c),t.float32.fill(-1/0,4*n,4*c)}function pd(l,t,n){const c=t[0],d=t[1];return l[0]=n[0]*c+n[4]*d+n[12],l[1]=n[1]*c+n[5]*d+n[13],l[3]=n[3]*c+n[7]*d+n[15],l}const ft=100;class fd{constructor(t,n,c=new qs(t.width+200,t.height+200,25),d=new qs(t.width+200,t.height+200,25)){this.transform=t,this.grid=c,this.ignoredGrid=d,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+ft,this.screenBottomBoundary=t.height+ft,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=n}placeCollisionBox(t,n,c,d,p,m,y,x,T,S,M){let E=c.projectedAnchorX,C=c.projectedAnchorY,D=c.projectedAnchorZ;const z=c.tileAnchorX,F=c.tileAnchorY,L=c.elevation,N=c.tileID,j=t.getProjection();if(L&&N){const[Ie,xe,Me]=j.upVector(N.canonical,c.tileAnchorX,c.tileAnchorY),Ue=j.upVectorScale(N.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;E+=Ie*L*Ue,C+=xe*L*Ue,D+=Me*L*Ue}const q=t.projection.name==="globe",X=t.projection.name==="globe"?s.ah(this.transform.zoom):0;if(N&&q&&X<1&&!m){const Ie=1<<N.canonical.z,xe=s.bM(z,F);s.bN(xe,xe,1/s.aj),s.bO(xe,xe,s.bM(N.canonical.x,N.canonical.y)),s.bN(xe,xe,1/Ie),s.bP(xe,xe,s.bM(d[0],d[1])),xe[0]=s.bQ(xe[0],-.5,.5),s.bN(xe,xe,s.aj);const Me=s.bR(xe[0],xe[1],s.aj/(2*Math.PI),1);s.aA(Me,Me,p),E=s.ai(E,Me[0],X),C=s.ai(C,Me[1],X),D=s.ai(D,Me[2],X)}const ee=this.projectAndGetPerspectiveRatio(S,E,C,D,c.tileID,j.name==="globe"||!!L||this.transform.pitch>0,j),ie=T*ee.perspectiveRatio,Y=(c.x1*n+y.x-c.padding)*ie+ee.point.x,K=(c.y1*n+y.y-c.padding)*ie+ee.point.y,J=(c.x2*n+y.x+c.padding)*ie+ee.point.x,fe=(c.y2*n+y.y+c.padding)*ie+ee.point.y,se=ee.perspectiveRatio<=.55||ee.occluded;return!this.isInsideGrid(Y,K,J,fe)||!x&&this.grid.hitTest(Y,K,J,fe,M)||se?{box:[],offscreen:!1,occluded:ee.occluded}:{box:[Y,K,J,fe],offscreen:this.isOffscreen(Y,K,J,fe),occluded:!1}}placeCollisionCircles(t,n,c,d,p,m,y,x,T,S,M,E,C,D,z){const F=[],L=this.transform.elevation,N=t.getProjection(),j=L?L.getAtTileOffsetFunc(z,this.transform.center.lat,this.transform.worldSize,N):null,q=new s.P(c.tileAnchorX,c.tileAnchorY);let{x:X,y:ee,z:ie}=N.projectTilePoint(q.x,q.y,z.canonical);if(j){const[ze,Re,Le]=j(q);X+=ze,ee+=Re,ie+=Le}const Y=N.name==="globe",K=this.projectAndGetPerspectiveRatio(y,X,ee,ie,z,Y||!!L||this.transform.pitch>0,N),{perspectiveRatio:J}=K,fe=(M?m/J:m*J)/s.bU,se=wn(X,ee,ie,x),Ie=c.lineOffsetX*fe,xe=c.lineOffsetY*fe,Me=s.al(t.layers[0].layout.get("text-max-angle")),Ue=Math.cos(Me),me=K.signedDistanceFromCamera>0?un(fe,p,Ie,xe,!1,se,q,c,d,x,{},L&&!M?j:null,M&&!!L,N,z,M,Ue):null;let oe=!1,we=!1,_e=!0;if(me&&!K.occluded){const ze=.5*C*J+D,Re=new s.P(-100,-100),Le=new s.P(this.screenRightBoundary,this.screenBottomBoundary),Ze=new ud,{first:at,last:dt}=me,Qe=at.path.length;let ht=[];for(let At=Qe-1;At>=1;At--)ht.push(at.path[At]);for(let At=1;At<dt.path.length;At++)ht.push(dt.path[At]);const lt=2.5*ze;T&&(ht=ht.map(([At,Ot,Yt],Et)=>(j&&!Y&&(Yt=j(Et<Qe-1?at.tilePath[Qe-1-Et]:dt.tilePath[Et-Qe+2])[2]),wn(At,Ot,Yt,T))),ht.some(At=>At[3]<=0)&&(ht=[]));let wt=[];if(ht.length>0){let At=1/0,Ot=-1/0,Yt=1/0,Et=-1/0;for(const Kt of ht)At=Math.min(At,Kt[0]),Yt=Math.min(Yt,Kt[1]),Ot=Math.max(Ot,Kt[0]),Et=Math.max(Et,Kt[1]);Ot>=Re.x&&At<=Le.x&&Et>=Re.y&&Yt<=Le.y&&(wt=[ht.map(Kt=>new s.P(Kt[0],Kt[1]))],(At<Re.x||Ot>Le.x||Yt<Re.y||Et>Le.y)&&(wt=s.bS(wt,Re.x,Re.y,Le.x,Le.y)))}for(const At of wt){Ze.reset(At,.25*ze);let Ot=0;Ot=Ze.length<=.5*ze?1:Math.ceil(Ze.paddedLength/lt)+1;for(let Yt=0;Yt<Ot;Yt++){const Et=Yt/Math.max(Ot-1,1),Kt=Ze.lerp(Et),ti=Kt.x+ft,vi=Kt.y+ft;F.push(ti,vi,ze,0);const Dt=ti-ze,Jt=vi-ze,Qt=ti+ze,ni=vi+ze;if(_e=_e&&this.isOffscreen(Dt,Jt,Qt,ni),we=we||this.isInsideGrid(Dt,Jt,Qt,ni),!n&&this.grid.hitTestCircle(ti,vi,ze,E)&&(oe=!0,!S))return{circles:[],offscreen:!1,collisionDetected:oe,occluded:!1}}}}return{circles:!S&&oe||!we?[]:F,offscreen:_e,collisionDetected:oe,occluded:K.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let c=1/0,d=1/0,p=-1/0,m=-1/0;for(const S of t){const M=new s.P(S.x+ft,S.y+ft);c=Math.min(c,M.x),d=Math.min(d,M.y),p=Math.max(p,M.x),m=Math.max(m,M.y),n.push(M)}const y=this.grid.query(c,d,p,m).concat(this.ignoredGrid.query(c,d,p,m)),x={},T={};for(const S of y){const M=S.key;if(x[M.bucketInstanceId]===void 0&&(x[M.bucketInstanceId]={}),x[M.bucketInstanceId][M.featureIndex])continue;const E=[new s.P(S.x1,S.y1),new s.P(S.x2,S.y1),new s.P(S.x2,S.y2),new s.P(S.x1,S.y2)];s.bT(n,E)&&(x[M.bucketInstanceId][M.featureIndex]=!0,T[M.bucketInstanceId]===void 0&&(T[M.bucketInstanceId]=[]),T[M.bucketInstanceId].push(M.featureIndex))}return T}insertCollisionBox(t,n,c,d,p){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:d,collisionGroupID:p},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,c,d,p){const m=n?this.ignoredGrid:this.grid,y={bucketInstanceId:c,featureIndex:d,collisionGroupID:p};for(let x=0;x<t.length;x+=4)m.insertCircle(y,t[x],t[x+1],t[x+2])}projectAndGetPerspectiveRatio(t,n,c,d,p,m,y){const x=[n,c,d,1];let T=!1;d||this.transform.pitch>0?(s.aA(x,x,t),this.fogState&&p&&y.name!=="globe"&&(T=function(E,C,D,z,F,L){const N=L.calculateFogTileMatrix(F),j=[C,D,z];return s.ad(j,j,N),pt(E,s.ae(j),L.pitch,L._fov)}(this.fogState,n,c,d,p.toUnwrapped(),this.transform)>.9)):pd(x,x,t);const S=x[3];return{point:new s.P((x[0]/S+1)/2*this.transform.width+ft,(-x[1]/S+1)/2*this.transform.height+ft),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(y)/S*.5,1.5),signedDistanceFromCamera:S,occluded:m&&x[2]>S||T}}isOffscreen(t,n,c,d){return c<ft||t>=this.screenRightBoundary||d<ft||n>this.screenBottomBoundary}isInsideGrid(t,n,c,d){return c>=0&&t<this.gridRightBoundary&&d>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=s.bx([]);return s.bo(t,t,[-100,-100,0]),t}}class el{constructor(t,n,c,d){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):d&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class gs{constructor(t,n,c,d,p,m=!1){this.text=new el(t?t.text:null,n,c,p),this.icon=new el(t?t.icon:null,n,d,p),this.clipped=m}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Tn{constructor(t,n,c,d=!1){this.text=t,this.icon=n,this.skipFade=c,this.clipped=d}}class _h{constructor(){this.invProjMatrix=s.bz(),this.viewportMatrix=s.bz(),this.circles=[]}}class Zs{constructor(t,n,c,d,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=p}}class ut{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:c=>c.collisionGroupID===n}}return this.collisionGroups[t]}}function si(l,t,n,c,d){const{horizontalAlign:p,verticalAlign:m}=s.bZ(l),y=-(p-.5)*t,x=-(m-.5)*n,T=s.b_(l,c);return new s.P(y+T[0]*d,x+T[1]*d)}function ai(l,t,n,c,d){const p=new s.P(l,t);return n&&p._rotate(c?d:-d),p}class dn{constructor(t,n,c,d,p,m){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new fd(this.transform,p),this.buildingIndex=m,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new ut(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,c,d,p=1){const m=c.getBucket(n),y=c.latestFeatureIndex;if(!m||!y||n.fqid!==m.layerIds[0])return;const x=m.layers[0].layout,T=m.layers[0].paint,S=c.collisionBoxArray,M=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ),E=c.tileSize/s.aj,C=c.tileID.toUnwrapped();this.transform.setProjection(m.projection);const D=(z=c.tileID,F=m.getProjection(),L=this.transform,F.name===this.projection?L.calculateProjMatrix(z.toUnwrapped()):Ka(L,F,z));var z,F,L;const N=x.get("text-pitch-alignment")==="map",j=x.get("text-rotation-alignment")==="map";n.compileFilter(n.options);const q=n.dynamicFilter(),X=n.dynamicFilterNeedsFeature(),ee=this.transform.calculatePixelsToTileUnitsMatrix(c),ie=Hs(D,c.tileID.canonical,N,j,this.transform,m.getProjection(),ee);let Y=null;const K=m.getProjection().createInversionMatrix(this.transform,c.tileID.canonical);if(N){const oe=yo(D,c.tileID.canonical,N,j,this.transform,m.getProjection(),ee);Y=s.az([],this.transform.labelPlaneMatrix,oe)}let J=null;q&&c.latestFeatureIndex&&(J={unwrappedTileID:C,dynamicFilter:q,dynamicFilterNeedsFeature:X}),this.retainedQueryData[m.bucketInstanceId]=new Zs(m.bucketInstanceId,y,m.sourceLayerIndex,m.index,c.tileID);const[fe,se]=m.layers[0].layout.get("text-size-scale-range"),Ie=s.ay(p,fe,se),[xe,Me]=x.get("icon-size-scale-range"),Ue=s.ay(p,xe,Me),me={bucket:m,layout:x,paint:T,posMatrix:D,invMatrix:K,mercatorCenter:[s.aD(this.transform.center.lng),s.aH(this.transform.center.lat)],textLabelPlaneMatrix:ie,labelToScreenMatrix:Y,clippingData:J,scale:M,textPixelRatio:E,holdingForFade:c.holdingForFade(),collisionBoxArray:S,partiallyEvaluatedTextSize:s.bH(m.textSizeData,this.transform.zoom,Ie),partiallyEvaluatedIconSize:s.bH(m.iconSizeData,this.transform.zoom,Ue),collisionGroup:this.collisionGroups.get(m.sourceID),latestFeatureIndex:c.latestFeatureIndex};if(d)for(const oe of m.sortKeyRanges){const{sortKey:we,symbolInstanceStart:_e,symbolInstanceEnd:ze}=oe;t.push({sortKey:we,symbolInstanceStart:_e,symbolInstanceEnd:ze,parameters:me})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:me})}attemptAnchorPlacement(t,n,c,d,p,m,y,x,T,S,M,E,C,D,z,F,L,N,j,q,X){const{textOffset0:ee,textOffset1:ie,crossTileID:Y}=z,K=[ee,ie],J=si(t,m,y,K,x),fe=this.collisionIndex.placeCollisionBox(L,x,n,c,d,p,ai(J.x,J.y,T,S,this.transform.angle),D,M,E,C.predicate);if(j){const se=L.getSymbolInstanceIconSize(X,this.transform.zoom,z.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(L,se,j,c,d,p,ai(J.x,J.y,T,S,this.transform.angle),D,M,E,C.predicate).box.length===0)return}if(fe.box.length>0){let se;return this.prevPlacement&&this.prevPlacement.variableOffsets[Y]&&this.prevPlacement.placements[Y]&&this.prevPlacement.placements[Y].text&&(se=this.prevPlacement.variableOffsets[Y].anchor),this.variableOffsets[Y]={textOffset:K,width:m,height:y,anchor:t,textScale:x,prevAnchor:se},this.markUsedJustification(L,t,z,N),L.allowVerticalPlacement&&(this.markUsedOrientation(L,N,z),this.placedOrientations[Y]=N),{shift:J,placedGlyphBoxes:fe}}}placeLayerBucketPart(t,n,c,d,p=1){const{bucket:m,layout:y,paint:x,posMatrix:T,textLabelPlaneMatrix:S,labelToScreenMatrix:M,clippingData:E,textPixelRatio:C,mercatorCenter:D,invMatrix:z,holdingForFade:F,collisionBoxArray:L,partiallyEvaluatedTextSize:N,partiallyEvaluatedIconSize:j,collisionGroup:q,latestFeatureIndex:X}=t.parameters,ee=y.get("text-optional"),ie=y.get("icon-optional"),Y=y.get("text-allow-overlap"),K=y.get("icon-allow-overlap"),J=y.get("text-rotation-alignment")==="map",fe=y.get("icon-rotation-alignment")==="map",se=y.get("text-pitch-alignment")==="map",Ie=x.get("symbol-z-offset"),xe=y.get("symbol-elevation-reference")==="sea",Me=y.get("symbol-placement"),[Ue,me]=y.get("text-size-scale-range"),[oe,we]=y.get("icon-size-scale-range"),_e=s.ay(p,Ue,me),ze=s.ay(p,oe,we),Re=y.get("text-variable-anchor"),Le=J&&Me!=="point",Ze=fe&&Me!=="point",at=Re&&m.hasTextData(),dt=m.hasIconTextFit()&&at&&m.hasIconData();this.transform.setProjection(m.projection);const Qe=at||Le,ht=Ze||dt;let lt=Y&&(K||!m.hasIconData()||ie),wt=K&&(Y||!m.hasTextData()||ee);const At=!Ie.isConstant();!m.collisionArrays&&L&&m.deserializeCollisionBoxes(L),c&&d&&m.updateCollisionDebugBuffers(this.transform.zoom,L,_e,ze);const Ot=(Et,Kt,ti)=>{const{crossTileID:vi,numVerticalGlyphVertices:Dt}=Et;let Jt=null;if(E&&E.dynamicFilterNeedsFeature||At){const Ji=this.retainedQueryData[m.bucketInstanceId];Jt=X.loadFeature({featureIndex:Et.featureIndex,bucketIndex:Ji.bucketIndex,sourceLayerIndex:Ji.sourceLayerIndex,layoutVertexArrayOffset:0})}if(E&&!(0,E.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},Jt,this.retainedQueryData[m.bucketInstanceId].tileID.canonical,new s.P(Et.tileAnchorX,Et.tileAnchorY),this.transform.calculateDistanceTileData(E.unwrappedTileID)))return this.placements[vi]=new Tn(!1,!1,!1,!0),void n.add(vi);const Qt=Ie.evaluate(Jt,{});if(n.has(vi))return;if(F)return void(this.placements[vi]=new Tn(!1,!1,!1));let ni=!1,kt=!1,di=!0,ii=!1,Vi=!1,Wt=null,oi={box:null,offscreen:null,occluded:null},yi={box:null},sr=null,rr=null,ar=null,Sr=0,Xn=0,Yr=0;ti.textFeatureIndex?Sr=ti.textFeatureIndex:Et.useRuntimeCollisionCircles&&(Sr=Et.featureIndex),ti.verticalTextFeatureIndex&&(Xn=ti.verticalTextFeatureIndex);const fn=Ji=>{Ji.tileID=this.retainedQueryData[m.bucketInstanceId].tileID;const Zi=this.transform.elevation;Ji.elevation=xe?Qt:Qt+(Zi?Zi.getAtTileOffset(Ji.tileID,Ji.tileAnchorX,Ji.tileAnchorY):0),Ji.elevation+=Et.zOffset},Pr=ti.textBox;if(Pr){fn(Pr);const Ji=wi=>{let fr=s.bI.horizontal;if(m.allowVerticalPlacement&&!wi&&this.prevPlacement){const Er=this.prevPlacement.placedOrientations[vi];Er&&(this.placedOrientations[vi]=Er,fr=Er,this.markUsedOrientation(m,fr,Et))}return fr},Zi=(wi,fr)=>{if(m.allowVerticalPlacement&&Dt>0&&ti.verticalTextBox){for(const Er of m.writingModes)if(Er===s.bI.vertical?(oi=fr(),yi=oi):oi=wi(),oi&&oi.box&&oi.box.length)break}else oi=wi()};if(Re){let wi=Re;if(this.prevPlacement&&this.prevPlacement.variableOffsets[vi]){const Qi=this.prevPlacement.variableOffsets[vi];wi.indexOf(Qi.anchor)>0&&(wi=wi.filter(Cn=>Cn!==Qi.anchor),wi.unshift(Qi.anchor))}const fr=(Qi,Cn,Ps)=>{const rs=m.getSymbolInstanceTextSize(N,Et,this.transform.zoom,Kt),wa=(Qi.x2-Qi.x1)*rs+2*Qi.padding,Ta=(Qi.y2-Qi.y1)*rs+2*Qi.padding,Pn=Et.hasIconTextFit&&!K?Cn:null;Pn&&fn(Pn);let no={box:[],offscreen:!1,occluded:!1};const mr=Y?2*wi.length:wi.length;for(let zn=0;zn<mr;++zn){const zs=this.attemptAnchorPlacement(wi[zn%wi.length],Qi,D,z,Qe,wa,Ta,rs,J,se,C,T,q,zn>=wi.length,Et,Kt,m,Ps,Pn,N,j);if(zs&&(no=zs.placedGlyphBoxes,no&&no.box&&no.box.length)){ni=!0,Wt=zs.shift;break}}return no};Zi(()=>fr(Pr,ti.iconBox,s.bI.horizontal),()=>{const Qi=ti.verticalTextBox;return Qi&&fn(Qi),m.allowVerticalPlacement&&!(oi&&oi.box&&oi.box.length)&&Dt>0&&Qi?fr(Qi,ti.verticalIconBox,s.bI.vertical):{box:null,offscreen:null,occluded:null}}),oi&&(ni=oi.box,di=oi.offscreen,ii=oi.occluded);const Er=Ji(!(!oi||!oi.box));if(!ni&&this.prevPlacement){const Qi=this.prevPlacement.variableOffsets[vi];Qi&&(this.variableOffsets[vi]=Qi,this.markUsedJustification(m,Qi.anchor,Et,Er))}}else{const wi=(fr,Er)=>{const Qi=m.getSymbolInstanceTextSize(N,Et,this.transform.zoom,Kt,p),Cn=this.collisionIndex.placeCollisionBox(m,Qi,fr,D,z,Qe,new s.P(0,0),Y,C,T,q.predicate);return Cn&&Cn.box&&Cn.box.length&&(this.markUsedOrientation(m,Er,Et),this.placedOrientations[vi]=Er),Cn};Zi(()=>wi(Pr,s.bI.horizontal),()=>{const fr=ti.verticalTextBox;return m.allowVerticalPlacement&&Dt>0&&fr?(fn(fr),wi(fr,s.bI.vertical)):{box:null,offscreen:null,occluded:null}}),Ji(!!(oi&&oi.box&&oi.box.length))}}if(sr=oi,ni=sr&&sr.box&&sr.box.length>0,di=sr&&sr.offscreen,ii=sr&&sr.occluded,Et.useRuntimeCollisionCircles){const Ji=m.text.placedSymbolArray.get(Et.centerJustifiedTextSymbolIndex>=0?Et.centerJustifiedTextSymbolIndex:Et.verticalPlacedTextSymbolIndex),Zi=s.bJ(m.textSizeData,N,Ji),wi=y.get("text-padding");rr=this.collisionIndex.placeCollisionCircles(m,Y,Ji,m.lineVertexArray,m.glyphOffsetArray,Zi,T,S,M,c,se,q.predicate,Et.collisionCircleDiameter*Zi/s.bU,wi,this.retainedQueryData[m.bucketInstanceId].tileID),ni=Y||rr.circles.length>0&&!rr.collisionDetected,di=di&&rr.offscreen,ii=rr.occluded}if(ti.iconFeatureIndex&&(Yr=ti.iconFeatureIndex),ti.iconBox){const Ji=Zi=>{fn(Zi);const wi=Et.hasIconTextFit&&Wt?ai(Wt.x,Wt.y,J,se,this.transform.angle):new s.P(0,0),fr=m.getSymbolInstanceIconSize(j,this.transform.zoom,Et.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(m,fr,Zi,D,z,ht,wi,K,C,T,q.predicate)};yi&&yi.box&&yi.box.length&&ti.verticalIconBox?(ar=Ji(ti.verticalIconBox),kt=ar.box.length>0):(ar=Ji(ti.iconBox),kt=ar.box.length>0),di=di&&ar.offscreen,Vi=ar.occluded}const Mn=ee||Et.numHorizontalGlyphVertices===0&&Dt===0,Gn=ie||Et.numIconVertices===0;if(Mn||Gn?Gn?Mn||(kt=kt&&ni):ni=kt&&ni:kt=ni=kt&&ni,ni&&sr&&sr.box&&this.collisionIndex.insertCollisionBox(sr.box,y.get("text-ignore-placement"),m.bucketInstanceId,yi&&yi.box&&Xn?Xn:Sr,q.ID),kt&&ar&&this.collisionIndex.insertCollisionBox(ar.box,y.get("icon-ignore-placement"),m.bucketInstanceId,Yr,q.ID),rr&&(ni&&this.collisionIndex.insertCollisionCircles(rr.circles,y.get("text-ignore-placement"),m.bucketInstanceId,Sr,q.ID),c)){const Ji=m.bucketInstanceId;let Zi=this.collisionCircleArrays[Ji];Zi===void 0&&(Zi=this.collisionCircleArrays[Ji]=new _h);for(let wi=0;wi<rr.circles.length;wi+=4)Zi.circles.push(rr.circles[wi+0]),Zi.circles.push(rr.circles[wi+1]),Zi.circles.push(rr.circles[wi+2]),Zi.circles.push(rr.collisionDetected?1:0)}const zr=m.projection.name!=="globe";lt=lt&&(zr||!ii),wt=wt&&(zr||!Vi),this.placements[vi]=new Tn(ni||lt,kt||wt,di||m.justReloaded),n.add(vi)},Yt=this.retainedQueryData[m.bucketInstanceId].tileID;if(m.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(m,Yt),m.elevationType==="road"&&m.updateRoadElevation(Yt.canonical),m.updateZOffset(),m.sortFeaturesByY){const Et=m.getSortedSymbolIndexes(this.transform.angle);for(let Kt=Et.length-1;Kt>=0;--Kt){const ti=Et[Kt];Ot(m.symbolInstances.get(ti),ti,m.collisionArrays[ti])}m.hasAnyZOffset&&s.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 Et=m.getSortedIndexesByZOffset();for(let Kt=0;Kt<Et.length;++Kt){const ti=Et[Kt];Ot(m.symbolInstances.get(ti),ti,m.collisionArrays[ti])}}else for(let Et=t.symbolInstanceStart;Et<t.symbolInstanceEnd;Et++)Ot(m.symbolInstances.get(Et),Et,m.collisionArrays[Et]);if(c&&m.bucketInstanceId in this.collisionCircleArrays){const Et=this.collisionCircleArrays[m.bucketInstanceId];s.bi(Et.invProjMatrix,T),Et.viewportMatrix=this.collisionIndex.getViewportMatrix()}m.justReloaded=!1}markUsedJustification(t,n,c,d){const{leftJustifiedTextSymbolIndex:p,centerJustifiedTextSymbolIndex:m,rightJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:x,crossTileID:T}=c,S=s.b$(n),M=d===s.bI.vertical?x:S==="left"?p:S==="center"?m:S==="right"?y:-1;p>=0&&(t.text.placedSymbolArray.get(p).crossTileID=M>=0&&p!==M?0:T),m>=0&&(t.text.placedSymbolArray.get(m).crossTileID=M>=0&&m!==M?0:T),y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=M>=0&&y!==M?0:T),x>=0&&(t.text.placedSymbolArray.get(x).crossTileID=M>=0&&x!==M?0:T)}markUsedOrientation(t,n,c){const d=n===s.bI.horizontal||n===s.bI.horizontalOnly?n:0,p=n===s.bI.vertical?n:0,{leftJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:y,rightJustifiedTextSymbolIndex:x,verticalPlacedTextSymbolIndex:T}=c,S=t.text.placedSymbolArray;m>=0&&(S.get(m).placedOrientation=d),y>=0&&(S.get(y).placedOrientation=d),x>=0&&(S.get(x).placedOrientation=d),T>=0&&(S.get(T).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let c=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const d=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},y=n?n.placedOrientations:{};for(const x in this.placements){const T=this.placements[x],S=p[x];S?(this.opacities[x]=new gs(S,d,T.text,T.icon,null,T.clipped),c=c||T.text!==S.text.placed||T.icon!==S.icon.placed):(this.opacities[x]=new gs(null,d,T.text,T.icon,T.skipFade,T.clipped),c=c||T.text||T.icon)}for(const x in p){const T=p[x];if(!this.opacities[x]){const S=new gs(T,d,!1,!1);S.isHidden()||(this.opacities[x]=S,c=c||T.text.placed||T.icon.placed)}}for(const x in m)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=m[x]);for(const x in y)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=y[x]);c?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n,c,d){const p=new Set;for(const m of n){const y=m.getBucket(t);y&&m.latestFeatureIndex&&t.fqid===y.layerIds[0]&&(this.updateBucketOpacities(y,p,m,m.collisionBoxArray,c,d,m.tileID,t.scope),y.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(y,m.tileID),y.elevationType==="road"&&y.updateRoadElevation(m.tileID.canonical),y.updateZOffset())}}updateBucketOpacities(t,n,c,d,p,m,y,x){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const T=t.layers[0].layout,S=t.layers[0].paint,M=!!t.layers[0].dynamicFilter(),E=new gs(null,0,!1,!1,!0),C=T.get("text-allow-overlap"),D=T.get("icon-allow-overlap"),z=T.get("text-variable-anchor"),F=T.get("text-rotation-alignment")==="map",L=T.get("text-pitch-alignment")==="map",N=S.get("symbol-z-offset"),j=T.get("symbol-elevation-reference")==="sea",q=!N.isConstant(),X=new gs(null,0,C&&(D||!t.hasIconData()||T.get("icon-optional")),D&&(C||!t.hasTextData()||T.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const ee=(Y,K,J)=>{for(let fe=0;fe<K/4;fe++)Y.opacityVertexArray.emplaceBack(J)};let ie=0;m&&t.updateReplacement(y,m);for(let Y=0;Y<t.symbolInstances.length;Y++){const K=t.symbolInstances.get(Y),{numHorizontalGlyphVertices:J,numVerticalGlyphVertices:fe,crossTileID:se,numIconVertices:Ie,tileAnchorX:xe,tileAnchorY:Me}=K;let Ue=null;const me=this.retainedQueryData[t.bucketInstanceId];q&&K&&me&&(Ue=c.latestFeatureIndex.loadFeature({featureIndex:K.featureIndex,bucketIndex:me.bucketIndex,sourceLayerIndex:me.sourceLayerIndex,layoutVertexArrayOffset:0}));const oe=N.evaluate(Ue,{}),we=n.has(se);let _e=this.opacities[se];we?_e=E:_e||(_e=X,this.opacities[se]=_e),n.add(se);const ze=J>0||fe>0,Re=Ie>0,Le=this.placedOrientations[se],Ze=Le===s.bI.vertical,at=Le===s.bI.horizontal||Le===s.bI.horizontalOnly;!ze&&!Re||_e.isHidden()||ie++;let dt=!1;if((ze||Re)&&m)for(const Qe of t.activeReplacements){if(s.bV(Qe,p,s.bW.Symbol,x)||Qe.min.x>xe||xe>Qe.max.x||Qe.min.y>Me||Me>Qe.max.y)continue;const ht=s.bX(xe,Me,y.canonical,Qe.footprintTileId.canonical);if(dt=s.bY(ht,Qe.footprint),dt)break}if(ze){const Qe=dt?No:Ws(_e.text);ee(t.text,J,Ze?No:Qe),ee(t.text,fe,at?No:Qe);const ht=_e.text.isHidden(),{leftJustifiedTextSymbolIndex:lt,centerJustifiedTextSymbolIndex:wt,rightJustifiedTextSymbolIndex:At,verticalPlacedTextSymbolIndex:Ot}=K,Yt=t.text.placedSymbolArray,Et=ht||Ze?1:0;lt>=0&&(Yt.get(lt).hidden=Et),wt>=0&&(Yt.get(wt).hidden=Et),At>=0&&(Yt.get(At).hidden=Et),Ot>=0&&(Yt.get(Ot).hidden=ht||at?1:0);const Kt=this.variableOffsets[se];Kt&&this.markUsedJustification(t,Kt.anchor,K,Le);const ti=this.placedOrientations[se];ti&&(this.markUsedJustification(t,"left",K,ti),this.markUsedOrientation(t,ti,K))}if(Re){const Qe=dt?No:Ws(_e.icon),{placedIconSymbolIndex:ht,verticalPlacedIconSymbolIndex:lt}=K,wt=t.icon.placedSymbolArray,At=_e.icon.isHidden()?1:0;ht>=0&&(ee(t.icon,Ie,Ze?No:Qe),wt.get(ht).hidden=At),lt>=0&&(ee(t.icon,K.numVerticalIconVertices,at?No:Qe),wt.get(lt).hidden=At)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const Qe=t.collisionArrays[Y];if(Qe){let ht=new s.P(0,0),lt=!0;if(Qe.textBox||Qe.verticalTextBox){if(z){const At=this.variableOffsets[se];At?(ht=si(At.anchor,At.width,At.height,At.textOffset,At.textScale),F&&ht._rotate(L?this.transform.angle:-this.transform.angle)):lt=!1}M&&(lt=!_e.clipped),Qe.textBox&&xo(t.textCollisionBox.collisionVertexArray,_e.text.placed,!lt||Ze,oe,j,ht.x,ht.y),Qe.verticalTextBox&&xo(t.textCollisionBox.collisionVertexArray,_e.text.placed,!lt||at,oe,j,ht.x,ht.y)}const wt=lt&&!!(!at&&Qe.verticalIconBox);Qe.iconBox&&xo(t.iconCollisionBox.collisionVertexArray,_e.icon.placed,wt,oe,j,K.hasIconTextFit?ht.x:0,K.hasIconTextFit?ht.y:0),Qe.verticalIconBox&&xo(t.iconCollisionBox.collisionVertexArray,_e.icon.placed,!wt,oe,j,K.hasIconTextFit?ht.x:0,K.hasIconTextFit?ht.y:0)}}}if(t.fullyClipped=ie===0,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const Y=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=Y.invProjMatrix,t.placementViewportMatrix=Y.viewportMatrix,t.collisionCircleArray=Y.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const c=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*c>t}setStale(){this.stale=!0}}function xo(l,t,n,c,d,p,m){l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0)}const ci=Math.pow(2,25),Wl=Math.pow(2,24),tl=Math.pow(2,17),il=Math.pow(2,16),Br=Math.pow(2,9),pr=Math.pow(2,8),uf=Math.pow(2,1);function Ws(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,n=Math.floor(127*l.opacity);return n*ci+t*Wl+n*tl+t*il+n*Br+t*pr+n*uf+t}const No=0;class rl{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&t.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(t,n,c,d,p,m){const y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(y,d,t[this._currentTileIndex],this._sortAcrossTiles,m),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort((x,T)=>x.sortKey-T.sortKey));this._currentPartIndex<y.length;){const x=y[this._currentPartIndex];if(n.placeLayerBucketPart(x,this._seenCrossTileIDs,c,x.symbolInstanceStart===0,m),this._currentPartIndex++,p())return!0}return!1}}class Xl{constructor(t,n,c,d,p,m,y,x,T){this.placement=new dn(t,p,m,y,x,T),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,c,d,p){const m=s.q.now(),y=()=>{const x=s.q.now()-m;return!this._forceFullPlacement&&x>2};for(;this._currentPlacementIndex>=0;){const x=n[t[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&(!x.minzoom||x.minzoom<=T)&&(!x.maxzoom||x.maxzoom>T)){const S=x,M=S.layout.get("symbol-z-elevate"),E=S.layout.get("symbol-sort-key").constantOr(1)!==void 0,C=S.layout.get("symbol-z-order"),D=C==="viewport-y"||C==="auto"&&!(C!=="viewport-y"&&E),z=S.layout.get("text-allow-overlap")||S.layout.get("icon-allow-overlap")||S.layout.get("text-ignore-placement")||S.layout.get("icon-ignore-placement"),F=D&&z,L=this._inProgressLayer=this._inProgressLayer||new rl(S),N=s.C(x.source,x.scope);if(L.continuePlacement(M||F?d[N]:c[N],this.placement,this._showCollisionBoxes,x,y,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const nl=512/s.aj/2;class Yl{constructor(t,n,c){this.tileID=t,this.bucketInstanceId=c,this.index=new s.c0(n.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=t.canonical.x*s.aj,p=t.canonical.y*s.aj;for(let m=0;m<n.length;m++){const{key:y,crossTileID:x,tileAnchorX:T,tileAnchorY:S}=n.get(m),M=Math.floor((d+T)*nl),E=Math.floor((p+S)*nl);this.index.add(M,E),this.keys.push(y),this.crossTileIDs.push(x)}this.index.finish()}findMatches(t,n,c){const d=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z),p=nl/Math.pow(2,n.canonical.z-this.tileID.canonical.z),m=n.canonical.x*s.aj,y=n.canonical.y*s.aj;for(let x=0;x<t.length;x++){const T=t.get(x);if(T.crossTileID)continue;const{key:S,tileAnchorX:M,tileAnchorY:E}=T,C=Math.floor((m+M)*p),D=Math.floor((y+E)*p),z=this.index.range(C-d,D-d,C+d,D+d).sort((F,L)=>F-L);for(const F of z){const L=this.crossTileIDs[F];if(this.keys[F]===S&&!c.has(L)){c.add(L),T.crossTileID=L;break}}}}}class $r{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class vo{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const c in this.indexes){const d=this.indexes[c],p={};for(const m in d){const y=d[m];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),p[y.tileID.key]=y}this.indexes[c]=p}this.lng=t}addBucket(t,n,c){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const d=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const y in m){const x=m[y];x.tileID.isChildOf(t)&&x.findMatches(n.symbolInstances,t,d)}else{const y=m[t.scaledTo(Number(p)).key];y&&y.findMatches(n.symbolInstances,t,d)}}for(let p=0;p<n.symbolInstances.length;p++){const m=n.symbolInstances.get(p);m.crossTileID||(m.crossTileID=c.generate(),d.add(m.crossTileID))}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Yl(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const c of n.crossTileIDs)this.usedCrossTileIDs[t].delete(c)}removeStaleBuckets(t){let n=!1;for(const c in this.indexes){const d=this.indexes[c];for(const p in d)t[d[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[p]),delete d[p],n=!0)}return n}}class on{constructor(){this.layerIndexes={},this.crossTileIDs=new $r,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,c,d){let p=this.layerIndexes[t.fqid];p===void 0&&(p=this.layerIndexes[t.fqid]=new vo);let m=!1;const y={};d.name!=="globe"&&p.handleWrapJump(c);for(const x of n){const T=x.getBucket(t);T&&t.fqid===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),p.addBucket(x.tileID,T,this.crossTileIDs)&&(m=!0),y[T.bucketInstanceId]=!0)}return p.removeStaleBuckets(y)&&(m=!0),m}pruneUnusedLayers(t){const n={};t.forEach(c=>{n[c]=!0});for(const c in this.layerIndexes)n[c]||delete this.layerIndexes[c]}}const ys=771;class Pt{constructor(t,n,c,d){this.blendFunction=t,this.blendColor=n.toNonPremultipliedRenderColor(null),this.mask=c,this.blendEquation=d}}Pt.Replace=[1,0,1,0],Pt.disabled=new Pt(Pt.Replace,s.am.transparent,[!1,!1,!1,!1]),Pt.unblended=new Pt(Pt.Replace,s.am.transparent,[!0,!0,!0,!0]),Pt.alphaBlended=new Pt([1,ys,1,ys],s.am.transparent,[!0,!0,!0,!0]),Pt.alphaBlendedNonPremultiplied=new Pt([770,ys,770,ys],s.am.transparent,[!0,!0,!0,!0]),Pt.multiply=new Pt([774,0,774,0],s.am.transparent,[!0,!0,!0,!0]);class it{constructor(t,n,c){this.func=t,this.mask=n,this.range=c}}it.ReadOnly=!1,it.ReadWrite=!0,it.disabled=new it(519,it.ReadOnly,[0,1]);const kn=7680;class xt{constructor(t,n,c,d,p,m){this.test=t,this.ref=n,this.mask=c,this.fail=d,this.depthFail=p,this.pass=m}}xt.disabled=new xt({func:519,mask:0},0,0,kn,kn,kn);const hr=1029,ol=2305;class mt{constructor(t,n,c){this.enable=t,this.mode=n,this.frontFace=c}}function Xs(l,t){const n=s.c6(l,3);s.c8(l,t),s.cc(l,3,n)}function Ys(l,t){const n=s.c3([]);return s.c4(n,n,-t),s.c5(n,n,-l),n}function Vo(l,t){const n=[l[0],l[1],0],c=[t[0],t[1],0];if(s.ae(n)>=1e-15){const m=s.au([],n);s.c1(c,m,s.bG(c,m)),t[0]=c[0],t[1]=c[1]}const d=s.bF([],t,l);if(s.c2(d)<1e-15)return null;const p=Math.atan2(-d[1],d[0]);return Ys(Math.atan2(Math.sqrt(l[0]*l[0]+l[1]*l[1]),-l[2]),p)}mt.disabled=new mt(!1,hr,ol),mt.backCCW=new mt(!0,hr,ol),mt.backCW=new mt(!0,hr,2304),mt.frontCW=new mt(!0,1028,2304),mt.frontCCW=new mt(!0,1028,ol);class md{constructor(t,n){this.position=t,this.orientation=n}get position(){return this._position}set position(t){if(t){const n=t instanceof s.ac?t:new s.ac(t[0],t[1],t[2]);
vendor: 4,345 bytes, line 15
15this._renderWorldCopies&&(n.x=s.bQ(n.x,0,1)),this._position=n}else this._position=null}lookAtPoint(t,n){if(this.orientation=null,!this.position)return;const c=this.position,d=this._elevation?this._elevation.getAtPointOrZero(s.ac.fromLngLat(t)):0,p=s.ac.fromLngLat(t,d),m=[p.x-c.x,p.y-c.y,p.z-c.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=Vo(m,n)}setPitchBearing(t,n){this.orientation=Ys(s.al(t),s.al(-n))}}class Bn{constructor(t,n){this._transform=s.bx([]),this.orientation=n,this.position=t}get mercatorPosition(){const t=this.position;return new s.ac(t[0],t[1],t[2])}get position(){const t=s.c6(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var n;t&&s.cc(this._transform,3,[(n=t)[0],n[1],n[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||s.c3([]),t&&Xs(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),n=this.right();return{bearing:Math.atan2(-n[1],n[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,n){this._orientation=Ys(t,n),Xs(this._transform,this._orientation)}forward(){const t=s.c6(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=s.c6(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=s.c6(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,n){const c=new Float64Array(16);return s.bi(c,this.getWorldToCamera(t,n)),c}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,n,c){const d=this.position;s.c1(d,d,-t);const p=new Float64Array(16);return s.bn(p,[c,c,c]),s.bo(p,p,d),p[10]*=n,p}getWorldToCamera(t,n){const c=new Float64Array(16),d=new Float64Array(4),p=this.position;return s.c7(d,this._orientation),s.c1(p,p,-t),s.c8(c,d),s.bo(c,c,p),c[1]*=-1,c[5]*=-1,c[9]*=-1,c[13]*=-1,c[8]*=n,c[9]*=n,c[10]*=n,c[11]*=n,c}getCameraToClipPerspective(t,n,c,d){const p=new Float64Array(16);return s.c9(p,t,n,c,d),p}getCameraToClipOrthographic(t,n,c,d,p,m){const y=new Float64Array(16);return s.ca(y,t,n,c,d,p,m),y}getDistanceToElevation(t,n=!1){const c=t===0?0:s.cb(t,n?s.aY(this.position[1]):this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new Bn([...this.position],[...this.orientation])}}const Zr={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class sl{constructor(t=0,n=0,c=0,d=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=c,this.right=d}interpolate(t,n,c){return n.top!=null&&t.top!=null&&(this.top=s.ai(t.top,n.top,c)),n.bottom!=null&&t.bottom!=null&&(this.bottom=s.ai(t.bottom,n.bottom,c)),n.left!=null&&t.left!=null&&(this.left=s.ai(t.left,n.left,c)),n.right!=null&&t.right!=null&&(this.right=s.ai(t.right,n.right,c)),this}getCenter(t,n){const c=s.ay((this.left+t-this.right)/2,0,t),d=s.ay((this.top+n-this.bottom)/2,0,n);return new s.P(c,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new sl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Tr=15;class gh{constructor(t,n,c,d,p,m,y){this.tileSize=512,this._renderWorldCopies=p===void 0||p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=c??0,this._maxPitch=d??60,this.setProjection(m),this.setMaxBounds(y),this.width=0,this.height=0,this._center=new s.ci(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new sl,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Bn,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const t=new gh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForE
vendor: 27,431 bytes, line 15
15xaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t._allowWorldUnderZoom=this._allowWorldUnderZoom,t}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<Tr}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(t,n=!1){const c=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||c)&&this._updateCameraOnTerrain(),(t||c)&&this._constrainCamera(n),this._calcMatrices()}getProjection(){return s.aF(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const n=this.projection?this.getProjection():void 0;this.projection=s.cj(this.projectionOptions);const c=this.getProjection(),d=!s.bv(n,c);return d&&this._calcMatrices(),this.mercatorFromTransition=!1,d}setOrthographicProjectionAtLowPitch(t){return this._orthographicProjectionAtLowPitch!==t&&(this._orthographicProjectionAtLowPitch=t,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=s.cj({name:"mercator"});const n=t!==this.projection.name;return n&&this._calcMatrices(),n}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return s.cb(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.P(this.width,this.height)}get bearing(){return s.bQ(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const n=-t*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=s.ck(),s.cl(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=s.ay(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=s.al(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._setZoom(n),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(t){this._tileCoverLift!==t&&(this._tileCoverLift=t)}_updateCameraOnTerrain(){const t=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,n=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&&(!n||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const c=this._elevation;n||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&c.exaggeration()&&this._centerAltitudeValidForExaggeration!==c.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*c.exaggeration(),this._centerAltitudeValidForExaggeration=c.exaggeration()):(this._centerAltitude=t||0,this._centerAltitudeValidForExaggeration=c.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const t=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(t)}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],c=this.horizonLineFromTop();let d=0,p=0;for(let m=0;m<n.length;m++){const y=new s.P(n[m][0]*this.width,c+n[m][1]*(this.height-c)),x=t.pointCoordinate(y);if(!x)continue;const T=1/Math.hypot(x[0]-this._camera.position[0],x[1]-this._camera.position[1]);d+=x[3]*T,p+=T}return p===0?NaN:d/p}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,n=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),c=this.pixelsPerMeter/this.worldSize*n,d=this._mercatorZfromZoom(t),p=this._mercatorZfromZoom(this._maxZoom),m=Math.max(d-c,p);this._setZoom(this._zoomFromMercatorZ(m))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}computeZoomRelativeTo(t){const n=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let c;c=t.z<this._camera.position[2]?[n.x,n.y,n.z]:[t.x,t.y,t.z];const d=s.ae(s.at([],this._camera.position,c));return s.ay(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let n=!1;if(t.orientation&&!s.cm(t.orientation,this._camera.orientation)&&(n=this._setCameraOrientation(t.orientation)),t.position){const c=[t.position.x,t.position.y,t.position.z];s.cn(c,this._camera.position)||(this._setCameraPosition(c),n=!0)}n&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,n=new md;return n.position=new s.ac(t[0],t[1],t[2]),n.orientation=this._camera.orientation,n._elevation=this.elevation,n._renderWorldCopies=this.renderWorldCopies,n}_setCameraOrientation(t){if(!s.co(t))return!1;s.cp(t,t);const n=s.cq([],[0,0,-1],t),c=s.cq([],[0,-1,0],t);if(c[2]<0)return!1;const d=Vo(n,c);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(t){const n=this.zoomScale(this.minZoom)*this.tileSize,c=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;t[2]=s.ay(t[2],d/c,d/n),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,c){this._unmodified=!1,this._edgeInsets.interpolate(t,n,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new s.cr(0,t)];if(this.renderWorldCopies){const c=this.pointCoordinate(new s.P(0,0)),d=this.pointCoordinate(new s.P(this.width,0)),p=this.pointCoordinate(new s.P(this.width,this.height)),m=this.pointCoordinate(new s.P(0,this.height)),y=Math.floor(Math.min(c.x,d.x,p.x,m.x)),x=Math.floor(Math.max(c.x,d.x,p.x,m.x)),T=1;for(let S=y-T;S<=x+T;S++)S!==0&&n.push(new s.cr(S,t))}return n}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,n,c){let d=[];const p=c!=null,m=!p;if(m&&this.zoom<n||p&&c[0]===0&&c[1]===0)return d;const y=new Set,x=(S,M,E,C,D)=>{const z=s.cV(M,S,E,C,D);y.has(z)||(d.push(new s.aM(S,M,E,C,D)),y.add(z))};for(let S=0;S<t.length;S++){const M=t[S];if(m&&M.canonical.z!==n)continue;const E=M.canonical,C=M.overscaledZ,D=M.wrap,z=1<<E.z,F=E.x+1<z,L=E.x>0,N=E.y+1<z,j=E.y>0,q=M.wrap-(L?0:1),X=M.wrap+(F?0:1),ee=L?E.x-1:z-1,ie=F?E.x+1:0;if(p)c[0]<0?(x(C,X,E.z,ie,E.y),c[1]<0&&N&&(x(C,D,E.z,E.x,E.y+1),x(C,X,E.z,ie,E.y+1)),c[1]>0&&j&&(x(C,D,E.z,E.x,E.y-1),x(C,X,E.z,ie,E.y-1))):c[0]>0?(x(C,q,E.z,ee,E.y),c[1]<0&&N&&(x(C,D,E.z,E.x,E.y+1),x(C,q,E.z,ee,E.y+1)),c[1]>0&&j&&(x(C,D,E.z,E.x,E.y-1),x(C,q,E.z,ee,E.y-1))):c[1]<0&&N?x(C,D,E.z,E.x,E.y+1):j&&x(C,D,E.z,E.x,E.y-1);else{const Y=M.visibleQuadrants;1&Y&&(x(C,q,E.z,ee,E.y),j&&(x(C,D,E.z,E.x,E.y-1),x(C,q,E.z,ee,E.y-1))),2&Y&&(x(C,X,E.z,ie,E.y),j&&(x(C,D,E.z,E.x,E.y-1),x(C,X,E.z,ie,E.y-1))),4&Y&&(x(C,q,E.z,ee,E.y),N&&(x(C,D,E.z,E.x,E.y+1),x(C,q,E.z,ee,E.y+1))),8&Y&&(x(C,X,E.z,ie,E.y),N&&(x(C,D,E.z,E.x,E.y+1),x(C,X,E.z,ie,E.y+1)))}}const T=[];for(const S of d)d.some(M=>S.isChildOf(M))||T.push(S);if(d=T.filter(S=>!t.some(M=>!!(S.overscaledZ<n&&M.isChildOf(S))||S.equals(M)||S.isChildOf(M))),m){const S=1<<n,M=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),E=[S*M.x,S*M.y],C=4,D=C*C;d=d.filter(z=>{const F=z.canonical.x+.5-E[0],L=z.canonical.y+.5-E[1];return F*F+L*L<D})}return d}extendTileCoverToNearPlane(t,n,c){const d=[],p=new Set;for(const N of t)p.add(N.key);const m=(N,j,q,X,ee)=>{const ie=s.cV(j,N,q,X,ee);p.has(ie)||(d.push(new s.aM(N,j,q,X,ee)),p.add(ie))},y=t.reduce((N,j)=>Math.max(N,j.overscaledZ),c),x=1<<c,T=[new s.P(0,0),new s.P(s.aj,0),new s.P(s.aj,s.aj),new s.P(0,s.aj)],S=new s.P(0,0),M=new s.P(0,0),E=(N,j)=>{const q=Math.floor(N[0]),X=Math.floor(N[1]),ee=(N[0]-q)*s.aj,ie=(N[1]-X)*s.aj,Y=Math.floor(j[0]),K=Math.floor(j[1]),J=(j[0]-Y)*s.aj,fe=(j[1]-K)*s.aj;for(let se=-1;se<=1;se++){const Ie=q+se;if(!(Ie<0||Ie>=x)){S.x=ee-se*s.aj,M.x=J-(Ie-Y)*s.aj;for(let xe=-1;xe<=1;xe++){const Me=X+xe;S.y=ie-xe*s.aj,M.y=fe-(Me-K)*s.aj,s.cW(S,M,T)&&m(y,0,c,Ie,Me)}}}},C=n.points,D=C[s.cs],z=C[s.ct],F=this._projectToGround(D,C[s.cu]),L=this._projectToGround(z,C[s.cv]);return E(D,F),E(z,L),d}_projectToGround(t,n){return s.cw(s.cx(),t,n,t[2]/(t[2]-n[2]))}coveringTiles(t){let n=this.coveringZoomLevel(t);const c=n,d=this.elevation&&this.elevation.exaggeration(),p=d&&!t.isTerrainDEM,m=this.projection.name==="mercator";if(t.minzoom!==void 0&&n<t.minzoom)return[];t.maxzoom!==void 0&&n>t.maxzoom&&(n=t.maxzoom);const y=this.locationCoordinate(this.center),x=this.center.lat,T=1<<n,S=[T*y.x,T*y.y,0],M=this.projection.name==="globe",E=!M,C=s.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,E),D=M?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),z=T*s.cb(1,this.center.lat),F=this._camera.position[2]/s.cb(1,this.center.lat),L=[T*D.x,T*D.y,F*(E?1:z)],N=M||d,j=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),q=this.isLODDisabled(!0)?n:0;let X;if(this._elevation&&t.isTerrainDEM)X=1e4*this._elevation.exaggeration();else if(this._elevation){const oe=this._elevation.getMinMaxForVisibleTiles();X=oe?oe.max:this._centerAltitude}else X=this._centerAltitude;const ee=t.isTerrainDEM?-X:this._elevation?this._elevation.getMinElevationBelowMSL():0,ie=this.projection.isReprojectedInTileSpace?s.cz(this):1,Y=oe=>{const _e=new s.ac(oe.x+25e-6,oe.y,oe.z),ze=new s.ac(oe.x,oe.y+25e-6,oe.z),Re=oe.toLngLat(),Le=_e.toLngLat(),Ze=ze.toLngLat(),at=this.locationCoordinate(Re),dt=this.locationCoordinate(Le),Qe=this.locationCoordinate(Ze),ht=Math.hypot(dt.x-at.x,dt.y-at.y),lt=Math.hypot(Qe.x-at.x,Qe.y-at.y);return Math.sqrt(ht*lt)*ie/25e-6},K=oe=>{const we=X,_e=ee;return{aabb:s.cC(this,T,0,0,0,oe,_e,we,this.projection),zoom:0,x:0,y:0,minZ:_e,maxZ:we,wrap:oe,fullyVisible:!1}},J=[];let fe=[];const se=n,Ie=t.reparseOverscaled?c:n,xe=(F-this._centerAltitude)*z,Me=oe=>{if(!this._elevation||!oe.tileID||!m)return;const we=this._elevation.getMinMaxForTile(oe.tileID),_e=oe.aabb;we?(_e.min[2]=we.min,_e.max[2]=we.max,_e.center[2]=(_e.min[2]+_e.max[2])/2):(oe.shouldSplit=me(oe),oe.shouldSplit||(_e.min[2]=_e.max[2]=_e.center[2]=this._centerAltitude))},Ue=(oe,we)=>{if(.707*we<oe)return 1;const _e=we/oe;return _e/(1.4144271570014144+(Math.pow(1.1,_e-1.4144271570014144+1)-1)/(1.1-1)-1)},me=oe=>{if(oe.zoom<q)return!0;if(oe.zoom===se)return!1;if(oe.shouldSplit!=null)return oe.shouldSplit;const we=oe.aabb.distanceX(L),_e=oe.aabb.distanceY(L);let ze=xe,Re=1;if(M){ze=oe.aabb.distanceZ(L);const lt=Math.pow(2,oe.zoom),wt=s.aY((oe.y+1)/lt),At=s.aY(oe.y/lt),Ot=Math.min(Math.max(x,wt),At),Yt=s.c_(Ot)/s.c_(x);if(Re=Ot===x?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,Yt/this._mercatorScaleRatio),this.zoom<=s.cX&&oe.zoom===se-1&&Yt>=.9)return!0}else if(p&&(ze=oe.aabb.distanceZ(L)*z),this.projection.isReprojectedInTileSpace&&c<=5){const lt=Math.pow(2,oe.zoom),wt=Y(new s.ac((oe.x+.5)/lt,(oe.y+.5)/lt));Re=wt>.85?1:wt}if(!m){const lt=Math.sqrt(we*we+_e*_e+ze*ze);let wt=(1<<se-oe.zoom)*j*Re;return wt*=Ue(Math.max(ze,xe),lt),lt<wt}let Le=Number.MAX_VALUE,Ze=0;const at=oe.aabb.getCorners(),dt=[];for(const lt of at){s.at(dt,lt,L),M||(p?dt[2]*=z:dt[2]=xe);const wt=s.bG(dt,this._camera.forward());wt<Le&&(Le=wt,Ze=Math.abs(dt[2]))}let Qe=(1<<se-oe.zoom)*j*Re;if(Qe*=Ue(Math.max(Ze,xe),Le),Le<Qe)return!0;const ht=oe.aabb.closestPoint(S);return ht[0]===S[0]&&ht[1]===S[1]};if(this.renderWorldCopies)for(let oe=1;oe<=3;oe++)J.push(K(-oe)),J.push(K(oe));for(J.push(K(0));J.length>0;){const oe=J.pop(),we=oe.x,_e=oe.y;let ze=oe.fullyVisible;const Re=()=>this.projection.name==="globe"&&(oe.y===0||oe.y===(1<<oe.zoom)-1);if(!ze){let Le=N?oe.aabb.intersects(C):oe.aabb.intersectsFlat(C);if(Le===0&&Re()){const Ze=new s.cA(oe.zoom,we,_e);Le=s.cB(this,T,Ze,!0).intersects(C)}if(Le===0)continue;ze=Le===2}if(oe.zoom!==se&&me(oe))for(let Le=0;Le<4;Le++){const Ze=(we<<1)+Le%2,at=(_e<<1)+(Le>>1),dt={aabb:m?oe.aabb.quadrant(Le):s.cC(this,T,oe.zoom+1,Ze,at,oe.wrap,oe.minZ,oe.maxZ,this.projection),zoom:oe.zoom+1,x:Ze,y:at,wrap:oe.wrap,fullyVisible:ze,tileID:void 0,shouldSplit:void 0,minZ:oe.minZ,maxZ:oe.maxZ};p&&!M&&(dt.tileID=new s.aM(oe.zoom+1===se?Ie:oe.zoom+1,oe.wrap,oe.zoom+1,Ze,at),Me(dt)),J.push(dt)}else{const Le=oe.zoom===se?Ie:oe.zoom;if(t.minzoom&&t.minzoom>Le)continue;let Ze=0;if(!ze){let ht=N?oe.aabb.intersectsPrecise(C):oe.aabb.intersectsPreciseFlat(C);if(ht===0&&Re()){const lt=new s.cA(oe.zoom,we,_e);ht=s.cB(this,T,lt,!0).intersectsPrecise(C)}if(ht===0)continue;if(t.calculateQuadrantVisibility)if(C.containsPoint(oe.aabb.center))Ze=15;else for(let lt=0;lt<4;lt++)oe.aabb.quadrant(lt).intersects(C)!==0&&(Ze|=1<<lt)}const at=S[0]-(.5+we+(oe.wrap<<oe.zoom))*(1<<n-oe.zoom),dt=S[1]-.5-_e,Qe=oe.tileID?oe.tileID:new s.aM(Le,oe.wrap,oe.zoom,we,_e);t.calculateQuadrantVisibility&&(Qe.visibleQuadrants=Ze),fe.push({tileID:Qe,distanceSq:at*at+dt*dt})}}if(this.fogCullDistSq){const oe=this.fogCullDistSq,we=this.horizonLineFromTop();fe=fe.filter(_e=>{const ze=[0,0,0,1],Re=[s.aj,s.aj,0,1],Le=this.calculateFogTileMatrix(_e.tileID.toUnwrapped());s.aA(ze,ze,Le),s.aA(Re,Re,Le);const Ze=s.cD([],ze,Re),at=s.cE([],ze,Re),dt=s.cY(Ze,at);if(dt===0)return!0;let Qe=!1;const ht=this._elevation;if(ht&&dt>oe&&we!==0){const lt=this.calculateProjMatrix(_e.tileID.toUnwrapped());let wt;t.isTerrainDEM||(wt=ht.getMinMaxForTile(_e.tileID)),wt||(wt={min:ee,max:X});const At=s.cF(this.rotation),Ot=[At[0]*s.aj,At[1]*s.aj,wt.max];s.ad(Ot,Ot,lt),Qe=(1-Ot[1])*this.height*.5<we}return dt<oe||Qe})}return fe.sort((oe,we)=>oe.distanceSq-we.distanceSq).map(oe=>oe.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=s.ay(t.lat,-s.cG,s.cG),c=this.projection.project(t.lng,n);return new s.P(c.x*this.worldSize,c.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/s.cb(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,n){let c,d;const p=this.centerPoint;if(this.projection.name==="globe"){const y=this.worldSize;c=(n.x-p.x)/y,d=(n.y-p.y)/y}else{const y=this.pointCoordinate(n),x=this.pointCoordinate(p);c=y.x-x.x,d=y.y-x.y}const m=this.locationCoordinate(t);this.setLocation(new s.ac(m.x-c,m.y-d))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,n){return this.projection.locationPoint(this,t,n)}locationPoint3D(t,n){return this.projection.locationPoint(this,t,n,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,n){return this.coordinateLocation(this.pointCoordinate3D(t,n))}locationCoordinate(t,n){const c=n?s.cb(n,t.lat):void 0,d=this.projection.project(t.lng,t.lat);return new s.ac(d.x,d.y,c)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,n){const c=n??this._centerAltitude,d=[t.x,t.y,0,1],p=[t.x,t.y,1,1];s.aA(d,d,this.pixelMatrixInverse),s.aA(p,p,this.pixelMatrixInverse);const m=p[3];s.cH(d,d,1/d[3]),s.cH(p,p,1/m);const y=d[2],x=p[2];return{p0:d,p1:p,t:y===x?0:(c-y)/(x-y)}}screenPointToMercatorRay(t){const n=[t.x,t.y,0,1],c=[t.x,t.y,1,1];return s.aA(n,n,this.pixelMatrixInverse),s.aA(c,c,this.pixelMatrixInverse),s.cH(n,n,1/n[3]),s.cH(c,c,1/c[3]),n[2]=s.cb(n[2],this._center.lat)*this.worldSize,c[2]=s.cb(c[2],this._center.lat)*this.worldSize,s.cH(n,n,1/this.worldSize),s.cH(c,c,1/this.worldSize),new s.av([n[0],n[1],n[2]],s.au([],s.at([],c,n)))}rayIntersectionCoordinate(t){const{p0:n,p1:c,t:d}=t,p=s.cb(n[2],this._center.lat),m=s.cb(c[2],this._center.lat);return new s.ac(s.ai(n[0],c[0],d)/this.worldSize,s.ai(n[1],c[1],d)/this.worldSize,s.ai(p,m,d))}pointCoordinate(t,n=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,n)}pointCoordinate3D(t,n){if(!this.elevation)return this.pointCoordinate(t,n);let c=this.projection.pointCoordinate3D(this,t.x,t.y);if(c)return new s.ac(c[0],c[1],c[2]);let d=0,p=this.horizonLineFromTop();if(t.y>p)return this.pointCoordinate(t,n);const m=.02*p,y=t.clone();for(let x=0;x<10&&p-d>m;x++){y.y=s.ai(d,p,.66);const T=this.projection.pointCoordinate3D(this,y.x,y.y);T?(p=y.y,c=T):d=y.y}return c?new s.ac(c[0],c[1],c[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=s.cI)return!this.isPointAboveHorizon(t);const n=this.pointCoordinate(t);return n.y>=0&&n.y<=1}_coordinatePoint(t,n){const c=n&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,d=[t.x*this.worldSize,t.y*this.worldSize,c+t.toAltitude(),1];return s.aA(d,d,this.pixelMatrix),d[3]>0?new s.P(d[0]/d[3],d[1]/d[3]):new s.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:n}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,p=this.pointLocation3D(new s.P(n,t)),m=this.pointLocation3D(new s.P(d,t)),y=this.pointLocation3D(new s.P(d,c)),x=this.pointLocation3D(new s.P(n,c));let T=Math.min(p.lng,m.lng,y.lng,x.lng),S=Math.max(p.lng,m.lng,y.lng,x.lng),M=Math.min(p.lat,m.lat,y.lat,x.lat),E=Math.max(p.lat,m.lat,y.lat,x.lat);const C=Math.pow(2,-this.zoom)/16*270,D=this.projection.name==="globe"?1:4,z=(F,L,N,j,q)=>{const X=(F+N)/2,ee=(L+j)/2,ie=new s.P(X,ee),{lng:Y,lat:K}=this.pointLocation3D(ie),J=Math.max(0,T-Y,M-K,Y-S,K-E);T=Math.min(T,Y),S=Math.max(S,Y),M=Math.min(M,K),E=Math.max(E,K),(q<D||J>C)&&(z(F,L,X,ee,q+1),z(X,ee,N,j,q+1))};if(z(n,t,d,t,1),z(d,t,d,c,1),z(d,c,n,c,1),z(n,c,n,t,1),this.projection.name==="globe"){const[F,L]=s.cJ(this);F?(E=90,S=180,T=-180):L&&(M=-90,S=180,T=-180)}return new s.aG(new s.ci(T,M),new s.ci(S,E))}_getBoundsRectangular(t,n){const{top:c,left:d}=this._edgeInsets,p=this.height-this._edgeInsets.bottom,m=this.width-this._edgeInsets.right,y=new s.P(d,c),x=new s.P(m,c),T=new s.P(m,p),S=new s.P(d,p);let M=this.pointCoordinate(y,t),E=this.pointCoordinate(x,t);const C=this.pointCoordinate(T,n),D=this.pointCoordinate(S,n),z=(F,L)=>(L.y-F.y)/(L.x-F.x);return M.y>1&&E.y>=0?M=new s.ac((1-D.y)/z(D,M)+D.x,1):M.y<0&&E.y<=1&&(M=new s.ac(-D.y/z(D,M)+D.x,0)),E.y>1&&M.y>=0?E=new s.ac((1-C.y)/z(C,E)+C.x,1):E.y<0&&M.y<=1&&(E=new s.ac(-C.y/z(C,E)+C.x,0)),new s.aG().extend(this.coordinateLocation(M)).extend(this.coordinateLocation(E)).extend(this.coordinateLocation(D)).extend(this.coordinateLocation(C))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const n=t.visibleDemTiles.reduce((c,d)=>{if(d.dem){const p=d.dem.tree;c.min=Math.min(c.min,p.minimums[0]),c.max=Math.max(c.max,p.maximums[0])}return c},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(n.min*t.exaggeration(),n.max*t.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(t=!0){const n=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,c=this.height/2-n*(1-this._horizonShift);return t?Math.max(0,c):c}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-s.cG,this.maxLat=s.cG,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=s.aD(this.minLng)*this.tileSize,this.worldMaxX=s.aD(this.maxLng)*this.tileSize,this.worldMinY=s.aH(this.maxLat)*this.tileSize,this.worldMaxY=s.aH(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,n){return this.projection.createTileMatrix(this,n,t)}calculateDistanceTileData(t){const n=t.key,c=this._distanceTileDataCache;if(c[n])return c[n];const d=t.canonical,p=1/this.height,m=this.cameraWorldSize,y=m/this.zoomScale(d.z),x=(d.x+Math.pow(2,d.z)*t.wrap)*y,T=d.y*y,S=this.point;S.x*=m/this.worldSize,S.y*=m/this.worldSize;const M=this.angle,E=Math.sin(-M),C=-Math.cos(-M);return c[n]={bearing:[E,C],center:[(S.x-x)*p,(S.y-T)*p],scale:y/s.aj*p},c[n]}calculateFogTileMatrix(t){const n=t.key,c=this._fogTileMatrixCache;if(c[n])return c[n];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return s.az(d,this.worldToFogMatrix,d),c[n]=new Float32Array(d),c[n]}calculateProjMatrix(t,n=!1,c=!1){const d=t.key;let p;if(p=c?this._expandedProjMatrixCache:n?this._alignedProjMatrixCache:this._projMatrixCache,p[d])return p[d];const m=this.calculatePosMatrix(t,this.worldSize);let y;return y=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:c?this.expandedFarZProjMatrix:n?this.alignedProjMatrix:this.projMatrix,s.az(m,y,m),p[d]=new Float32Array(m),p[d]}calculatePixelsToTileUnitsMatrix(t){const n=t.tileID.key,c=this._pixelsToTileUnitsCache;if(c[n])return c[n];const d=s.cK(t,this);return c[n]=d,c[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,n=s.bn([],[t,t,t]);return s.az(n,n,this.globeMatrix),n}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const n=s.cb(1,this._center.lat)*this.worldSize,c=this._computeCameraPosition(n),d=this._camera.forward(),p=s.cb(1,this._center.lat);c[2]/=p,d[2]/=p,s.au(d,d);const m=t.raycast(c,d,t.exaggeration());if(m){const y=s.bE([],c,d,m),x=new s.ac(y[0],y[1],s.cb(y[2],s.aY(y[1]))),T=(x.z+s.ae([x.x-c[0],x.y-c[1],x.z-c[2]*p]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(T),this._centerAltitude=x.toAltitude(),this._center=this.coordinateLocation(x),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const n=this._elevation,c=s.cb(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(c),p=n.getAtPointOrZero(new s.ac(...d)),m=this.pixelsPerMeter/this.worldSize*p,y=this._minimumHeightOverTerrain(),x=d[2]-m;if(x<=y)if(x<0||t){const T=this.locationCoordinate(this._center,this._centerAltitude),S=[d[0],d[1],T.z-d[2]],M=s.ae(S);S[2]-=(y-x)/this._pixelsPerMercatorPixel;const E=s.ae(S);if(E===0)return;s.c1(S,S,M/E*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],T.z*this._pixelsPerMercatorPixel-S[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const E=this.center;return E.lat=s.ay(E.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(E.lng=s.ay(E.lng,this.minLng,this.maxLng)),this.center=E,void(this._constraining=!1)}const n=this._unmodified,{x:c,y:d}=this.point;let p=0,m=c,y=d;const x=this.width/2,T=this.height/2,S=this.worldMinY*this.scale,M=this.worldMaxY*this.scale;if(d-T<S&&(y=S+T),d+T>M&&(y=M-T),M-S<this.height&&(p=Math.max(p,this.height/(M-S)),y=(M+S)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const E=this.worldMinX*this.scale,C=this.worldMaxX*this.scale,D=this.worldSize/2-(E+C)/2;
15m=(c+D+this.worldSize)%this.worldSize-D,m-x<E&&(m=E+x),m+x>C&&(m=C-x),C-E<this.width&&(p=Math.max(p,this.width/(C-E)),m=(C+E)/2)}m===c&&y===d||this._allowWorldUnderZoom||(this.center=this.unproject(new s.P(m,y))),p&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(p)),this._constrainCamera(),this._unmodified=n,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.projection.name==="globe",c=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=s.cb(1,this.center.lat)/s.cb(1,s.c$));const d=s.cL(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),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 p=this.projection.zAxisUnit==="meters"?c:1,m=this._camera.getWorldToCamera(this.worldSize,p);let y;const x=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(x[8]=2*-t.x/this.width,x[9]=2*t.y/this.height,this.isOrthographic){let K=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),J=K*this.aspect,fe=-J,se=-K;J-=t.x,fe-=t.x,K+=t.y,se+=t.y,y=this._camera.getCameraToClipOrthographic(fe,J,se,K,this._nearZ,this._farZ),((Ie,xe,Me,Ue)=>{for(let me=0;me<16;me++)Ie[me]=s.ai(xe[me],Me[me],Ue)})(y,y,x,s.cZ(this.pitch>=Tr?1:this.pitch/Tr))}else y=x;const T=s.cM([],x,m);let S=s.cM([],y,m);if(this.projection.isReprojectedInTileSpace){const K=this.locationCoordinate(this.center),J=s.bx([]);s.bo(J,J,[K.x*this.worldSize,K.y*this.worldSize,0]),s.az(J,J,s.cN(this)),s.bo(J,J,[-K.x*this.worldSize,-K.y*this.worldSize,0]),s.az(S,S,J),s.az(T,T,J),this.inverseAdjustmentMatrix=s.cO(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=s.cP([],S,[this.worldSize,this.worldSize,this.worldSize/p,1]),this.projMatrix=S,this.invProjMatrix=s.bi(new Float64Array(16),this.projMatrix),n){const K=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);K[8]=2*-t.x/this.width,K[9]=2*t.y/this.height,this.expandedFarZProjMatrix=s.cM([],K,m)}else this.expandedFarZProjMatrix=this.projMatrix;const M=s.bi([],y);this.frustumCorners=s.cQ.fromInvProjectionMatrix(M,this.horizonLineFromTop(),this.height),this.cameraFrustum=s.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!n);const E=new Float32Array(16);s.bx(E),s.cP(E,E,[1,-1,1]),s.cR(E,E,this._pitch),s.by(E,E,this.angle);const C=s.c9(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=s.bw(C);const D=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;C[8]=2*-t.x/this.width,C[9]=2*(t.y+D)/this.height,this.skyboxMatrix=s.az(E,C,E);const z=this.point,F=z.x,L=z.y,N=this.width%2/2,j=this.height%2/2,q=Math.cos(this.angle),X=Math.sin(this.angle),ee=F-Math.round(F)+q*N+X*j,ie=L-Math.round(L)+q*j+X*N,Y=new Float64Array(S);if(s.bo(Y,Y,[ee>.5?ee-1:ee,ie>.5?ie-1:ie,0]),this.alignedProjMatrix=Y,S=s.bz(),s.cP(S,S,[this.width/2,-this.height/2,1]),s.bo(S,S,[1,-1,0]),this.labelPlaneMatrix=S,S=s.bz(),s.cP(S,S,[1,-1,1]),s.bo(S,S,[-1,-1,0]),s.cP(S,S,[2/this.width,2/this.height,1]),this.glCoordMatrix=S,this.pixelMatrix=s.az(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},S=s.bi(new Float64Array(16),this.pixelMatrix),!S)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=S,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=s.cS(this);const K=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=s.ad(K,K,m),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=S;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,n=this.cameraPixelsPerMeter,c=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,p=[t,t,n];s.c1(p,p,d),s.c1(c,c,-1),s.cT(c,c,p);const m=s.bz();s.bo(m,m,c),s.cP(m,m,p),this.mercatorFogMatrix=m,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,n,d)}_computeCameraPosition(t){const n=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),d=this.point,p=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*n-t/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-c[0]*p,d.y/this.worldSize-c[1]*p,t/this.worldSize*this._centerAltitude-c[2]*p]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=this._camera.position[2],d=t[2];let p=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(p=Math.min((n-c)/d,1)),this._camera.position=s.bE([],this._camera.position,t,p),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,n=this._camera.forward(),{pitch:c,bearing:d}=this._camera.getPitchBearing(),p=s.cb(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,m=this._mercatorZfromZoom(this._maxZoom)*Math.cos(s.al(this._maxPitch)),y=Math.max((t[2]-p)/Math.cos(c),m),x=this._zoomFromMercatorZ(y);s.bE(t,t,n,y),this._pitch=s.ay(c,s.al(this.minPitch),s.al(this.maxPitch)),this.angle=s.bQ(d,-Math.PI,Math.PI),this._setZoom(s.ay(x,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new s.ac(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,t)*this.tileSize))}zoomFromMercatorZAdjusted(t){let n=0,c=s.cI,d=0,p=1/0;for(;c-n>1e-6&&c>n;){const m=n+.5*(c-n),y=this.tileSize*Math.pow(2,m),x=this.getCameraToCenterDistance(this.projection,m,y),T=this.scaleZoom(x/(Math.max(0,t)*this.tileSize)),S=Math.abs(m-T);S<p&&(p=S,d=m),m<T?n=m:c=m}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(s.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,n){const c=Math.min(t.x,n.x),d=Math.max(t.x,n.x),p=Math.min(t.y,n.y),m=Math.max(t.y,n.y);if(p<this.horizonLineFromTop(!1))return!0;
15if(this.projection.name!=="mercator")return!1;const y=[new s.P(c,p),new s.P(d,m),new s.P(c,m),new s.P(d,p)],x=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const S of y){const M=this.pointRayIntersection(S);if(M.t<0)return!0;const E=this.rayIntersectionCoordinate(M);if(E.x<x||E.y<0||E.x>T||E.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+s.cU(this.fovAboveCenter)>88||this.anyCornerOffEdge(new s.P(0,0),new s.P(this.width,this.height))}zoomDeltaToMovement(t,n){const c=s.ae(s.at([],this._camera.position,t)),d=this._zoomFromMercatorZ(c)+n;return c-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const t=function([n,c,d],p){const m=[n,c,d,1];s.aA(m,m,p);const y=m[3]=Math.max(m[3],1e-6);return m[0]/=y,m[1]/=y,m[2]/=y,m}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new s.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.P(0,t))}}getCameraToCenterDistance(t,n=this.zoom,c=this.worldSize){const d=s.cL(t,n,this.width,this.height,1024),p=t.pixelSpaceConversion(this.center.lat,c,d);let m=.5/Math.tan(.5*this._fov)*this.height*p;return this.isOrthographic&&(m=s.ai(1,m,s.cZ(this.pitch>=Tr?1:this.pitch/Tr))),m}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&s.az(t,t,this.globeMatrix),t}getFrustum(t){return s.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const Qn=(l,t)=>{if(t>0&&l.terrain&&s.w("Cutoff is currently disabled on terrain"),t<=0||l.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const n=l.transform,c=Math.max(Math.abs(n._zoom-(l.minCutoffZoom-1)),1),d=n.isLODDisabled(!1)?s.af(60,45,n.pitch):s.af(30,15,n.pitch),p=n._farZ-n._nearZ,m=t*n.height,y=((1-(x=d))*n.cameraToCenterDistance+x*(n._farZ+m))*c;var x;return{shouldRenderCutoff:d<1,uniformValues:{u_cutoff_params:[n._nearZ,n._farZ,(y-n._nearZ)/p,(y-m-n._nearZ)/p]}}},Nr={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class al{constructor(t,n){this.aabb=t,this.lastCascade=n}}class df{add(t,n){const c=this.receivers[t.key];c!==void 0?(c.aabb.min[0]=Math.min(c.aabb.min[0],n.min[0]),c.aabb.min[1]=Math.min(c.aabb.min[1],n.min[1]),c.aabb.min[2]=Math.min(c.aabb.min[2],n.min[2]),c.aabb.max[0]=Math.max(c.aabb.max[0],n.max[0]),c.aabb.max[1]=Math.max(c.aabb.max[1],n.max[1]),c.aabb.max[2]=Math.max(c.aabb.max[2],n.max[2])):this.receivers[t.key]=new al(n,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,n,c){const d=s.d6.fromPoints(t.points);let p=0;for(const m in this.receivers){const y=this.receivers[m];if(!y||!d.intersectsAabb(y.aabb))continue;y.aabb.min=d.closestPoint(y.aabb.min),y.aabb.max=d.closestPoint(y.aabb.max);const x=y.aabb.getCorners();for(let T=0;T<c.length;T++){let S=!0;for(const M of x){const E=[M[0]*n,M[1]*n,M[2]];if(s.ad(E,E,c[T].matrix),E[0]<-1||E[0]>1||E[1]<-1||E[1]>1){S=!1;break}}if(y.lastCascade=T,p=Math.max(p,T),S)break}}return p+1}}class pf{constructor(t){this.painter=t,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new df,this._depthMode=new it(t.context.gl.LEQUAL,it.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,t.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),t.tp.registerParameter(Nr,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),t.tp.registerParameter(Nr,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),t.tp.registerParameter(Nr,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),t.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,n){const c=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!n||!n.properties)return;const d=n.properties.get("shadow-intensity");if(!n.shadowsEnabled()||d<=0||(this._shadowLayerCount=c.style.order.reduce((D,z)=>{const F=c.style._mergedLayers[z];return D+(F.hasShadowPass()&&!F.isHidden(t.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const p=c.context,m=Nr.shadowMapResolution,y=Nr.shadowMapResolution;if(this._cascades.length===0||Nr.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let D=0;D<Nr.cascadeCount;++D){const z=c._shadowMapDebug,F=p.gl,L=p.createFramebuffer(m,y,z,"texture"),N=new s.T(p,{width:m,height:y,data:null},F.DEPTH_COMPONENT16);if(L.depthAttachment.set(N.texture),z){const j=new s.T(p,{width:m,height:y,data:null},F.RGBA8);L.colorAttachment.set(j.texture)}this._cascades.push({framebuffer:L,texture:N,matrix:[],far:0,boundingSphereRadius:0,frustum:new s.cy,scale:0})}}this.shadowDirection=Ks(n);let x=0;if(t.elevation){const D=t.elevation,z=[1e4,-1e4];D.visibleDemTiles.filter(F=>F.dem).forEach(F=>{const L=F.dem.tree;z[0]=Math.min(z[0],L.minimums[0]),z[1]=Math.max(z[1],L.maximums[0])}),z[0]!==1e4&&(x=(z[1]-z[0])*D.exaggeration())}const T=1.5*t.cameraToCenterDistance,S=3*T,M=new Float64Array(16);for(let D=0;D<this._cascades.length;++D){const z=this._cascades[D];let F=t.height/50,L=1;Nr.cascadeCount===1?L=S:D===0?L=T:(F=T,L=S);const[N,j]=Js(t,this.shadowDirection,F,L,Nr.shadowMapResolution,x);z.scale=t.scale,z.matrix=N,z.boundingSphereRadius=j,s.bi(M,z.matrix),z.frustum=s.cy.fromInvProjectionMatrix(M,1,0,!0),z.far=L}const E=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[E].far,this._cascades[E].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/Nr.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=Nr.shadowMapResolution,this._uniformValues.u_shadowmap_0=Zr.ShadowMap0,this._uniformValues.u_shadowmap_1=Zr.ShadowMap0+1,this._groundShadowTiles=c.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const C=c.transform.elevation;for(const D of this._groundShadowTiles){let z={min:0,max:0};if(C){const F=C.getMinMaxForTile(D);F&&(z=F)}this.addShadowReceiver(D.toUnwrapped(),z.min,z.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(t){this._enabled=t}drawShadowPass(t,n){if(!this.enabled)return;const c=this.painter,d=c.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(c.transform.getFrustum(0),c.transform.worldSize,this._cascades),d.viewport.set([0,0,Nr.shadowMapResolution,Nr.shadowMapResolution]);for(let p=0;p<this._numCascadesToRender;++p){c.currentShadowCascade=p,d.bindFramebuffer.set(this._cascades[p].framebuffer.framebuffer),d.clear({color:s.am.white,depth:1});for(const m of t.order){const y=t._mergedLayers[m];if(!y.hasShadowPass()||y.isHidden(c.transform.zoom))continue;const x=t.getLayerSourceCache(y),T=x?n[x.id]:void 0;(y.type==="model"||T&&T.length)&&c.renderLayer(c,x,y,T)}}c.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,n=t.style,c=t.context,d=c.gl,p=n.directionalLight,m=n.ambientLight;if(!p||!m)return;const y=[],x=Qn(t,t.longestCutoffRange);x.shouldRenderCutoff&&y.push("RENDER_CUTOFF"),y.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&y.push("NORMAL_OFFSET");const T=xs(n,p,m),S=new it(d.LEQUAL,it.ReadOnly,t.depthRangeFor3D),M=new xt({func:d.EQUAL,mask:255},0,255,d.KEEP,d.KEEP,d.KEEP);for(const E of this._groundShadowTiles){const C=E.toUnwrapped(),D=t.isTileAffectedByFog(E),z=t.getOrCreateProgram("groundShadow",{defines:y,overrideFog:D});this.setupShadows(C,z),t.uploadCommonUniforms(c,z,C,null,x);const F={u_matrix:t.transform.calculateProjMatrix(C),u_ground_shadow_factor:T};z.draw(t,d.TRIANGLES,S,M,Pt.multiply,mt.disabled,F,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Pt.unblended:Pt.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const n=this.painter.transform,c=n.calculatePosMatrix(t,n.worldSize);return s.az(c,this._cascades[this.painter.currentShadowCascade].matrix,c),Float32Array.from(c)}
15calculateShadowPassMatrixFromMatrix(t){return s.az(t,this._cascades[this.painter.currentShadowCascade].matrix,t),Float32Array.from(t)}setupShadows(t,n,c){if(!this.enabled)return;const d=this.painter.transform,p=this.painter.context,m=p.gl,y=this._uniformValues,x=new Float64Array(16),T=d.calculatePosMatrix(t,d.worldSize);for(let S=0;S<this._cascades.length;S++)s.az(x,this._cascades[S].matrix,T),y[S===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(x),p.activeTexture.set(m.TEXTURE0+Zr.ShadowMap0+S),this._cascades[S].texture.bindExtraParam(m.LINEAR,m.LINEAR,m.CLAMP_TO_EDGE,m.CLAMP_TO_EDGE,m.GREATER);if(this.useNormalOffset=!!c,this.useNormalOffset){const S=s.d4(t.canonical),M=2/d.tileSize*s.aj/Nr.shadowMapResolution,E=M*this._cascades[0].boundingSphereRadius,C=M*this._cascades[this._cascades.length-1].boundingSphereRadius,D=(c==="vector-tile"?1:3)*function(z,F,L,N,j){const q=s.ay((z-22)/-22,0,1);return .125*(1-q)+4*q}(d.zoom);y.u_shadow_normal_offset=[S,E*D,C*D],y.u_shadow_bias=[1e-4,.0012,.012]}else y.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(p,y)}setupShadowsFromMatrix(t,n,c=!1){if(!this.enabled)return;const d=this.painter.context,p=d.gl,m=this._uniformValues,y=new Float64Array(16);for(let x=0;x<Nr.cascadeCount;x++)s.az(y,this._cascades[x].matrix,t),m[x===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(y),d.activeTexture.set(p.TEXTURE0+Zr.ShadowMap0+x),this._cascades[x].texture.bindExtraParam(p.LINEAR,p.LINEAR,p.CLAMP_TO_EDGE,p.CLAMP_TO_EDGE,p.GREATER);if(this.useNormalOffset=c,c){const x=Nr.normalOffset;m.u_shadow_normal_offset=[1,x,x],m.u_shadow_bias=[6e-5,.0012,.012]}else m.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(d,m)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,n,c,d){if(d[2]>=0)return{};const p=function(x,T,S){const M=S/(1<<x.canonical.z);return new s.d6([x.canonical.x*M+x.wrap*S,x.canonical.y*M+x.wrap*S,0],[(x.canonical.x+1)*M+x.wrap*S,(x.canonical.y+1)*M+x.wrap*S,T])}(t,n,c).getCorners(),m=n/-d[2];d[0]<0?(s.d5(p[0],p[0],[d[0]*m,0,0]),s.d5(p[3],p[3],[d[0]*m,0,0])):d[0]>0&&(s.d5(p[1],p[1],[d[0]*m,0,0]),s.d5(p[2],p[2],[d[0]*m,0,0])),d[1]<0?(s.d5(p[0],p[0],[0,d[1]*m,0]),s.d5(p[1],p[1],[0,d[1]*m,0])):d[1]>0&&(s.d5(p[2],p[2],[0,d[1]*m,0]),s.d5(p[3],p[3],[0,d[1]*m,0]));const y={};return y.vertices=p,y.planes=[Uo(p[1],p[0],p[4]),Uo(p[2],p[1],p[5]),Uo(p[3],p[2],p[6]),Uo(p[0],p[3],p[7])],y}addShadowReceiver(t,n,c){this._receivers.add(t,s.d6.fromTileIdAndHeight(t,n,c))}getMaxCascadeForTile(t){const n=this._receivers.get(t);return n&&n.lastCascade?n.lastCascade:0}}function Uo(l,t,n){const c=s.at([],n,t),d=s.at([],l,t),p=s.bF([],c,d),m=s.ae(p);return m===0?[0,0,1,0]:(s.c1(p,p,1/m),[p[0],p[1],p[2],-s.bG(p,t)])}function Ks(l){const t=l.properties.get("direction"),n=s.d1(t.x,t.y,t.z);n[2]=s.ay(n[2],0,75);const c=s.d3([n[0],n[1],n[2]]);return s.d2(c.x,c.y,c.z)}function xs(l,t,n){const c=t.properties.get("color-use-theme")==="none",d=t.properties.get("color"),p=t.properties.get("intensity"),m=t.properties.get("direction"),y=[m.x,m.y,m.z],x=n.properties.get("color-use-theme")==="none",T=n.properties.get("color"),S=n.properties.get("intensity"),M=Math.max(s.bG([0,0,1],y),0),E=[0,0,0];s.c1(E,T.toPremultipliedRenderColor(x?null:l.getLut(t.scope)).toArray01Linear().slice(0,3),S);const C=[0,0,0];return s.c1(C,d.toPremultipliedRenderColor(c?null:l.getLut(n.scope)).toArray01Linear().slice(0,3),M*p),s.d8([E[0]>0?E[0]/(E[0]+C[0]):0,E[1]>0?E[1]/(E[1]+C[1]):0,E[2]>0?E[2]/(E[2]+C[2]):0])}function Js(l,t,n,c,d,p){const m=l.zoom,y=l.scale,x=l.worldSize,T=1/x,S=l.aspect,M=Math.sqrt(1+S*S)*Math.tan(.5*l.fovX),E=M*M,C=c-n,D=c+n;let z,F;E>C/D?(z=c,F=c*M):(z=.5*D*(1+E),F=.5*Math.sqrt(C*C+2*(c*c+n*n)*E+D*D*E*E));const L=l.projection.pixelsPerMeter(l.center.lat,x),N=l._camera.getCameraToWorldMercator(),j=[0,0,-z*T];s.ad(j,j,N);let q=F*T;const X=l._edgeInsets;if(!(X.left===0&&X.top===0&&X.right===0&&X.bottom===0||X.left===X.right&&X.top===X.bottom)){const ze=l._camera.getWorldToCamera(l.worldSize,l.projection.zAxisUnit==="meters"?L:1),Re=l._camera.getCameraToClipPerspective(l._fov,l.width/l.height,n,c);Re[8]=2*-l.centerOffset.x/l.width,Re[9]=2*l.centerOffset.y/l.height;const Le=new Float64Array(16);s.cM(Le,Re,ze);const Ze=new Float64Array(16);s.bi(Ze,Le);const at=s.cy.fromInvProjectionMatrix(Ze,x,m,!0);for(const dt of at.points){const Qe=((ee=dt)[0]/=y,ee[1]/=y,ee[2]=s.cb(ee[2],l._center.lat),ee);q=Math.max(q,s.c2(s.d7([],j,Qe)))}}var ee;q*=d/(d-1);const ie=Math.acos(t[2]),Y=Math.atan2(-t[0],-t[1]),K=new Bn;K.position=j,K.setPitchBearing(ie,Y);const J=K.getWorldToCamera(x,L),fe=q*x,se=Math.min(l._mercatorZfromZoom(17)*x*-2,-2*fe),Ie=K.getCameraToClipOrthographic(-fe,fe,-fe,fe,se,(fe+p*L)/t[2]),xe=new Float64Array(16);s.az(xe,Ie,J);const Me=s.d2(Math.floor(1e6*j[0])/1e6*x,Math.floor(1e6*j[1])/1e6*x,0),Ue=.5*d,me=[0,0,0];s.ad(me,Me,xe),s.c1(me,me,Ue);const oe=[Math.floor(me[0]),Math.floor(me[1]),Math.floor(me[2])],we=[0,0,0];s.at(we,me,oe),s.c1(we,we,-1/Ue);const _e=new Float64Array(16);return s.bx(_e),s.bo(_e,_e,we),s.az(xe,_e,xe),[xe,fe]}class _d extends s.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,n){return s.aS(this.requestManager.transformRequest(n,s.R.Model).url).then(c=>{if(!c)return;const d=s.aT(c),p=new s.aU(t,void 0,void 0,d);return p.computeBoundsAndApplyParent(),p}).catch(c=>{if(c&&c.status===404)return null;this.fire(new s.z(new Error(`Could not load model ${t} from ${n}: ${c.message}`)))})}load(t,n,c={forceReload:!1}){this.models[n]||(this.models[n]={});const d=Object.keys(t),p=[],m=[];for(const y of d){const x=t[y];this.hasURLBeenRequested(x)&&!c.forceReload||(this.modelByURL[x]={modelId:y,scope:n},p.push(this.loadModel(y,x)),m.push(y)),this.models[n][y]||(this.models[n][y]={model:null,numReferences:1})}this.numModelsLoading[n]=(this.numModelsLoading[n]||0)+m.length,Promise.allSettled(p).then(y=>{for(let x=0;x<y.length;x++){const{status:T}=y[x];if(T==="rejected")continue;const{value:S}=y[x];this.models[n][m[x]]||(this.models[n][m[x]]={model:null,numReferences:1}),this.models[n][m[x]].model=S}this.numModelsLoading[n]-=m.length,this.fire(new s.A("data",{dataType:"style"}))}).catch(y=>{this.fire(new s.z(new Error(`Could not load models: ${y.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]>0)return!1;return!0}hasModel(t,n,c={exactIdMatch:!1}){return!!(c.exactIdMatch?this.getModel(t,n):this.getModelByURL(this.modelUris[n][t]))}getModel(t,n){return this.models[n]||(this.models[n]={}),this.models[n][t]?this.models[n][t].model:void 0}getModelByURL(t){if(!t)return null;const n=this.modelByURL[t];return n?this.models[n.scope][n.modelId].model:null}hasModelBeenAdded(t,n){return this.models[n]&&this.models[n][t]!==void 0}getModelURIs(t){return this.modelUris[t]||{}}addModel(t,n,c){this.models[c]||(this.models[c]={}),this.modelUris[c]||(this.modelUris[c]={});const d=this.requestManager.normalizeModelURL(n);if((this.hasModel(t,c,{exactIdMatch:!0})||this.hasModelBeenAdded(t,c))&&this.modelUris[c][t]===d)this.models[c][t].numReferences++;else if(this.hasURLBeenRequested(d)){const{scope:p,modelId:m}=this.modelByURL[d];this.models[p][m].numReferences++}else this.modelUris[c][t]=d,this.load({[t]:this.modelUris[c][t]},c)}addModelURLs(t,n){this.models[n]||(this.models[n]={}),this.modelUris[n]||(this.modelUris[n]={});const c=this.modelUris[n];for(const d in t)c[d]=this.requestManager.normalizeModelURL(t[d])}
15reloadModels(t){this.load(this.modelUris[t],t,{forceReload:!0})}addModelsFromBucket(t,n){this.models[n]||(this.models[n]={}),this.modelUris[n]||(this.modelUris[n]={});const c={};for(const d of t)this.hasModel(d,n,{exactIdMatch:!0})||this.hasURLBeenRequested(d)?this.models[n][d].numReferences++:this.modelUris[n][d]&&!this.hasURLBeenRequested(d)?c[d]=this.modelUris[n][d]:!this.hasURLBeenRequested(d)&&s.d9(d,!1)&&(this.modelUris[n][d]=this.requestManager.normalizeModelURL(d),c[d]=this.modelUris[n][d]);this.load(c,n)}hasURLBeenRequested(t){return this.modelByURL[t]!==void 0}removeModel(t,n,c=!1,d=!1){if(this.models[n]&&this.models[n][t]&&(this.models[n][t].numReferences--,this.models[n][t].numReferences===0||d)){const p=this.modelUris[n][t];c||delete this.modelUris[n][t],delete this.modelByURL[p];const m=this.models[n][t].model;if(!m)return;delete this.models[n][t],m.destroy()}}destroy(){for(const t of Object.keys(this.models))for(const n of Object.keys(this.models[t])){const c=this.models[t][n].model;delete this.models[t][n],c&&c.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(t){return this.models[t]||(this.models[t]={}),Object.keys(this.models[t])}upload(t,n){this.models[n]||(this.models[n]={});for(const c in this.models[n])this.models[n][c].model&&this.models[n][c].model.upload(t.context)}}const Kl=new s.a7({data:new s.a8(s.a5.colorTheme.data)});class yh{constructor(t){this._scope=t,this._buildingQueryParams={target:{featuresetId:"building-outline",importId:this._scope}},this._floorQueryParams={target:{featuresetId:"floor-outline",importId:this._scope}}}execute(t){const n=this._makeBuildingsQueryArea(t),c=this._makeFloorsQueryArea(t),d=t.queryRenderedFeatures(n,this._buildingQueryParams).filter(y=>y.properties.shape_type==="building").reduce((y,x)=>{const T=x.properties.id;return x.properties.shape_type!=="building"||y.some(S=>S.properties.id===T)||y.push(x),y},[]),p=t.queryRenderedFeatures(c,this._floorQueryParams).filter(y=>y.properties.shape_type==="floor").reduce((y,x)=>{const T=x.properties.id;return x.properties.shape_type!=="floor"||y.some(S=>S.properties.id===T)||y.push(x),y},[]),m=[t.getCenter().lng,t.getCenter().lat];return{floors:p,building:this._findBuildingAtCenter(m,d)||(d.length>0?d[0]:null)}}_makeBuildingsQueryArea(t){const n=t.transform.width,c=t.transform.height,d=Math.min(n,c),p=d*(1/8),m=d*(1/8),y=.5*(n-p),x=.5*(c-m);return[new s.P(y,x),new s.P(y+p,x+m)]}_makeFloorsQueryArea(t){const n=t.transform.width,c=t.transform.height,d=n*(2/3),p=c*(2/3),m=.5*(n-d),y=.5*(c-p);return[new s.P(m,y),new s.P(m+d,y+p)]}_findBuildingAtCenter(t,n){for(const c of n)if(c.geometry.type==="Polygon"&&this._pointInPolygon(t,c.geometry.coordinates[0]))return c;return null}_pointInPolygon(t,n){let c=!1;for(let d=0,p=n.length-1;d<n.length;p=d++){const m=n[d][0],y=n[d][1],x=n[p][1];y>t[1]!=x>t[1]&&t[0]<(n[p][0]-m)*(t[1]-y)/(x-y)+m&&(c=!c)}return c}}class jo{constructor(){this._selectedFloorId=null,this._selectedBuildingId=null,this._floors=[]}setBuildingId(t){this._selectedBuildingId=t}setFloors(t){if(this._floors=t.filter(n=>n.properties.building_id===this._selectedBuildingId),!this._selectedFloorId||!this._floors.map(n=>n.properties.id).includes(this._selectedFloorId)){const n=this._floors.map(c=>({id:c.properties.id,level:c.properties.floor_level})).reduce((c,d)=>{const p=Math.abs(c.level-1),m=Math.abs(d.level-1);return m<p||m===p&&d.level>c.level?d:c});this._selectedFloorId=n.id}}setFloorId(t){this._selectedFloorId=t}getSelectedFloorId(){return this._selectedFloorId}getCurrentBuildingFloors(){return this._floors}reset(){this._selectedFloorId=null,this._selectedBuildingId=null,this._floors=[]}}const ff={"mbx-indoor-level-selected":{default:["literal",[]]}};function gd(l){return l=l||{},Object.assign(l,ff)}class mf extends s.E{constructor(t){super(),s.aV(["_onLoad","_onMove"],this),this._map=t,this._floorSelectionState=new jo,this._queryIndoor(),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=null,this._floorSelectionState=null}_onLoad(){this._map.style.forEachFragmentStyle(t=>
15{t.stylesheet.indoor&&(this._indoorDataQuery?this.fire(new s.z(new Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._scope=t.scope,this._indoorDataQuery=new yh(this._scope)))}),this._map._addIndoorControl(),this._queryIndoor()}_onMove(){this._queryIndoor()}_queryIndoor(){if(!this._indoorDataQuery||!this._map.isStyleLoaded())return;if(this._map.transform.zoom<16)return void this._clearIndoorData();const t=this._indoorDataQuery.execute(this._map);t&&t.floors.length!==0?(this._floorSelectionState.getSelectedFloorId()||this._map._addIndoorControl(),this._selectFloors(t)):this._clearIndoorData()}_selectFloors(t){if(t.building)this._floorSelectionState.setBuildingId(t.building.properties.id),this._floorSelectionState.setFloors(t.floors),this._updateUI();else{const n=this._floorSelectionState.getSelectedFloorId();if(n&&t.floors.some(c=>c.properties.id===n))return;this._clearIndoorData()}}_clearIndoorData(){this._floorSelectionState.reset(),this._map._removeIndoorControl(),this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",[]])}_updateUI(){const t=this._floorSelectionState.getCurrentBuildingFloors().map(c=>({id:c.properties.id,name:c.properties.name,shortName:c.properties.floor_level,levelOrder:c.properties.floor_level})),n=this._floorSelectionState.getSelectedFloorId();n?(this._updateIndoorConfig(),this.fire(new s.A("indoorupdate",{selectedFloorId:n,floors:t}))):console.warn("IndoorManager: Selected floor is not set")}_updateIndoorConfig(){const t=this._floorSelectionState.getSelectedFloorId();t?this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",[t]]):console.warn("IndoorManager: Selected floor is not set")}selectFloor(t){this._floorSelectionState.setFloorId(t),this._updateIndoorConfig()}}function yd(l){if(!l.metadata||!l.metadata.content_area)return;const t=s.q.devicePixelRatio,{left:n,top:c,width:d,height:p}=l.metadata.content_area,m=n*t,y=c*t;return[m,y,m+d*t,y+p*t]}function xd(l){if(l)return l.map(([t,n])=>[t*s.q.devicePixelRatio,n*s.q.devicePixelRatio])}class xh{constructor(t,n,c){this.id=t,this.scope=n,this.sourceCache=c,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(t){this.missingRequests.has(t.name)||this.pendingRequests.has(t.name)||this.pendingRequests.add(t.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const n=this.sourceCache.getVisibleCoordinates();if(n.length===0)return t;const c=this.sourceCache.getSource();if(!(c instanceof ko))return t;const d=n.map(m=>this.sourceCache.getTile(m)),p=c.getImages(d,Array.from(this.pendingRequests));for(const[m,y]of p)t.set(s.I.from({name:m,iconsetId:this.id}),y),this.pendingRequests.delete(m);for(const m of this.pendingRequests)this.missingRequests.add(m);return this.pendingRequests.clear(),t}}const Go=(l,t)=>W(l,t&&t.filter(n=>n.identifier!=="source.canvas")),vd=s.aF(Xt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),bd=s.aF(Xt,["setCenter","setZoom","setBearing","setPitch"]),Jl=new Set(["background","sky","slot","custom"]),qo={version:8,layers:[],sources:{}},ll={duration:300,delay:0};class Nn extends s.E{constructor(t,n={}){super(),this.map=t,this.scope=n.scope||"",this.globalId=null,this.fragments=[],this.importDepth=n.importDepth||0,this.importsCache=n.importsCache||new Map,this.resolvedImports=n.resolvedImports||new Set,this.transition=s.h({},ll),this._buildingIndex=new ld(this),this.crossTileSymbolIndex=new on,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=n.styleChanges||new La,this.dispatcher=n.dispatcher?n.dispatcher:new s.D(s.db(),this),n.imageManager?this.imageManager=n.imageManager:(this.imageManager=new ir(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=n.glyphManager?n.glyphManager:new s.dc(t._requestManager,n.localFontFamily?s.dd.all:n.localIdeographFontFamily?s.dd.ideographs:s.dd.none,n.localFontFamily||n.localIdeographFontFamily),n.modelManager?this.modelManager=n.modelManager:(this.modelManager=new _d(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={}
15,this._order=[],this._markersNeedUpdate=!1,this.options=n.configOptions?n.configOptions:new Map,this._configDependentLayers=n.configDependentLayers?n.configDependentLayers:new Set,this._config=n.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:n.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=n.initialConfig,this.dispatcher.broadcast("setReferrer",s.de());const c=this;this._rtlTextPluginCallback=Nn.registerForPluginStateChange(d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(p,m)=>{if(s.df(p),m&&m.every(y=>y))for(const y in c._sourceCaches){const x=c._sourceCaches[y],T=x.getSource().type;T!=="vector"&&T!=="geojson"||x.reload()}})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const p=this.getOwnSource(d.sourceId);if(p&&p.vectorLayerIds)for(const m in this._layers){const y=this._layers[m];y.source===p.id&&this._validateLayer(y)}})}load(t){return t?(typeof t=="string"?this.loadURL(t):this.loadJSON(t),this):this}_getGlobalId(t){if(!t)return null;if(typeof t=="string"){if(s.j(t))return t;const n=s.dg(t);if(!n.startsWith("http"))try{return new URL(n,location.href).toString()}catch{return n}return n}return`json://${s.dh(JSON.stringify(t))}`}_diffStyle(t,n,c){this.globalId=this._getGlobalId(t);const d=(p,m)=>{try{m(null,this.setState(p,c))}catch(y){m(y,!1)}};if(typeof t=="string"){const p=this.map._requestManager.normalizeStyleURL(t),m=this.map._requestManager.transformRequest(p,s.R.Style);s.n(m,(y,x)=>{y?this.fire(new s.z(y)):x&&d(x,n)})}else typeof t=="object"&&d(t,n)}loadURL(t,n={}){this.fire(new s.A("dataloading",{dataType:"style"}));const c=typeof n.validate=="boolean"?n.validate:!s.j(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,n.accessToken),this.resolvedImports.add(t);const d=this.importsCache.get(t);if(d)return this._load(d,c);const p=this.map._requestManager.transformRequest(t,s.R.Style);this._request=s.n(p,(m,y)=>{if(this._request=null,m)this.fire(new s.z(m));else if(y)return this.importsCache.set(t,y),this._load(y,c)})}loadJSON(t,n={}){this.fire(new s.A("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=s.q.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new s.A("dataloading",{dataType:"style"})),this._load(qo,!1)}_loadImports(t,n,c){if(this.importDepth>=4)return s.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const p of t){const m=this._createFragmentStyle(p),y=new Promise(S=>{m.once("style.import.load",S),m.once("error",S)}).then(()=>this.mergeAll());if(d.push(y),this.resolvedImports.has(p.url)){m.loadEmpty();continue}const x=p.data||this.importsCache.get(p.url);x?(m.loadJSON(x,{validate:n}),this._isInternalStyle(x)&&(m.globalId=null)):p.url?m.loadURL(p.url,{validate:n}):m.loadEmpty();const T={style:m,id:p.id,config:p.config};if(c){const S=this.fragments.findIndex(({id:M})=>M===c);this.fragments=this.fragments.slice(0,S).concat(T).concat(this.fragments.slice(S))}else this.fragments.push(T)}return Promise.allSettled(d)}getImportGlobalIds(t=this,n=new Set){for(const c of t.fragments)c.style.globalId&&n.add(c.style.globalId),this.getImportGlobalIds(c.style,n);return[...n.values()]}_createFragmentStyle(t){const n=this.scope?s.C(t.id,this.scope):t.id;let c;const d=this._initialConfig&&this._initialConfig[n];(t.config||d)&&(c=s.h({},t.config,d));const p=new Nn(this.map,{scope:n,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:c,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers});return p.setEventedParent(this.map,{style:p}),p}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(t){return this.isRootStyle()&&(t.fragment||!!t.schema&&t.fragment!==!1)}_load(t,n){const c=t.indoor?gd(t.schema):t.schema;if(this._isInternalStyle(t)){const m=s.h({},qo,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(m,n)}if(this.updateConfig(this._config,c),n&&Go(this,vn(t)))return;this._loaded=!0,this.stylesheet=s.di(t);const d=()=>{for(const T in t.sources)this.addSource(T,t.sources[T],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const T in t.iconsets)this.addIconset(T,t.iconsets[T]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&t.glyphs&&this.glyphManager.setURL(t.glyphs);
vendor: 6,491 bytes, line 15
15const m=Wa(this.stylesheet.layers);if(this._order=m.map(T=>T.id),this.stylesheet.light&&s.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 T=this.stylesheet.lights[0];this.light=new ve(T.properties,T.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new ve(this.stylesheet.light)),this._layers={};for(const T of m){const S=s.dn(T,this.scope,this._styleColorTheme.lut,this.options);S.configDependencies.size!==0&&this._configDependentLayers.add(S.fqid),S.setEventedParent(this,{layer:{id:S.id}}),this._layers[S.id]=S;const M=this.getOwnLayerSourceCache(S),E=!!this.directionalLight&&this.directionalLight.shadowsEnabled();M&&S.canCastShadows()&&E&&(M.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const y=this.stylesheet.terrain;y&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(y,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 s.A("data",{dataType:"style"}));const x=this.isRootStyle();t.imports?this._loadImports(t.imports,n).then(()=>{this._reloadImports(),this.fire(new s.A(x?"style.load":"style.import.load"))}).catch(T=>{this.fire(new s.z(new Error("Failed to load imports",T))),this.fire(new s.A(x?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new s.A(x?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const p=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(p){const m=this._evaluateColorThemeData(p);this._loadColorTheme(m).then(()=>{d()}).catch(y=>{s.w(`Couldn't load color theme from the stylesheet: ${y}`),d()})}else this._styleColorTheme.lut=null,d()}isRootStyle(){return this.importDepth===0}mergeAll(){let t,n,c,d,p,m,y,x,T,S;const M={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(E=>{if(E.stylesheet){if(E.light!=null&&(t=E.light),E.stylesheet.lights)for(const C of E.stylesheet.lights)C.type==="ambient"&&E.ambientLight!=null&&(n=E.ambientLight),C.type==="directional"&&E.directionalLight!=null&&(c=E.directionalLight);d=this._prioritizeTerrain(d,E.terrain,E.stylesheet.terrain),E.stylesheet.fog&&E.fog!=null&&(p=E.fog),E.stylesheet.snow&&E.snow!=null&&(m=E.snow),E.stylesheet.rain&&E.rain!=null&&(y=E.rain),E.stylesheet.camera!=null&&(S=E.stylesheet.camera),E.stylesheet.projection!=null&&(x=E.stylesheet.projection),E.stylesheet.transition!=null&&(T=E.stylesheet.transition),M[E.scope]=E._styleColorTheme}}),this.light=t,this.ambientLight=n,this.directionalLight=c,this.fog=p,this.snow=m,this.rain=y,this._styleColorThemeForScope=M,d===null?delete this.terrain:this.terrain=d,this.camera=S||{"camera-projection":"perspective"},this.projection=x||{name:"mercator"},this.transition=s.h({},ll,T),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(t){const n=c=>{for(const d of c.fragments)n(d.style);t(c)};n(this)}_prioritizeTerrain(t,n,c){const d=t&&t.drapeRenderMode===0;return c===null?n&&n.drapeRenderMode===0?n:d?t:null:n!=null&&(!t||d||n&&n.drapeRenderMode===1)?n:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(n=>{t=this._prioritizeTerrain(t,n.terrain,n.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t}mergeProjection(){let t;this.forEachFragmentStyle(n=>{n.stylesheet.projection!=null&&(t=n.stylesheet.projection)}),this.projection=t||{name:"mercator"}}mergeSources(){const t={},n={},c={};this.forEachFragmentStyle(d=>{for(const p in d._sourceCaches){const m=s.C(p,d.scope);t[m]=d._sourceCaches[p]}for(const p in d._otherSourceCaches){const m=s.C(p,d.scope);n[m]=d._otherSourceCaches[p]}for(const p in d._symbolSourceCaches){const m=s.C(p,d.scope);c[m]=d._symbolSourceCaches[p]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=n,this._mergedSymbolSourceCaches=c}mergeLayers(){const t={},n=[],c={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(p=>{for(const m of p._order){const y=p._layers[m];if(y.type==="slot"){const x=s.dj(m);if(t[x])continue;t[x]=[]}y.slot&&t[y.slot]?t[y.slot].push(y):n.push(y)}}),this._mergedOrder=[];const d=(p=[])=>{for(const m of p)if(m.type==="slot"){const y=s.dj(m.id);t[y]&&d(t[y]),this._mergedSlots.push(y)}else{const y=s.C(m.id,m.scope);this._mergedOrder.push(y),c[y]=m,m.is3D(!!this.terrain)&&(this._has3DLayers=!0),m.type==="circle"&&(this._hasCircleLayers=!0),m.type==="symbol"&&(this._hasSymbolLayers=!0),m.type==="clip"&&(this._clipLayerPresent=!0)}};d(n),this._mergedOrder.sort((p,m)=>{const y=c[p],x=c[m];return y.hasInitialOcclusionOpacityProperties?x.is3D(!!this.terrain)?1:0:y.is3D(!!this.terrain)&&x.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=c,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=s.h({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(n,c,d,p){const m=s.h({},c);for(const x of Object.keys(s.a5.colorTheme))m[x]===void 0&&(m[x]=s.a5.colorTheme[x].default);const y=new s.a6(Kl,n,new Map(d));return y.setTransitionOrValue(m,d),y.untransitioned().possiblyEvaluate(new s.aa(0,{worldview:void 0}))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const n=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((c,d)=>{const p="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void c();let m=t;m.startsWith(p)||(m=p+m);const y=s.I.from("mapbox-reserved-lut"),x=new Image;x.src=m,x.onerror=()=>{this._styleColorTheme.lutLoading=!1,d(new Error("Failed to load image data"))},x.onload=()=>
15{if(this._styleColorTheme.lutLoadingCorrelationID!==n)return void c();this._styleColorTheme.lutLoading=!1;const{width:T,height:S,data:M}=s.q.getImageData(x);if(S>32)return void d(new Error("The height of the image must be less than or equal to 32 pixels."));if(T!==S*S)return void d(new Error("The width of the image must be equal to the height squared."));this.getImage(y)&&this.removeImage(y),this.addImage(y,{data:new s.r({width:T,height:S},M),pixelRatio:1,sdf:!1,usvg:!1,version:0});const E=this.imageManager.getImage(y,this.scope);E?(this._styleColorTheme.lut={image:E.data,data:t},c()):d(new Error("Missing LUT image."))}})}getLut(t){const n=this._styleColorThemeForScope[t];return n?n.lut:null}setProjection(t){t?this.stylesheet.projection=t:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(n,c,d){let p,m,y;const x=s.q.devicePixelRatio>1?"@2x":"";let T=s.n(c.transformRequest(c.normalizeSpriteURL(n,x,".json"),s.R.SpriteJSON),(E,C)=>{T=null,y||(y=E,p=C,M())}),S=s.o(c.transformRequest(c.normalizeSpriteURL(n,x,".png"),s.R.SpriteImage),(E,C)=>{S=null,y||(y=E,m=C,M())});function M(){if(y)d(y);else if(p&&m){const E=s.q.getImageData(m),C={};for(const D in p){const{width:z,height:F,x:L,y:N,sdf:j,pixelRatio:q,stretchX:X,stretchY:ee,content:ie}=p[D],Y=new s.r({width:z,height:F});s.r.copy(E,Y,{x:L,y:N},{x:0,y:0},{width:z,height:F},null),C[D]={data:Y,pixelRatio:q,sdf:j,stretchX:X,stretchY:ee,content:ie,usvg:!1}}d(null,C)}}return{cancel(){T&&(T.cancel(),T=null),S&&(S.cancel(),S=null)}}}(t,this.map._requestManager,(n,c)=>{if(this._spriteRequest=null,n)this.fire(new s.z(n));else if(c){const d=new Map;for(const p in c)d.set(s.I.from(p),c[p]);this.addImages(d)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.A("data",{dataType:"style"}))})}addIconset(t,n){if(n.type==="sprite")return void this._loadSprite(n.url);const c=this.getOwnSourceCache(n.source);if(!c)return void this.fire(new s.z(new Error(`Source "${n.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const d=c.getSource();if(d.type!=="raster-array")return void this.fire(new s.z(new Error(`Source "${n.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));d.partial=!1;const p=new xh(t,this.scope,c);this.imageManager.addImageProvider(p,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!s.j(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const n=this.map._spriteFormat==="auto";var c,d;this._spriteRequest=(d=(p,m)=>{if(this._spriteRequest=null,p)n?this._loadSprite(t):this.fire(new s.z(p));else if(m){const y=new Map;for(const x in m)y.set(s.I.from(x),m[x]);this.addImages(y)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.A("data",{dataType:"style"}))},s.br((c=this.map._requestManager).transformRequest(c.normalizeIconsetURL(t),s.R.Iconset),(p,m)=>{if(p)return void d(p);const y={},x=s.da(new s.bq(m));for(const T of x.icons){const S={version:1,pixelRatio:s.q.devicePixelRatio,content:yd(T),stretchX:T.metadata?xd(T.metadata.stretch_x_areas):void 0,stretchY:T.metadata?xd(T.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:T};y[T.name]=S}d(null,y)}))}_validateLayer(t){const n=this.getOwnSource(t.source);if(!n)return;const c=t.sourceLayer;c&&(n.type==="geojson"||n.vectorLayerIds&&n.vectorLayerIds.indexOf(c)===-1)&&this.fire(new s.z(new Error(`Source layer "${c}" does not exist on source "${n.id}" as specified by style layer "${t.id}"`)))}
15loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:t}of this.fragments)if(!t.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((t,n)=>{const c=this.fragments[n];return c&&c.style&&(t.data=c.style.serialize()),t})}_serializeSources(){const t={};for(const n in this._sourceCaches){const c=this._sourceCaches[n].getSource();t[c.id]||(t[c.id]=c.serialize())}return t}_serializeLayers(t){const n=[];for(const c of t){const d=this._layers[c];d&&d.type!=="custom"&&n.push(d.serialize())}return n}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 t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(t){return t?this.order:this._mergedOrder}isLayerDraped(t){return!!this.terrain&&t.isDraped(this.getLayerSourceCache(t))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const n=this.getOwnLayer(t);if(n)return n;this.fire(new s.z(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const n=this.getOwnSource(t);if(n)return n;this.fire(new s.z(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(t,n){const c=this.map.painter;if(c)for(let d=t.minzoom||0;d<(t.maxzoom||25.5);d++){const p=t.getProgramIds();if(p)for(const m of p){const y=t.getDefaultProgramParams(m,n.zoom,this._styleColorTheme.lut);y&&(c.style=this,this.fog&&(c._fogVisible=!0,y.overrideFog=!0,c.getOrCreateProgram(m,y)),c._fogVisible=!1,y.overrideFog=!1,c.getOrCreateProgram(m,y),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(y.overrideRtt=!0,c.getOrCreateProgram(m,y)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const n=this.calculateLightsBrightness();t.brightness=n||0,n!==this._brightness&&(this._brightness=n,this.dispatcher.broadcast("setBrightness",n)),t.worldview!==this._worldview&&(this._worldview=t.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const c=this._changes.isDirty();let d=!1;if(this._changes.isDirty()){const y=this._changes.getLayerUpdatesByScope();for(const x in y){const{updatedIds:T,removedIds:S}=y[x];(T||S)&&(this._updateWorkerLayers(x,T,S),d=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const p={};for(const y in this._mergedSourceCaches){const x=this._mergedSourceCaches[y];p[y]=x.used,x.used=!1,x.tileCoverLift=0}for(const y of this._mergedOrder){const x=this._mergedLayers[y];if(x.recalculate(t,this._availableImages),!x.isHidden(t.zoom)){const T=this.getLayerSourceCache(x);T&&(T.used=!0,T.tileCoverLift=Math.max(T.tileCoverLift,x.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>
15{this.precompilePrograms(x,t)}):this.precompilePrograms(x,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&d&&this.mergeLayers();const m=this.imageManager.getPendingImageProviders();for(const y of m)y.sourceCache.used=!0;for(const y in p){const x=this._mergedSourceCaches[y];p[y]!==x.used&&x.getSource().fire(new s.A("data",{sourceDataType:"visibility",dataType:"source",sourceId:x.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),c&&this.fire(new s.A("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const n of t){const c=n.resolvePendingRequests(),d=this.getFragmentStyle(n.scope);d&&d.addImages(c)}}_updateTilesForChangedImages(){const t={};for(const n in this._mergedSourceCaches){const c=this._mergedSourceCaches[n].getSource().scope;t[c]=t[c]||this._changes.getUpdatedImages(c),t[c].length!==0&&this._mergedSourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t[c])}for(const n in t)this._changes.resetUpdatedImages(n)}_updateWorkerLayers(t,n,c){const d=this.getFragmentStyle(t);d&&this.dispatcher.broadcast("updateLayers",{layers:n?d._serializeLayers(n):[],scope:t,removedIds:c||[],options:d.options})}setState(t,n){if(this._checkLoaded(),Go(this,vn(t)))return!1;(t=s.di(t)).layers=Wa(t.layers);const c=function(m,y){if(!m)return[{command:Xt.setStyle,args:[y]}];let x=[];try{if(!s.bv(m.version,y.version))return[{command:Xt.setStyle,args:[y]}];if(s.bv(m.center,y.center)||x.push({command:Xt.setCenter,args:[y.center]}),s.bv(m.zoom,y.zoom)||x.push({command:Xt.setZoom,args:[y.zoom]}),s.bv(m.bearing,y.bearing)||x.push({command:Xt.setBearing,args:[y.bearing]}),s.bv(m.pitch,y.pitch)||x.push({command:Xt.setPitch,args:[y.pitch]}),s.bv(m.sprite,y.sprite)||x.push({command:Xt.setSprite,args:[y.sprite]}),s.bv(m.glyphs,y.glyphs)||x.push({command:Xt.setGlyphs,args:[y.glyphs]}),s.bv(m.imports,y.imports)||function(C=[],D=[],z){D=D||[];const F=(C=C||[]).map(fs),L=D.map(fs),N=C.reduce(Bo,{}),j=D.reduce(Bo,{}),q=F.slice();let X,ee,ie,Y;for(X=0,ee=0;X<F.length;X++)ie=F[X],j.hasOwnProperty(ie)?ee++:(z.push({command:Xt.removeImport,args:[ie]}),q.splice(q.indexOf(ie,ee),1));for(X=0,ee=0;X<L.length;X++)ie=L[L.length-1-X],q[q.length-1-X]!==ie&&(N.hasOwnProperty(ie)?(z.push({command:Xt.removeImport,args:[ie]}),q.splice(q.lastIndexOf(ie,q.length-ee),1)):ee++,Y=q[q.length-X],z.push({command:Xt.addImport,args:[j[ie],Y]}),q.splice(q.length-X,0,ie));for(const K of D){const J=N[K.id];J&&(delete J.data,s.bv(J,K)||z.push({command:Xt.updateImport,args:[K.id,K]}))}}(m.imports,y.imports,x),s.bv(m.transition,y.transition)||x.push({command:Xt.setTransition,args:[y.transition]}),s.bv(m.light,y.light)||x.push({command:Xt.setLight,args:[y.light]}),s.bv(m.fog,y.fog)||x.push({command:Xt.setFog,args:[y.fog]}),s.bv(m.snow,y.snow)||x.push({command:Xt.setSnow,args:[y.snow]}),s.bv(m.rain,y.rain)||x.push({command:Xt.setRain,args:[y.rain]}),s.bv(m.projection,y.projection)||x.push({command:Xt.setProjection,args:[y.projection]}),s.bv(m.lights,y.lights)||x.push({command:Xt.setLights,args:[y.lights]}),s.bv(m.camera,y.camera)||x.push({command:Xt.setCamera,args:[y.camera]}),s.bv(m.iconsets,y.iconsets)||function(C,D,z){let F;for(F in D=D||{},C=C||{})C.hasOwnProperty(F)&&(D.hasOwnProperty(F)||z.push({command:Xt.removeIconset,args:[F]}));for(F in D){if(!D.hasOwnProperty(F))continue;const L=D[F];C.hasOwnProperty(F)?s.bv(C[F],L)||(z.push({command:Xt.removeIconset,args:[F]}),z.push({command:Xt.addIconset,args:[F,L]})):z.push({command:Xt.addIconset,args:[F,L]})}}(m.iconsets,y.iconsets,x),!s.bv(m["color-theme"],y["color-theme"]))return[{command:Xt.setStyle,args:[y]}];const T={},S=[];(function(C,D,z,F){let L;for(L in D=D||{},C=C||{})C.hasOwnProperty(L)&&(D.hasOwnProperty(L)||Gs(L,z,F));for(L in D){if(!D.hasOwnProperty(L))continue;const N=D[L];
15C.hasOwnProperty(L)?s.bv(C[L],N)||(C[L].type==="geojson"&&N.type==="geojson"&&hf(C,D,L)?z.push({command:Xt.setGeoJSONSourceData,args:[L,N.data]}):Xa(L,D,z,F)):Hl(L,D,z)}})(m.sources,y.sources,S,T);const M=[];m.layers&&m.layers.forEach(C=>{C.source&&T[C.source]?x.push({command:Xt.removeLayer,args:[C.id]}):M.push(C)});let E=m.terrain;E&&T[E.source]&&(x.push({command:Xt.setTerrain,args:[void 0]}),E=void 0),x=x.concat(S),s.bv(E,y.terrain)||x.push({command:Xt.setTerrain,args:[y.terrain]}),function(C,D,z){D=D||[];const F=(C=C||[]).map(fs),L=D.map(fs),N=C.reduce(Bo,{}),j=D.reduce(Bo,{}),q=F.slice(),X=Object.create(null);let ee,ie,Y,K,J,fe,se;for(ee=0,ie=0;ee<F.length;ee++)Y=F[ee],j.hasOwnProperty(Y)?ie++:(z.push({command:Xt.removeLayer,args:[Y]}),q.splice(q.indexOf(Y,ie),1));for(ee=0,ie=0;ee<L.length;ee++)Y=L[L.length-1-ee],q[q.length-1-ee]!==Y&&(N.hasOwnProperty(Y)?(z.push({command:Xt.removeLayer,args:[Y]}),q.splice(q.lastIndexOf(Y,q.length-ie),1)):ie++,fe=q[q.length-ee],z.push({command:Xt.addLayer,args:[j[Y],fe]}),q.splice(q.length-ee,0,Y),X[Y]=!0);for(ee=0;ee<L.length;ee++)if(Y=L[ee],K=N[Y],J=j[Y],!X[Y]&&!s.bv(K,J))if(s.bv(K.source,J.source)&&s.bv(K["source-layer"],J["source-layer"])&&s.bv(K.type,J.type)){for(se in Ya(K.layout,J.layout,z,Y,null,Xt.setLayoutProperty),Ya(K.paint,J.paint,z,Y,null,Xt.setPaintProperty),s.bv(K.slot,J.slot)||z.push({command:Xt.setSlot,args:[Y,J.slot]}),s.bv(K.filter,J.filter)||z.push({command:Xt.setFilter,args:[Y,J.filter]}),s.bv(K.minzoom,J.minzoom)&&s.bv(K.maxzoom,J.maxzoom)||z.push({command:Xt.setLayerZoomRange,args:[Y,J.minzoom,J.maxzoom]}),K)K.hasOwnProperty(se)&&se!=="layout"&&se!=="paint"&&se!=="filter"&&se!=="metadata"&&se!=="minzoom"&&se!=="maxzoom"&&se!=="slot"&&(se.indexOf("paint.")===0?Ya(K[se],J[se],z,Y,se.slice(6),Xt.setPaintProperty):s.bv(K[se],J[se])||z.push({command:Xt.setLayerProperty,args:[Y,se,J[se]]}));for(se in J)J.hasOwnProperty(se)&&!K.hasOwnProperty(se)&&se!=="layout"&&se!=="paint"&&se!=="filter"&&se!=="metadata"&&se!=="minzoom"&&se!=="maxzoom"&&se!=="slot"&&(se.indexOf("paint.")===0?Ya(K[se],J[se],z,Y,se.slice(6),Xt.setPaintProperty):s.bv(K[se],J[se])||z.push({command:Xt.setLayerProperty,args:[Y,se,J[se]]}))}else z.push({command:Xt.removeLayer,args:[Y]}),fe=q[q.lastIndexOf(Y)+1],z.push({command:Xt.addLayer,args:[J,fe]})}(M,y.layers,x)}catch(T){console.warn("Unable to compute style diff:",T),x=[{command:Xt.setStyle,args:[y]}]}return x}(this.serialize(),t).filter(m=>!(m.command in bd));if(c.length===0)return!1;const d=c.filter(m=>!(m.command in vd));if(d.length>0)throw new Error(`Unimplemented: ${d.map(m=>m.command).join(", ")}.`);const p=[];return c.forEach(m=>{p.push(this[m.command](...m.args))}),n&&Promise.all(p).then(n).catch(n),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(t){if(t.size===0)return this;for(const[n,c]of t.entries()){if(this.getImage(n))return this.fire(new s.z(new Error(`An image with the name "${n.name}" already exists.`)));this.imageManager.addImage(n,this.scope,c),this._changes.updateImage(n,this.scope)}return this._updateWorkerImages(),this.fire(new s.A("data",{dataType:"style"})),this}addImage(t,n){return this.getImage(t)?this.fire(new s.z(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,n),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.A("data",{dataType:"style"})),this)}updateImage(t,n,c=!1){this.imageManager.updateImage(t,this.scope,n),c&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.A("data",{dataType:"style"})))}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.A("data",{dataType:"style"})),this):this.fire(new s.z(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModelURLs(t){return this.modelManager.addModelURLs(t,this.scope),this._updateWorkerModels(),this.fire(new s.A("data",{dataType:"style"})),this}addModel(t,n,c={}
vendor: 9,120 bytes, line 15
15){return this._checkLoaded(),this._validate(Z,`models.${t}`,n,null,c)||(this.modelManager.addModel(t,n,this.scope),this.fire(new s.A("data",{dataType:"style"}))),this}hasModel(t){return this.modelManager.hasModel(t,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope,!1,!0),this.fire(new s.A("data",{dataType:"style"})),this):this.fire(new s.z(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,n,c={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(Na,`sources.${t}`,n,null,c))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const d=ja(t,n,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id}));const p=m=>{const y=(m?"symbol:":"other:")+d.id,x=s.C(y,this.scope),T=this._sourceCaches[y]=new nn(x,d,m);(m?this._symbolSourceCaches:this._otherSourceCaches)[d.id]=T,T.onAdd(this.map)};p(!1),n.type!=="vector"&&n.type!=="geojson"||p(!0),d.onAdd&&d.onAdd(this.map),c.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const n=this.getOwnSource(t);if(!n)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===t)return this.fire(new s.z(new Error(`Source "${t}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new s.z(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const d=Object.entries(this.stylesheet.iconsets).find(([p,m])=>m.type==="source"&&m.source===t);if(d)return this.fire(new s.z(new Error(`Source "${t}" cannot be removed while iconset "${d[0]}" is using it.`)))}const c=this.getOwnSourceCaches(t);for(const d of c){const p=s.dj(d.id);delete this._sourceCaches[p],this._changes.discardSourceCacheUpdate(d.id),d.fire(new s.A("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,n){this._checkLoaded(),this.getOwnSource(t).setData(n),this._changes.setDirty()}getOwnSource(t){const n=this.getOwnSourceCache(t);return n&&n.getSource()}getOwnSources(){const t=[];for(const n in this._otherSourceCaches){const c=this.getOwnSourceCache(n);c&&t.push(c.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const n in t){const c=t[n]._tiles;for(const d in c){const p=c[d];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const n=this._getTransitionParameters();for(const p of t){if(this._validate(Vs,"lights",p))return;switch(p.type){case"ambient":if(this.ambientLight){const m=this.ambientLight;m.set(p),m.updateTransitions(n)}else this.ambientLight=new gi(p,Gt||(Gt=new s.a7({color:new s.a8(s.a5.properties_light_ambient.color),"color-use-theme":new s.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.a8(s.a5.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const m=this.directionalLight;m.set(p),m.updateTransitions(n)}else this.directionalLight=new gi(p,Ki||(Ki=new s.a7({direction:new s.an(s.a5.properties_light_directional.direction),color:new s.a8(s.a5.properties_light_directional.color),"color-use-theme":new s.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.a8(s.a5.properties_light_directional.intensity),"cast-shadows":new s.a8(s.a5.properties_light_directional["cast-shadows"]),"shadow-quality":new s.a8(s.a5.properties_light_directional["shadow-quality"]),"shadow-intensity":new s.a8(s.a5.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const c=Object.assign(n,{worldview:this.map.getWorldview()}),d=new s.aa(this.z||0,c);this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,n=this.ambientLight;if(!t||!n)return;const c=E=>.2126*(E[0]<=.03928?E[0]/12.92:Math.pow((E[0]+.055)/1.055,2.4))+.7152*(E[1]<=.03928?E[1]/12.92:Math.pow((E[1]+.055)/1.055,2.4))+.0722*(E[2]<=.03928?E[2]/12.92:Math.pow((E[2]+.055)/1.055,2.4)),d=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),p=t.properties.get("intensity"),m=t.properties.get("direction"),y=1-s.d1(m.x,m.y,m.z)[2]/90,x=c(d)*p*y,T=n.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),S=n.properties.get("intensity"),M=c(T)*S;return Number(((x+M)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const t=[];return this.directionalLight&&t.push(this.directionalLight.get()),this.ambientLight&&t.push(this.ambientLight.get()),t}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(t==null||t===""&&this.isRootStyle())return this;if(s.dk(t)){const n=s.dl(t),c=this.fragments.find(({id:p})=>p===n);if(!c)return;const d=s.dj(t);return c.style.getFragmentStyle(d)}{const n=this.fragments.find(({id:c})=>c===t);return n?n.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const n={},c=(d,p="")=>`${d}::${p}`;this._featuresetSelectors={};for(const d in t){const p=this._featuresetSelectors[d]=[];for(const m of t[d].selectors){if(m.featureNamespace){const x=this.getOwnLayer(m.layer);if(!x){s.w(`Layer is undefined for selector: ${m.layer}`);continue}const T=c(x.source,x.sourceLayer);if(T in n&&n[T]!==m.featureNamespace){s.w(`"featureNamespace ${m.featureNamespace} of featureset ${d}'s selector is not associated to the same source, skip this selector`);continue}n[T]=m.featureNamespace}let y;if(m.properties)for(const x in m.properties){const T=s.X(m.properties[x]);T.result==="success"&&(y=y||{},y[x]=T.value)}p.push({layerId:m.layer,namespace:m.featureNamespace,properties:y,uniqueFeatureID:m._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const n=this.getFragmentStyle(t);if(!n||!n.stylesheet.featuresets)return[];const c=[];for(const d in n.stylesheet.featuresets)c.push({featuresetId:d,importId:n.scope?n.scope:void 0});return c}getFeaturesetLayers(t,n){const c=this.getFragmentStyle(n),d=c.stylesheet.featuresets;if(!d||!d[t])return this.fire(new s.z(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const p=[];for(const m of d[t].selectors){const y=c.getOwnLayer(m.layer);y&&p.push(y)}return p}getConfigProperty(t,n){const c=this.getFragmentStyle(t);if(!c)return null;const d=s.C(n,c.scope),p=c.options.get(d),m=p?p.value||p.default:null;return m?m.serialize():null}setConfigProperty(t,n,c){const d=this.getFragmentStyle(t);if(!d)return;const p=d.stylesheet.indoor?gd(d.stylesheet.schema):d.stylesheet.schema;if(!p||!p[n])return;const m=s.X(c);if(m.result!=="success")return void Go(this,m.value);const y=m.value.expression,x=s.C(n,d.scope),T=d.options.get(x);if(!T)return;let S;const{minValue:M,maxValue:E,stepValue:C,type:D,values:z}=p[n],F=s.X(p[n].default);F.result==="success"&&(S=F.value.expression),S?(this.options.set(x,Object.assign({},T,{value:y,default:S,minValue:M,maxValue:E,stepValue:C,type:D,values:z})),this.updateConfigDependencies(n)):this.fire(new s.z(new Error(`No schema defined for the config option "${n}" in the "${t}" fragment.`)))}getConfig(t){const n=this.getFragmentStyle(t);if(!n)return null;const c=n.stylesheet.schema;if(!c)return null;const d={};for(const p in c){const m=s.C(p,n.scope),y=n.options.get(m),x=y?y.value||y.default:null;d[p]=x?x.serialize():null}return d}setConfig(t,n){const c=this.getFragmentStyle(t);c&&(c.updateConfig(n,c.stylesheet.schema),this.updateConfigDependencies())}getSchema(t){const n=this.getFragmentStyle(t);return n?n.stylesheet.schema:null}setSchema(t,n){const c=this.getFragmentStyle(t);c&&(c.stylesheet.schema=n,c.updateConfig(c._config,n),this.updateConfigDependencies())}updateConfig(t,n){if(this._config=t,t||n)if(n)for(const c in n){let d,p;const m=s.X(n[c].default);if(m.result==="success"&&(d=m.value.expression),t&&t[c]!==void 0){const E=s.X(t[c]);E.result==="success"&&(p=E.value.expression)}const{minValue:y,maxValue:x,stepValue:T,type:S,values:M}=n[c];if(d){const E=s.C(c,this.scope);this.options.set(E,{default:d,value:p,minValue:y,maxValue:x,stepValue:T,type:S,values:M})}
15else this.fire(new s.z(new Error(`No schema defined for config option "${c}".`)))}else this.fire(new s.z(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(t){for(const n of this._configDependentLayers){const c=this.getLayer(n);if(c){if(t&&!c.configDependencies.has(t))continue;c.possiblyEvaluateVisibility(),this._updateLayer(c)}}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(n=>{const c=n._styleColorTheme.colorThemeOverride?n._styleColorTheme.colorThemeOverride:n._styleColorTheme.colorTheme;if(c){const d=n._evaluateColorThemeData(c);(!n._styleColorTheme.lut&&d!==""||n._styleColorTheme.lut&&d!==n._styleColorTheme.lut.data)&&n.setColorTheme(c)}}),this._changes.setDirty()}addLayer(t,n,c={}){this._checkLoaded();const d=t.id;if(this._layers[d])return void this.fire(new s.z(new Error(`Layer with i
15d "${d}" already exists on this map`)));let p;if(t.type==="custom"){if(Go(this,s.dm(t)))return;p=s.dn(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=s.di(t),t=s.h(t,{source:d})),this._validate(ei,`layers.${d}`,t,{arrayIndex:-1},c))return;p=s.dn(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(p),p.setEventedParent(this,{layer:{id:d}})}p.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid);let m=this._order.length;if(n){const S=this._order.indexOf(n);if(S===-1)return void this.fire(new s.z(new Error(`Layer with id "${n}" does not exist on this map.`)));p.slot===this._layers[n].slot?m=S:s.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(m,0,d),this._layerOrderChanged=!0,this._layers[d]=p;const y=this.getOwnLayerSourceCache(p),x=!!this.directionalLight&&this.directionalLight.shadowsEnabled();y&&p.canCastShadows()&&x&&(y.castsShadows=!0);const T=this._changes.getRemovedLayer(p);if(T&&p.source&&y&&p.type!=="custom"){this._changes.discardLayerRemoval(p);const S=s.C(p.source,p.scope);T.type!==p.type?this._changes.updateSourceCache(S,"clear"):(this._changes.updateSourceCache(S,"reload"),y.pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map),p.scope=this.scope,this.mergeLayers()}moveLayer(t,n){this._checkLoaded();const c=this._checkLayer(t);if(!c||t===n)return;const d=this._order.indexOf(t);this._order.splice(d,1);let p=this._order.length;if(n){const m=this._order.indexOf(n);
15if(m===-1)return void this.fire(new s.z(new Error(`Layer with id "${n}" does not exist on this map.`)));c.slot===this._layers[n].slot?p=m:s.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(p,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(t){this._checkLoaded();const n=this._checkLayer(t);if(!n)return;n.setEventedParent(null);const c=this._order.indexOf(t);this._order.splice(c,1),delete this._layers[t],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(n.fqid),this._changes.removeLayer(n);const d=this.getOwnLayerSourceCache(n);if(d&&d.castsShadows){let p=!1;for(const m in this._layers)if(this._layers[m].source===n.source&&this._layers[m].canCastShadows()){p=!0;break}d.castsShadows=p}n.onRemove&&n.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const n in this._layers)if(this._layers[n].type===t)return!0;return!1}setLayerZoomRange(t,n,c){this._checkLoaded();const d=this._checkLayer(t);d&&(d.minzoom===n&&d.maxzoom===c||(n!=null&&(d.minzoom=n),c!=null&&(d.maxzoom=c),this._updateLayer(d)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(t,n){this._checkLoaded();const c=this._checkLayer(t);c&&c.slot!==n&&(c.slot=n,this._updateLayer(c))}setFilter(t,n,c={}){this._checkLoaded();const d=this._checkLayer(t);if(d&&!s.bv(d.filter,n))return n==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(ge,`layers.${d.id}.filter`,n,{layerType:d.type},c)||(d.filter=s.di(n),this._updateLayer(d)))}getFilter(t){const n=this._checkLayer(t);if(n)return s.di(n.filter)}setLayoutProperty(t,n,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(p&&!s.bv(p.getLayoutProperty(n),c)){if(c!=null&&(!d||d.validate!==!1)&&Go(p,B.call(vn,{key:`layers.${t}.layout.${n}`,layerType:p.type,objectKey:n,value:c,styleSpec:s.a5,style:{glyphs:!0,sprite:!0}})))return;p.setLayoutProperty(n,c),p.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),this._updateLayer(p)}}getLayoutProperty(t,n){const c=this._checkLayer(t);if(c)return c.getLayoutProperty(n)}setPaintProperty(t,n,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(!p||s.bv(p.getPaintProperty(n),c)||c!=null&&(!d||d.validate!==!1)&&Go(p,k.call(vn,{key:`layers.${t}.paint.${n}`,layerType:p.type,objectKey:n,value:c,styleSpec:s.a5})))return;const m=p.setPaintProperty(n,c);p.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),m&&this._updateLayer(p),this._changes.updatePaintProperties(p)}getPaintProperty(t,n){const c=this._checkLayer(t);if(c)return c.getPaintProperty(n)}setFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,S=this.getFragmentStyle(T),M=S.getFeaturesetLayers(x);for(const{source:E,sourceLayer:C}of M)S.setFeatureState({id:t.id,source:E,sourceLayer:C},n)}else if("layerId"in t.target){const{layerId:x}=t.target,T=this.getLayer(x);this.setFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},n)}return}const c=t.source,d=t.sourceLayer,p=this._checkSource(c);if(!p)return;const m=p.type;if(m==="geojson"&&d)return void this.fire(new s.z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(m==="vector"&&!d)return void this.fire(new s.z(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new s.z(new Error("The feature id parameter must be provided.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.setFeatureState(d,t.id,n)}removeFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,S=this.getFragmentStyle(T),M=S.getFeaturesetLayers(x);for(const{source:E,sourceLayer:C}of M)S.removeFeatureState({id:t.id,source:E,sourceLayer:C},n)}else if("layerId"in t.target){const{layerId:x}=t.target,T=this.getLayer(x);this.removeFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},n)}return}const c=t.source,d=this._checkSource(c);if(!d)return;const p=d.type,m=p==="vector"?t.sourceLayer:void 0;if(p==="vector"&&!m)return void this.fire(new s.z(new Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new s.z(new Error("A feature id is required to remove its specific state property.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.removeFeatureState(m,t.id,n)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let p;if("featuresetId"in t.target){const{featuresetId:m,importId:y}=t.target,x=this.getFragmentStyle(y),T=x.getFeaturesetLayers(m);for(const{source:S,sourceLayer:M}of T){const E=x.getFeatureState({id:t.id,source:S,sourceLayer:M});if(E&&!p)p=E;else if(!s.bv(p,E))return void this.fire(new s.z(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 t.target){const{layerId:m}=t.target,y=this.getLayer(m);p=this.getFeatureState({id:t.id,source:y.source,sourceLayer:y.sourceLayer})}return p}const n=t.source,c=t.sourceLayer,d=this._checkSource(n);if(d){if(d.type!=="vector"||c)return t.id===void 0&&this.fire(new s.z(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)[0].getFeatureState(c,t.id);this.fire(new s.z(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=s.h({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return s.h({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),n=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return s.dp({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:n,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,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)},c=>c!==void 0)}_updateFilteredLayers(t){for(const n of Object.values(this._mergedLayers))t(n)&&this._updateLayer(n)}_updateLayer(t){this._changes.updateLayer(t);const n=this.getLayerSourceCache(t),c=s.C(t.source,t.scope),d=this._changes.getUpd
vendor: 9,938 bytes, line 15
15atedSourceCaches();t.source&&!d[c]&&n&&n.getSource().type!=="raster"&&(this._changes.updateSourceCache(c,"reload"),n.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const n=y=>this._mergedLayers[y].is3D(!!this.terrain),c=this.order,d={},p=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(n(x)){d[x]=y;for(const T of t){const S=T[x];if(S)for(const M of S)p.push(M)}}}p.sort((y,x)=>x.intersectionZ-y.intersectionZ);const m=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(n(x))for(let T=p.length-1;T>=0;T--){const S=p[T].feature;if(S.layer&&d[S.layer.id]<y)break;m.push(S),p.pop()}else for(const T of t){const S=T[x];if(S)for(const M of S)m.push(M.feature)}}return m}queryRenderedFeatures(t,n,c){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(ge,"queryRenderedFeatures.filter",n.filter,null,n),d=s.b3(n.filter));const p={},m=S=>{if(Jl.has(S.type))return;const M=this.getOwnLayerSourceCache(S),E=p[M.id]=p[M.id]||{sourceCache:M,layers:{},has3DLayers:!1};S.is3D(!!this.terrain)&&(E.has3DLayers=!0),E.layers[S.fqid]=E.layers[S.fqid]||{styleLayer:S,targets:[]},E.layers[S.fqid].targets.push({filter:d})};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new s.z(new Error("parameters.layers must be an Array."))),[];for(const S of n.layers){const M=this._layers[S];if(!M)return this.fire(new s.z(new Error(`The layer '${S}' does not exist in the map's style and cannot be queried for features.`))),[];m(M)}}else for(const S in this._layers)m(this._layers[S]);const y=this._queryRenderedFeatures(t,p,c),x=this._flattenAndSortRenderedFeatures(y),T=[];for(const S of x)s.dq(S.layer.id)===this.scope&&T.push(S);return T}queryRenderedFeatureset(t,n,c){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(ge,"queryRenderedFeatures.filter",n.filter,null,n),d=s.b3(n.filter));const p="mock",m=[];if(n&&n.target)m.push(Object.assign({},n,{targetId:p,filter:d}));else{const S=this.getFeaturesetDescriptors();for(const M of S)m.push({targetId:p,filter:d,target:M});for(const{style:M}of this.fragments){const E=M.getFeaturesetDescriptors();for(const C of E)m.push({targetId:p,filter:d,target:C})}}const y=this.queryRenderedTargets(t,m,c),x=[],T=new Set;for(const S of y)for(const M of S.variants[p])jl(M,S,T)||x.push(new s.dr(S,M));return x}queryRenderedTargets(t,n,c){const d={},p=(y,x,T,S)=>{const M=d[x.id]=d[x.id]||{sourceCache:x,layers:{},has3DLayers:!1};if(M.layers[y.fqid]=M.layers[y.fqid]||{styleLayer:y,targets:[]},y.is3D(!!this.terrain)&&(M.has3DLayers=!0),!S)return T.uniqueFeatureID=!1,void M.layers[y.fqid].targets.push(T);M.layers[y.fqid].targets.push(Object.assign({},T,{namespace:S.namespace,properties:S.properties,uniqueFeatureID:S.uniqueFeatureID}))};for(const y of n)if("featuresetId"in y.target){const{featuresetId:x,importId:T}=y.target,S=this.getFragmentStyle(T);if(!S||!S._featuresetSelectors)continue;const M=S._featuresetSelectors[x];if(!M){this.fire(new s.z(new Error(`The featureset '${x}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const E of M){const C=S.getOwnLayer(E.layerId);C&&!Jl.has(C.type)&&p(C,S.getOwnLayerSourceCache(C),y,E)}}else if("layerId"in y.target){const{layerId:x}=y.target,T=this.getLayer(x);if(!T||Jl.has(T.type))continue;p(T,this.getLayerSourceCache(T),y)}const m=this._queryRenderedFeatures(t,d,c);return this._flattenAndSortRenderedFeatures(m)}_queryRenderedFeatures(t,n,c){const d=[],p=!!this.map._showQueryGeometry,m=ri.createFromScreenPoints(t,c);for(const y in n){const x=Gl(m,n[y],this._availableImages,c,p);Object.keys(x).length&&d.push(x)}if(this.placement)for(const y in n){if(!n[y].sourceCache._onlySymbols)continue;const x=us(m.screenGeometry,n[y],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(x).length&&d.push(x)}return d}querySourceFeatures(t,n){const c=n&&n.filter;c&&this._validate(ge,"querySourceFeatures.filter",c,null,n);let d=[];const p=this.getOwnSourceCaches(t);for(const m of p)d=d.concat(qa(m,n));return d}addSourceType(t,n,c){return Nn.getSourceType(t)?c(new Error(`A source type called "${t}" already exists.`)):(Nn.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},c):c(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,n,c={}){this._checkLoaded();const d=this.light.getLight();let p=!1;for(const y in t)if(!s.bv(t[y],d[y])){p=!0;break}if(!p)return;const m=this._getTransitionParameters();this.light.setLight(t,n,c),this.light.updateTransitions(m)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=s.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&s.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,n=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),n===0&&delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let c=t;const d=t.source==null;if(n===1){if(this.disableElevatedTerrain)return;if(typeof c.source=="object"){const y="terrain-dem-src";this.addSource(y,c.source),c=s.di(c),c=s.h(c,{source:y})}const p=s.h({},c),m={};if(this.terrain&&d){p.source=this.terrain.get().source;const y=this.terrain?this.getFragmentStyle(this.terrain.scope):null;y&&(m.style=y.serialize())}if(this._validate(ke,"terrain",p,m))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&n!==this.terrain.drapeRenderMode){if(!c)return;this._createTerrain(c,n),this.fire(new s.A("data",{dataType:"style"}))}else{const p=this.terrain,m=p.get();for(const y of Object.keys(s.a5.terrain))!c.hasOwnProperty(y)&&s.a5.terrain[y].default&&(c[y]=s.a5.terrain[y].default);for(const y in t)if(!s.bv(t[y],m[y])){p.set(t,this.options),this.stylesheet.terrain=t;const x=this._getTransitionParameters({duration:0});p.updateTransitions(x),this.fire(new s.A("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const n=this.fog=new Ft(t,this.map.transform,this.scope,this.options);this.stylesheet.fog=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_createSnow(t){const n=this.snow=new yr(t,this.map.transform,this.scope,this.options);this.stylesheet.snow=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_createRain(t){const n=this.rain=new dr(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const n=this.fog;if(!s.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.fog=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const n=this.snow;if(!s.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.snow=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const n=this.rain;if(!s.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.rain=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createRain(t);this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const d in this._layers)this._layers[d].lut=this._styleColorTheme.lut;for(const d in this._sourceCaches)this._sourceCaches[d].clearTiles()},n=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!n)return this._styleColorTheme.lut=null,void t();const c=this._evaluateColorThemeData(n);this._loadColorTheme(c).then(()=>{this.fire(new s.A("colorthemeset")),t()}).catch(d=>{s.w(`Couldn't set color theme: ${d}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&s.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(t,n){const c=this.getFragmentStyle(t);c&&(c._styleColorTheme.colorThemeOverride=n,c._reloadColorTheme())}_getTransitionParameters(t){return{now:s.q.now(),transition:s.h(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],n=[];for(const c of this._mergedOrder)this.isLayerDraped(this._mergedLayers[c])?t.push(c):n.push(c);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...n)}_createTerrain(t,n){const c=this.terrain=new he(t,n,this.scope,this.options,this.map.getWorldview());n===1&&(this.stylesheet.terrain=t),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const d=this._getTransitionParameters({duration:0});c.updateTransitions(d)}_force3DLayerUpdate(){for(const t in this._layers){const n=this._layers[t];n.type==="fill-extrusion"&&this._updateLayer(n)}}
15_forceSymbolLayerUpdate(){for(const t in this._layers){const n=this._layers[t];n.type==="symbol"&&this._updateLayer(n)}}_validate(t,n,c,d,p={}){if(p&&p.validate===!1)return!1;const m=s.h({},this.serialize());return Go(this,t.call(vn,s.h({key:n,style:m,value:c,styleSpec:s.a5},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),s.ds.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles(),this._mergedSourceCaches[t].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(t){const n=this.getSourceCaches(t);for(const c of n)c.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}clearLayers(){for(const t in this._mergedLayers){const n=this._mergedLayers[t];n._clear&&n._clear()}}reloadSource(t){const n=this.getSourceCaches(t);for(const c of n)c.resume(),c.reload()}reloadSources(){for(const t of this.getSources())t.reload&&t.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(t=>{t.modelManager.reloadModels(t.scope)})}updateSources(t){let n;this.directionalLight&&(n=Ks(this.directionalLight));const c=new Set;for(const d in this._mergedLayers){const p=this._mergedLayers[d];
vendor: 5,502 bytes, line 15
15p.hasElevation()&&!c.has(p.source)&&c.add(p.source)}for(const d in this._mergedSourceCaches){const p=this._mergedSourceCaches[d],m=c.has(p._source.id);p.update(t,void 0,void 0,n,m)}}_generateCollisionBoxes(){for(const t in this._sourceCaches){const n=this._sourceCaches[t];n.resume(),n.reload()}}_updatePlacement(t,n,c,d,p,m,y=!1){let x=!1,T=!1;const S={},M={};for(const E of this._mergedOrder){const C=this._mergedLayers[E];if(C.type!=="symbol")continue;const D=s.C(C.source,C.scope);let z=S[D];if(!z){const L=this.getLayerSourceCache(C);if(!L)continue;const N=L.getRenderableIds(!0).map(j=>L.getTileByID(j));M[D]=N.slice(),z=S[D]=N.sort((j,q)=>q.tileID.overscaledZ-j.tileID.overscaledZ||(j.tileID.isLessThan(q.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(C,z,n.center.lng,n.projection);x=x||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),y=y||this._layerOrderChanged||d===0,this._layerOrderChanged&&this.fire(new s.A("neworder")),(y||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.q.now(),n.zoom))&&(this.pauseablePlacement=new Xl(n,this._mergedOrder,y,c,d,p,this.placement,this.fog&&n.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,S,M,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(s.q.now()),T=!0),x&&this.pauseablePlacement.placement.setStale()),T||x){this._buildingIndex.onNewFrame(n.zoom);for(let E=0;E<this._mergedOrder.length;E++){const C=this._mergedLayers[this._mergedOrder[E]];if(C.type!=="symbol")continue;const D=this.isLayerClipped(C);this.placement.updateLayerOpacities(C,S[s.C(C.source,C.scope)],E,D?m:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(s.q.now())}}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,n){this._checkLoaded();const c=this.stylesheet.imports=this.stylesheet.imports||[];if(c.findIndex(({id:p})=>p===t.id)!==-1)return void this.fire(new s.z(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!n)return c.push(t),this._loadImports([t],!0);const d=c.findIndex(({id:p})=>p===n);return d===-1&&this.fire(new s.z(new Error(`Import with id "${n}" does not exist on this map.`))),this.stylesheet.imports=c.slice(0,d).concat(t).concat(c.slice(d)),this._loadImports([t],!0,n)}updateImport(t,n){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);return d===-1?this:typeof n=="string"?(this.setImportUrl(t,n),this):(n.url&&n.url!==c[d].url&&this.setImportUrl(t,n.url),s.bv(n.config,c[d].config)||this.setImportConfig(t,n.config,n.data.schema),s.bv(n.data,c[d].data)||this.setImportData(t,n.data),this)}moveImport(t,n){this._checkLoaded();let c=this.stylesheet.imports||[];const d=this.getImportIndex(t);if(d===-1)return this;const p=this.getImportIndex(n);if(p===-1)return this;const m=c[d],y=this.fragments[d];return c=c.filter(({id:x})=>x!==t),this.fragments=this.fragments.filter(({id:x})=>x!==t),this.stylesheet.imports=c.slice(0,p).concat(m).concat(c.slice(p)),this.fragments=this.fragments.slice(0,p).concat(y).concat(this.fragments.slice(p)),this.mergeLayers(),this}setImportUrl(t,n){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);if(d===-1)return this;c[d].url=n;const p=this.fragments[d];return p.style=this._createFragmentStyle(c[d]),p.style.on("style.import.load",()=>this.mergeAll()),p.style.loadURL(n),this}setImportData(t,n){this._checkLoaded();const c=this.getImportIndex(t),d=this.stylesheet.imports||[];return c===-1?this:n?(this.fragments[c].style.setState(n),this._reloadImports(),this):(delete d[c].data,this.setImportUrl(t,d[c].url))}setImportConfig(t,n,c){this._checkLoaded();const d=this.getImportIndex(t),p=this.stylesheet.imports||[];if(d===-1)return this;n?p[d].config=n:delete p[d].config;const m=this.fragments[d];c&&m.style.stylesheet&&(m.style.stylesheet.schema=c);const y=m.style.stylesheet&&m.style.stylesheet.schema;return m.config=n,m.style.updateConfig(n,y),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const n=this.stylesheet.imports||[],c=this.getImportIndex(t);c!==-1&&(n.splice(c,1),this.fragments[c].style._remove(),this.fragments.splice(c,1),this._reloadImports())}getImportIndex(t){const n=(this.stylesheet.imports||[]).findIndex(c=>c.id===t);return n===-1&&this.fire(new s.z(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),n}getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const n in this._mergedOtherSourceCaches){const c=this._mergedOtherSourceCaches[n];c&&t.push(c.getSource())}return t}getSource(t,n){const c=this.getSourceCache(t,n);return c&&c.getSource()}getLayerSource(t){const n=this.getLayerSourceCache(t);return n&&n.getSource()}getSourceCache(t,n){const c=s.C(t,n);return this._mergedOtherSourceCaches[c]}getLayerSourceCache(t){const n=s.C(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[n]:this._mergedOtherSourceCaches[n]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const n=[];return this._mergedOtherSourceCaches[t]&&n.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&n.push(this._mergedSymbolSourceCaches[t]),n}
15updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const n in t){const c=t[n];c==="reload"?this.reloadSource(n):c==="clear"&&this.clearSource(n)}}updateLayers(t){const n=this._changes.getUpdatedPaintProperties();for(const c of n){const d=this.getLayer(c);d&&d.updateTransitions(t)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(t){this.stylesheet.glyphs=t,this.glyphManager.setURL(t)}getImages(t,n,c){this.imageManager.getImages(n.images,n.scope,c),this._updateTilesForChangedImages();const d=m=>{if(m){const y=n.images.map(x=>s.I.toString(x));m.setDependencies(n.tileID.key,n.type,y)}},p=s.C(n.source,n.scope);d(this._mergedOtherSourceCaches[p]),d(this._mergedSymbolSourceCaches[p]),n.images.some(m=>m.iconsetId)&&this.fire(new s.A("data",{dataType:"style"}))}rasterizeImages(t,n,c){this.imageManager.rasterizeImages(n,c)}getGlyphs(t,n,c){this.glyphManager.getGlyphs(n.stacks,c)}getResource(t,n,c){return s.dt(n,c)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const n=[];return this._otherSourceCaches[t]&&n.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&n.push(this._symbolSourceCaches[t]),n}_isSourceCacheLoaded(t){const n=this.getOwnSourceCaches(t);return n.length===0?(this.fire(new s.z(new Error(`There is no source with ID '${t}'`))),!1):n.every(c=>c.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,n){if(!this._clipLayerPresent&&t.type!=="fill-extrusion"&&t.type!=="building")return!1;const c=t.type==="fill-extrusion"&&(t.sourceLayer==="building"||t.sourceLayer==="procedural_buildings"),d=t.type==="building";if(t.is3D(!!this.terrain)){if(c||d||n&&n.type==="batched-model"||t.type==="model")return!0}else if(t.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(t=>{t.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Nn.getSourceType=function(l){return Ul[l]},Nn.setSourceType=function(l,t){Ul[l]=t},Nn.registerForPluginStateChange=s.du;var vh=`
16#define EPSILON 0.0000001
17#define PI 3.141592653589793
18#ifdef RENDER_CUTOFF
19float 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);}
20#endif`,Qs=`
21out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)
22{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}
23#ifdef INDICATOR_CUTOUT
24uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;
25#endif
26vec4 applyCutout(vec4 color,float height) {
27#ifdef INDICATOR_CUTOUT
28float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);
29#else
30return color;
31#endif
32}
33#ifdef DEBUG_WIREFRAME
34#define HANDLE_WIREFRAME_DEBUG \\
35glFragColor=vec4(0.7,0.0,0.0,0.7); \\
36gl_FragDepth=gl_FragCoord.z-0.0001;
37#else
38#define HANDLE_WIREFRAME_DEBUG
39#endif
40#ifdef RENDER_CUTOFF
41uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;
42#endif
43vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,ea=`
44#define EXTENT 8192.0
45#define RAD_TO_DEG 180.0/PI
46#define DEG_TO_RAD PI/180.0
47#define GLOBE_RADIUS EXTENT/PI/2.0
48float 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;}
49#ifdef PROJECTION_GLOBE_VIEW
50vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
51#ifndef PROJECTED_POS_ON_VIEWPORT
52float 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;
53#else
54return vec3(0.0);
55#endif
56}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);}
57#endif
58vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(
59unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
60);}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);}
61#ifdef RENDER_CUTOFF
62uniform vec4 u_cutoff_params;out float v_cutoff_opacity;
63#endif
64const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)
65{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`,bh="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Ql=`
66#define ELEVATION_SCALE 7.0
67#define ELEVATION_OFFSET 450.0
68#ifdef PROJECTION_GLOBE_VIEW
69uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(
70mix(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;}
71#else
72vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
73#endif
74#ifdef TERRAIN
75uniform 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) {
76#ifdef TERRAIN_DEM_FLOAT_FORMAT
77vec2 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;
78#else
79float 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);
80#endif
81}float prevElevation(vec2 apos) {
82#ifdef TERRAIN_DEM_FLOAT_FORMAT
83vec2 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;
84#else
85float 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);
86#endif
87}
88#ifdef TERRAIN_VERTEX_MORPHING
89float elevation(vec2 apos) {
90#ifdef ZERO_EXAGGERATION
91return 0.0;
92#endif
93float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
94#else
95float elevation(vec2 apos) {
96#ifdef ZERO_EXAGGERATION
97return 0.0;
98#endif
99return currentElevation(apos);}
100#endif
101vec4 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);}
102#else
103float elevation(vec2 pos) { return 0.0; }
104#endif
105#ifdef DEPTH_OCCLUSION
106uniform 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;
107#ifdef DEPTH_D24
108float 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);}
109#else
110highp float unpack_depth_rgba(vec4 rgba_depth)
111{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;}
112#endif
113bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;
114#ifdef DEPTH_D24
115float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);
116#else
117float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));
118#endif
119return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
119size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;
120#ifdef DEPTH_D24
121highp vec4 depth=vec4(
122texture(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
123);depth=unpack_depth4(depth);
124#else
125highp vec4 depth=vec4(
126unpack_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))
127);
128#endif
129return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int 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) {
130#ifdef DEPTH_D24
131highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);
132#else
133highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));
134#endif
135res+=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;highp 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));}
136#else
137bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }
138#endif//DEPTH_OCCLUSION`,Sn=`#ifdef FOG
139uniform 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);}
140#endif`,ec=`#ifdef FOG
141uniform 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;
142#ifdef FLIP_Y
143uv.y=1.0-uv.y;
144#endif
145highp vec3 ray_dir=mix(
146mix(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;}
146vec3 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);}
147#endif`,We=`#ifdef RASTER_ARRAY
148uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)
149);}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)
150);}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);}
151#endif`,wh=`#ifdef RASTER_ARRAY
152uniform 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;}
153#endif
154uniform 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;}`,tc=`#ifdef RENDER_SHADOWS
155uniform 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];}
156#endif//RENDER_SHADOWS`,ic=`#ifdef RENDER_SHADOWS
157precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,high
157p float bias) {
158#ifdef CLIP_ZERO_TO_ONE
159highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);
160#else
161highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);
162#endif
163return 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;
164#ifdef SHADOWS_SINGLE_CASCADE
165vec2 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);
166#else
167light_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);
168#endif
169}highp float calculate_shadow_bias(float NDotL) {
170#ifdef NORMAL_OFFSET
171return 0.5*u_shadow_bias.x;
172#else
173return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));
174#endif
175}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)
176{highp vec2 biasUV=vec2(
177pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}
178#endif`;const cl=[];Zn(vh,cl),Zn(ea,cl),Zn(Qs,cl);const vs={"_prelude_fog.vertex.glsl":Sn,"_prelude_terrain.vertex.glsl":Ql,"_prelude_shadow.vertex.glsl":tc,"_prelude_fog.fragment.glsl":ec,"_prelude_shadow.fragment.glsl":ic,"_prelude_lighting.glsl":`
179#ifdef LIGHTING_3D_MODE
180uniform 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
180));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);}
181#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":We,"_prelude_raster_particle.glsl":wh},Vn={};Ht("",Ql),Ht(ec,Sn),Ht(ic,tc),Ht(We,""),Ht(wh,"");const rc=Ht(Qs,ea),Ho=vh;var hl={background:Ht(`#include "_prelude_fog.fragment.glsl"
182#include "_prelude_lighting.glsl"
183uniform vec4 u_color;uniform float u_opacity;
184#ifdef LIGHTING_3D_MODE
185in vec4 v_color;
186#endif
187void main() {vec4 out_color;
188#ifdef LIGHTING_3D_MODE
189out_color=v_color;
190#else
191out_color=u_color;
192#endif
193#ifdef FOG
194out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
195#endif
196glFragColor=out_color*u_opacity;
197#ifdef OVERDRAW_INSPECTOR
198glFragColor=vec4(1.0);
199#endif
200HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
201#include "_prelude_lighting.glsl"
202in vec2 a_pos;uniform mat4 u_matrix;
203#ifdef LIGHTING_3D_MODE
204uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;
205#endif
206void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
207#ifdef LIGHTING_3D_MODE
208v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
209#endif
210#ifdef FOG
211v_fog_pos=fog_position(a_pos);
212#endif
213}`),backgroundPattern:Ht(`#include "_prelude_fog.fragment.glsl"
214#include "_prelude_lighting.glsl"
215uniform 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);
216#ifdef LIGHTING_3D_MODE
217out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
218#endif
219#ifdef FOG
220out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
221#endif
222glFragColor=out_color*u_opacity;
223#ifdef OVERDRAW_INSPECTOR
224glFragColor=vec4(1.0);
225#endif
226HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
227uniform 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 vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);
228#ifdef FOG
229v_fog_pos=fog_position(a_pos);
230#endif
231}`),building:Ht(`#include "_prelude_fog.fragment.glsl"
232#include "_prelude_shadow.fragment.glsl"
233#include "_prelude_lighting.glsl"
234const 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;
235#ifdef BUILDING_FAUX_FACADE
236in 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;
237#endif
238#ifdef RENDER_SHADOWS
239in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
240#endif
241uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}
242#ifdef BUILDING_FAUX_FACADE
243float hash12(in vec2 p) {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);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {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;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;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;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}
243float 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 vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;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;
244#if 0
245if (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;
246#else
247if (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;
248#endif
249return out_color;}
250#endif
251vec3 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;
252#ifdef BUILDING_FAUX_FACADE
253if (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;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);}
254#endif
255vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;
256#ifdef RENDER_SHADOWS
257shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
258#else
259shadowed_lighting_factor=dot(normal,u_lighting_directional_dir);
260#endif
261color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=mix(color.rgb,base_color.rgb,emissive);
262#ifdef FOG
263color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));
264#endif
265color.rgb=linearTosRGB(color.rgb);color*=u_opacity;
266#ifdef INDICATOR_CUTOUT
267color=applyCutout(color,v_pos.z);
268#endif
269glFragColor=color; 
270#ifdef DEBUG_SHOW_NORMALS
271color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;
272#endif
273#ifdef OVERDRAW_INSPECTOR
274glFragColor=vec4(1.0);
275#endif
276HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
277#include "_prelude_shadow.vertex.glsl"
278in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;
279#ifdef BUILDING_FAUX_FACADE
280out 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;
281#endif
282#ifdef RENDER_SHADOWS
283uniform 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;
284#endif
285const 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;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
286#ifdef BUILDING_FAUX_FACADE
287mat3 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);}
288#endif
289#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive
290#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive
291void main() {
292#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
293#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive
294vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;
295#ifdef BUILDING_FAUX_FACADE
296v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_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=(a_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=(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(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);}
297#endif
298v_pos=a_pos_3f;
299#ifdef RENDER_CUTOFF
300vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;
301#endif
302#ifdef RENDER_SHADOWS
303vec3 shadow_pos=v_pos;
304#ifdef NORMAL_OFFSET
305vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();
306#endif
307v_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);v_depth_shadows=gl_Position.w;
308#endif
309#ifdef FOG
310v_fog_pos=fog_position(v_pos);
311#endif
312gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);}`),buildingBloom:Ht(`in vec4 v_color_emissive;
313#pragma mapbox: define-attribute highp vec4 bloom_attenuation
314#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
315float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;
316#ifdef HAS_ATTRIBUTE_a_bloom_attenuation
317float 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));
317opacity*=saturate(1.0-distance*distance);
318#endif
319glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f;
320#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive
321#pragma mapbox: define-attribute highp vec4 bloom_attenuation
322out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
323#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
324#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
325#ifdef HAS_ATTRIBUTE_a_part_color_emissive
326vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);
327#else
328v_color_emissive=vec4(1.0);
329#endif
330gl_Position=u_matrix*vec4(a_pos_3f,1.0);}`),buildingDepth:Ht(`in highp float v_depth;void main() {
331#ifndef DEPTH_TEXTURE
332glFragColor=pack_depth(v_depth);
333#endif
334}`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:Ht(`#include "_prelude_fog.fragment.glsl"
335#include "_prelude_lighting.glsl"
336in vec3 v_data;in float v_visibility;
337#pragma mapbox: define highp vec4 color
338#pragma mapbox: define mediump float radius
339#pragma mapbox: define lowp float blur
340#pragma mapbox: define lowp float opacity
341#pragma mapbox: define highp vec4 stroke_color
342#pragma mapbox: define mediump float stroke_width
343#pragma mapbox: define lowp float stroke_opacity
344uniform float u_emissive_strength;void main() {
345#pragma mapbox: initialize highp vec4 color
346#pragma mapbox: initialize mediump float radius
347#pragma mapbox: initialize lowp float blur
348#pragma mapbox: initialize lowp float opacity
349#pragma mapbox: initialize highp vec4 stroke_color
350#pragma mapbox: initialize mediump float stroke_width
351#pragma mapbox: initialize lowp float stroke_opacity
352vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? 
353smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 
354smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
355antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
356);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
357#ifdef LIGHTING_3D_MODE
358out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
359#endif
360#ifdef FOG
361out_color=fog_apply_premultiplied(out_color,v_fog_pos);
362#endif
363glFragColor=out_color*(v_visibility*opacity_t);
364#ifdef OVERDRAW_INSPECTOR
365glFragColor=vec4(1.0);
366#endif
367}`,`#include "_prelude_fog.vertex.glsl"
368#include "_prelude_terrain.vertex.glsl"
369#define NUM_VISIBILITY_RINGS 2
370#define INV_SQRT2 0.70710678
371#define ELEVATION_BIAS 0.0001
372#define NUM_SAMPLES_PER_RING 16
373uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;
374#ifdef PROJECTION_GLOBE_VIEW
375in vec3 a_pos_3;in vec3 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;
376#endif
377#ifdef ELEVATED_ROADS
378in float a_circle_z_offset;
379#endif
380out vec3 v_data;out float v_visibility;
381#pragma mapbox: define highp vec4 color
382#pragma mapbox: define mediump float radius
383#pragma mapbox: define lowp float blur
384#pragma mapbox: define lowp float opacity
385#pragma mapbox: define highp vec4 stroke_color
386#pragma mapbox: define mediump float stroke_width
387#pragma mapbox: define lowp float stroke_opacity
388vec2 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,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),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) {
389#if defined(TERRAIN)
390return elevation(pos)+ELEVATION_BIAS;
391#else
392return 0.0;
393#endif
394}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);
395#ifdef PITCH_WITH_MAP
396#ifdef PROJECTION_GLOBE_VIEW
397return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
398#else
399return u_matrix*( world_center+vec4(sample_offset,0,0) );
400#endif
401#else
402return projected_center+vec4(sample_offset,0,0);
403#endif
404}float get_sample_step() {
405#ifdef PITCH_WITH_MAP
406return 2.0*PI/float(NUM_SAMPLES_PER_RING);
407#else
408return PI/float(NUM_SAMPLES_PER_RING);
409#endif
410}void main(void) {
411#pragma mapbox: initialize highp vec4 color
412#pragma mapbox: initialize mediump float radius
413#pragma mapbox: initialize lowp float blur
414#pragma mapbox: initialize lowp float opacity
415#pragma mapbox: initialize highp vec4 stroke_color
416#pragma mapbox: initialize mediump float stroke_width
417#pragma mapbox: initialize lowp float stroke_opacity
418vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;
419#ifdef PROJECTION_GLOBE_VIEW
420vec3 pos_normal_3=a_pos_normal_3/16384.0;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(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);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);
421#else 
422surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);
423#endif
424#ifdef ELEVATED_ROADS
425world_center.z+=a_circle_z_offset+ELEVATION_BIAS;
426#endif
427vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
428#ifdef PITCH_WITH_MAP
429#ifdef SCALE_WITH_MAP
430view_scale=1.0;
431#else
432view_scale=projected_center.w/u_camera_to_center_distance;
433#endif
434#else
435#ifdef SCALE_WITH_MAP
436view_scale=u_camera_to_center_distance;
437#else
438view_scale=projected_center.w;
439#endif
440#endif
441gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;
442#ifdef TERRAIN
443float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
444#ifdef PITCH_WITH_MAP
445float 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;
446#else
447occlusion_world_center=world_center;occlusion_projected_center=projected_center;
448#endif
449for(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);
450#else
451visibility=1.0;
452#endif
453#ifdef PROJECTION_GLOBE_VIEW
454visibility=1.0;
455#endif
456v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
457#ifdef FOG
458v_fog_pos=fog_position(world_center.xyz);
459#endif
460}`),clippingMask:Ht("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Ht(`#include "_prelude_fog.fragment.glsl"
461uniform highp float u_intensity;in vec2 v_extrude;
462#pragma mapbox: define highp float weight
463#define GAUSS_COEF 0.3989422804014327
464void main() {
465#pragma mapbox: initialize highp float weight
466float 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);
467#ifdef FOG
468if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
469#endif
470#ifdef OVERDRAW_INSPECTOR
471glFragColor=vec4(1.0);
472#endif
473HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
474#include "_prelude_fog.vertex.glsl"
475uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;
476#ifdef PROJECTION_GLOBE_VIEW
477in vec3 a_pos_3;in vec3 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;
478#endif
479out vec2 v_extrude;
480#pragma mapbox: define highp float weight
481#pragma mapbox: define mediump float radius
482const highp float ZERO=1.0/255.0/16.0;
483#define GAUSS_COEF 0.3989422804014327
484void main(void) {
485#pragma mapbox: initialize highp float weight
486#pragma mapbox: initialize mediump float radius
487vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;
488#ifdef PROJECTION_GLOBE_VIEW
489vec3 pos_normal_3=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=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);
490#else
491pos=vec3(tilePos+extrude,elevation(tilePos));
492#endif
493gl_Position=u_matrix*vec4(pos,1);
494#ifdef FOG
495v_fog_pos=fog_position(pos);
496#endif
497}`),heatmapTexture:Ht(`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;
498#ifdef OVERDRAW_INSPECTOR
499glFragColor=vec4(0.0);
500#endif
501HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Ht("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"
502in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 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;
503#ifdef PROJECTION_GLOBE_VIEW
504uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;
505#endif
506out float v_placed;out float v_notUsed;void main() {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(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation);
507#ifdef PROJECTION_GLOBE_VIEW
508#ifndef PROJECTED_POS_ON_VIEWPORT
509vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);
510#endif
511#endif
512vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
5130.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Ht("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 vec2 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;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
514mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(
5150.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Ht("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"
516in vec2 a_pos;
517#ifdef PROJECTION_GLOBE_VIEW
518in vec3 a_pos_3;
519#endif
520out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;
521#ifdef PROJECTION_GLOBE_VIEW
522gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);
523#else
524gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);
525#endif
526}`),elevatedStructuresDepth:Ht(`void main() {
527#ifndef DEPTH_TEXTURE
528glFragColor=vec4(0.);
529#endif
530}`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Ht(`#ifdef DEPTH_RECONSTRUCTION
531in float v_height;
532#endif
533void main() {
534#ifdef DEPTH_RECONSTRUCTION
535if (v_height >=0.0)
536discard;
537#endif
538glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 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;
539#ifdef DEPTH_RECONSTRUCTION
540out float v_height;
541#endif
542void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);
543#ifdef DEPTH_RECONSTRUCTION
544if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;
545#endif
546gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:Ht(`#include "_prelude_fog.fragment.glsl"
547#include "_prelude_lighting.glsl"
548#include "_prelude_shadow.fragment.glsl"
549in vec3 v_normal;in float v_height;
550#ifdef RENDER_SHADOWS
551in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;
552#endif
553vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
553vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)
554{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;
555#pragma mapbox: define highp vec4 structure_color
556void main() {
557#pragma mapbox: initialize highp vec4 structure_color
558vec3 color=structure_color.xyz;
559#ifdef LIGHTING_3D_MODE
560vec3 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);
561#ifdef RENDER_SHADOWS
562float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor);
563#else
564color=apply_lighting(color,transformed_normal);
565#endif
566color=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);}
567#endif
568#ifdef FOG
569color=fog_apply(color,v_fog_pos);
570#endif
571vec4 out_color=vec4(color,1.0);
572#ifdef INDICATOR_CUTOUT
573out_color=applyCutout(out_color,v_height);
574#endif
575#ifdef FEATURE_CUTOUT
576out_color=apply_feature_cutout(out_color,gl_FragCoord);
577#endif
578glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
579#include "_prelude_shadow.vertex.glsl"
580in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;
581#ifdef RENDER_SHADOWS
582uniform 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;
583#endif
584#pragma mapbox: define highp vec4 structure_color
585void main() {
586#pragma mapbox: initialize highp vec4 structure_color
587v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1);
588#ifdef RENDER_SHADOWS
589vec3 shd_pos0=pos;vec3 shd_pos1=pos;
590#ifdef NORMAL_OFFSET
591vec3 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();
592#endif
593v_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;
594#endif
595#ifdef FOG
596v_fog_pos=fog_position(a_pos);
597#endif
598}`),fill:Ht(`#include "_prelude_fog.fragment.glsl"
599#include "_prelude_lighting.glsl"
600#include "_prelude_shadow.fragment.glsl"
601#pragma mapbox: define highp vec4 color
602#pragma mapbox: define lowp float opacity
603uniform float u_emissive_strength;
604#ifdef RENDER_SHADOWS
605uniform 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;
606#endif
607#ifdef ELEVATED_ROADS
608in highp float v_road_z_offset;
609#endif
610#ifdef INDICATOR_CUTOUT
611in highp float v_z_offset;
612#endif
613void main() {
614#pragma mapbox: initialize highp vec4 color
615#pragma mapbox: initialize lowp float opacity
616vec4 out_color=color;
617#ifdef LIGHTING_3D_MODE
618out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
619#ifdef RENDER_SHADOWS
620float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
621#endif
622#endif
623#ifdef FOG
624out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
625#endif
626out_color*=opacity;
627#ifdef INDICATOR_CUTOUT
628if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}
629#endif
630#ifdef FEATURE_CUTOUT
631out_color=apply_feature_cutout(out_color,gl_FragCoord);
632#endif
633glFragColor=out_color;
634#ifdef OVERDRAW_INSPECTOR
635glFragColor=vec4(1.0);
636#endif
637HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
638#include "_prelude_shadow.vertex.glsl"
639in vec2 a_pos;
640#ifdef ELEVATED_ROADS
641in float a_road_z_offset;out highp float v_road_z_offset;
642#endif
643#ifdef RENDER_SHADOWS
644uniform 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;
645#endif
646#ifdef INDICATOR_CUTOUT
647out highp float v_z_offset;
648#endif
649uniform mat4 u_matrix;
650#pragma mapbox: define highp vec4 color
651#pragma mapbox: define lowp float opacity
652#pragma mapbox: define highp float z_offset
653void main() {
654#pragma mapbox: initialize highp vec4 color
655#pragma mapbox: initialize lowp float opacity
656#pragma mapbox: initialize highp float z_offset
657#ifdef ELEVATED_ROADS
658z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
659#endif
660float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
661#ifdef RENDER_SHADOWS
662vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
663#ifdef NORMAL_OFFSET
664vec3 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();
665#endif
666v_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;
667#endif
668#ifdef FOG
669v_fog_pos=fog_position(a_pos);
670#endif
671#ifdef INDICATOR_CUTOUT
672v_z_offset=z_offset;
673#endif
674}`),fillOutline:Ht(`#include "_prelude_fog.fragment.glsl"
675#include "_prelude_lighting.glsl"
676#include "_prelude_shadow.fragment.glsl"
677in highp vec2 v_pos;uniform float u_emissive_strength;
678#ifdef RENDER_SHADOWS
679uniform 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;
680#endif
681#pragma mapbox: define highp vec4 outline_color
682#pragma mapbox: define lowp float opacity
683void main() {
684#pragma mapbox: initialize highp vec4 outline_color
685#pragma mapbox: initialize lowp float opacity
686float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;
687#ifdef LIGHTING_3D_MODE
688out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
689#ifdef RENDER_SHADOWS
690float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
691#endif
692#endif
693#ifdef FOG
694out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
695#endif
696#ifdef FEATURE_CUTOUT
697out_color=apply_feature_cutout(out_color,gl_FragCoord);
698#endif
699glFragColor=out_color*(alpha*opacity);
700#ifdef OVERDRAW_INSPECTOR
701glFragColor=vec4(1.0);
702#endif
703HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
704#include "_prelude_shadow.vertex.glsl"
705in vec2 a_pos;
706#ifdef ELEVATED_ROADS
707in float a_road_z_offset;
708#endif
709#ifdef RENDER_SHADOWS
710uniform 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;
711#endif
712uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;
713#pragma mapbox: define highp vec4 outline_color
714#pragma mapbox: define lowp float opacity
715#pragma mapbox: define highp float z_offset
716void main() {
717#pragma mapbox: initialize highp vec4 outline_color
718#pragma mapbox: initialize lowp float opacity
719#pragma mapbox: initialize highp float z_offset
720#ifdef ELEVATED_ROADS
721z_offset+=a_road_z_offset;
722#endif
723float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
724#ifdef FLIP_Y
725v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
726#else
727v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
728#endif
729#ifdef RENDER_SHADOWS
730vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
731#ifdef NORMAL_OFFSET
732vec3 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();
733#endif
734v_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;
735#endif
736#ifdef FOG
737v_fog_pos=fog_position(a_pos);
738#endif
739}`),fillOutlinePattern:Ht(`#include "_prelude_fog.fragment.glsl"
740#include "_prelude_lighting.glsl"
741#include "_prelude_shadow.fragment.glsl"
742uniform vec2 u_texsize;uniform sampler2D u_image;
743#ifdef FILL_PATTERN_TRANSITION
744uniform float u_pattern_transition;
745#endif
746uniform float u_emissive_strength;
747#ifdef RENDER_SHADOWS
748uniform 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;
749#endif
750in highp vec2 v_pos;in highp vec2 v_pos_world;
751#pragma mapbox: define lowp float opacity
752#pragma mapbox: define lowp vec4 pattern
753#ifdef FILL_PATTERN_TRANSITION
754#pragma mapbox: define mediump vec4 pattern_b
755#endif
756void main() {
757#pragma mapbox: initialize lowp float opacity
758#pragma mapbox: initialize mediump vec4 pattern
759#ifdef FILL_PATTERN_TRANSITION
760#pragma mapbox: initialize mediump vec4 pattern_b
761#endif
762vec2 pattern_tl=pattern.xy;vec2 pattern_br=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);
763#ifdef FILL_PATTERN_TRANSITION
764vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
765#endif
766#ifdef LIGHTING_3D_MODE
767out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
768#ifdef RENDER_SHADOWS
769float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
770#endif
771#endif
772#ifdef FEATURE_CUTOUT
773out_color=apply_feature_cutout(out_color,gl_FragCoord);
774#endif
775#ifdef FOG
776out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
777#endif
778glFragColor=out_color*(alpha*opacity);
779#ifdef OVERDRAW_INSPECTOR
780glFragColor=vec4(1.0);
781#endif
782HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
783#include "_prelude_shadow.vertex.glsl"
784uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
785#ifdef ELEVATED_ROADS
786in float a_road_z_offset;
787#endif
788#ifdef RENDER_SHADOWS
789uniform 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;
790#endif
791out highp vec2 v_pos;out highp vec2 v_pos_world;
792#pragma mapbox: define lowp float opacity
793#pragma mapbox: define lowp vec4 pattern
794#ifdef FILL_PATTERN_TRANSITION
795#pragma mapbox: define mediump vec4 pattern_b
796#endif
797#pragma mapbox: define lowp float pixel_ratio
798#pragma mapbox: define highp float z_offset
799void main() {
800#pragma mapbox: initialize lowp float opacity
801#pragma mapbox: initialize mediump vec4 pattern
802#ifdef FILL_PATTERN_TRANSITION
803#pragma mapbox: initialize mediump vec4 pattern_b
804#endif
805#pragma mapbox: initialize lowp float pixel_ratio
806#pragma mapbox: initialize highp float z_offset
807vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;
808#ifdef ELEVATED_ROADS
809z_offset+=a_road_z_offset;
810#endif
811float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_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,a_pos);
812#ifdef FLIP_Y
813v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
814#else
815v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
816#endif
817#ifdef RENDER_SHADOWS
818vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
819#ifdef NORMAL_OFFSET
820vec3 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();
821#endif
822v_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;
823#endif
824#ifdef FOG
825v_fog_pos=fog_position(a_pos);
826#endif
827}`),fillPattern:Ht(`#include "_prelude_fog.fragment.glsl"
828#include "_prelude_lighting.glsl"
829#include "_prelude_shadow.fragment.glsl"
830uniform vec2 u_texsize;uniform sampler2D u_image;
831#ifdef FILL_PATTERN_TRANSITION
832uniform float u_pattern_transition;
833#endif
834in highp vec2 v_pos;uniform float u_emissive_strength;
835#ifdef RENDER_SHADOWS
836uniform 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;
837#endif
838#ifdef ELEVATED_ROADS
839in highp float v_road_z_offset;
840#endif
841#pragma mapbox: define lowp float opacity
842#pragma mapbox: define lowp vec4 pattern
843#ifdef FILL_PATTERN_TRANSITION
844#pragma mapbox: define mediump vec4 pattern_b
845#endif
846void main() {
847#pragma mapbox: initialize lowp float opacity
848#pragma mapbox: initialize mediump vec4 pattern
849#ifdef FILL_PATTERN_TRANSITION
850#pragma mapbox: initialize mediump vec4 pattern_b
851#endif
852vec2 pattern_tl=pattern.xy;vec2 pattern_br=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);
853#ifdef FILL_PATTERN_TRANSITION
854vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
855#endif
856#ifdef LIGHTING_3D_MODE
857out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
858#ifdef RENDER_SHADOWS
859float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
860#ifdef ELEVATED_ROADS
861out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
862#else
863out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
864#endif
865#endif
866#endif
867#ifdef FEATURE_CUTOUT
868out_color=apply_feature_cutout(out_color,gl_FragCoord);
869#endif
870#ifdef FOG
871out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
872#endif
873glFragColor=out_color*opacity;
874#ifdef OVERDRAW_INSPECTOR
875glFragColor=vec4(1.0);
876#endif
877HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
878#include "_prelude_shadow.vertex.glsl"
879uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
880#ifdef ELEVATED_ROADS
881in float a_road_z_offset;out highp float v_road_z_offset;
882#endif
883#ifdef RENDER_SHADOWS
884uniform 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;
885#endif
886out highp vec2 v_pos;
887#pragma mapbox: define lowp float opacity
888#pragma mapbox: define lowp vec4 pattern
889#ifdef FILL_PATTERN_TRANSITION
890#pragma mapbox: define mediump vec4 pattern_b
891#endif
892#pragma mapbox: define lowp float pixel_ratio
893#pragma mapbox: define highp float z_offset
894void main() {
895#pragma mapbox: initialize lowp float opacity
896#pragma mapbox: initialize mediump vec4 pattern
897#pragma mapbox: initialize lowp float pixel_ratio
898#pragma mapbox: initialize highp float z_offset
899#ifdef FILL_PATTERN_TRANSITION
900#pragma mapbox: initialize mediump vec4 pattern_b
901#endif
902vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;
903#ifdef ELEVATED_ROADS
904z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
905#endif
906float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_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,a_pos);
907#ifdef RENDER_SHADOWS
908vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
909#ifdef NORMAL_OFFSET
910vec3 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();
911#endif
912v_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;
913#endif
914#ifdef FOG
915v_fog_pos=fog_position(a_pos);
916#endif
917}`),fillExtrusion:Ht(`#include "_prelude_fog.fragment.glsl"
918#include "_prelude_shadow.fragment.glsl"
919#include "_prelude_lig
919hting.glsl"
920in vec4 v_color;in vec4 v_flat;
921#ifdef RENDER_SHADOWS
922in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
923#endif
924uniform lowp float u_opacity;
925#ifdef FAUX_AO
926uniform lowp vec2 u_ao;in vec2 v_ao;
927#endif
928#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
929in vec4 v_roof_color;
930#endif
931#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
932in highp vec3 v_normal;
933#endif
934uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
935#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
936in float v_flood_radius;in float v_has_floodlight;
937#endif
938in float v_height;
939#pragma mapbox: define highp float emissive_strength
940void main() {
941#pragma mapbox: initialize highp float emissive_strength
942#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
943vec3 normal=normalize(v_normal);
944#endif
945float z;vec4 color=v_color;
946#ifdef ZERO_ROOF_RADIUS
947z=float(normal.z > 0.00001);
948#ifdef LIGHTING_3D_MODE
949normal=mix(normal,vec3(0.0,0.0,1.0),z);
950#else
951color=mix(v_color,v_roof_color,z);
952#endif
953#endif
954float h=max(0.0,v_height);float ao_shade=1.0;
955#ifdef FAUX_AO
956float 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;
957#ifdef ZERO_ROOF_RADIUS
958concave*=(1.0-z);
959#endif
960float 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);
961#ifdef LIGHTING_3D_MODE
962#ifdef FLOOD_LIGHT
963color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
964#else
965color.rgb*=ao_shade;
966#endif
967#else
968color.rgb*=ao_shade;
969#endif
970#endif
971#ifdef LIGHTING_3D_MODE
972float flood_radiance=0.0;
973#ifdef FLOOD_LIGHT
974flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
975#endif
976#ifdef RENDER_SHADOWS
977#ifdef FLOOD_LIGHT
978float 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);
979#else
980float shadowed_lighting_factor;
981#ifdef RENDER_CUTOFF
982shadowed_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;}
983#else
984shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
985#endif
986color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
987#endif
988#else
989color.rgb=apply_lighting(color.rgb,normal);
990#ifdef FLOOD_LIGHT
991color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
992#endif
993#endif
994color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;
995#endif
996#ifdef FOG
997color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
998#endif
999#ifdef INDICATOR_CUTOUT
1000color=applyCutout(color,h);
1001#endif
1002#ifdef FEATURE_CUTOUT
1003color=apply_feature_cutout(color,gl_FragCoord);
1004#endif
1005glFragColor=color;
1006#ifdef OVERDRAW_INSPECTOR
1007glFragColor=vec4(1.0);
1008#endif
1009HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1010#include "_prelude_terrain.vertex.glsl"
1011#include "_prelude_shadow.vertex.glsl"
1012#include "_prelude_lighting.glsl"
1013uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1014#ifdef RENDER_WALL_MODE
1015in vec3 a_join_normal_inside;
1016#endif
1017#ifdef PROJECTION_GLOBE_VIEW
1018in vec3 a_pos_3;in vec3 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;
1019#endif
1020#ifdef TERRAIN
1021uniform int u_height_type;uniform int u_base_type;
1022#endif
1023uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;
1024#ifdef RENDER_SHADOWS
1025uniform 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;
1026#endif
1027#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1028out vec4 v_roof_color;
1029#endif
1030#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1031out highp vec3 v_normal;
1032#endif
1033#ifdef FAUX_AO
1034uniform lowp vec2 u_ao;out vec2 v_ao;
1035#endif
1036#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1037out float v_flood_radius;out float v_has_floodlight;
1038#endif
1039out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
1040#pragma mapbox: define highp float base
1041#pragma mapbox: define highp float height
1042#pragma mapbox: define highp vec4 color
1043#pragma mapbox: define highp float flood_light_wall_radius
1044#pragma mapbox: define highp float line_width
1045#pragma mapbox: define highp float emissive_strength
1046void main() {
1047#pragma mapbox: initialize highp float base
1048#pragma mapbox: initialize highp float height
1049#pragma mapbox: initialize highp vec4 color
1050#pragma mapbox: initialize highp float flood_light_wall_radius
1051#pragma mapbox: initialize highp float line_width
1052#pragma mapbox: initialize highp float emissive_strength
1053base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));
1054#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1055v_normal=normal;
1056#endif
1057base=max(0.0,base);float attr_height=height;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);
1058#if defined(HAS_CENTROID) || defined(TERRAIN)
1059centroid_pos=a_centroid_pos;
1060#endif
1061float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;
1062#ifdef TERRAIN
1063bool 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);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? 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;pos=vec3(pos_nx.xy,h);
1064#else
1065h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);
1066#endif
1067#ifdef PROJECTION_GLOBE_VIEW
1068float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=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);
1069#endif
1070float cutoff=1.0;vec3 scaled_pos=pos;
1071#ifdef RENDER_CUTOFF
1072vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);
1073#ifdef CLIP_ZERO_TO_ONE
1074cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);
1075#else
1076cutoff=cutoff_opacity(u_cutoff_params,ground.z);
1077#endif
1078if (centroid_pos.y !=0.0 && centroid_pos.x !=0.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);
1079#endif
1080float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));
1081#ifdef RENDER_WALL_MODE
1082vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
1083#endif
1084gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;
1085#ifdef RENDER_SHADOWS
1086vec3 shd_pos0=pos;vec3 shd_pos1=pos;
1087#ifdef NORMAL_OFFSET
1088vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
1089#endif
1090v_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);
1091#endif
1092float NdotL=0.0;float colorvalue=0.0;
1093#ifndef LIGHTING_3D_MODE
1094colorvalue=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*=(
1095(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1096#endif
1097#ifdef FAUX_AO
1098float 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;
1099#ifdef TERRAIN
1100top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
1101#endif
1102v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
1103#ifdef PROJECTION_GLOBE_VIEW
1104top_height+=u_height_lift;
1105#endif
1106gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1107#endif
1108#ifdef LIGHTING_3D_MODE
1109#ifdef FLOOD_LIGHT
1110float is_wall=1.0-float(t > 0.0 && top_up_ny.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;
1111#endif
1112v_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);
1113#else
1114v_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;
1115#endif
1116#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1117float 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;
1118#endif
1119#ifdef FOG
1120v_fog_pos=fog_position(pos);
1121#endif
1122}`),fillExtrusionDepth:Ht(`in highp float v_depth;void main() {
1123#ifndef DEPTH_TEXTURE
1124glFragColor=pack_depth(v_depth);
1125#endif
1126}`,`#include "_prelude_terrain.vertex.glsl"
1127uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;
1128#ifdef TERRAIN
1129uniform int u_height_type;uniform int u_base_type;
1130#endif
1131in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1132#ifdef RENDER_WALL_MODE
1133in vec3 a_join_normal_inside;
1134#endif
1135#pragma mapbox: define highp float base
1136#pragma mapbox: define highp float height
1137#pragma mapbox: define highp float line_width
1138#pragma mapbox: define highp vec4 color
1139out highp float v_depth;void main() {
1140#pragma mapbox: initialize highp float base
1141#pragma mapbox: initialize highp float height
1142#pragma mapbox: initialize highp float line_width
1143#pragma mapbox: initialize highp vec4 color
1144base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;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);
1145#if defined(HAS_CENTROID) || defined(TERRAIN)
1146centroid_pos=a_centroid_pos;
1147#endif
1148vec3 pos;
1149#ifdef TERRAIN
1150bool 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);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? 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);
1151#else
1152pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
1153#endif
1154#ifdef RENDER_WALL_MODE
1155vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
1156#endif
1157float 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);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Ht(`#include "_prelude_fog.fragment.glsl"
1158#include "_prelude_lighting.glsl"
1159uniform vec2 u_texsize;uniform sampler2D u_image;
1160#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1161uniform float u_pattern_transition;
1162#endif
1163#ifdef FAUX_AO
1164uniform lowp vec2 u_ao;in vec3 v_ao;
1165#endif
1166#ifdef LIGHTING_3D_MODE
1167in vec3 v_normal;
1168#endif
1169in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
1170#pragma mapbox: define highp float base
1171#pragma mapbox: define highp float height
1172#pragma mapbox: define mediump vec4 pattern
1173#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1174#pragma mapbox: define mediump vec4 pattern_b
1175#endif
1176#pragma mapbox: define highp float pixel_ratio
1177void main() {
1178#pragma mapbox: initialize highp float base
1179#pragma mapbox: initialize highp float height
1180#pragma mapbox: initialize mediump vec4 pattern
1181#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1182#pragma mapbox: initialize mediump vec4 pattern_b
1183#endif
1184#pragma mapbox: initialize highp float pixel_ratio
1185vec2 pattern_tl=pattern.xy;vec2 pattern_br=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);
1186#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1187vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
1188#endif
1189#ifdef LIGHTING_3D_MODE
1190out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
1191#else
1192out_color=out_color*v_lighting;
1193#endif
1194#ifdef FAUX_AO
1195float 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
1195),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;
1196#endif
1197#ifdef FOG
1198out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1199#endif
1200#ifdef INDICATOR_CUTOUT
1201out_color=applyCutout(out_color,height);
1202#endif
1203glFragColor=out_color;
1204#ifdef OVERDRAW_INSPECTOR
1205glFragColor=vec4(1.0);
1206#endif
1207HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1208#include "_prelude_terrain.vertex.glsl"
1209#include "_prelude_lighting.glsl"
1210uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1211#ifdef RENDER_WALL_MODE
1212in vec3 a_join_normal_inside;
1213#endif
1214#ifdef PROJECTION_GLOBE_VIEW
1215in vec3 a_pos_3;in vec3 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;
1216#endif
1217#ifdef TERRAIN
1218uniform int u_height_type;uniform int u_base_type;
1219#endif
1220out highp vec2 v_pos;out vec4 v_lighting;
1221#ifdef FAUX_AO
1222uniform lowp vec2 u_ao;out vec3 v_ao;
1223#endif
1224#ifdef LIGHTING_3D_MODE
1225out vec3 v_normal;
1226#endif
1227#pragma mapbox: define highp float base
1228#pragma mapbox: define highp float height
1229#pragma mapbox: define highp vec4 color
1230#pragma mapbox: define mediump vec4 pattern
1231#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1232#pragma mapbox: define mediump vec4 pattern_b
1233#endif
1234#pragma mapbox: define highp float pixel_ratio
1235#pragma mapbox: define highp float line_width
1236void main() {
1237#pragma mapbox: initialize highp float base
1238#pragma mapbox: initialize highp float height
1239#pragma mapbox: initialize highp vec4 color
1240#pragma mapbox: initialize mediump vec4 pattern
1241#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1242#pragma mapbox: initialize mediump vec4 pattern_b
1243#endif
1244#pragma mapbox: initialize highp float pixel_ratio
1245#pragma mapbox: initialize highp float line_width
1246vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=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.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
1247#if defined(HAS_CENTROID) || defined(TERRAIN)
1248centroid_pos=a_centroid_pos;
1249#endif
1250float ele=0.0;float h=z;vec3 p;float c_ele;
1251#ifdef TERRAIN
1252bool 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);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? 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);
1253#else
1254p=vec3(pos_nx.xy,z);
1255#endif
1256#ifdef PROJECTION_GLOBE_VIEW
1257float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=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);
1258#endif
1259#ifdef RENDER_WALL_MODE
1260vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;
1261#endif
1262float 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
1263? pos_nx.xy
1264: 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;
1265#ifdef LIGHTING_3D_MODE
1266NdotL=calculate_NdotL(normal);
1267#else
1268NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
1269#endif
1270if (normal.y !=0.0) {float r=0.84;
1271#ifndef LIGHTING_3D_MODE
1272r=mix(0.7,0.98,1.0-u_lightintensity);
1273#endif
1274NdotL*=(
1275(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1276#ifdef FAUX_AO
1277float 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;
1278#ifdef TERRAIN
1279top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
1280#endif
1281v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
1282#ifdef PROJECTION_GLOBE_VIEW
1283top_height+=u_height_lift;
1284#endif
1285gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1286#endif
1287#ifdef LIGHTING_3D_MODE
1288v_normal=normal;
1289#else
1290v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
1291#endif
1292#ifdef FOG
1293v_fog_pos=fog_position(p);
1294#endif
1295}`),groundShadow:Ht(`#include "_prelude_shadow.fragment.glsl"
1296precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
1297#ifdef FOG
1298in float v_fog_opacity;
1299#endif
1300void 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);
1301#ifdef RENDER_CUTOFF
1302shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));
1303#endif
1304#ifdef FOG
1305shadow=mix(shadow,vec3(1.0),v_fog_opacity);
1306#endif
1307#ifdef INDICATOR_CUTOUT
1308shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);
1309#endif
1310glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
1311uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
1312#ifdef FOG
1313out float v_fog_opacity;
1314#endif
1315void 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);
1316#ifdef FOG
1317v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);
1318#endif
1319}`),fillExtrusionGroundEffect:Ht(`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;
1320#ifdef SDF_SUBPASS
1321in 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);}
1322#ifdef FOG
1323in highp float v_fog;
1324#endif
1325#endif
1326void main() {
1327#ifdef CLEAR_SUBPASS
1328vec4 color=vec4(1.0);
1329#ifdef CLEAR_FROM_TEXTURE
1330color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
1331#endif
1332glFragColor=color;
1333#else
1334#ifdef SDF_SUBPASS
1335highp 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;
1336#ifdef FOG
1337fog=v_fog;
1338#endif
1339#ifdef RENDER_CUTOFF
1340fog*=v_cutoff_opacity;
1341#endif
1342glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
1343#else
1344vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
1345#ifdef OVERDRAW_INSPECTOR
1346color=vec4(1.0);
1347#endif
1348glFragColor=color;
1349#endif
1350HANDLE_WIREFRAME_DEBUG;
1351#endif
1352}`,`#include "_prelude_fog.vertex.glsl"
1353in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;
1354#ifdef SDF_SUBPASS
1355out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
1356#ifdef FOG
1357out highp float v_fog;
1358#endif
1359#endif
1360uniform 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;
1361#pragma mapbox: define highp float flood_light_ground_radius
1362const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
1363#pragma mapbox: initialize highp float flood_light_ground_radius
1364vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;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=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;
1365#ifdef SDF_SUBPASS
1366v_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);
1367#ifdef FOG
1368v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
1369#endif
1370#endif
1371float hidden_by_landmark=0.0;
1372#ifdef HAS_CENTROID
1373hidden_by_landmark=a_hidden_by_landmark;
1374#endif
1375float 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));
1376#ifdef RENDER_CUTOFF
1377v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
1378#endif
1379}`),hillshadePrepare:Ht(`precision highp float;uniform 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(
1380(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
1381)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
1382deriv.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 vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Ht(`#include "_prelude_fog.fragment.glsl"
1383#include "_prelude_lighting.glsl"
1384uniform 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;
1385#ifdef LIGHTING_3D_MODE
1386glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
1387#endif
1388#ifdef FOG
1389glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
1390#endif
1391#ifdef OVERDRAW_INSPECTOR
1392glFragColor=vec4(1.0);
1393#endif
1394HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1395uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;
1396#ifdef FOG
1397v_fog_pos=fog_position(a_pos);
1398#endif
1399}`),line:Ht(`#include "_prelude_fog.fragment.glsl"
1400#include "_prelude_lighting.glsl"
1401#include "_prelude_shadow.fragment.glsl"
1402uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1402uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;
1403#ifdef ELEVATED_ROADS
1404in highp float v_road_z_offset;
1405#endif
1406#ifdef RENDER_LINE_DASH
1407uniform sampler2D u_dash_image;in vec2 v_tex;
1408#endif
1409#ifdef RENDER_LINE_GRADIENT
1410uniform sampler2D u_gradient_image;
1411#endif
1412#ifdef INDICATOR_CUTOUT
1413in highp float v_z_offset;
1414#endif
1415#ifdef RENDER_SHADOWS
1416uniform 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;
1417#endif
1418float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;
1419#pragma mapbox: define highp vec4 color
1420#pragma mapbox: define lowp float floorwidth
1421#pragma mapbox: define lowp vec4 dash
1422#pragma mapbox: define lowp float blur
1423#pragma mapbox: define lowp float opacity
1424#pragma mapbox: define lowp float border_width
1425#pragma mapbox: define lowp vec4 border_color
1426float linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
1427#pragma mapbox: initialize highp vec4 color
1428#pragma mapbox: initialize lowp float floorwidth
1429#pragma mapbox: initialize lowp vec4 dash
1430#pragma mapbox: initialize lowp float blur
1431#pragma mapbox: initialize lowp float opacity
1432#pragma mapbox: initialize lowp float border_width
1433#pragma mapbox: initialize lowp vec4 border_color
1434float 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);
1435#ifdef RENDER_LINE_DASH
1436float sdfdist=texture(u_dash_image,v_tex).r;
1436float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);
1437#endif
1438highp vec4 out_color;
1439#ifdef RENDER_LINE_GRADIENT
1440out_color=texture(u_gradient_image,v_uv.xy);
1441#else
1442out_color=color;
1443#endif
1444float trim_alpha=1.0;
1445#ifdef RENDER_LINE_TRIM_OFFSET
1446highp 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);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;}
1447#endif
1448if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}
1449#ifdef RENDER_LINE_BORDER
1450float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}
1451#endif
1452#ifdef LIGHTING_3D_MODE
1453out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
1454#ifdef RENDER_SHADOWS
1455float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1456#ifdef ELEVATED_ROADS
1457out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1458#else
1459out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1460#endif
1461#endif
1462#endif
1463#ifdef FOG
1464out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1465#endif
1466out_color*=(alpha*opacity);
1467#ifdef INDICATOR_CUTOUT
1468out_color=applyCutout(out_color,v_z_offset);
1469#endif
1470#ifdef FEATURE_CUTOUT
1471out_color=apply_feature_cutout(out_color,gl_FragCoord);
1472#endif
1473glFragColor=out_color;
1474#ifdef OVERDRAW_INSPECTOR
1475glFragColor=vec4(1.0);
1476#endif
1477HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1478#include "_prelude_shadow.vertex.glsl"
1479#include "_prelude_terrain.vertex.glsl"
1480#define EXTRUDE_SCALE 0.015873016
1481in vec2 a_pos_normal;in vec4 a_data;
1482#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)
1483in vec3 a_z_offset_width;
1484#endif
1485#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1486in highp vec3 a_packed;
1487#endif
1488#ifdef RENDER_LINE_DASH
1489in float a_linesofar;
1490#endif
1491uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale;
1492#ifdef ELEVATED
1493uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1494#ifdef ELEVATION_REFERENCE_SEA
1495return 0.0;
1496#else
1497return elevation(apos);
1498#endif
1499}
1500#endif
1501out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv;
1502#ifdef ELEVATED_ROADS
1503out highp float v_road_z_offset;
1504#endif
1505#ifdef RENDER_LINE_DASH
1506uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
1507#endif
1508#ifdef RENDER_LINE_GRADIENT
1509uniform float u_image_height;
1510#endif
1511#ifdef INDICATOR_CUTOUT
1512out highp float v_z_offset;
1513#endif
1514#ifdef RENDER_SHADOWS
1515uniform 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;
1516#endif
1517#pragma mapbox: define highp vec4 color
1518#pragma mapbox: define lowp float floorwidth
1519#pragma mapbox: define lowp vec4 dash
1520#pragma mapbox: define lowp float blur
1521#pragma mapbox: define lowp float opacity
1522#pragma mapbox: define mediump float gapwidth
1523#pragma mapbox: define lowp float offset
1524#pragma mapbox: define mediump float width
1525#pragma mapbox: define lowp float border_width
1526#pragma mapbox: define lowp vec4 border_color
1527void main() {
1528#pragma mapbox: initialize highp vec4 color
1529#pragma mapbox: initialize lowp float floorwidth
1530#pragma mapbox: initialize lowp vec4 dash
1531#pragma mapbox: initialize lowp float blur
1532#pragma mapbox: initialize lowp float opacity
1533#pragma mapbox: initialize mediump float gapwidth
1534#pragma mapbox: initialize lowp float offset
1535#pragma mapbox: initialize mediump float width
1536#pragma mapbox: initialize lowp float border_width
1537#pragma mapbox: initialize lowp vec4 border_color
1538float a_z_offset;
1539#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1540a_z_offset=a_z_offset_width.x;
1541#endif
1542float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth;
1543#ifdef VARIABLE_LINE_WIDTH
1544float left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0;
1545#else
1546halfwidth=(u_width_scale*width)/2.0;
1547#endif
1548offset=-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);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;
1548vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1549#ifdef ELEVATED_ROADS
1550v_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;
1551#else
1552#ifdef ELEVATED
1553vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;
1554#ifdef CROSS_SLOPE_VERTICAL
1555float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
1556#else
1557#ifdef CROSS_SLOPE_HORIZONTAL
1558float 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+a_z_offset;
1559#else
1560float 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+a_z_offset;
1561#endif
1562#endif
1563gl_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);
1564#else
1565gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
1566#endif
1567#endif
1568#ifdef ELEVATED_ROADS
1569#ifdef RENDER_SHADOWS
1570vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1571#ifdef NORMAL_OFFSET
1572vec3 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();
1573#endif
1574v_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;
1575#endif
1576#endif
1577#ifndef RENDER_TO_TEXTURE
1578float 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));
1579#else
1580v_gamma_scale=1.0;
1581#endif
1582#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1583highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2];
1584#ifdef RENDER_LINE_GRADIENT
1585highp 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);
1586#else
1587v_uv=vec3(a_uv_x,0.0,line_progress);
1588#endif
1589#endif
1590#ifdef RENDER_LINE_DASH
1591float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y);
1592#endif
1593v_width2=vec2(outset,inset);
1594#ifdef FOG
1595v_fog_pos=fog_position(pos);
1596#endif
1597#ifdef INDICATOR_CUTOUT
1598v_z_offset=a_z_offset;
1599#endif
1600}`),linePattern:Ht(`#include "_prelude_fog.fragment.glsl"
1601#include "_prelude_lighting.glsl"
1602#include "_prelude_shadow.fragment.glsl"
1603uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;
1604#ifdef LINE_PATTERN_TRANSITION
1605uniform float u_pattern_transition;
1606#endif
1607in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;
1608#ifdef RENDER_LINE_TRIM_OFFSET
1609in highp vec3 v_uv;
1610#endif
1611#ifdef ELEVATED_ROADS
1612in highp float v_road_z_offset;
1613#endif
1614#ifdef LINE_JOIN_NONE
1615in vec2 v_pattern_data;
1616#endif
1617#ifdef INDICATOR_CUTOUT
1618in highp float v_z_offset;
1619#endif
1620#ifdef RENDER_SHADOWS
1621uniform 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;
1622#endif
1623uniform float u_emissive_strength;
1624#pragma mapbox: define mediump vec4 pattern
1625#ifdef LINE_PATTERN_TRANSITION
1626#pragma mapbox: define mediump vec4 pattern_b
1627#endif
1628#pragma mapbox: define mediump float pixel_ratio
1629#pragma mapbox: define mediump float blur
1630#pragma mapbox: define mediump float opacity
1631void main() {
1632#pragma mapbox: initialize mediump vec4 pattern
1633#ifdef LINE_PATTERN_TRANSITION
1634#pragma mapbox: initialize mediump vec4 pattern_b
1635#endif
1636#pragma mapbox: initialize mediump float pixel_ratio
1637#pragma mapbox: initialize mediump float blur
1638#pragma mapbox: initialize mediump float opacity
1639vec2 pattern_tl=pattern.xy;vec2 pattern_br=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);
1640#ifdef LINE_PATTERN_TRANSITION
1641vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=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;
1642#endif
1643#ifdef RENDER_LINE_TRIM_OFFSET
1644highp 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);}
1645#endif
1646#ifdef LINE_JOIN_NONE
1647highp 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);}
1648#endif
1649#ifdef LIGHTING_3D_MODE
1650color=apply_lighting_with_emission_ground(color,u_emissive_strength);
1651#ifdef RENDER_SHADOWS
1652float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1653#ifdef ELEVATED_ROADS
1654color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1655#else
1656color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1657#endif
1658#endif
1659#endif
1660#ifdef FOG
1661color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
1662#endif
1663color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}
1664#ifdef INDICATOR_CUTOUT
1665color=applyCutout(color,v_z_offset);
1666#endif
1667glFragColor=color;
1668#ifdef OVERDRAW_INSPECTOR
1669glFragColor=vec4(1.0);
1670#endif
1671HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1672#include "_prelude_shadow.vertex.glsl"
1673#include "_prelude_terrain.vertex.glsl"
1674#define scale 0.015873016
1675in vec2 a_pos_normal;in vec4 a_data;
1676#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1677in vec3 a_z_offset_width;
1678#endif
1679#ifdef RENDER_LINE_TRIM_OFFSET
1680in highp vec3 a_packed;
1681#endif
1682in highp float a_linesofar;
1683#ifdef LINE_JOIN_NONE
1684in highp vec3 a_pattern_data;out vec2 v_pattern_data;
1685#endif
1686#ifdef INDICATOR_CUTOUT
1687out highp float v_z_offset;
1688#endif
1689uniform 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;
1690#ifdef ELEVATED
1691uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1692#ifdef ELEVATION_REFERENCE_SEA
1693return 0.0;
1694#else
1695return elevation(apos);
1696#endif
1697}
1698#endif
1699out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;
1700#ifdef RENDER_LINE_TRIM_OFFSET
1701out highp vec3 v_uv;
1702#endif
1703#ifdef ELEVATED_ROADS
1704out highp float v_road_z_offset;
1705#endif
1706#ifdef RENDER_SHADOWS
1707uniform 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;
1708#endif
1709#pragma mapbox: define mediump float blur
1710#pragma mapbox: define mediump float opacity
1711#pragma mapbox: define mediump float offset
1712#pragma mapbox: define mediump float gapwidth
1713#pragma mapbox: define mediump float width
1714#pragma mapbox: define mediump float floorwidth
1715#pragma mapbox: define mediump vec4 pattern
1716#ifdef LINE_PATTERN_TRANSITION
1717#pragma mapbox: define mediump vec4 pattern_b
1718#endif
1719#pragma mapbox: define mediump float pixel_ratio
1720void main() {
1721#pragma mapbox: initialize mediump float blur
1722#pragma mapbox: initialize mediump float opacity
1723#pragma mapbox: initialize mediump float offset
1724#pragma mapbox: initialize mediump float gapwidth
1725#pragma mapbox: initialize mediump float width
1726#pragma mapbox: initialize mediump float floorwidth
1727#pragma mapbox: initialize mediump vec4 pattern
1728#ifdef LINE_PATTERN_TRANSITION
1729#pragma mapbox: initialize mediump vec4 pattern_b
1730#endif
1731#pragma mapbox: initialize mediump float pixel_ratio
1732float a_z_offset;
1733#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1734a_z_offset=a_z_offset_width.x;
1735#endif
1736float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(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;
1736vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1737#ifdef ELEVATED_ROADS
1738v_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;
1739#else
1740#ifdef ELEVATED
1741vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;
1742#ifdef CROSS_SLOPE_VERTICAL
1743float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
1744#else
1745#ifdef CROSS_SLOPE_HORIZONTAL
1746float 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+a_z_offset;
1747#else
1748float 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+a_z_offset;
1749#endif
1750#endif
1751gl_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);
1752#else
1753gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
1754#endif
1755#endif
1756#ifdef ELEVATED_ROADS
1757#ifdef RENDER_SHADOWS
1758vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1759#ifdef NORMAL_OFFSET
1760vec3 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();
1761#endif
1762v_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;
1763#endif
1764#endif
1765#ifndef RENDER_TO_TEXTURE
1766float 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));
1767#else
1768v_gamma_scale=1.0;
1769#endif
1770#ifdef RENDER_LINE_TRIM_OFFSET
1771highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);
1772#endif
1773v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);
1774#ifdef LINE_JOIN_NONE
1775v_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/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(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);
1776#endif
1777#ifdef FOG
1778v_fog_pos=fog_position(pos);
1779#endif
1780#ifdef INDICATOR_CUTOUT
1781v_z_offset=a_z_offset;
1782#endif
1783}`),raster:Ht(`#include "_prelude_fog.fragment.glsl"
1784#include "_prelude_lighting.glsl"
1785#include "_prelude_raster_array.glsl"
1786uniform 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;
1787#ifdef PROJECTION_GLOBE_VIEW
1788in float v_split_fade;
1789#endif
1790uniform 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;
1791#ifndef RASTER_ARRAY
1792uniform highp sampler2D u_image0;uniform sampler2D u_image1;
1793#endif
1794#ifdef RASTER_COLOR
1795uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
1796#endif
1797void main() {vec4 color0,color1,color;vec2 value;
1798#ifdef RASTER_COLOR
1799#ifdef RASTER_ARRAY
1800#ifdef RASTER_ARRAY_LINEAR
1801value=mix(
1802raTexture2D_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
1803);
1804#else
1805value=mix(
1806raTexture2D_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
1807);
1808#endif
1809if (value.y > 0.0) value.x/=value.y;
1810#else
1811color=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);
1812#endif
1813color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;
1814#else
1815color0=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);
1816#endif
1817color.a*=u_opacity;
1818#ifdef GLOBE_POLES
1819color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);
1820#endif
1821vec3 rgb=color.rgb;rgb=vec3(
1822dot(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);
1823#ifdef LIGHTING_3D_MODE
1824out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
1825#endif
1826#ifdef FOG
1827highp 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));
1828#endif
1829glFragColor=vec4(out_color*color.a,color.a);
1830#ifdef PROJECTION_GLOBE_VIEW
1831glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
1832#endif
1833#ifdef RENDER_CUTOFF
1834glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
1835#endif
1836#ifdef OVERDRAW_INSPECTOR
1837glFragColor=vec4(1.0);
1838#endif
1839HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1840uniform 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;
1841#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
1842#ifdef GLOBE_POLES
1843in vec3 a_globe_pos;in vec2 a_uv;
1844#else
1845in vec2 a_pos;in vec2 a_texture_pos;
1846#endif
1847out vec2 v_pos0;out vec2 v_pos1;out float v_depth;
1848#ifdef PROJECTION_GLOBE_VIEW
1849out float v_split_fade;
1850#endif
1851void main() {vec2 uv;
1852#ifdef GLOBE_POLES
1853vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos   ,1.0);uv=a_uv;
1854#ifdef FOG
1855v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
1856#endif
1857#else
1858float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;
1859#ifdef PROJECTION_GLOBE_VIEW
1860vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);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);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);    
1861v_split_fade=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;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)));}float tiles=u_grid_matrix[0][2];
1861if (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);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
1862#ifdef FOG
1863v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1864#endif
1865#else
1866gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
1867#ifdef FOG
1868v_fog_pos=fog_position(a_pos);
1869#endif
1870#endif
1871#endif
1872v_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;
1873#ifdef RENDER_CUTOFF
1874v_depth=gl_Position.z;
1875#endif
1876}`),rasterParticle:Ht(`#include "_prelude_fog.fragment.glsl"
1877#include "_prelude_lighting.glsl"
1878uniform 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;
1879#ifdef LIGHTING_3D_MODE
1880out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;
1881#endif
1882#ifdef FOG
1883highp 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));
1884#endif
1885glFragColor=vec4(out_color*color.a,color.a);
1886#ifdef OVERDRAW_INSPECTOR
1887glFragColor=vec4(1.0);
1888#endif
1889HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1890uniform 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;
1891#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
1892in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;
1893#ifdef PROJECTION_GLOBE_VIEW
1894vec3 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;
1895#ifdef FOG
1896v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1897#endif
1898#else
1899uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
1900#ifdef FOG
1901v_fog_pos=fog_position(a_pos);
1902#endif
1903#endif
1904v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Ht("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"
1905in float 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(
1906mod(a_index,u_particle_texture_side_len),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:Ht("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 vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Ht(`#include "_prelude_raster_particle.glsl"
1907uniform 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;
1907vec2 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(
1908linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)
1909);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 vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Ht(`#include "_prelude_lighting.glsl"
1910#include "_prelude_shadow.fragment.glsl"
1911#define SDF_PX 8.0
1912#define SDF 1.0
1913#define ICON 0.0
1914uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;
1915#ifdef ICON_TRANSITION
1916uniform float u_icon_transition;
1917#endif
1918#ifdef COLOR_ADJUSTMENT
1919uniform mat4 u_color_adj_mat;
1920#endif
1921#ifdef INDICATOR_CUTOUT
1922in highp float v_z_offset;
1923#else
1924#ifdef RENDER_SHADOWS
1925in highp float v_z_offset;
1926#endif
1927#endif
1928in vec2 v_tex_a;
1929#ifdef ICON_TRANSITION
1930in vec2 v_tex_b;
1931#endif
1932in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;
1933#ifdef RENDER_TEXT_AND_SYMBOL
1934in float is_sdf;in vec2 v_tex_a_icon;
1935#endif
1936#ifdef RENDER_SHADOWS
1937uniform 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;
1938#endif
1939#pragma mapbox: define highp vec4 fill_color
1940#pragma mapbox: define highp vec4 halo_color
1941#pragma mapbox: define lowp float opacity
1942#pragma mapbox: define lowp float halo_width
1943#pragma mapbox: define lowp float halo_blur
1944#pragma mapbox: define lowp float emissive_strength
1945void main() {
1946#pragma mapbox: initialize highp vec4 fill_color
1947#pragma mapbox: initialize highp vec4 halo_color
1948#pragma mapbox: initialize lowp float opacity
1949#pragma mapbox: initialize lowp float halo_width
1950#pragma mapbox: initialize lowp float halo_blur
1951#pragma mapbox: initialize lowp float emissive_strength
1952vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];
1953#ifdef RENDER_TEXT_AND_SYMBOL
1954if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;
1955#ifdef OVERDRAW_INSPECTOR
1956glFragColor=vec4(1.0);
1957#endif
1958return;}
1959#endif
1960#ifdef RENDER_SDF
1961float 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;
1962#else
1963#ifdef ICON_TRANSITION
1964vec4 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);
1965#else
1966out_color=texture(u_texture,v_tex_a);
1967#endif
1968#ifdef COLOR_ADJUSTMENT
1969out_color=u_color_adj_mat*out_color;
1970#endif
1971#endif
1972out_color*=opacity*fade_opacity;
1973#ifdef LIGHTING_3D_MODE
1974out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1975#ifdef RENDER_SHADOWS
1976float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1977#ifdef TERRAIN
1978out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1979#else
1980out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1981#endif
1982#endif
1983#endif
1984#ifdef INDICATOR_CUTOUT
1985out_color=applyCutout(out_color,v_z_offset);
1986#endif
1987#ifdef FEATURE_CUTOUT
1988out_color=apply_feature_cutout(out_color,gl_FragCoord);
1989#endif
1990glFragColor=out_color;
1991#ifdef OVERDRAW_INSPECTOR
1992glFragColor=vec4(1.0);
1993#endif
1994HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
1995#include "_prelude_shadow.vertex.glsl"
1996in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
1997#ifdef Z_OFFSET
1998in float a_auto_z_offset;
1999#endif
2000#ifdef PROJECTION_GLOBE_VIEW
2001in vec3 a_globe_anchor;in vec3 a_globe_normal;
2002#endif
2003#ifdef ICON_TRANSITION
2004in vec2 a_texb;
2005#endif
2006#ifdef OCCLUSION_QUERIES
2007in float a_occlusion_query_opacity;
2008#endif
2009#ifdef ELEVATED_ROADS
2010in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;
2011#endif
2012#ifdef INDICATOR_CUTOUT
2013out highp float v_z_offset;
2014#else
2015#ifdef RENDER_SHADOWS
2016out highp float v_z_offset;
2017#endif
2018#endif
2019uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;
2020#ifdef PROJECTION_GLOBE_VIEW
2021uniform 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;
2022#endif
2023out vec2 v_tex_a;
2024#ifdef ICON_TRANSITION
2025out vec2 v_tex_b;
2026#endif
2027out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;
2028#ifdef RENDER_TEXT_AND_SYMBOL
2029out float is_sdf;out vec2 v_tex_a_icon;
2030#endif
2031#ifdef RENDER_SHADOWS
2032uniform 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;
2033#endif
2034#pragma mapbox: define highp vec4 fill_color
2035#pragma mapbox: define highp vec4 halo_color
2036#pragma mapbox: define lowp float opacity
2037#pragma mapbox: define lowp float halo_width
2038#pragma mapbox: define lowp float halo_blur
2039#pragma mapbox: define lowp float emissive_strength
2040#pragma mapbox: define lowp float occlusion_opacity
2041#pragma mapbox: define lowp float z_offset
2042void main() {
2043#pragma mapbox: initialize highp vec4 fill_color
2044#pragma mapbox: initialize highp vec4 halo_color
2045#pragma mapbox: initialize lowp float opacity
2046#pragma mapbox: initialize lowp float halo_width
2047#pragma mapbox: initialize lowp float halo_blur
2048#pragma mapbox: initialize lowp float emissive_strength
2049#pragma mapbox: initialize lowp float occlusion_opacity
2050#pragma mapbox: initialize lowp float z_offset
2051vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);
2052#ifdef Z_OFFSET
2053e+=a_auto_z_offset;
2054#endif
2055vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;
2056#ifdef PROJECTION_GLOBE_VIEW
2057mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=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;
2058#else
2059world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
2060#endif
2061vec4 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 ?
2062camera_to_anchor_distance/u_camera_to_center_distance :
2063u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
20640.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;
2065#ifdef PROJECTION_GLOBE_VIEW
2066vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(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;
2067#else
2068offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;
2069#endif
2070vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
2071#ifdef PROJECTION_GLOBE_VIEW
2072#ifdef PROJECTED_POS_ON_VIEWPORT
2073projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);
2074#else
2075vec3 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);    
2076#endif
2077#else
2078projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
2079#endif
2080highp 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);
2081#ifdef TERRAIN
2082#ifdef PITCH_WITH_MAP_TERRAIN
2083vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
2084#endif
2085#endif
2086#ifdef Z_OFFSET
2087z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;
2088#else
2089z+=u_pitch_with_map ? z_offset : 0.0;
2090#endif
2091float 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));
2092#ifdef DEPTH_OCCLUSION
2093float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;
2094#endif
2095#ifdef OCCLUSION_QUERIES
2096float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;
2097#endif
2098float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;
2099#ifdef PROJECTION_GLOBE_VIEW
2100vec3 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;
2101#else
2102#ifdef ELEVATED_ROADS
2103vec3 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;
2104#else
2105pos=vec3(projected_pos.xy/projected_pos.w+offset,z);
2106#endif
2107#endif
2108gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);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;
2109#ifdef RENDER_TEXT_AND_SYMBOL
2110is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;
2111#endif
2112#ifdef ICON_TRANSITION
2113v_tex_b=a_texb/u_texsize;
2114#endif
2115#ifdef RENDER_SHADOWS
2116vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;
2117#ifdef NORMAL_OFFSET
2118vec3 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();
2119#endif
2120v_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;
2121#endif
2122#ifdef INDICATOR_CUTOUT
2123v_z_offset=e;
2124#else
2125#ifdef RENDER_SHADOWS
2126v_z_offset=e;
2127#endif
2128#endif
2129}`),terrainRaster:Ht(`#include "_prelude_fog.fragment.glsl"
2130#include "_prelude_shadow.fragment.glsl"
2131#include "_prelude_lighting.glsl"
2132uniform sampler2D u_image0;in vec2 v_pos0;
2133#ifdef FOG
2134in float v_fog_opacity;
2135#endif
2136#ifdef RENDER_SHADOWS
2137in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
2138#endif
2139uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
2140#ifdef LIGHTING_3D_MODE
2141const vec3 normal=vec3(0.0,0.0,1.0);
2142#ifdef RENDER_SHADOWS
2143float cutoffOpacity=1.0;
2144#ifdef RENDER_CUTOFF
2145cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);
2146#endif
2147#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2148vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;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;
2149#else
2150float 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));
2151#endif
2152#else
2153float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
2154#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2155color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;
2156#endif
2157#endif
2158#else
2159color=image_color;
2160#endif
2161#ifdef FOG
2162#ifdef ZERO_EXAGGERATION
2163color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2164#else
2165color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
2166#endif
2167#endif
2168glFragColor=color;
2169#ifdef OVERDRAW_INSPECTOR
2170glFragColor=vec4(1.0);
2171#endif
2172HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2173#include "_prelude_terrain.vertex.glsl"
2174uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;
2175#ifdef FOG
2176out float v_fog_opacity;
2177#endif
2178#ifdef RENDER_SHADOWS
2179uniform 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;
2180#endif
2181void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);
2182#ifdef FOG
2183#ifdef ZERO_EXAGGERATION
2184v_fog_pos=fog_position(decodedPos);
2185#else
2186v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
2187#endif
2188#endif
2189#ifdef RENDER_SHADOWS
2190vec3 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.);
2191#endif
2192}`),terrainDepth:Ht("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
2193uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Ht(`#include "_prelude_fog.fragment.glsl"
2194in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_su
2194n_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(
2195cos_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))/(end-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;
2196#ifdef FOG
2197sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
2198#endif
2199sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
2200#ifdef OVERDRAW_INSPECTOR
2201glFragColor=vec4(1.0);
2202#endif
2203}`,bh),skyboxGradient:Ht(`#include "_prelude_fog.fragment.glsl"
2204in 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));
2205#ifdef FOG
2206color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
2207#endif
2208color*=u_opacity;glFragColor=color;
2209#ifdef OVERDRAW_INSPECTOR
2210glFragColor=vec4(1.0);
2211#endif
2212}`,bh),skyboxCapture:Ht
vendor: 3,792 bytes, lines 2212-2223
2212(`
2213in 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;
2214#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)
2215#define BETA_M                  vec3(21e-6,21e-6,21e-6)
2216#define MIE_G                   0.76
2217#define DENSITY_HEIGHT_SCALE_R  8000.0
2218#define DENSITY_HEIGHT_SCALE_M  1200.0
2219#define PLANET_RADIUS           6360e3
2220#define ATMOSPHERE_RADIUS       6420e3
2221#define SAMPLE_STEPS            10
2222#define DENSITY_STEPS           4
2223float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
2223Raster:Ht(`#include "_prelude_fog.fragment.glsl"
2224#include "_prelude_lighting.glsl"
2225uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;
2226#ifndef FOG
2227uniform 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;
2228#endif
2229void main() {vec4 color;
2230#ifdef CUSTOM_ANTIALIASING
2231highp vec2 uv=gl_FragCoord.xy/u_viewport;
2232#ifdef FLIP_Y
2233uv.y=1.0-uv.y;
2234#endif
2235highp vec3 ray_dir=mix(
2236mix(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);
2237#ifdef LIGHTING_3D_MODE
2238#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2239raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);
2240#else
2241raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
2242#endif
2243#else
2244color=vec4(raster.rgb*antialias,raster.a*antialias);
2245#endif
2246#else
2247color=texture(u_image0,v_pos0);
2248#ifdef LIGHTING_3D_MODE
2249#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2250color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;
2251#else
2252color=apply_lighting_ground(color);
2253#endif
2254#endif
2255#endif
2256#ifdef FOG
2257color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2258#endif
2259color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;
2260#ifdef OVERDRAW_INSPECTOR
2261glFragColor=vec4(1.0);
2262#endif
2263HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2264#include "_prelude_terrain.vertex.glsl"
2265uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;
2266#ifdef GLOBE_POLES
2267in vec3 a_globe_pos;in vec2 a_uv;
2268#else
2269in vec2 a_pos;
2270#endif
2271out vec2 v_pos0;void main() {
2272#ifdef GLOBE_POLES
2273vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
2274#else
2275float 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);
2276#endif
2277v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
2278#ifdef GLOBE_POLES
2279vec3 up_vector=globe_derived_up_vector;
2280#else
2281vec3 up_vector=elevationVector(tile_pos);
2282#endif
2283float height=elevation(tile_pos);globe_pos+=up_vector*height;
2284#ifndef GLOBE_POLES
2285globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
2286#endif
2287#ifdef GLOBE_POLES
2288vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
2289#else
2290vec4 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);
2291#endif
2292gl_Position=u_proj_matrix*interpolated_pos;
2293#ifdef FOG
2294v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2295#endif
2296}`),globeAtmosphere:Ht(`#include "_prelude_fog.fragment.glsl"
2297uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_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;
2298#ifdef PROJECTION_GLOBE_VIEW
2299globe_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) {
2300#ifdef ALPHA_PASS
2301glFragColor=vec4(0,0,0,0);return;
2302#else
2303#ifdef NATIVE
2304glFragColor=vec4(1,1,1,1);
2305#else
2306glFragColor=vec4(0,0,0,1);
2307#endif
2308return;
2309#endif
2310}
2311#endif
2312highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
23130.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
2314#ifdef PROJECTION_GLOBE_VIEW
2315highp 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 ?
2316PI-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);
2317#else
2318horizon_angle=horizon_angle_mercator;
2319#endif
2320horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2320vec3 color_stop_2=u_space_color.rgb;
2321#ifdef ALPHA_PASS
2322float 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);
2323#else
2324vec3 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);
2325#endif
2326}`,`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(
2327mix(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(
2328mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Ht(`#include "_prelude_fog.fragment.glsl"
2329#include "_prelude_shadow.fragment.glsl"
2330#include "_prelude_lighting.glsl"
2331uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;
2332#ifdef RENDER_SHADOWS
2333in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
2334#endif
2335#ifdef OCCLUSION_TEXTURE_TRANSFORM
2336uniform vec4 u_occlusionTextureTransform;
2337#endif
2338#pragma mapbox: define-attribute highp vec3 normal_3f
2339#pragma mapbox: define-attribute highp vec3 color_3f
2340#pragma mapbox: define-attribute highp vec4 color_4f
2341#pragma mapbox: define-attribute highp vec2 uv_2f
2342#pragma mapbox: initialize-attribute highp vec3 normal_3f
2343#pragma mapbox: initialize-attribute highp vec3 color_3f
2344#pragma mapbox: initialize-attribute highp vec4 color_4f
2345#pragma mapbox: initialize-attribute highp vec2 uv_2f
2346#ifdef HAS_ATTRIBUTE_a_pbr
2347in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
2348#endif
2349#ifdef HAS_TEXTURE_u_baseColorTexture
2350uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
2351#endif
2352#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
2353uniform sampler2D u_metallicRoughnessTexture;
2354#endif
2355#ifdef HAS_TEXTURE_u_occlusionTexture
2356uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
2357#endif
2358#ifdef HAS_TEXTURE_u_normalTexture
2359uniform sampler2D u_normalTexture;
2360#endif
2361#ifdef HAS_TEXTURE_u_emissionTexture
2362uniform sampler2D u_emissionTexture;
2363#endif
2364#ifdef APPLY_LUT_ON_GPU
2365uniform highp sampler3D u_lutTexture;
2366#endif
2367#ifdef TERRAIN_FRAGMENT_OCCLUSION
2368in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;
2369#ifdef DEPTH_D24
2370highp float unpack_depth(highp float depth) {return  depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}
2371#else
2372highp float unpack_depth_rgba(highp vec4 rgba_depth)
2373{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;}
2374#endif
2375bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;
2376#ifdef DEPTH_D24
2377highp float depth=unpack_depth(texture(u_depthTexture,coord).r);
2378#else
2379highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));
2380#endif
2381return v_depth > depth+0.0005;}
2382#endif
2383#define saturate(_x) clamp(_x,0.,1.)
2384vec3 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)
2385{
2386#ifdef LIGHTING_3D_MODE
2387vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
2388#ifdef RENDER_SHADOWS
2389lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2390#else
2391lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
2392#endif
2393return apply_lighting(albedo,transformed_normal,lighting_factor);
2394#else
2395vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
2395Color),vec3(1.0));return c3;
2396#endif
2397}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
2398#ifdef HAS_ATTRIBUTE_a_color_3f
2399albedo*=vec4(color_3f,1.0);
2400#endif
2401#ifdef HAS_ATTRIBUTE_a_pbr
2402#else
2403#ifdef HAS_ATTRIBUTE_a_color_4f
2404albedo*=color_4f;
2405#endif
2406#endif
2407#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)
2408vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}
2409#ifdef UNPREMULT_TEXTURE_IN_SHADER
2410if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;
2411#endif
2412if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}
2413#endif
2414vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);
2415#ifdef APPLY_LUT_ON_GPU
2416color=applyLUT(u_lutTexture,color);
2417#endif
2418return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
2419#ifdef HAS_TEXTURE_u_normalTexture
2420highp 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;
2421#ifdef FLIP_Y
2422T=-T;B=-B;
2423#endif
2424highp 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;
2425#else
2426return mat3(1.0);
2427#endif
2428}highp vec3 getNormal(){highp vec3 n;
2429#ifdef HAS_ATTRIBUTE_a_normal_3f
2430n=normalize(normal_3f);
2431#else
2432highp 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));
2433#ifdef FLIP_Y
2434n=normalize(cross(fdx,fdy));
2435#else
2436n=normalize(cross(fdx,fdy))*-1.0;
2437#endif
2438#endif
2439#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2440vec3 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);
2441#endif
2442return 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;
2443#ifdef HAS_ATTRIBUTE_a_pbr
2444mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
2445#endif
2446#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 
2447vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
2448#endif
2449const 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)
2450{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)
2451{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
2452{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)
2453{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)
2454{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)
2455{
2456#ifdef LIGHTING_3D_MODE
2457return mat.diffuseColor;
2458#else
2459return mat.diffuseColor/PI;
2460#endif
2461}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
2462{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)
2463{vec3 env_light=vec3(0.65,0.65,0.65);
2464#ifdef LIGHTING_3D_MODE
2465float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
2466#endif
2467vec3 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)
2468{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;
2469#ifdef RENDER_SHADOWS
2470lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2471#else
2472lighting_factor=NdotL;
2473#endif
2474vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2474Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
2475#if !defined(LIGHTING_3D_MODE)
2476const 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);
2477#endif
2478color*=intensityFactor;return color;}void main() {
2479#ifdef TERRAIN_FRAGMENT_OCCLUSION
2480if (isOccluded()) {discard;}
2481#endif
2482vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;
2483#ifdef LIGHTING_3D_MODE
2484lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
2485#endif
2486vec4 finalColor;
2487#ifdef DIFFUSE_SHADED
2488vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);
2489#ifdef HAS_TEXTURE_u_occlusionTexture
2490float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
2491#endif
2492finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;
2493#else
2494Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
2495#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2496#ifdef OCCLUSION_TEXTURE_TRANSFORM
2497vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;
2498#else
2499vec2 uv=uv_2f;
2500#endif
2501ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;
2502#endif
2503vec4 emissive=u_emissiveFactor;
2504#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2505emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
2506#endif
2507#ifdef APPLY_LUT_ON_GPU
2508float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;
2509#endif
2510color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
2511#ifdef HAS_ATTRIBUTE_a_pbr
2512float 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;
2513#ifdef APPLY_LUT_ON_GPU
2514color_mix=applyLUT(u_lutTexture,color_mix);
2515#endif
2516color=mix(color,color_mix,min(1.0,resEmission));
2517#ifdef HAS_ATTRIBUTE_a_color_4f
2518float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2518y));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);
2519#endif
2520#endif
2521vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
2522#endif
2523#ifdef FOG
2524finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
2525#endif
2526#ifdef RENDER_CUTOFF
2527finalColor*=v_cutoff_opacity;
2528#endif
2529#ifdef INDICATOR_CUTOUT
2530finalColor=applyCutout(finalColor,v_position_height.w);
2531#endif
2532#ifdef FEATURE_CUTOUT
2533finalColor=apply_feature_cutout(finalColor,gl_FragCoord);
2534#endif
2535glFragColor=finalColor;
2536#ifdef OVERDRAW_INSPECTOR
2537glFragColor=vec4(1.0);
2538#endif
2539HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2540#include "_prelude_shadow.vertex.glsl"
2541in vec3 a_pos_3f;
2542#pragma mapbox: define-attribute highp vec3 normal_3f
2543#pragma mapbox: define-attribute highp vec2 uv_2f
2544#pragma mapbox: define-attribute highp vec3 color_3f
2545#pragma mapbox: define-attribute highp vec4 color_4f
2546#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr
2547#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
2548uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
2549#ifdef INSTANCED_ARRAYS
2550in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2551#else
2552uniform highp mat4 u_normal_matrix;
2553#endif
2554#ifdef RENDER_SHADOWS
2555uniform 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;
2556#endif
2557out vec4 v_position_height;out lowp vec4 v_color_mix;
2558#ifdef TERRAIN_FRAGMENT_OCCLUSION
2559out highp float v_depth;
2560#endif
2561#ifdef HAS_ATTRIBUTE_a_pbr
2562out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
2563#endif
2564vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
2565#pragma mapbox: initialize-attribute highp vec3 normal_3f
2566#pragma mapbox: initialize-attribute highp vec2 uv_2f
2567#pragma mapbox: initialize-attribute highp vec3 color_3f
2568#pragma mapbox: initialize-attribute highp vec4 color_4f
2569#pragma mapbox: initialize-attribute-custom highp vec4 pbr
2570#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
2571highp mat4 normal_matrix;
2572#ifdef INSTANCED_ARRAYS
2573normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2574#else
2575normal_matrix=u_normal_matrix;
2576#endif
2577vec3 local_pos;mat3 rs;
2578#ifdef MODEL_POSITION_ON_GPU
2579vec3 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;
2580#else
2581local_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);
2582#endif
2583v_position_height.w=a_pos_3f.z;
2584#ifdef HAS_ATTRIBUTE_a_pbr
2585vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_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(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;
2586#endif
2587#ifdef FOG
2588v_fog_pos=fog_position(local_pos);
2589#endif
2590#ifdef RENDER_CUTOFF
2591v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
2592#endif
2593#ifdef TERRAIN_FRAGMENT_OCCLUSION
2594v_depth=gl_Position.z/gl_Position.w;
2595#endif
2596#ifdef HAS_ATTRIBUTE_a_normal_3f
2597#ifdef MODEL_POSITION_ON_GPU
2598float 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);
2599#else
2600normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
2601#endif
2602#endif
2603#ifdef HAS_ATTRIBUTE_a_pbr
2604#ifdef HAS_ATTRIBUTE_a_color_4f
2605v_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);
2606#endif
2607#endif
2608#ifdef RENDER_SHADOWS
2609vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);
2610#ifdef NORMAL_OFFSET
2611#ifdef HAS_ATTRIBUTE_a_normal_3f
2612#ifdef MODEL_POSITION_ON_GPU
2613vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2614#else
2615vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2616#endif
2617#endif
2618#endif
2619v_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;
2620#endif
2621}`),modelDepth:Ht(`in highp float v_depth;void main() {
2622#ifndef DEPTH_TEXTURE
2623glFragColor=pack_depth(v_depth);
2624#endif
2625}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;
2626#ifdef MODEL_POSITION_ON_GPU
2627#ifdef INSTANCED_ARRAYS
2628in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2629#else
2630uniform highp mat4 u_instance;
2631#endif
2632uniform highp mat4 u_node_matrix;
2633#endif
2634void main() {
2635#ifdef MODEL_POSITION_ON_GPU
2636highp mat4 instance;
2637#ifdef INSTANCED_ARRAYS
2638instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2639#else
2640instance=u_instance;
2641#endif
2642vec3 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;
2642rs[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);
2643#else
2644gl_Position=u_matrix*vec4(a_pos_3f,1);
2645#endif
2646v_depth=gl_Position.z/gl_Position.w;}`),stars:Ht(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
2647{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;}`,`
2648in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_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_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:Ht("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;}",`
2649in 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; 
2650uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 
2651uniform float u_horizontalOscillationRate; 
2652uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+
2653localY*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:Ht("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;}",`
2654in 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; 
2655uniform float u_velocity; 
2656uniform 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;
2656pos*=halfBoxSize; 
2657pos+=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+
2658localY*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:Ht("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:Ht("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl"
2659in 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;
2660#ifdef TERRAIN
2661float e=elevation(world_pos.xy);world_pos.z+=e;
2662#endif
2663vec4 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 Zn(l,t){const n=l.replace(/\s*\/\/[^\n]*\n/g,`
2664`).split(`
2665`);for(let c of n)if(c=c.trim(),c[0]==="#"&&c.includes("if")&&!c.includes("endif")){c=c.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const d=c.split(" ");for(const p of d)t.includes(p)||t.push(p)}}function Ht(l,t){const n=/#include\s+"([^"]+)"/g,c=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let d=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);d&&(d=d.map(T=>{const S=T.split(" ");return S[S.length-1]}),d=[...new Set(d)]);const p={},m=[],y=[];if(l=l.replace(n,(T,S)=>(y.push(S),"")),(t=t.replace(n,(T,S)=>(m.push(S),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let x=[...cl];Zn(l,x),Zn(t,x);for(const T of[...m,...y])vs[T]||console.error(`Undefined include: ${T}`),Vn[T]||(Vn[T]=[],Zn(vs[T],Vn[T])),x=[...x,...Vn[T]];return{fragmentSource:l=l.replace(c,(T,S,M,E,C)=>(p[C]=!0,S==="define"?`
2666#ifndef HAS_UNIFORM_u_${C}
2667in ${M} ${E} ${C};
2668#else
2669uniform ${M} ${E} u_${C};
2670#endif
2671`:S==="initialize"?`
2672#ifdef HAS_UNIFORM_u_${C}
2673    ${M} ${E} ${C} = u_${C};
2674#endif
2675`:S==="define-attribute"?`
2676#ifdef HAS_ATTRIBUTE_a_${C}
2677    in ${M} ${E} ${C};
2678#endif
2679`:S==="initialize-attribute"?"":void 0)),vertexSource:t=t.replace(c,(T,S,M,E,C)=>{const D=E==="float"?"vec2":E,z=C.match(/color/)?"color":D;return S==="define-attribute-vertex-shader-only"?`
2680#ifdef HAS_ATTRIBUTE_a_${C}
2681in ${M} ${E} a_${C};
2682#endif
2683`:p[C]?S==="define"?`
2684#ifndef HAS_UNIFORM_u_${C}
2685uniform lowp float u_${C}_t;
2686in ${M} ${D} a_${C};
2687out ${M} ${E} ${C};
2688#else
2689uniform ${M} ${E} u_${C};
2690#endif
2691`:S==="initialize"?z==="vec4"?`
2692#ifndef HAS_UNIFORM_u_${C}
2693    ${C} = a_${C};
2694#else
2695    ${M} ${E} ${C} = u_${C};
2696#endif
2697`:`
2698#ifndef HAS_UNIFORM_u_${C}
2699    ${C} = unpack_mix_${z}(a_${C}, u_${C}_t);
2700#else
2701    ${M} ${E} ${C} = u_${C};
2702#endif
2703`:S==="define-attribute"?`
2704#ifdef HAS_ATTRIBUTE_a_${C}
2705    in ${M} ${E} a_${C};
2706    out ${M} ${E} ${C};
2707#endif
2708`:S==="initialize-attribute"?`
2709#ifdef HAS_ATTRIBUTE_a_${C}
2710    ${C} = a_${C};
2711#endif
2712`:void 0:S==="define"?`
2713#ifndef HAS_UNIFORM_u_${C}
2714uniform lowp float u_${C}_t;
2715in ${M} ${D} a_${C};
2716#else
2717uniform ${M} ${E} u_${C};
2718#endif
2719`:S==="define-instanced"?z==="mat4"?`
2720#ifdef INSTANCED_ARRAYS
2721in vec4 a_${C}0;
2722in vec4 a_${C}1;
2723in vec4 a_${C}2;
2724in vec4 a_${C}3;
2725#else
2726uniform ${M} ${E} u_${C};
2727#endif
2728`:`
2729#ifdef INSTANCED_ARRAYS
2730in ${M} ${D} a_${C};
2731#else
2732uniform ${M} ${E} u_${C};
2733#endif
2734`:S==="initialize-attribute-custom"?`
2735#ifdef HAS_ATTRIBUTE_a_${C}
2736    ${M} ${E} ${C} = a_${C};
2737#endif
2738`:z==="vec4"?`
2739#ifndef HAS_UNIFORM_u_${C}
2740    ${M} ${E} ${C} = a_${C};
2741#else
2742    ${M} ${E} ${C} = u_${C};
2743#endif
2744`:`
2745#ifndef HAS_UNIFORM_u_${C}
2746    ${M} ${E} ${C} = unpack_mix_${z}(a_${C}, u_${C}_t);
2747#else
2748    ${M} ${E} ${C} = u_${C};
2749#endif
2750`}),staticAttributes:d,usedDefines:x,vertexIncludes:m,fragmentIncludes:y}}class _f{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,n,c,d,p,m,y,x){this.context=t;let T=this.boundPaintVertexBuffers.length!==d.length;for(let M=0;!T&&M<d.length;M++)this.boundPaintVertexBuffers[M]!==d[M]&&(T=!0);let S=this.boundDynamicVertexBuffers.length!==y.length;for(let M=0;!S&&M<y.length;M++)this.boundDynamicVertexBuffers[M]!==y[M]&&(S=!0);if(!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==c||T||S||this.boundIndexBuffer!==p||this.boundVertexOffset!==m)this.freshBind(n,c,d,p,m,y,x);else{t.bindVertexArrayOES.set(this.vao);for(const M of y)M&&(M.bind(),x&&M.instanceCount&&M.setVertexAttribDivisor(t.gl,n,x));p&&p.dynamicDraw&&p.bind()}}
vendor: 41,154 bytes, lines 2750-2751
2750freshBind(t,n,c,d,p,m,y){const x=t.numAttributes,T=this.context,S=T.gl;this.vao&&this.destroy(),this.vao=T.gl.createVertexArray(),T.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=p,this.boundDynamicVertexBuffers=m,n.enableAttributes(S,t),n.bind(),n.setVertexAttribPointers(S,t,p);for(const M of c)M.enableAttributes(S,t),M.bind(),M.setVertexAttribPointers(S,t,p);for(const M of m)M&&(M.enableAttributes(S,t),M.bind(),M.setVertexAttribPointers(S,t,p),y&&M.instanceCount&&M.setVertexAttribDivisor(S,t,y));d&&d.bind(),T.currentNumAttributes=x}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Th(l,t){const n=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new s.ac(0,c/n).toLngLat().lat,new s.ac(0,(c+1)/n).toLngLat().lat]}function gf(l,t,n,c,d,p,m){const y=l.context,x=y.gl,T=n.hillshadeFBO;if(!T)return;l.prepareDrawTile();const S=l.isTileAffectedByFog(t),M=l.getOrCreateProgram("hillshade",{overrideFog:S});y.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,T.colorAttachment.get());const E=((F,L,N,j)=>{const q=N.paint.get("hillshade-shadow-color"),X=N.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",ee=N.paint.get("hillshade-highlight-color"),ie=N.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",Y=N.paint.get("hillshade-accent-color"),K=N.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",J=N.paint.get("hillshade-emissive-strength");let fe=s.al(N.paint.get("hillshade-illumination-direction"));if(N.paint.get("hillshade-illumination-anchor")==="viewport")fe-=F.transform.angle;else if(F.style&&F.style.enable3dLights()&&F.style.directionalLight){const Ie=F.style.directionalLight.properties.get("direction"),xe=s.d1(Ie.x,Ie.y,Ie.z);fe=s.al(xe[1])}const se=!F.options.moving;return{u_matrix:j||F.transform.calculateProjMatrix(L.tileID.toUnwrapped(),se),u_image:0,u_latrange:Th(0,L.tileID),u_light:[N.paint.get("hillshade-exaggeration"),fe],u_shadow:q.toPremultipliedRenderColor(X?null:N.lut),u_highlight:ee.toPremultipliedRenderColor(ie?null:N.lut),u_emissive_strength:J,u_accent:Y.toPremultipliedRenderColor(K?null:N.lut)}})(l,n,c,l.terrain?t.projMatrix:null);l.uploadCommonUniforms(y,M,t.toUnwrapped());const{tileBoundsBuffer:C,tileBoundsIndexBuffer:D,tileBoundsSegments:z}=l.getTileBoundsBuffers(n);M.draw(l,x.TRIANGLES,d,p,m,mt.disabled,E,c.id,C,D,z)}function Sh(l,t,n){if(!t.needsDEMTextureUpload)return;const c=l.context,d=c.gl;c.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(n.stride);const p=n.getPixels();t.demTexture?t.demTexture.update(p,{premultiply:!1}):t.demTexture=new s.T(c,p,d.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function wd(l,t,n){const c=l.context,d=c.gl;if(!t.dem)return;const p=t.dem;if(c.activeTexture.set(d.TEXTURE1),Sh(l,t,p),!t.demTexture)return;t.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const m=p.dim;c.activeTexture.set(d.TEXTURE0);let y=t.hillshadeFBO;if(!y){const E=new s.T(c,{width:m,height:m,data:null},d.RGBA8);E.bind(d.LINEAR,d.CLAMP_TO_EDGE),y=t.hillshadeFBO=c.createFramebuffer(m,m,!0,"renderbuffer"),y.colorAttachment.set(E.texture)}c.bindFramebuffer.set(y.framebuffer),c.viewport.set([0,0,m,m]);const{tileBoundsBuffer:x,tileBoundsIndexBuffer:T,tileBoundsSegments:S}=l.getMercatorTileBoundsBuffers(),M=[];l.linearFloatFilteringSupported()&&M.push("TERRAIN_DEM_FLOAT_FORMAT"),l.getOrCreateProgram("hillshadePrepare",{defines:M}).draw(l,d.TRIANGLES,it.disabled,xt.disabled,Pt.unblended,mt.disabled,((E,C)=>{const D=C.stride,z=s.bz();return s.ca(z,0,s.aj,-s.aj,0,0,1),s.bo(z,z,[0,-s.aj,0]),{u_matrix:z,u_image:1,u_dimension:[D,D],u_zoom:E.overscaledZ}})(t.tileID,p),n.id,x,T,S),t.needsHillshadePrepare=!1}class Oi{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class yf extends Oi{getDefault(){return s.am.transparent.toNonPremultipliedRenderColor(null)}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class xf extends Oi{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class vf extends Oi{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class bf extends Oi{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Td extends Oi{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class wf extends Oi{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class nc extends Oi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Tf extends Oi{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Sd extends Oi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class Eh extends Oi{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class oc extends Oi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Ih extends Oi{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class bs extends Oi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class ta extends Oi{getDefault(){const t=this.gl;return[t.ONE,t.ZERO,t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.blendFuncSeparate(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class sc extends Oi{getDefault(){return s.am.transparent.toNonPremultipliedRenderColor(null)}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class ac extends Oi{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(t,t),this.current=t,this.dirty=!1)}}class ia extends Oi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Ed extends Oi{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Ah extends Oi{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let Id=class extends Oi{getDefault(){return null}set(l){(l!==this.current||this.dirty)&&(this.gl.useProgram(l),this.current=l,this.dirty=!1)}};class ra extends Oi{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class lc extends Oi{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class cc extends Oi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Mh extends Oi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class hc extends Oi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class ul extends Oi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ad extends Oi{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Md extends Oi{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class Cd extends Oi{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class na extends Oi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Pd extends Oi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class Ch extends Oi{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Sf extends Ch{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class zd extends Ch{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,this.attachment(),n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ph extends Ch{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,this.attachment(),n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class zh extends zd{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Rh=(l,t,n)=>({u_matrix:l,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:n}),uc=(l,t,n,c,d,p,m,y,x,T,S,M,E,C,D,z)=>({u_proj_matrix:Float32Array.from(l),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(c),u_merc_matrix:n,u_zoom_transition:d,u_merc_center:p,u_image0:0,u_frustum_tl:m,u_frustum_tr:y,u_frustum_br:x,u_frustum_bl:T,u_globe_pos:S,u_globe_radius:M,u_viewport:E,u_grid_matrix:z?Float32Array.from(z):new Float32Array(9),u_skirt_height:C,u_far_z_cutoff:D});function Dh(l,t){return l!=null&&t!=null&&!(!l.hasData()||!t.hasData())&&l.demTexture!=null&&t.demTexture!=null&&l.tileID.key!==t.tileID.key}const ws=new class{constructor(){this.operations={}}newMorphing(l,t,n,c,d){if(l in this.operations){const p=this.operations[l];p.to.tileID.key!==n.tileID.key&&(p.queued=n)}else this.operations[l]={startTime:c,phase:0,duration:d,from:t,to:n,queued:null}}getMorphValuesForProxy(l){if(!(l in this.operations))return null;const t=this.operations[l];return{from:t.from,to:t.to,phase:t.phase}}update(l){for(const t in this.operations){const n=this.operations[t];for(n.phase=(l-n.startTime)/n.duration;n.phase>=1||!this._validOp(n);)if(!this._nextOp(n,l)){delete this.operations[t];break}}}_nextOp(l,t){return!!l.queued&&(l.from=l.to,l.to=l.queued,l.queued=null,l.phase=0,l.startTime=t,!0)}_validOp(l){return l.from.hasData()&&l.to.hasData()}},Rd={0:null,1:"TERRAIN_VERTEX_MORPHING"};function oa(l,t,n){if(t===0)return 0;const c=t<1&&n===514?.25/t:1;return 6*Math.pow(1.5,22-l)*Math.max(t,1)*c}function dl(l,t){const n=1<<l.z;return!t&&(l.x===0||l.x===n-1)||l.y===0||l.y===n-1}const dc=l=>({u_matrix:l});function sn(l,t,n,c,d){if(d>0){const p=s.q.now(),m=(p-l.timeAdded)/d,y=t?(p-t.timeAdded)/d:-1,x=n.getSource(),T=c.coveringZoomLevel({tileSize:x.tileSize,roundZoom:x.roundZoom}),S=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(l.tileID.overscaledZ-T),M=S&&l.refreshedUponExpiration?1:s.ay(S?m:1-y,0,1);return l.refreshedUponExpiration&&m>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-M}:{opacity:M,mix:0}}return{opacity:1,mix:0}}class Lh extends nn{constructor(t){const n=ja("mock-dem",{type:"raster-dem",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("mock-dem",n,!1),n.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,n){t.state="loaded",n(null)}}class pc extends nn{constructor(t){const n=ja("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("proxy",n,!1),n.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,n,c){if(t.freezeTileCoverage)return;this.transform=t;const d=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((p,m)=>{if(p[m.key]="",!this._tiles[m.key]){const y=new ds(m,this._source.tileSize*m.overscaleFactor(),t.tileZoom,void 0,void 0,this._source.worldview);y.state="loaded",this._tiles[m.key]=y}return p},{});for(const p in this._tiles)p in d||(this.freeFBO(p),this._tiles[p].unloadVectorData(),delete this._tiles[p])}freeFBO(t){const n=this.proxyCachedFBO[t];if(n!==void 0){const c=Object.values(n);this.renderCachePool.push(...c),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=>t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class pl extends s.aM{constructor(t,n,c){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=n,this.projMatrix=c}}class fc extends s.dF{constructor(t,n){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},t.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),t.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),t.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[c,d,p]=function(x){const T=new s.ba,S=new s.a_,M=131;T.reserve(17161),S.reserve(33800);const E=s.aj/128,C=s.aj+E/2,D=C+E;for(let F=-E;F<D;F+=E)for(let L=-E;L<D;L+=E){const N=L<0||L>C||F<0||F>C?24575:0,j=s.ay(Math.round(L),0,s.aj),q=s.ay(Math.round(F),0,s.aj);T.emplaceBack(j+N,q)}const z=(F,L)=>{const N=L*M+F;S.emplaceBack(N+1,N,N+M),S.emplaceBack(N+M,N+M+1,N+1)};for(let F=1;F<129;F++)for(let L=1;L<129;L++)z(L,F);return[0,129].forEach(F=>{for(let L=0;L<130;L++)z(L,F),z(F,L)}),[T,S,32768]}(),m=t.context;this.gridBuffer=m.createVertexBuffer(c,s.bc.members),this.gridIndexBuffer=m.createIndexBuffer(d),this.gridSegments=s.bd.simpleSegment(0,0,c.length,d.length),this.gridNoSkirtSegments=s.bd.simpleSegment(0,0,c.length,p),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new pc(n.map),this.orthoMatrix=s.bz(),s.ca(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,s.aj,0,s.aj,0,1);const y=m.gl;this._overlapStencilMode=new xt({func:y.GEQUAL,mask:255},0,255,y.KEEP,y.KEEP,y.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Lh(n.map),this._pendingGroundEffectLayers=[]}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(t,n,c){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const d=t.terrain.properties,p=t.terrain.drapeRenderMode===0,m=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=s.q.now();const y=t.terrain&&t.terrain.scope,x=d.get("source"),T=p?this._mockSourceCache:t.getSourceCache(x,y);if(!T)return void s.w(`Couldn't find terrain source "${x}".`);if(this.sourceCache=T,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=m?this.calculateExaggeration(n):d.get("exaggeration"),!n.projection.requiresDraping&&m&&this._exaggeration===0)return void this._disable();this.enabled=!0;const S=()=>{this.sourceCache.used&&s.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
2751This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const M=this.getScaledDemTileSize();this.sourceCache.update(n,M,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,S(),this._initializing=!0),S(),n.updateElevation(!0,c),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(n),this._emptyDEMTextureDirty=!0,this._previousZoom=n.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const n=this._previousCameraAltitude,c=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=c;const d=n!=null?c-n:Number.MAX_VALUE;if(Math.abs(d)<2)return this._exaggeration;const p=t.zoom,m=this._style.terrain;if(!this._previousUpdateTimestamp)return m.getExaggeration(p);let y=p-this._previousZoom;const x=this._previousUpdateTimestamp;let T=p;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(p-T)>.5&&(y=.5*(p-T+y)),y*d<0&&(T+=y)),this._evaluationZoom=T;const S=m.getExaggeration(T),M=S===m.getExaggeration(Math.max(0,T-.1));if(M&&Math.abs(S-this._exaggeration)<.01)return S;let E=Math.min(.1,.00375*(this._updateTimestamp-x));return(M||S<.1||Math.abs(y)<1e-4)&&(E=Math.min(.2,4*E)),s.ai(this._exaggeration,S,E)}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(t){t.coord&&t.dataType==="source"?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.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 t in this._style._mergedSourceCaches)this._style._mergedSourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(t=>t.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 t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const n=this.proxySourceCache,c=this.painter.transform;this._initializing&&(this._initializing=c._centerAltitude===0&&this.getAtPointOrZero(s.ac.fromLngLat(c.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=n.getIds().map(x=>{const T=n.getTileByID(x).tileID;return T.projMatrix=c.calculateProjMatrix(T.toUnwrapped()),T});(function(x,T){const S=T.transform.pointCoordinate(T.transform.getCameraPoint()),M=new s.P(S.x,S.y);x.sort((E,C)=>{if(C.overscaledZ-E.overscaledZ)return C.overscaledZ-E.overscaledZ;const D=new s.P(E.canonical.x+(1<<E.canonical.z)*E.wrap,E.canonical.y),z=new s.P(C.canonical.x+(1<<C.canonical.z)*C.wrap,C.canonical.y),F=M.mult(1<<E.canonical.z);return F.x-=.5,F.y-=.5,F.distSqr(D)-F.distSqr(z)})})(d,this.painter);const p=this.proxyToSource||{};this.proxyToSource={},d.forEach(x=>{this.proxyToSource[x.key]={}}),this.terrainTileForTile={};const m=this._style._mergedSourceCaches;for(const x in m){const T=m[x];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,t[x],p),T.usedForTerrain))continue;const S=t[x];T.getSource().reparseOverscaled&&this._assignTerrainTiles(S)}this.proxiedCoords[n.id]=d.map(x=>new pl(x,x.key,this.orthoMatrix)),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(p),this.renderingToTexture=!1;const y={};this._visibleDemTiles=[];for(const x of this.proxyCoords){const T=this.terrainTileForTile[x.key];if(!T)continue;const S=T.tileID.key;S in y||(this._visibleDemTiles.push(T),y[S]=S)}}_assignTerrainTiles(t){this._initializing||t.forEach(n=>{if(this.terrainTileForTile[n.key])return;const c=this._findTileCoveringTileID(n,this.sourceCache);c&&(this.terrainTileForTile[n.key]=c)})}_prepareDEMTextures(){const t=this.painter.context,n=t.gl;for(const c in this.terrainTileForTile){const d=this.terrainTileForTile[c],p=d.dem;!p||d.demTexture&&!d.needsDEMTextureUpload||(t.activeTexture.set(n.TEXTURE1),Sh(this.painter,d,p))}}_prepareDemTileUniforms(t,n,c,d){if(!n||n.demTexture==null)return!1;const p=t.tileID.canonical,m=Math.pow(2,n.tileID.canonical.z-p.z),y=d||"";return c[`u_dem_tl${y}`]=[p.x*m%1,p.y*m%1],c[`u_dem_scale${y}`]=m,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let t=0;const n=this._visibleDemTiles.reduce((c,d)=>{if(!d.dem)return c;const p=d.dem.tree.minimums[0];return p>0&&t++,c+p},0);return t?n/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,n=t.gl;t.activeTexture.set(n.TEXTURE2);const c=this._getLoadedAreaMinimum(),d=new s.dG({width:1,height:1},new Float32Array([c]));this._emptyDEMTextureDirty=!1;let p=this._emptyDEMTexture;return p?p.update(d,{premultiply:!1}):p=this._emptyDEMTexture=new s.T(t,d,n.R32F,{premultiply:!1}),p}setupElevationDraw(t,n,c){const d=this.painter.context,p=d.gl,m={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};m.u_exaggeration=this.exaggeration();let y=null,x=null,T=1;if(c&&c.morphing&&this._useVertexMorphing){const C=c.morphing.srcDemTile,D=c.morphing.dstDemTile;T=c.morphing.phase,C&&D&&(this._prepareDemTileUniforms(t,C,m,"_prev")&&(x=C),this._prepareDemTileUniforms(t,D,m)&&(y=D))}const S=C=>C&&C.demTexture&&this.painter.linearFloatFilteringSupported()?p.LINEAR:p.NEAREST;let M=null;var E;if(this.enabled?x&&y?(M=y.demTexture,d.activeTexture.set(p.TEXTURE4),x.demTexture.bind(S(x),p.CLAMP_TO_EDGE),m.u_dem_lerp=T):(y=this.terrainTileForTile[t.tileID.key],M=this._prepareDemTileUniforms(t,y,m)?y.demTexture:this.emptyDEMTexture):M=this.emptyDEMTexture,d.activeTexture.set(p.TEXTURE2),M&&(m.u_dem_size=(E=M).size[0]===1?1:E.size[0]-2,M.bind(S(y),p.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(c&&c.useDepthForOcclusion,n,m),c&&c.useMeterToDem&&y){const C=(1<<y.tileID.canonical.z)*s.cb(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;m.u_meter_to_dem=C}if(c&&c.labelPlaneMatrixInv&&(m.u_label_plane_matrix_inv=c.labelPlaneMatrixInv),n.setTerrainUniformValues(d,m),this.painter.transform.projection.name==="globe"){const C=this.globeUniformValues(this.painter.transform,t.tileID.canonical,c&&c.useDenormalizedUpVectorScale);n.setGlobeUniformValues(d,C)}}globeUniformValues(t,n,c){const d=t.projection;return{u_tile_tl_up:d.upVector(n,0,0),u_tile_tr_up:d.upVector(n,s.aj,0),u_tile_br_up:d.upVector(n,s.aj,s.aj),u_tile_bl_up:d.upVector(n,0,s.aj),u_tile_up_scale:c?s.dH(1):d.upVectorScale(n,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const n=this.painter,c=this.painter.context;t.length!==0&&(c.bindFramebuffer.set(null),c.viewport.set([0,0,n.width,n.height]),n.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(d,p,m,y,x){if(d.transform.projection.name==="globe")(function(T,S,M,E,C){const D=T.context,z=D.gl;let F,L;const N=T.transform,j=s.dy(T,D,N),q=(Ie,xe)=>{if(L===xe)return;const Me=[Rd[xe],"PROJECTION_GLOBE_VIEW"];j&&Me.push("CUSTOM_ANTIALIASING");const Ue=T.isTileAffectedByFog(Ie);F=T.getOrCreateProgram("globeRaster",{defines:Me,overrideFog:Ue}),L=xe},X=T.colorModeForRenderPass(),ee=new it(z.LEQUAL,it.ReadWrite,T.depthRangeFor3D);ws.update(C);const ie=s.dz(N),Y=[s.aD(N.center.lng),s.aH(N.center.lat)],K=T.globeSharedBuffers,J=[N.width*s.q.devicePixelRatio,N.height*s.q.devicePixelRatio],fe=Float32Array.from(N.globeMatrix),se={useDenormalizedUpVectorScale:!0};{const Ie=T.transform,xe=oa(Ie.zoom,S.exaggeration(),S.sourceCache._source.tileSize);L=-1;const Me=z.TRIANGLES;for(const Ue of E){const me=M.getTile(Ue),oe=xt.disabled,we=S.prevTerrainTileForTile[Ue.key],_e=S.terrainTileForTile[Ue.key];Dh(we,_e)&&ws.newMorphing(Ue.key,we,_e,C,250),D.activeTexture.set(z.TEXTURE0),me.texture&&me.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);const ze=ws.getMorphValuesForProxy(Ue.key),Re=ze?1:0;ze&&s.L(se,{morphing:{srcDemTile:ze.from,dstDemTile:ze.to,phase:s.dx(ze.phase)}});const Le=s.dA(Ue.canonical),Ze=s.dB(Le.getCenter().lat),at=s.dC(Ue.canonical,Le,Ze,Ie.worldSize/Ie._pixelsPerMercatorPixel),dt=s.bh(s.dD(Ue.canonical)),Qe=uc(Ie.expandedFarZProjMatrix,fe,ie,dt,s.ah(Ie.zoom),Y,Ie.frustumCorners.TL,Ie.frustumCorners.TR,Ie.frustumCorners.BR,Ie.frustumCorners.BL,Ie.globeCenterInViewSpace,Ie.globeRadius,J,xe,Ie._farZ,at);if(q(Ue,Re),F&&(S.setupElevationDraw(me,F,se),T.uploadCommonUniforms(D,F,Ue.toUnwrapped()),K)){const[ht,lt,wt]=K.getGridBuffers(Ze,xe!==0);F.draw(T,Me,ee,oe,X,mt.backCCW,Qe,"globe_raster",ht,lt,wt)}}}if(K&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const Ie=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];j&&Ie.push("CUSTOM_ANTIALIASING"),F=T.getOrCreateProgram("globeRaster",{defines:Ie});for(const xe of E){const{x:Me,y:Ue,z:me}=xe.canonical,oe=Ue===0,we=Ue===(1<<me)-1,[_e,ze,Re,Le]=K.getPoleBuffers(me,!1);if(Le&&(oe||we)){const Ze=M.getTile(xe);D.activeTexture.set(z.TEXTURE0),Ze.texture&&Ze.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);let at=s.dE(me,Me,N);const dt=s.bh(s.dD(xe.canonical)),Qe=(ht,lt)=>ht.draw(T,z.TRIANGLES,ee,xt.disabled,X,mt.disabled,uc(N.expandedFarZProjMatrix,at,at,dt,0,Y,N.frustumCorners.TL,N.frustumCorners.TR,N.frustumCorners.BR,N.frustumCorners.BL,N.globeCenterInViewSpace,N.globeRadius,J,0,N._farZ),"globe_pole_raster",lt,Re,Le);S.setupElevationDraw(Ze,F,se),T.uploadCommonUniforms(D,F,xe.toUnwrapped()),oe&&T.renderDefaultNorthPole&&Qe(F,_e),we&&T.renderDefaultSouthPole&&(at=s.cP(s.bz(),at,[1,-1,1]),Qe(F,ze))}}}})(d,p,m,y,x);else{const T=d.context,S=T.gl;let M,E;const C=d.shadowRenderer,D=Qn(d,d.longestCutoffRange),z=X=>{if(E===X)return;const ee=[];ee.push(Rd[X]),D.shouldRenderCutoff&&ee.push("RENDER_CUTOFF"),C&&(ee.push("RENDER_SHADOWS","DEPTH_TEXTURE"),C.useNormalOffset&&ee.push("NORMAL_OFFSET")),M=d.getOrCreateProgram("terrainRaster",{defines:ee}),E=X},F=d.colorModeForRenderPass(),L=new it(S.LEQUAL,it.ReadWrite,d.depthRangeFor3D);ws.update(x);const N=d.transform,j=oa(N.zoom,p.exaggeration(),p.sourceCache._source.tileSize);let q=[0,0,0];if(C){const X=d.style.directionalLight,ee=d.style.ambientLight;X&&ee&&(q=xs(d.style,X,ee))}{E=-1;const X=S.TRIANGLES,[ee,ie]=[p.gridIndexBuffer,p.gridSegments];for(const Y of y){const K=m.getTile(Y),J=xt.disabled,fe=p.prevTerrainTileForTile[Y.key],se=p.terrainTileForTile[Y.key];Dh(fe,se)&&ws.newMorphing(Y.key,fe,se,x,250),T.activeTexture.set(S.TEXTURE0),K.texture&&K.texture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const Ie=ws.getMorphValuesForProxy(Y.key),xe=Ie?1:0;let Me;Ie&&(Me={morphing:{srcDemTile:Ie.from,dstDemTile:Ie.to,phase:s.dx(Ie.phase)}});const Ue=Rh(Y.projMatrix,dl(Y.canonical,N.renderWorldCopies)?j/10:j,q);if(z(xe),!M)continue;p.setupElevationDraw(K,M,Me);const me=Y.toUnwrapped();C&&C.setupShadows(me,M),d.uploadCommonUniforms(T,M,me,null,D),M.draw(d,X,L,J,F,mt.backCCW,Ue,"terrain_raster",p.gridBuffer,ee,ie)}}}}(n,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,n.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const n=this.painter,c=this.painter.context,d=this.proxySourceCache,p=this.proxiedCoords[d.id],m=this._drapedRenderBatches.shift(),y=n.style.order,x=[];let T=0;for(const S of p){const M=d.getTileByID(S.proxyTileKey),E=d.proxyCachedFBO[S.key]?d.proxyCachedFBO[S.key][t]:void 0,C=E!==void 0?d.renderCache[E]:this.pool[T++],D=E!==void 0;if(M.texture=C.tex,D&&!C.dirty){x.push(M.tileID);continue}let z;c.bindFramebuffer.set(C.fb.framebuffer),this.renderedToTile=!1,C.dirty&&(c.clear({color:s.am.transparent,stencil:0}),C.dirty=!1);for(let F=m.start;F<=m.end;++F){const L=n.style._mergedLayers[y[F]];if(L.isHidden(n.transform.zoom))continue;const N=n.style.getLayerSourceCache(L),j=N?this.proxyToSource[S.key][N.id]:[S];if(!j)continue;const q=j;c.viewport.set([0,0,C.fb.width,C.fb.height]),z!==(N?N.id:null)&&(this._setupStencil(C,j,L,N),z=N?N.id:null),n.renderLayer(n,N,L,q)}if(this._drapedRenderBatches.length===0)for(const F of this._pendingGroundEffectLayers){const L=n.style._mergedLayers[y[F]];if(L.isHidden(n.transform.zoom))continue;const N=n.style.getLayerSourceCache(L),j=N?this.proxyToSource[S.key][N.id]:[S];if(!j)continue;const q=j;c.viewport.set([0,0,C.fb.width,C.fb.height]),z!==(N?N.id:null)&&(this._setupStencil(C,j,L,N),z=N?N.id:null),n.renderLayer(n,N,L,q)}this.renderedToTile?(C.dirty=!0,x.push(M.tileID)):D||--T,T===5&&(T=0,this.renderToBackBuffer(x))}return this.renderToBackBuffer(x),this.renderingToTexture=!1,c.bindFramebuffer.set(null),c.viewport.set([0,0,n.width,n.height]),m.end+1}postRender(){}isLayerOrderingCorrect(t){const n=t.order.length;let c=-1,d=n;for(let p=0;p<n;++p)this._style.isLayerDraped(t._mergedLayers[t.order[p]])?c=Math.max(c,p):d=Math.min(d,p);return d>c}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter(n=>n.dem).forEach(n=>{t=Math.min(t,n.dem.tree.minimums[0])}),t===0?t:(t-30)*this._exaggeration}raycast(t,n,c){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(p=>p.dem).map(p=>{const m=p.tileID,y=1<<m.overscaledZ,{x,y:T}=m.canonical,S=x/y,M=(x+1)/y,E=T/y,C=(T+1)/y;return{minx:S,miny:E,maxx:M,maxy:C,t:p.dem.tree.raycastRoot(S,E,M,C,t,n,c),tile:p}});d.sort((p,m)=>(p.t!==null?p.t:Number.MAX_VALUE)-(m.t!==null?m.t:Number.MAX_VALUE));for(const p of d){if(p.t==null)return null;const m=p.tile.dem.tree.raycast(p.minx,p.miny,p.maxx,p.maxy,t,n,c);if(m!=null)return m}return null}_createFBO(){const t=this.painter.context,n=t.gl,c=this.drapeBufferSize;t.activeTexture.set(n.TEXTURE0);const d=new s.T(t,{width:c[0],height:c[1],data:null},n.RGBA8);d.bind(n.LINEAR,n.CLAMP_TO_EDGE);const p=t.createFramebuffer(c[0],c[1],!0,null);return p.colorAttachment.set(d.texture),p.depthAttachment=new zh(t,p.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,c[0],c[1]),this._stencilRef=0,p.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):p.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:p,tex:d,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some(t=>{const n=this._style._mergedLayers[t],c=n.isHidden(this.painter.transform.zoom);return n.type==="hillshade"||n.type==="custom"?!c&&n.shouldRedrape():!c&&n.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const c of this._style.getSources())if(c instanceof Ua){t=!0;break}if(!t)return;const n={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],p=this._style.getLayerSourceCache(d);if(p&&!n[p.id]&&!d.isHidden(this.painter.transform.zoom)&&d.type==="line"&&d.widthExpression()instanceof s.ab){n[p.id]=!0;for(const m of this.proxyCoords){const y=this.proxyToSource[m.key][p.id];if(y)for(const x of y)this._clearRenderCacheForTile(p.id,x)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const c in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[c]._source instanceof Ar){t=!0;break}if(!t)return;const n={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],p=this._style.getLayerSourceCache(d);if(!p||n[p.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="raster")continue;const m=d.paint.get("raster-fade-duration");for(const y of this.proxyCoords){const x=this.proxyToSource[y.key][p.id];if(x)for(const T of x){const S=sn(p.getTile(T),p.findLoadedParent(T,0),p,this.painter.transform,m);(S.opacity!==1||S.mix!==0)&&this._clearRenderCacheForTile(p.id,T)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,n=t.length;if(n===0)return;const c=[];this._pendingGroundEffectLayers=[];let d,p=0,m=this._style._mergedLayers[t[p]];for(;!this._style.isLayerDraped(m)&&m.isHidden(this.painter.transform.zoom)&&++p<n;)m=this._style._mergedLayers[t[p]];for(;p<n;++p){const y=this._style._mergedLayers[t[p]];y.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(y)?d===void 0&&(d=p):(y.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(p),d!==void 0&&(c.push({start:d,end:p-1}),d=void 0)))}if(d!==void 0&&c.push({start:d,end:p-1}),c.length!==0){const y=c[c.length-1];this._pendingGroundEffectLayers.every(x=>x>y.end)||s.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=c}_setupRenderCache(t){const n=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,n.renderCache.length>n.renderCachePool.length){const m=Object.values(n.proxyCachedFBO);n.proxyCachedFBO={};for(let y=0;y<m.length;++y){const x=Object.values(m[y]);n.renderCachePool.push(...x)}}return}this._clearRasterLayersFromRenderCache();const c=this.proxyCoords,d=this._tilesDirty;for(let m=c.length-1;m>=0;m--){const y=c[m];if(n.getTileByID(y.key),n.proxyCachedFBO[y.key]!==void 0){const x=t[y.key],T=this.proxyToSource[y.key];let S=0;for(const M in T){const E=T[M],C=x[M];if(!C||C.length!==E.length||E.some((D,z)=>D!==C[z]||d[M]&&d[M].hasOwnProperty(D.key))){S=-1;break}++S}for(const M in n.proxyCachedFBO[y.key])n.renderCache[n.proxyCachedFBO[y.key][M]].dirty=S<0||S!==Object.values(x).length}}const p=[...this._drapedRenderBatches];p.sort((m,y)=>y.end-y.start-(m.end-m.start));for(const m of p)for(const y of c){if(n.proxyCachedFBO[y.key])continue;let x=n.renderCachePool.pop();x===void 0&&n.renderCache.length<50&&(x=n.renderCache.length,n.renderCache.push(this._createFBO())),x!==void 0&&(n.proxyCachedFBO[y.key]={},n.proxyCachedFBO[y.key][m.start]=x,n.renderCache[x].dirty=!0)}this._tilesDirty={}}_setupStencil(t,n,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const p=this.painter.context,m=p.gl;if(n.length<=1)return void(this._overlapStencilType=!1);let y;if(c.isTileClipped())y=n.length,this._overlapStencilMode.test={func:m.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(n[0].overscaledZ>n[n.length-1].overscaledZ))return void(this._overlapStencilType=!1);y=1,this._overlapStencilMode.test={func:m.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+y>255&&(p.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=y,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(n,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):xt.disabled}_renderTileClippingMasks(t,n){const c=this.painter,d=this.painter.context,p=d.gl;c._tileClippingMaskIDs={},d.setColorMode(Pt.disabled),d.setDepthMode(it.disabled);const m=c.getOrCreateProgram("clippingMask");for(const y of t){const x=c._tileClippingMaskIDs[y.key]=--n;m.draw(c,p.TRIANGLES,it.disabled,new xt({func:p.ALWAYS,mask:0},x,255,p.KEEP,p.KEEP,p.REPLACE),Pt.disabled,mt.disabled,dc(y.projMatrix),"$clipping",c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}}pointCoordinate(t){const n=this.painter.transform;if(t.x<0||t.x>n.width||t.y<0||t.y>n.height)return null;const c=[t.x,t.y,1,1];s.aA(c,c,n.pixelMatrixInverse),s.cH(c,c,1/c[3]),c[0]/=n.worldSize,c[1]/=n.worldSize;const d=n._camera.position,p=s.cb(1,n.center.lat),m=[d[0],d[1],d[2]/p,0],y=s.d7([],c.slice(0,3),m);s.au(y,y);const x=this.raycast(m,y,this._exaggeration);return x!==null&&x?(s.bE(m,m,y,x),m[3]=m[2],m[2]*=p,m):null}_setupProxiedCoordsForOrtho(t,n,c){if(t.getSource()instanceof s.aP)return this._setupProxiedCoordsForImageSource(t,n,c);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords;for(let x=0;x<p.length;x++){const T=p[x],S=this._findTileCoveringTileID(T,t);if(S){const M=this._createProxiedId(T,S,c[T.key]&&c[T.key][t.id]);d.push(M),this.proxyToSource[T.key][t.id]=[M]}}let m=!1;const y=new Set;for(let x=0;x<n.length;x++){const T=t.getTile(n[x]);if(!T||!T.hasData())continue;const S=this._findTileCoveringTileID(T.tileID,this.proxySourceCache);if(S&&S.tileID.canonical.z!==T.tileID.canonical.z){const M=this.proxyToSource[S.tileID.key][t.id],E=this._createProxiedId(S.tileID,T,c[S.tileID.key]&&c[S.tileID.key][t.id]);M?M.splice(M.length-1,0,E):this.proxyToSource[S.tileID.key][t.id]=[E];const C=this.proxyToSource[S.tileID.key][t.id];y.has(C)||y.add(C),d.push(E),m=!0}}if(this._sourceTilesOverlap[t.id]=m,m&&this._debugParams.sortTilesHiZFirst)for(const x of y)x.sort((T,S)=>S.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(t,n,c){if(!t.getSource().loaded())return;const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords,m=t.getSource(),y=m.tileID;if(!y)return;const x=new s.P(y.x,y.y)._div(1<<y.z),T=m.coordinates.map(s.ac.fromLngLat).reduce((M,E)=>(M.min.x=Math.min(M.min.x,E.x-x.x),M.min.y=Math.min(M.min.y,E.y-x.y),M.max.x=Math.max(M.max.x,E.x-x.x),M.max.y=Math.max(M.max.y,E.y-x.y),M),{min:new s.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new s.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),S=(M,E)=>{const C=M.wrap+M.canonical.x/(1<<M.canonical.z),D=M.canonical.y/(1<<M.canonical.z),z=s.aj/(1<<M.canonical.z),F=E.wrap+E.canonical.x/(1<<E.canonical.z),L=E.canonical.y/(1<<E.canonical.z);return C+z<F+T.min.x||C>F+T.max.x||D+z<L+T.min.y||D>L+T.max.y};for(let M=0;M<p.length;M++){const E=p[M];for(let C=0;C<n.length;C++){const D=t.getTile(n[C]);if(!D||!D.hasData()||S(E,D.tileID))continue;const z=this._createProxiedId(E,D,c[E.key]&&c[E.key][t.id]),F=this.proxyToSource[E.key][t.id];F?F.push(z):this.proxyToSource[E.key][t.id]=[z],d.push(z)}}}_createProxiedId(t,n,c){let d=this.orthoMatrix;if(c){const p=c.find(m=>m.key===n.tileID.key);if(p)return p}if(n.tileID.key!==t.key){const p=t.canonical.z-n.tileID.canonical.z;let m,y,x;d=s.bz();const T=n.tileID.wrap-t.wrap<<t.overscaledZ;p>0?(m=s.aj>>p,y=m*((n.tileID.canonical.x<<p)-t.canonical.x+T),x=m*((n.tileID.canonical.y<<p)-t.canonical.y)):(m=s.aj<<-p,y=s.aj*(n.tileID.canonical.x-(t.canonical.x+T<<-p)),x=s.aj*(n.tileID.canonical.y-(t.canonical.y<<-p))),s.ca(d,0,m,0,m,0,1),s.bo(d,d,[y,x,0])}return new pl(n.tileID,t.key,d)}_findTileCoveringTileID(t,n){let c=n.getTile(t);if(c&&c.hasData())return c;const d=this._findCoveringTileCache[n.id],p=d[t.key];
2751if(c=p?n.getTileByID(p):null,c&&c.hasData()||p===null)return c;let m=c?c.tileID:t,y=m.overscaledZ;const x=n.getSource().minzoom,T=[];if(!p){const M=n.getSource().maxzoom;if(t.canonical.z>=M){const E=t.canonical.z-M;n.getSource().reparseOverscaled?(y=Math.max(t.canonical.z+2,n.transform.tileZoom),m=new s.aM(y,t.wrap,M,t.canonical.x>>E,t.canonical.y>>E)):E!==0&&(y=M,m=new s.aM(y,t.wrap,M,t.canonical.x>>E,t.canonical.y>>E))}m.key!==t.key&&(T.push(m.key),c=n.getTile(m))}const S=M=>{T.forEach(E=>{d[E]=M}),T.length=0};for(y-=1;y>=x&&(!c||!c.hasData());y--){c&&S(c.tileID.key);const M=m.calculateScaledKey(y);if(c=n.getTileByID(M),c&&c.hasData())break;const E=d[M];if(E===null)break;E===void 0?T.push(M):c=n.getTileByID(E)}return S(c?c.tileID.key:null),c&&c.hasData()?c:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,n){let c=this._tilesDirty[t];c||(c=this._tilesDirty[t]={}),c[n.key]=!0}}function Fh(l,t,n){const c=function(y,x,T){const S=s.bG(x,y),M=s.bG(T,[.2126,.7152,.0722]),E=(D,z,F)=>(1-F)*D+F*z,C=E(1-.3*Math.min(M,1),1,Math.min(S+1,1));return E(.92,1,Math.asin(s.ay(x[2],-1,1))/Math.PI+.5)*C}(l,[0,0,1],t),d=[0,0,0];s.c1(d,n.slice(0,3),c);const p=[0,0,0];s.c1(p,t.slice(0,3),l[2]);const m=[0,0,0];return s.d5(m,d,p),s.d8(m)}const Oh=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],mc=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","elevatedStructures","model","symbol"];class _c{static cacheKey(t,n,c,d){let p=`${n}${d?d.cacheKey:""}`;for(const m of c)t.usedDefines.includes(m)&&(p+=`/${m}`);return p}constructor(t,n,c,d,p,m){const y=t.gl;this.program=y.createProgram(),this.configuration=d,this.name=n,this.fixedDefines=[...m];const x=d?d.getBinderAttributes():[],T=(c.staticAttributes||[]).concat(x);let S=d?d.defines():[];S=S.concat(m.map(F=>`#define ${F}`));const M=`#version 300 es
2752`;let E=M+S.concat("precision mediump float;",Ho,rc.fragmentSource).join(`
2753`);for(const F of c.fragmentIncludes)E+=`
2754${vs[F]}`;E+=`
2755${c.fragmentSource}`;let C=M+S.concat("precision highp float;",Ho,rc.vertexSource).join(`
2756`);for(const F of c.vertexIncludes)C+=`
2757${vs[F]}`;this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&c.vertexSource.indexOf("gl_InstanceID")!==-1,this.forceManualRenderingForInstanceIDShaders&&(C+=`
2758uniform int u_instanceID;
2759`),C+=`
2760${c.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(C=C.replaceAll("gl_InstanceID","u_instanceID"));const D=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(D,E),y.compileShader(D),y.attachShader(this.program,D);const z=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())this.failedToCreate=!0;else{y.shaderSource(z,C),y.compileShader(z),y.attachShader(this.program,z),this.attributes={},this.numAttributes=T.length;for(let F=0;F<this.numAttributes;F++)if(T[F]){const L=T[F].startsWith("a_")?T[F]:`a_${T[F]}`;y.bindAttribLocation(this.program,F,L),this.attributes[L]=F}y.linkProgram(this.program),y.deleteShader(z),y.deleteShader(D),this.fixedUniforms=p(t),this.binderUniforms=d?d.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(F=>({u_instanceID:new s.cd(F)}))(t)),(m.includes("TERRAIN")||n.indexOf("symbol")!==-1||n.indexOf("circle")!==-1)&&(this.terrainUniforms=(F=>({u_dem:new s.cd(F),u_dem_prev:new s.cd(F),u_dem_tl:new s.cg(F),u_dem_scale:new s.cf(F),u_dem_tl_prev:new s.cg(F),u_dem_scale_prev:new s.cf(F),u_dem_size:new s.cf(F),u_dem_lerp:new s.cf(F),u_exaggeration:new s.cf(F),u_depth:new s.cd(F),u_depth_size_inv:new s.cg(F),u_depth_range_unpack:new s.cg(F),u_occluder_half_size:new s.cf(F),u_occlusion_depth_offset:new s.cf(F),u_meter_to_dem:new s.cf(F),u_label_plane_matrix_inv:new s.ch(F)}))(t)),m.includes("GLOBE")&&(this.globeUniforms=(F=>({u_tile_tl_up:new s.ce(F),u_tile_tr_up:new s.ce(F),u_tile_br_up:new s.ce(F),u_tile_bl_up:new s.ce(F),u_tile_up_scale:new s.cf(F)}))(t)),m.includes("FOG")&&(this.fogUniforms=(F=>({u_fog_matrix:new s.ch(F),u_fog_range:new s.cg(F),u_fog_color:new s.d0(F),u_fog_horizon_blend:new s.cf(F),u_fog_vertical_limit:new s.cg(F),u_fog_temporal_offset:new s.cf(F),u_frustum_tl:new s.ce(F),u_frustum_tr:new s.ce(F),u_frustum_br:new s.ce(F),u_frustum_bl:new s.ce(F),u_globe_pos:new s.ce(F),u_globe_radius:new s.cf(F),u_globe_transition:new s.cf(F),u_is_globe:new s.cd(F),u_viewport:new s.cg(F)}))(t)),m.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(F=>({u_cutoff_params:new s.d0(F)}))(t)),m.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(F=>({u_lighting_ambient_color:new s.ce(F),u_lighting_directional_dir:new s.ce(F),u_lighting_directional_color:new s.ce(F),u_ground_radiance:new s.ce(F)}))(t)),m.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(F=>({u_light_matrix_0:new s.ch(F),u_light_matrix_1:new s.ch(F),u_fade_range:new s.cg(F),u_shadow_normal_offset:new s.ce(F),u_shadow_intensity:new s.cf(F),u_shadow_texel_size:new s.cf(F),u_shadow_map_resolution:new s.cf(F),u_shadow_direction:new s.ce(F),u_shadow_bias:new s.ce(F),u_shadowmap_0:new s.cd(F),u_shadowmap_1:new s.cd(F)}))(t))}}setTerrainUniformValues(t,n){if(!this.terrainUniforms)return;const c=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d]&&c[d].set(this.program,d,n[d])}}setGlobeUniformValues(t,n){if(!this.globeUniforms)return;const c=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d]&&c[d].set(this.program,d,n[d])}}setFogUniformValues(t,n){if(!this.fogUniforms)return;const c=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setCutoffUniformValues(t,n){if(!this.cutoffUniforms)return;const c=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setLightsUniformValues(t,n){if(!this.lightsUniforms)return;const c=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setShadowUniformValues(t,n){if(this.failedToCreate||!this.shadowUniforms)return;const c=this.shadowUniforms;t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}_drawDebugWireframe(t,n,c,d,p,m,y,x,T,S){const M=t.options.wireframe;if(M.terrain===!1&&M.layers2D===!1&&M.layers3D===!1)return;const E=t.context;if(!(!(!M.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!M.layers2D||t._terrain&&t._terrain.renderingToTexture||!Oh.includes(this.name))||!(!M.layers3D||!mc.includes(this.name))))return;const C=E.gl,D=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,p,E);if(!D)return;const z=[...this.fixedDefines];
2760z.push("DEBUG_WIREFRAME");const F=t.getOrCreateProgram(this.name,{config:this.configuration,defines:z});E.program.set(F.program);const L=(q,X,ee)=>{if(X[q]&&ee[q])for(const ie in X[q])ee[q][ie]&&ee[q][ie].set(ee.program,ie,X[q][ie].current)};T&&T.setUniforms(F.program,E,F.binderUniforms,y,{zoom:x}),L("fixedUniforms",this,F),L("terrainUniforms",this,F),L("globeUniforms",this,F),L("fogUniforms",this,F),L("lightsUniforms",this,F),L("shadowUniforms",this,F),D.bind(),E.setColorMode(new Pt([C.ONE,C.ONE_MINUS_SRC_ALPHA,C.ZERO,C.ONE],s.am.transparent,[!0,!0,!0,!1])),E.setDepthMode(new it(n.func===C.LESS?C.LEQUAL:n.func,it.ReadOnly,n.range)),E.setStencilMode(xt.disabled);const N=3*m.primitiveLength*2,j=3*m.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const q=S||1;for(let X=0;X<q;++X)F.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",X),C.drawElements(C.LINES,N,C.UNSIGNED_SHORT,j)}else S&&S>1?C.drawElementsInstanced(C.LINES,N,C.UNSIGNED_SHORT,j,S):C.drawElements(C.LINES,N,C.UNSIGNED_SHORT,j);p.bind(),E.program.set(this.program),E.setDepthMode(n),E.setStencilMode(c),E.setColorMode(d)}checkUniforms(t,n,c){if(this.fixedDefines.includes(n)){for(const d of Object.keys(c))if(!c[d].initialized)throw new Error(`Program '${this.name}', from draw '${t}': uniform ${d} not set but required by ${n} being defined`)}}draw(t,n,c,d,p,m,y,x,T,S,M,E,C,D,z,F){const L=t.context,N=L.gl;if(this.failedToCreate)return;L.program.set(this.program),L.setDepthMode(c),L.setStencilMode(d),L.setColorMode(p),L.setCullFace(m);for(const X of Object.keys(this.fixedUniforms))this.fixedUniforms[X].set(this.program,X,y[X]);D&&D.setUniforms(this.program,L,this.binderUniforms,E,{zoom:C});const j={[N.POINTS]:1,[N.LINES]:2,[N.TRIANGLES]:3,[N.LINE_STRIP]:1}[n];this.checkUniforms(x,"RENDER_SHADOWS",this.shadowUniforms);const q=F&&F>0?1:void 0;for(const X of M.get()){const ee=X.vaos||(X.vaos={});if((ee[x]||(ee[x]=new _f)).bind(L,this,T,D?D.getPaintVertexBuffers():[],S,X.vertexOffset,z||[],q),this.forceManualRenderingForInstanceIDShaders){const ie=F||1;for(let Y=0;Y<ie;++Y)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",Y),S?N.drawElements(n,X.primitiveLength*j,N.UNSIGNED_SHORT,X.primitiveOffset*j*2):N.drawArrays(n,X.vertexOffset,X.vertexLength)}else F&&F>1?N.drawElementsInstanced(n,X.primitiveLength*j,N.UNSIGNED_SHORT,X.primitiveOffset*j*2,F):S?N.drawElements(n,X.primitiveLength*j,N.UNSIGNED_SHORT,X.primitiveOffset*j*2):N.drawArrays(n,X.vertexOffset,X.vertexLength);n===N.TRIANGLES&&S&&this._drawDebugWireframe(t,c,d,p,S,X,E,C,D,F)}}}function gc(l,t,n=0){const c=Math.pow(2,t.tileID.overscaledZ),d=t.tileSize*Math.pow(2,l.transform.tileZoom)/c,p=d*(t.tileID.canonical.x+t.tileID.wrap*c),m=d*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/s.aw(t,1,l.transform.tileZoom),u_pixel_coord_upper:[p>>16,m>>16],u_pixel_coord_lower:[65535&p,65535&m],u_pattern_transition:n}}const Ts={terrain:0,flat:1},kh=s.bz(),Bh=(l,t,n,c,d,p,m,y,x,T,S,M,E,C,D,z,F,L)=>{const N=t.style.light,j=N.properties.get("position"),q=[j.x,j.y,j.z],X=s.dJ();N.properties.get("anchor")==="viewport"&&(s.dK(X,-t.transform.angle),s.dL(q,q,X));const ee=N.properties.get("color").toPremultipliedRenderColor(null),ie=t.transform,Y={u_matrix:l,u_lightpos:q,u_lightintensity:N.properties.get("intensity"),u_lightcolor:[ee.r,ee.g,ee.b],u_vertical_gradient:+n,u_opacity:c,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:kh,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Ts[T],u_base_type:Ts[S],u_ao:d,u_edge_radius:p,u_width_scale:m,u_flood_light_color:D,u_vertical_scale:z,u_flood_light_intensity:F,u_ground_shadow_factor:L};return ie.projection.name==="globe"&&(Y.u_tile_id=[y.canonical.x,y.canonical.y,1<<y.canonical.z],Y.u_zoom_transition=M,Y.u_inv_rot_matrix=C,Y.u_merc_center=E,Y.u_up_dir=ie.projection.upVector(new s.cA(0,0,0),E[0]*s.aj,E[1]*s.aj),Y.u_height_lift=x),Y},Dd=(l,t,n,c,d,p)=>({u_matrix:l,u_edge_radius:t,u_width_scale:n,u_vertical_scale:c,u_height_type:Ts[d],u_base_type:Ts[p]}),sa=(l,t,n,c,d,p,m,y,x,T,S,M,E,C,D,z,F,L)=>{const N=Bh(l,t,n,c,d,p,m,y,T,S,M,E,C,D,z,F,1,[0,0,0]),j={u_height_factor:-Math.pow(2,y.overscaledZ
vendor: 37,669 bytes, line 2760
2760)/x.tileSize/8};return s.h(N,gc(t,x,L),j)},Ld=(l,t,n)=>({u_matrix:l,u_emissive_strength:t,u_ground_shadow_factor:n}),Fd=(l,t,n,c,d,p=0)=>s.h(Ld(l,t,d),gc(n,c,p)),Ef=(l,t,n,c)=>({u_matrix:l,u_world:n,u_emissive_strength:t,u_ground_shadow_factor:c}),If=(l,t,n,c,d,p,m=0)=>s.h(Fd(l,t,n,c,p,m),{u_world:d}),Af=(l,t)=>({u_matrix:l,u_ground_shadow_factor:t}),yc=(l,t,n,c,d)=>({u_matrix:l,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:n,u_height_scale:c,u_reset_depth:d}),Nh=(l,t)=>({u_matrix:l,u_normal_matrix:t,u_opacity:1}),Vh=l=>({u_matrix:l}),Od=l=>({u_matrix:l}),aa=(l,t,n,c,d,p,m,y)=>{const x=s.aj/p.tileSize;return{u_matrix:l,u_inv_rot_matrix:t,u_camera_to_center_distance:n.getCameraToCenterDistance(y),u_extrude_scale:[n.pixelsToGLUnits[0]/x,n.pixelsToGLUnits[1]/x],u_zoom_transition:c,u_tile_id:m,u_merc_center:d}},Uh=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),kd=s.bz(),Bd=(l,t,n,c,d,p,m)=>{const y=l.transform,x=y.projection.name==="globe",T=x?s.dM(y.zoom,t.canonical)*y._pixelsPerMercatorPixel:s.aw(n,1,p),S={u_matrix:t.projMatrix,u_extrude_scale:T,u_intensity:m,u_inv_rot_matrix:kd,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(x){S.u_inv_rot_matrix=c,S.u_merc_center=d,S.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],S.u_zoom_transition=s.ah(y.zoom);const M=d[0]*s.aj,E=d[1]*s.aj;S.u_up_dir=y.projection.upVector(new s.cA(0,0,0),M,E)}return S};function xc(l,[t,n,c,d],[p,m]){if(p===m)return[0,0,0,0];const y=255*(l-1)/(l*(m-p));return[t*y,n*y,c*y,d*y]}function $o(l,t,[n,c]){return n===c?0:.5/l+(t-n)*(l-1)/(l*(c-n))}const jh=(l,t,n,c,d,p,m,y,x,T,S,M,E,C,D,z,F,L,N,j,q)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:n,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity*M.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:M.paint.get("raster-brightness-min"),u_brightness_high:M.paint.get("raster-brightness-max"),u_saturation_factor:s.dO(M.paint.get("raster-saturation")),u_contrast_factor:s.dN(M.paint.get("raster-contrast")),u_spin_weights:Zo(M.paint.get("raster-hue-rotate")),u_perspective_transform:E,u_raster_elevation:C,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x,u_colorization_mix:xc(s.dP,z,L),u_colorization_offset:$o(s.dP,F,L),u_color_ramp:D,u_texture_offset:[j/(N+2*j),N/(N+2*j)],u_texture_res:[N+2*j,N+2*j],u_emissive_strength:q});function Zo(l){l*=Math.PI/180;const t=Math.sin(l),n=Math.cos(l);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const Wo=.05,vc=(l,t,n,c,d,p,m,y,x,T,S,M)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:n,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity,u_image0:0,u_image1:1,u_raster_elevation:M,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x}),Nd=(l,t,n,c,d,p,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_tile_offset:n,u_velocity:c,u_color_ramp:p,u_velocity_res:d,u_max_speed:m,u_uv_offset:y,u_data_scale:[255*x[0],255*x[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Wo,Wo]}),Vd=(l,t,n,c,d,p,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_velocity:n,u_velocity_res:c,u_max_speed:d,u_speed_factor:p,u_reset_rate:m,u_rand_seed:Math.random(),u_uv_offset:y,u_data_scale:[255*x[0],255*x[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Wo,Wo]}),bc=s.bz(),wc=(l,t,n,c,d,p,m,y,x,T,S,M,E,C,D,z,F,L,N,j,q,X,ee,ie)=>{const Y=d.transform,K={u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:Y.getCameraToCenterDistance(N),u_rotate_symbol:+n,u_aspect_ratio:Y.width/Y.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:y,u_is_text:+T,u_elevation_from_sea:x?1:0,u_pitch_with_map:+c,u_texsize:S,u_texsize_icon:M,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:bc,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:bc,u_up_vector:[0,-1,0],u_color_adj_mat:X,u_icon_transition:ee||0,u_gamma_scale:c?d.transform.getCameraToCenterDistance(N)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:s.q.devicePixelRatio,u_is_halo:1,u_scale_factor:ie||1,u_ground_shadow_factor:j,u_inv_matrix:s.bi(s.bz(),m),u_normal_scale:q};return N.name==="globe"&&(K.u_tile_id=[C.canonical.x,C.canonical.y,1<<C.canonical.z],K.u_zoom_transition=D,K.u_inv_rot_matrix=F,K.u_merc_center=z,K.u_camera_forward=Y._camera.forward(),K.u_ecef_origin=s.dQ(Y.globeMatrix,C.toUnwrapped()),K.u_tile_matrix=Float32Array.from(Y.globeMatrix),K.u_up_vector=L),K},Ud=(l,t,n,c)=>({u_matrix:l,u_emissive_strength:t,u_opacity:n,u_color:c}),Gh=(l,t,n,c,d,p,m,y,x)=>s.h(function(T,S,M,E,C,D){const{width:z,height:F}=E.imageManager.getPixelSize(S),L=Math.pow(2,D.tileID.overscaledZ),N=D.tileSize*Math.pow(2,E.transform.tileZoom)/L,j=N*(D.tileID.canonical.x+D.tileID.wrap*L),q=N*D.tileID.canonical.y;return{u_image:0,u_pattern_tl:M.tl,u_pattern_br:M.br,u_texsize:[z,F],u_pattern_size:M.displaySize,u_pattern_units_to_pixels:C?[E.transform.width,-1*E.transform.height]:[1/s.aw(D,1,E.transform.tileZoom),1/s.aw(D,1,E.transform.tileZoom)],u_pixel_coord_upper:[j>>16,q>>16],u_pixel_coord_lower:[65535&j,65535&q]}}(0,p,m,c,y,x),{u_matrix:l,u_emissive_strength:t,u_opacity:n}),Ss=new Float32Array(s.bx([])),qh=(l,t,n,c,d,p,m,y,x,T,S,M,E,C=[0,0,0],D)=>{const z=d.style.light,F=z.properties.get("position"),L=[-F.x,-F.y,F.z],N=s.dJ();z.properties.get("anchor")==="viewport"&&(s.dK(N,-d.transform.angle),s.dL(L,L,N));const j=S.alphaMode==="MASK",q=z.properties.get("color").toNonPremultipliedRenderColor(null),X=E.paint.get("model-ambient-occlusion-intensity"),ee=E.paint.get("model-color").constantOr(s.am.white).toNonPremultipliedRenderColor(null);return ee.a=E.paint.get("model-color-mix-intensity").constantOr(0),{u_matrix:l,u_lighting_matrix:t,u_normal_matrix:n,u_node_matrix:c||Ss,u_lightpos:L,u_lightintensity:z.properties.get("intensity"),u_lightcolor:[q.r,q.g,q.b],u_camera_pos:C,u_opacity:p,u_baseTextureIsAlpha:0,u_alphaMask:+j,u_alphaCutoff:S.alphaCutoff,u_baseColorFactor:m.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:y.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:x,u_roughnessFactor:T,u_baseColorTexture:Zr.BaseColor,u_metallicRoughnessTexture:Zr.MetallicRoughness,u_normalTexture:Zr.Normal,u_occlusionTexture:Zr.Occlusion,u_emissionTexture:Zr.Emission,u_lutTexture:Zr.LUT,u_color_mix:ee.toArray01(),u_aoIntensity:X,u_emissive_strength:M,u_occlusionTextureTransform:D||[0,0,0,0]}},jd=(l,t=Ss,n=Ss)=>({u_matrix:l,u_instance:t,u_node_matrix:n}),Gd={fillExtrusion:l=>({u_matrix:new s.ch(l),u_lightpos:new s.ce(l),u_lightintensity:new s.cf(l),u_lightcolor:new s.ce(l),u_vertical_gradient:new s.cf(l),u_opacity:new s.cf(l),u_edge_radius:new s.cf(l),u_width_scale:new s.cf(l),u_ao:new s.cg(l),u_height_type:new s.cd(l),u_base_type:new s.cd(l),u_tile_id:new s.ce(l),u_zoom_transition:new s.cf(l),u_inv_rot_matrix:new s.ch(l),u_merc_center:new s.cg(l),u_up_dir:new s.ce(l),u_height_lift:new s.cf(l),u_flood_light_color:new s.ce(l),u_vertical_scale:new s.cf(l),u_flood_light_intensity:new s.cf(l),u_ground_shadow_factor:new s.ce(l)}),fillExtrusionDepth:l=>({u_matrix:new s.ch(l),u_edge_radius:new s.cf(l),u_width_scale:new s.cf(l),u_vertical_scale:new s.cf(l),u_height_type:new s.cd(l),u_base_type:new s.cd(l)}),fillExtrusionPattern:l=>({u_matrix:new s.ch(l),u_lightpos:new s.ce(l),u_lightintensity:new s.cf(l),u_lightcolor:new s.ce(l),u_vertical_gradient:new s.cf(l),u_height_factor:new s.cf(l),u_edge_radius:new s.cf(l),u_width_scale:new s.cf(l),u_ao:new s.cg(l),u_height_type:new s.cd(l),u_base_type:new s.cd(l),u_tile_id:new s.ce(l),u_zoom_transition:new s.cf(l),u_inv_rot_matrix:new s.ch(l),u_merc_center:new s.cg(l),u_up_dir:new s.ce(l),u_height_lift:new s.cf(l),u_image:new s.cd(l),u_texsize:new s.cg(l),u_pixel_coord_upper:new s.cg(l),u_pixel_coord_lower:new s.cg(l),u_tile_units_to_pixels:new s.cf(l),u_opacity:new s.cf(l),u_pattern_transition:new s.cf(l)}),fillExtrusionGroundEffect:l=>({u_matrix:new s.ch(l),u_opacity:new s.cf(l),u_ao_pass:new s.cf(l),u_meter_to_tile:new s.cf(l),u_ao:new s.cg(l),u_flood_light_intensity:new s.cf(l),u_flood_light_color:new s.ce(l),u_attenuation:new s.cf(l),u_edge_radius:new s.cf(l),u_fb:new s.cd(l),u_fb_size:new s.cf(l),u_dynamic_offset:new s.cf(l)}),fill:l=>({u_matrix:new s.ch(l),u_emissive_strength:new s.cf(l),u_ground_shadow_factor:new s.ce(l)}),fillPattern:l=>({u_matrix:new s.ch(l),u_emissive_strength:new s.cf(l),u_image:new s.cd(l),u_texsize:new s.cg(l),u_pixel_coord_upper:new s.cg(l),u_pixel_coord_lower:new s.cg(l),u_tile_units_to_pixels:new s.cf(l),u_ground_shadow_factor:new s.ce(l),u_pattern_transition:new s.cf(l)}),fillOutline:l=>({u_matrix:new s.ch(l),u_emissive_strength:new s.cf(l),u_world:new s.cg(l),u_ground_shadow_factor:new s.ce(l)}),fillOutlinePattern:l=>({u_matrix:new s.ch(l),u_emissive_strength:new s.cf(l),u_world:new s.cg(l),u_image:new s.cd(l),u_texsize:new s.cg(l),u_pixel_coord_upper:new s.cg(l),u_pixel_coord_lower:new s.cg(l),u_tile_units_to_pixels:new s.cf(l),u_ground_shadow_factor:new s.ce(l),u_pattern_transition:new s.cf(l)}),building:l=>({u_matrix:new s.ch(l),u_normal_matrix:new s.ch(l),u_opacity:new s.cf(l)}),buildingBloom:l=>({u_matrix:new s.ch(l)}),buildingDepth:l=>({u_matrix:new s.ch(l)}),elevatedStructuresDepth:l=>({u_matrix:new s.ch(l),u_depth_bias:new s.cf(l)}),elevatedStructures:l=>({u_matrix:new s.ch(l),u_ground_shadow_factor:new s.ce(l)}),elevatedStructuresDepthReconstruct:l=>({u_matrix:new s.ch(l),u_camera_pos:new s.ce(l),u_depth_bias:new s.cf(l),u_height_scale:new s.cf(l),u_reset_depth:new s.cf(l)}),circle:s.dT,collisionBox:l=>({u_matrix:new s.ch(l),u_inv_rot_matrix:new s.ch(l),u_camera_to_center_distance:new s.cf(l),u_extrude_scale:new s.cg(l),u_zoom_transition:new s.cf(l),u_merc_center:new s.cg(l),u_tile_id:new s.ce(l)}),collisionCircle:l=>({u_matrix:new s.ch(l),u_inv_matrix:new s.ch(l),u_camera_to_center_distance:new s.cf(l),u_viewport_size:new s.cg(l)}),debug:l=>({u_color:new s.dv(l),u_matrix:new s.ch(l),u_overlay:new s.cd(l),u_overlay_scale:new s.cf(l)}),clippingMask:l=>({u_matrix:new s.ch(l)}),heatmap:l=>({u_extrude_scale:new s.cf(l),u_intensity:new s.cf(l),u_matrix:new s.ch(l),u_inv_rot_matrix:new s.ch(l),u_merc_center:new s.cg(l),u_tile_id:new s.ce(l),u_zoom_transition:new s.cf(l),u_up_dir:new s.ce(l)}),heatmapTexture:l=>({u_image:new s.cd(l),u_color_ramp:new s.cd(l),u_opacity:new s.cf(l)}),hillshade:l=>({u_matrix:new s.ch(l),u_image:new s.cd(l),u_latrange:new s.cg(l),u_light:new s.cg(l),u_shadow:new s.dv(l),u_highlight:new s.dv(l),u_emissive_strength:new s.cf(l),u_accent:new s.dv(l)}),hillshadePrepare:l=>({u_matrix:new s.ch(l),u_image:new s.cd(l),u_dimension:new s.cg(l),u_zoom:new s.cf(l)}),line:s.dS,linePattern:s.dR,raster:l=>({u_matrix:new s.ch(l),u_normalize_matrix:new s.ch(l),u_globe_matrix:new s.ch(l),u_merc_matrix:new s.ch(l),u_grid_matrix:new s.dw(l),u_tl_parent:new s.cg(l),u_scale_parent:new s.cf(l),u_fade_t:new s.cf(l),u_opacity:new s.cf(l),u_image0:new s.cd(l),u_image1:new s.cd(l),u_brightness_low:new s.cf(l),u_brightness_high:new s.cf(l),u_saturation_factor:new s.cf(l),u_contrast_factor:new s.cf(l),u_spin_weights:new s.ce(l),u_perspective_transform:new s.cg(l),u_raster_elevation:new s.cf(l),u_zoom_transition:new s.cf(l),u_merc_center:new s.cg(l),u_cutoff_params:new s.d0(l),u_colorization_mix:new s.d0(l),u_colorization_offset:new s.cf(l),u_color_ramp:new s.cd(l),u_texture_offset:new s.cg(l),u_texture_res:new s.cg(l),u_emissive_strength:new s.cf(l)}),rasterParticle:l=>({u_matrix:new s.ch(l),u_normalize_matrix:new s.ch(l),u_globe_matrix:new s.ch(l),u_merc_matrix:new s.ch(l),u_grid_matrix:new s.dw(l),u_tl_parent:new s.cg(l),u_scale_parent:new s.cf(l),u_fade_t:new s.cf(l),u_opacity:new s.cf(l),u_image0:new s.cd(l),u_image1:new s.cd(l),u_raster_elevation:new s.cf(l),u_zoom_transition:new s.cf(l),u_merc_center:new s.cg(l),u_cutoff_params:new s.d0(l)}),rasterParticleTexture:l=>({u_texture:new s.cd(l),u_opacity:new s.cf(l)}),rasterParticleDraw:l=>({u_particle_texture:new s.cd(l),u_particle_texture_side_len:new s.cf(l),u_tile_offset:new s.cg(l),u_velocity:new s.cd(l),u_color_ramp:new s.cd(l),u_velocity_res:new s.cg(l),u_max_speed:new s.cf(l),u_uv_offset:new s.cg(l),u_data_scale:new s.cg(l),u_data_offset:new s.cf(l),u_particle_pos_scale:new s.cf(l),u_particle_pos_offset:new s.cg(l)}),rasterParticleUpdate:l=>({u_particle_texture:new s.cd(l),u_particle_texture_side_len:new s.cf(l),u_velocity:new s.cd(l),u_velocity_res:new s.cg(l),u_max_speed:new s.cf(l),u_speed_factor:new s.cf(l),u_reset_rate:new s.cf(l),u_rand_seed:new s.cf(l),u_uv_offset:new s.cg(l),u_data_scale:new s.cg(l),u_data_offset:new s.cf(l),u_particle_pos_scale:new s.cf(l),u_particle_pos_offset:new s.cg(l)}),symbol:l=>({u_is_size_zoom_constant:new s.cd(l),u_is_size_feature_constant:new s.cd(l),u_size_t:new s.cf(l),u_size:new s.cf(l),u_camera_to_center_distance:new s.cf(l),u_rotate_symbol:new s.cd(l),u_aspect_ratio:new s.cf(l),u_fade_change:new s.cf(l),u_matrix:new s.ch(l),u_label_plane_matrix:new s.ch(l),u_coord_matrix:new s.ch(l),u_is_text:new s.cd(l),u_elevation_from_sea:new s.cd(l),u_pitch_with_map:new s.cd(l),u_texsize:new s.cg(l),u_texsize_icon:new s.cg(l),u_texture:new s.cd(l),u_texture_icon:new s.cd(l),u_gamma_scale:new s.cf(l),u_device_pixel_ratio:new s.cf(l),u_tile_id:new s.ce(l),u_zoom_transition:new s.cf(l),u_inv_rot_matrix:new s.ch(l),u_merc_center:new s.cg(l),u_camera_forward:new s.ce(l),u_tile_matrix:new s.ch(l),u_up_vector:new s.ce(l),u_ecef_origin:new s.ce(l),u_is_halo:new s.cd(l),u_icon_transition:new s.cf(l),u_color_adj_mat:new s.ch(l),u_scale_factor:new s.cf(l),u_ground_shadow_factor:new s.ce(l),u_inv_matrix:new s.ch(l),u_normal_scale:new s.cf(l)}),background:l=>({u_matrix:new s.ch(l),u_emissive_strength:new s.cf(l),u_opacity:new s.cf(l),u_color:new s.dv(l)}),backgroundPattern:l=>({u_matrix:new s.ch(l),u_emissive_strength:new s.cf(l),u_opacity:new s.cf(l),u_image:new s.cd(l),u_pattern_tl:new s.cg(l),u_pattern_br:new s.cg(l),u_texsize:new s.cg(l),u_pattern_size:new s.cg(l),u_pixel_coord_upper:new s.cg(l),u_pixel_coord_lower:new s.cg(l),u_pattern_units_to_pixels:new s.cg(l)}),terrainRaster:l=>({u_matrix:new s.ch(l),u_image0:new s.cd(l),u_skirt_height:new s.cf(l),u_ground_shadow_factor:new s.ce(l)}),skybox:l=>({u_matrix:new s.ch(l),u_sun_direction:new s.ce(l),u_cubemap:new s.cd(l),u_opacity:new s.cf(l),u_temporal_offset:new s.cf(l)}),skyboxGradient:l=>({u_matrix:new s.ch(l),u_color_ramp:new s.cd(l),u_center_direction:new s.ce(l),u_radius:new s.cf(l),u_opacity:new s.cf(l),u_temporal_offset:new s.cf(l)}),skyboxCapture:l=>({u_matrix_3f:new s.dw(l),u_sun_direction:new s.ce(l),u_sun_intensity:new s.cf(l),u_color_tint_r:new s.d0(l),u_color_tint_m:new s.d0(l),u_luminance:new s.cf(l)}),globeRaster:l=>({u_proj_matrix:new s.ch(l),u_globe_matrix:new s.ch(l),u_normalize_matrix:new s.ch(l),u_merc_matrix:new s.ch(l),u_zoom_transition:new s.cf(l),u_merc_center:new s.cg(l),u_image0:new s.cd(l),u_grid_matrix:new s.dw(l),u_skirt_height:new s.cf(l),u_far_z_cutoff:new s.cf(l),u_frustum_tl:new s.ce(l),u_frustum_tr:new s.ce(l),u_frustum_br:new s.ce(l),u_frustum_bl:new s.ce(l),u_globe_pos:new s.ce(l),u_globe_radius:new s.cf(l),u_viewport:new s.cg(l)}),globeAtmosphere:l=>({u_frustum_tl:new s.ce(l),u_frustum_tr:new s.ce(l),u_frustum_br:new s.ce(l),u_frustum_bl:new s.ce(l),u_horizon:new s.cf(l),u_transition:new s.cf(l),u_fadeout_range:new s.cf(l),u_color:new s.d0(l),u_high_color:new s.d0(l),u_space_color:new s.d0(l),u_temporal_offset:new s.cf(l),u_horizon_angle:new s.cf(l)}),model:l=>({u_matrix:new s.ch(l),u_lighting_matrix:new s.ch(l),u_normal_matrix:new s.ch(l),u_node_matrix:new s.ch(l),u_lightpos:new s.ce(l),u_lightintensity:new s.cf(l),u_lightcolor:new s.ce(l),u_camera_pos:new s.ce(l),u_opacity:new s.cf(l),u_baseColorFactor:new s.d0(l),u_emissiveFactor:new s.d0(l),u_metallicFactor:new s.cf(l),u_roughnessFactor:new s.cf(l),u_baseTextureIsAlpha:new s.cd(l),u_alphaMask:new s.cd(l),u_alphaCutoff:new s.cf(l),u_baseColorTexture:new s.cd(l),u_metallicRoughnessTexture:new s.cd(l),u_normalTexture:new s.cd(l),u_occlusionTexture:new s.cd(l),u_emissionTexture:new s.cd(l),u_lutTexture:new s.cd(l),u_color_mix:new s.d0(l),u_aoIntensity:new s.cf(l),u_emissive_strength:new s.cf(l),u_occlusionTextureTransform:new s.d0(l)}),modelDepth:l=>({u_matrix:new s.ch(l),u_instance:new s.ch(l),u_node_matrix:new s.ch(l)}),groundShadow:l=>({u_matrix:new s.ch(l),u_ground_shadow_factor:new s.ce(l)}),stars:l=>({u_matrix:new s.ch(l),u_up:new s.ce(l),u_right:new s.ce(l),u_intensity_multiplier:new s.cf(l)}),snowParticle:l=>({u_modelview:new s.ch(l),u_projection:new s.ch(l),u_time:new s.cf(l),u_cam_pos:new s.ce(l),u_velocityConeAperture:new s.cf(l),u_velocity:new s.cf(l),u_horizontalOscillationRadius:new s.cf(l),u_horizontalOscillationRate:new s.cf(l),u_boxSize:new s.cf(l),u_billboardSize:new s.cf(l),u_simpleShapeParameters:new s.cg(l),u_screenSize:new s.cg(l),u_thinningCenterPos:new s.cg(l),u_thinningShape:new s.ce(l),u_thinningAffectedRatio:new s.cf(l),u_thinningParticleOffset:new s.cf(l),u_particleColor:new s.d0(l),u_direction:new s.ce(l)}),rainParticle:l=>({u_modelview:new s.ch(l),u_projection:new s.ch(l),u_time:new s.cf(l),u_cam_pos:new s.ce(l),u_texScreen:new s.cd(l),u_velocityConeAperture:new s.cf(l),u_velocity:new s.cf(l),u_boxSize:new s.cf(l),u_rainDropletSize:new s.cg(l),u_distortionStrength:new s.cf(l),u_rainDirection:new s.ce(l),u_color:new s.d0(l),u_screenSize:new s.cg(l),u_thinningCenterPos:new s.cg(l),u_thinningShape:new s.ce(l),u_thinningAffectedRatio:new s.cf(l),u_thinningParticleOffset:new s.cf(l),u_shapeDirectionalPower:new s.cf(l),u_shapeNormalPower:new s.cf(l),u_mode:new s.cf(l)}),vignette:l=>({u_vignetteShape:new s.ce(l),u_vignetteColor:new s.d0(l)}),occlusion:l=>({u_matrix:new s.ch(l),u_anchorPos:new s.ce(l),u_screenSizePx:new s.cg(l),u_occluderSizePx:new s.cg(l),u_color:new s.d0(l)})};class Xo{constructor(t,n,c,d){this.id=Xo.uniqueIdxCounter,Xo.uniqueIdxCounter++,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!c,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||d||n.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=Xo.uniqueIdxCounter,Xo.uniqueIdxCounter++;const n=this.context.gl;this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Xo.uniqueIdxCounter=0;const Hh={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class $h{constructor(t,n,c,d,p,m){this.length=n.length,this.attributes=c,this.itemSize=n.bytesPerElement,this.dynamicDraw=d,this.instanceCount=m,this.context=t;const y=t.gl;this.buffer=y.createBuffer(),t.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||p||n.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let c=0;c<this.attributes.length;c++){const d=n.attributes[this.attributes[c].name];d!==void 0&&t.enableVertexAttribArray(d)}}setVertexAttribPointers(t,n,c){for(let d=0;d<this.attributes.length;d++){const p=this.attributes[d],m=n.attributes[p.name];m!==void 0&&t.vertexAttribPointer(m,p.components,t[Hh[p.type]],!1,this.itemSize,p.offset+this.itemSize*(c||0))}}setVertexAttribDivisor(t,n,c){for(let d=0;d<this.attributes.length;d++){const p=n.attributes[this.attributes[d].name];p!==void 0&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(p,c)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Es{constructor(t,n,c,d,p){this.context=t,this.width=n,this.height=c;const m=this.framebuffer=t.gl.createFramebuffer();d&&(this.colorAttachment=new Sf(t,m)),p&&(this.depthAttachmentType=p,this.depthAttachment=p==="renderbuffer"?new zd(t,m):new Ph(t,m))}destroy(){const t=this.context.gl;if(this.colorAttachment){const n=this.colorAttachment.get();n&&t.deleteTexture(n)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const n=this.depthAttachment.get();n&&t.deleteRenderbuffer(n)}else{const n=this.depthAttachment.get();n&&t.deleteTexture(n)}t.deleteFramebuffer(this.framebuffer)}}class Tc{constructor(t,n){this.gl=t,this.clearColor=new yf(this),this.clearDepth=new xf(this),this.clearStencil=new vf(this),this.colorMask=new bf(this),this.depthMask=new Td(this),this.stencilMask=new wf(this),this.stencilFunc=new nc(this),this.stencilOp=new Tf(this),this.stencilTest=new Sd(this),this.depthRange=new Eh(this),this.depthTest=new oc(this),this.depthFunc=new Ih(this),this.blend=new bs(this),this.blendFunc=new ta(this),this.blendColor=new sc(this),this.blendEquation=new ac(this),this.cullFace=new ia(this),this.cullFaceSide=new Ed(this),this.frontFace=new Ah(this),this.program=new Id(this),this.activeTexture=new ra(this),this.viewport=new lc(this),this.bindFramebuffer=new cc(this),this.bindRenderbuffer=new Mh(this),this.bindTexture=new hc(this),this.bindVertexBuffer=new ul(this),this.bindElementBuffer=new Ad(this),this.bindVertexArrayOES=new Md(this),this.pixelStoreUnpack=new Cd(this),this.pixelStoreUnpackPremultiplyAlpha=new na(this),this.pixelStoreUnpackFlipY=new Pd(this),this.options=n?Object.assign({},n):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=t.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=t.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=t.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=n&&!!n.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=t.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxPointSize=t.getParameter(t.ALIASED_POINT_SIZE_RANGE)[1]}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(t,n,c){return new Xo(this,t,n,c)}createVertexBuffer(t,n,c,d,p){return new $h(this,t,n,c,d,p)}createRenderbuffer(t,n,c){const d=this.gl,p=d.createRenderbuffer();return this.bindRenderbuffer.set(p),d.renderbufferStorage(d.RENDERBUFFER,t,n,c),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,c,d){return new Es(this,t,n,c,d)}clear({color:t,depth:n,stencil:c,colorMask:d}){const p=this.gl;let m=0;t&&(m|=p.COLOR_BUFFER_BIT,this.clearColor.set(t.toNonPremultipliedRenderColor(null)),this.colorMask.set(d||[!0,!0,!0,!0])),n!==void 0&&(m|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),c!==void 0&&(m|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(c),this.stencilMask.set(255)),p.clear(m)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){s.bv(t.blendFunction,Pt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Yo;function Zh(l,t,n,c,d,p,m){const y=l.context,x=y.gl,T=l.transform,S=[s.aD(T.center.lng),s.aH(T.center.lat)],M=n.layout.get("symbol-placement"),E=n.layout.get("text-variable-anchor"),C=n.layout.get("icon-rotation-alignment")==="map",D=n.layout.get("text-rotation-alignment")==="map",z=M!=="point",F=[];let L=0,N=0;for(let K=0;K<c.length;K++){const J=c[K],fe=t.getTile(J),se=fe.getBucket(n);if(!se)continue;const Ie=se.getProjection().createInversionMatrix(T,J.canonical),xe=[],Me=hd(J,se,T),Ue=!m&&C&&z,me=m&&D&&z,oe=E&&se.hasTextData(),we=se.hasIconTextFit()&&oe&&se.hasIconData(),_e=Ue||me||m&&oe||we,ze=se.projection.name==="globe",Re=ze?s.ah(T.zoom):0;ze&&(xe.push("PROJECTION_GLOBE_VIEW"),_e&&xe.push("PROJECTED_POS_ON_VIEWPORT"));const Le=l.getOrCreateProgram("collisionBox",{defines:xe});let Ze=Me;d[0]===0&&d[1]===0||(Ze=l.translatePosMatrix(Me,fe,d,p));const at=m?se.textCollisionBox:se.iconCollisionBox,dt=se.collisionCircleArray;if(dt.length>0){const ht=s.bz(),lt=Ze;s.cM(ht,se.placementInvProjMatrix,T.glCoordMatrix),s.cM(ht,ht,se.placementViewportMatrix),F.push({circleArray:dt,circleOffset:N,transform:lt,invTransform:ht,projection:se.getProjection()}),L+=dt.length/4,N=L}if(!at)continue;l.terrain&&l.terrain.setupElevationDraw(fe,Le);const Qe=ze?[J.canonical.x,J.canonical.y,1<<J.canonical.z]:[0,0,0];Le.draw(l,x.LINES,it.disabled,xt.disabled,l.colorModeForRenderPass(),mt.disabled,aa(Ze,Ie,T,Re,S,fe,Qe,se.getProjection()),n.id,at.layoutVertexBuffer,at.indexBuffer,at.segments,null,T.zoom,null,[at.collisionVertexBuffer,at.collisionVertexBufferExt])}if(!m||!F.length)return;const j=l.getOrCreateProgram("collisionCircle"),q=new s.dU;q.resize(4*L),q._trim();let X=0;for(const K of F)for(let J=0;J<K.circleArray.length/4;J++){const fe=4*J,se=K.circleArray[fe+0],Ie=K.circleArray[fe+1],xe=K.circleArray[fe+2],Me=K.circleArray[fe+3];q.emplace(X++,se,Ie,xe,Me,0),q.emplace(X++,se,Ie,xe,Me,1),q.emplace(X++,se,Ie,xe,Me,2),q.emplace(X++,se,Ie,xe,Me,3)}(!Yo||Yo.length<2*L)&&(Yo=function(K){const J=2*K,fe=new s.a_;fe.resize(J),fe._trim();for(let se=0;se<J;se++){const Ie=6*se;fe.uint16[Ie+0]=4*se+0,fe.uint16[Ie+1]=4*se+1,fe.uint16[Ie+2]=4*se+2,fe.uint16[Ie+3]=4*se+2,fe.uint16[Ie+4]=4*se+3,fe.uint16[Ie+5]=4*se+0}return fe}(L));const ee=y.createIndexBuffer(Yo,!0),ie=y.createVertexBuffer(q,s.dV.members,!0);for(const K of F){const J={u_matrix:K.transform,u_inv_matrix:K.invTransform,u_camera_to_center_distance:(Y=T).getCameraToCenterDistance(K.projection),u_viewport_size:[Y.width,Y.height]};j.draw(l,x.TRIANGLES,it.disabled,xt.disabled,l.colorModeForRenderPass(),mt.disabled,J,n.id,ie,ee,s.bd.simpleSegment(0,2*K.circleOffset,K.circleArray.length,K.circleArray.length/2),null,T.zoom)}var Y;ie.destroy(),ee.destroy()}const Is=s.bz();function fl(l){const t=l._camera.getWorldToCamera(l.worldSize,1),n=s.az([],t,l.globeMatrix);s.bi(n,n);const c=[0,0,0],d=[0,1,0,0];return s.aA(d,d,n),c[0]=d[0],c[1]=d[1],c[2]=d[2],s.au(c,c),c}function Wh({width:l,height:t,anchor:n,textOffset:c,textScale:d},p){const{horizontalAlign:m,verticalAlign:y}=s.bZ(n),x=-(m-.5)*l,T=-(y-.5)*t,S=s.b_(n,c);return new s.P((x/d+S[0])*p,(T/d+S[1])*p)}function qd(l,t,n,c,d,p,m,y,x,T){const S=l.text.placedSymbolArray,M=l.text.dynamicLayoutVertexArray,E=l.icon.dynamicLayoutVertexArray,C={},D=l.getProjection(),z=$l(m,D,d),F=d.elevation,L=D.upVectorScale(m.canonical,d.center.lat,d.worldSize).metersToTile;M.clear();for(let N=0;N<S.length;N++){const j=S.get(N),{tileAnchorX:q,tileAnchorY:X,numGlyphs:ee}=j,ie=j.hidden||!j.crossTileID||l.allowVerticalPlacement&&!j.placedOrientation?null:c[j.crossTileID];if(ie){let Y=0,K=0,J=0;if(F){const we=F?F.getAtTileOffset(m,q,X):0,[_e,ze,Re]=D.upVector(m.canonical,q,X);Y=we*_e*L,K=we*ze*L,J=we*Re*L}let[fe,se,Ie,xe]=wn(j.projectedAnchorX+Y,j.projectedAnchorY+K,j.projectedAnchorZ+J,n?z:p);const Me=dh(d.getCameraToCenterDistance(D),xe);let Ue=s.bJ(l.textSizeData,x,j)*Me/s.bU;n&&(Ue*=l.tilePixelRatio/y);const me=Wh(ie,Ue);n?({x:fe,y:se,z:Ie}=D.projectTilePoint(q+me.x,X+me.y,m.canonical),[fe,se,Ie]=wn(fe+Y,se+K,Ie+J,p)):(t&&me._rotate(-d.angle),fe+=me.x,se+=me.y,Ie=0);const oe=l.allowVerticalPlacement&&j.placedOrientation===s.bI.vertical?Math.PI/2:0;for(let we=0;we<ee;we++)s.bL(M,fe,se,Ie,oe);T&&j.associatedIconIndex>=0&&(C[j.associatedIconIndex]={x:fe,y:se,z:Ie,angle:oe})}else $s(ee,M)}if(T){E.clear();const N=l.icon.placedSymbolArray;for(let j=0;j<N.length;j++){const q=N.get(j),{numGlyphs:X}=q,ee=C[j];if(q.hidden||!ee)$s(X,E);else{const{x:ie,y:Y,z:K,angle:J}=ee;for(let fe=0;fe<X;fe++)s.bL(E,ie,Y,K,J)}}l.icon.dynamicLayoutVertexBuffer.updateData(E)}l.text.dynamicLayoutVertexBuffer.updateData(M)}function Xh(l,t,n,c,d,p,m={}){const y=n.paint.get("icon-translate"),x=n.paint.get("text-translate"),T=n.paint.get("icon-translate-anchor"),S=n.paint.get("text-translate-anchor"),M=n.layout.get("icon-rotation-alignment"),E=n.layout.get("text-rotation-alignment"),C=n.layout.get("icon-pitch-alignment"),D=n.layout.get("text-pitch-alignment"),z=n.layout.get("icon-keep-upright"),F=n.layout.get("text-keep-upright"),L=n.paint.get("icon-color-saturation"),N=n.paint.get("icon-color-contrast"),j=n.paint.get("icon-color-brightness-min"),q=n.paint.get("icon-color-brightness-max"),X=n.layout.get("symbol-elevation-reference")==="sea",ee=l.context,ie=ee.gl,Y=l.transform,K=M==="map",J=E==="map",fe=C==="map",se=D==="map",Ie=n.layout.get("symbol-sort-key").constantOr(1)!==void 0;let xe=!1;const Me=l.depthModeForSublayer(0,it.ReadOnly),Ue=new it(l.context.gl.LEQUAL,it.ReadOnly,l.depthRangeFor3D),me=[s.aD(Y.center.lng),s.aH(Y.center.lat)],oe=n.layout.get("text-variable-anchor"),we=Y.projection.name==="globe",_e=[],ze=[0,-1,0];for(const Re of c){const Le=t.getTile(Re),Ze=Le.getBucket(n);if(!Ze||Ze.projection.name==="mercator"&&we||Ze.fullyClipped)continue;const at=Ze.projection.name==="globe",dt=at?s.ah(Y.zoom):0,Qe=$l(Re,Ze.getProjection(),Y),ht=Y.calculatePixelsToTileUnitsMatrix(Le),lt=oe&&Ze.hasTextData(),wt=Ze.hasIconTextFit()&&lt&&Ze.hasIconData(),At=Ze.getProjection().createInversionMatrix(Y,Re.canonical),Ot=(1<<Le.tileID.canonical.z)*s.aj/l.transform.worldSize,Yt=di=>{let ii=[0,0,0];if(di){const Vi=l.style.directionalLight,Wt=l.style.ambientLight;Vi&&Wt&&(ii=xs(l.style,Vi,Wt))}return ii},Et=di=>{Y.depthOcclusionForSymbolsAndCircles&&(n.hasInitialOcclusionOpacityProperties||l.terrain)&&(di.push("DEPTH_D24"),di.push("DEPTH_OCCLUSION"))},Kt=()=>{const di=K&&n.layout.get("symbol-placement")!=="point",ii=[];Et(ii);const Vi=di||wt,Wt=Ze.elevationType==="road",oi=l.shadowRenderer,yi=Wt&&fe&&!!oi&&oi.enabled,sr=Yt(yi),rr=Wt&&fe&&!l.terrain?Ue:Me,ar=n.paint.get("icon-image-cross-fade");l.terrainRenderModeElevated()&&fe&&ii.push("PITCH_WITH_MAP_TERRAIN"),at&&(ii.push("PROJECTION_GLOBE_VIEW"),Vi&&ii.push("PROJECTED_POS_ON_VIEWPORT")),ar>0&&Ze.hasAnySecondaryIcon&&ii.push("ICON_TRANSITION"),!Ze.icon.zOffsetVertexBuffer||Wt&&l.terrain||ii.push("Z_OFFSET"),L===0&&N===0&&j===0&&q===1||ii.push("COLOR_ADJUSTMENT"),Ze.sdfIcons&&ii.push("RENDER_SDF"),yi&&ii.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Wt&&fe&&!l.terrain&&Ze.icon.orientationVertexBuffer&&ii.push("ELEVATED_ROADS");const Sr=Ze.icon.programConfigurations.get(n.id),Xn=l.getOrCreateProgram("symbol",{config:Sr,defines:ii}),Yr=Le.imageAtlasTexture?Le.imageAtlasTexture.size:[0,0],fn=Ze.iconSizeData,Pr=s.bH(fn,Y.zoom),Mn=fe||!Y.isOrthographic,Gn=Ja(Qe,Le.tileID.canonical,fe,K,Y,Ze.getProjection(),ht),zr=yo(Qe,Le.tileID.canonical,fe,K,Y,Ze.getProjection(),ht),Ji=l.translatePosMatrix(zr,Le,y,T,!0),Zi=l.translatePosMatrix(Qe,Le,y,T),wi=Vi?Is:Gn,fr=K&&!fe&&!di;let Er=ze;!we&&!Y.mercatorFromTransition||K||(Er=fl(Y));const Qi=at?Er:ze,Cn=n.getColorAdjustmentMatrix(L,N,j,q),Ps=wc(fn.kind,Pr,fr,fe,l,Zi,wi,Ji,X,!1,Yr,[0,0],0,Re,dt,me,At,Qi,Ze.getProjection(),sr,Ot,Cn,ar,null),rs=Le.imageAtlasTexture?Le.imageAtlasTexture:null,wa=n.layout.get("icon-size").constantOr(0)!==1||Ze.iconsNeedLinear,Ta=Ze.sdfIcons||l.options.rotating||l.options.zooming||wa||Mn?ie.LINEAR:ie.NEAREST,Pn=Ze.sdfIcons&&n.paint.get("icon-halo-width").constantOr(1)!==0,no=l.terrain&&fe&&di?s.bi(s.bz(),Gn):Is;if(di&&Ze.icon){const mr=Y.elevation,zn=mr?mr.getAtTileOffsetFunc(Re,Y.center.lat,Y.worldSize,Ze.getProjection()):null,zs=Hs(Qe,Le.tileID.canonical,fe,K,Y,Ze.getProjection(),ht);_s(Ze,Qe,l,!1,zs,zr,fe,z,zn,Re)}return{program:Xn,buffers:Ze.icon,uniformValues:Ps,atlasTexture:rs,atlasTextureIcon:null,atlasInterpolation:Ta,atlasInterpolationIcon:null,isSDF:Ze.sdfIcons,hasHalo:Pn,depthMode:rr,tile:Le,renderWithShadows:yi,labelPlaneMatrixInv:no}},ti=()=>{const di=J&&n.layout.get("symbol-placement")!=="point",ii=[],Vi=di||oe||wt,Wt=Ze.elevationType==="road",oi=l.shadowRenderer,yi=Wt&&se&&!!oi&&oi.enabled,sr=Yt(yi),rr=Wt&&se&&!l.terrain?Ue:Me;l.terrainRenderModeElevated()&&se&&ii.push("PITCH_WITH_MAP_TERRAIN"),at&&(ii.push("PROJECTION_GLOBE_VIEW"),Vi&&ii.push("PROJECTED_POS_ON_VIEWPORT")),!Ze.text.zOffsetVertexBuffer||Wt&&l.terrain||ii.push("Z_OFFSET"),Ze.iconsInText&&ii.push("RENDER_TEXT_AND_SYMBOL"),ii.push("RENDER_SDF"),yi&&ii.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Wt&&se&&!l.terrain&&Ze.text.orientationVertexBuffer&&ii.push("ELEVATED_ROADS"),Et(ii);const ar=Ze.text.programConfigurations.get(n.id),Sr=l.getOrCreateProgram("symbol",{config:ar,defines:ii});let Xn,Yr=[0,0],fn=null;const Pr=Ze.textSizeData;Ze.iconsInText&&(Yr=Le.imageAtlasTexture?Le.imageAtlasTexture.size:[0,0],fn=Le.imageAtlasTexture?Le.imageAtlasTexture:null,Xn=se||!Y.isOrthographic||l.options.rotating||l.options.zooming||Pr.kind==="composite"||Pr.kind==="camera"?ie.LINEAR:ie.NEAREST);const Mn=Le.glyphAtlasTexture?Le.glyphAtlasTexture.size:[0,0],Gn=n.layout.get("text-size-scale-range"),zr=s.ay(l.scaleFactor,Gn[0],Gn[1]),Ji=s.bH(Pr,Y.zoom,zr),Zi=Ja(Qe,Le.tileID.canonical,se,J,Y,Ze.getProjection(),ht),wi=yo(Qe,Le.tileID.canonical,se,J,Y,Ze.getProjection(),ht),fr=l.translatePosMatrix(wi,Le,x,S,!0),Er=l.translatePosMatrix(Qe,Le,x,S),Qi=Vi?Is:Zi,Cn=J&&!se&&!di;let Ps=ze;!we&&!Y.mercatorFromTransition||J||(Ps=fl(Y));const rs=wc(Pr.kind,Ji,Cn,se,l,Er,Qi,fr,X,!0,Mn,Yr,0,Re,dt,me,At,at?Ps:ze,Ze.getProjection(),sr,Ot,null,null,zr),wa=Le.glyphAtlasTexture?Le.glyphAtlasTexture:null,Ta=ie.LINEAR,Pn=n.paint.get("text-halo-width").constantOr(1)!==0,no=l.terrain&&se&&di?s.bi(s.bz(),Zi):Is;if(di&&Ze.text){const mr=Y.elevation,zn=mr?mr.getAtTileOffsetFunc(Re,Y.center.lat,Y.worldSize,Ze.getProjection()):null,zs=Hs(Qe,Le.tileID.canonical,se,J,Y,Ze.getProjection(),ht);_s(Ze,Qe,l,!0,zs,wi,se,F,zn,Re)}return{program:Sr,buffers:Ze.text,uniformValues:rs,atlasTexture:wa,atlasTextureIcon:fn,atlasInterpolation:Ta,atlasInterpolationIcon:Xn,isSDF:!0,hasHalo:Pn,depthMode:rr,tile:Le,renderWithShadows:yi,labelPlaneMatrixInv:no}},vi=Ze.icon.segments.get().length,Dt=Ze.text.segments.get().length,Jt=vi&&!m.onlyText?Kt():null,Qt=Dt&&!m.onlyIcons?ti():null,ni=n.paint.get("icon-opacity").constantOr(1),kt=n.paint.get("text-opacity").constantOr(1);if(Ie&&Ze.canOverlap){xe=!0;const di=ni&&!m.onlyText?Ze.icon.segments.get():[],ii=kt&&!m.onlyIcons?Ze.text.segments.get():[];for(const Vi of di)_e.push({segments:new s.bd([Vi]),sortKey:Vi.sortKey,state:Jt});for(const Vi of ii)_e.push({segments:new s.bd([Vi]),sortKey:Vi.sortKey,state:Qt})}else m.onlyText||_e.push({segments:ni?Ze.icon.segments:new s.bd([]),sortKey:0,state:Jt}),m.onlyIcons||_e.push({segments:kt?Ze.text.segments:new s.bd([]),sortKey:0,state:Qt})}xe&&_e.sort((Re,Le)=>
2760Re.sortKey-Le.sortKey);for(const Re of _e){const Le=Re.state;if(Le)if(l.terrain?l.terrain.setupElevationDraw(Le.tile,Le.program,{useDepthForOcclusion:Y.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Le.labelPlaneMatrixInv}):l.setupDepthForOcclusion(Y.depthOcclusionForSymbolsAndCircles,Le.program),ee.activeTexture.set(ie.TEXTURE0),Le.atlasTexture&&Le.atlasTexture.bind(Le.atlasInterpolation,ie.CLAMP_TO_EDGE,!0),Le.atlasTextureIcon&&(ee.activeTexture.set(ie.TEXTURE1),Le.atlasTextureIcon&&Le.atlasTextureIcon.bind(Le.atlasInterpolationIcon,ie.CLAMP_TO_EDGE,!0)),Le.renderWithShadows&&l.shadowRenderer.setupShadows(Le.tile.tileID.toUnwrapped(),Le.program,"vector-tile"),l.uploadCommonLightUniforms(l.context,Le.program),Le.hasHalo){const Ze=Le.uniformValues;Ze.u_is_halo=1,Ko(Le.buffers,Re.segments,n,l,Le.program,Le.depthMode,d,p,Ze,2),Ze.u_is_halo=0}else{if(Le.isSDF){const Ze=Le.uniformValues;Le.hasHalo&&(Ze.u_is_halo=1,Ko(Le.buffers,Re.segments,n,l,Le.program,Le.depthMode,d,p,Ze,1)),Ze.u_is_halo=0}Ko(Le.buffers,Re.segments,n,l,Le.program,Le.depthMode,d,p,Le.uniformValues,1)}}}function Ko(l,t,n,c,d,p,m,y,x,T){const S=[l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer,l.iconTransitioningVertexBuffer,l.globeExtVertexBuffer,l.zOffsetVertexBuffer,l.orientationVertexBuffer];d.draw(c,c.context.gl.TRIANGLES,p,m,y,mt.disabled,x,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,c.transform.zoom,l.programConfigurations.get(n.id),S,T)}function ml(l,t){const n=1<<l.canonical.z,c=(t.x*n-l.canonical.x-l.wrap*n)*s.aj,d=(t.y*n-l.canonical.y)*s.aj,p=s.e2(t.z,t.y);return s.d2(c,d,p)}function rt(l,t,n,c,d){if(!n.layout||n.layout.get("fill-elevation-reference")==="none")return;const p=l.context.gl,m=new it(l.context.gl.LEQUAL,it.ReadWrite,l.depthRangeFor3D),y=new it(l.context.gl.GREATER,it.ReadWrite,l.depthRangeFor3D),x=function(C){const D=s.cU(C.pitch);let z=.01;return C.isOrthographic&&(z=s.ai(1e-4,z,s.cZ(D>=Tr?1:D/Tr))),2*z}(l.transform),T=l.transform.getFreeCameraOptions().position,S="elevatedStructuresDepthReconstruct",M=l.getOrCreateProgram(S,{defines:["DEPTH_RECONSTRUCTION"]}),E=l.getOrCreateProgram(S);for(const C of c){const D=t.getTile(C),z=D.getBucket(n);if(!z)continue;const F=z.elevatedStructures;if(!F)continue;const L=z.elevationBufferData.heightRange,N=ml(C.toUnwrapped(),T),j=l.translatePosMatrix(C.projMatrix,D,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));let q,X,ee,ie;if(d==="initialize"){if(!L||L.min>=1||F.depthSegments.segments[0].primitiveLength===0)continue;q=yc(j,N,x,1,0),X=m,ee=F.depthSegments,ie=M}else if(d==="reset"){if(!L||L.min>=0||F.maskSegments.segments[0].primitiveLength===0)continue;q=yc(j,N,0,0,1),X=y,ee=F.maskSegments,ie=M}else if(d==="geometry"){if(F.depthSegments.segments[0].primitiveLength===0)continue;q=yc(j,N,x,1,0),X=m,ee=F.depthSegments,ie=E}ie.draw(l,p.TRIANGLES,X,xt.disabled,Pt.disabled,mt.disabled,q,n.id,F.vertexBuffer,F.indexBuffer,ee,n.paint,l.transform.zoom)}}function Sc(l,t,n){const{painter:c,sourceCache:d,layer:p,coords:m,colorMode:y,elevationType:x,terrainEnabled:T,pass:S}=l,M=c.context.gl,E=p.paint.get("fill-pattern"),C=p.paint.get("fill-pattern-cross-fade"),D=E.constantOr(null);let z=x;x!=="road"||t&&!T||(z="none");const F=z==="road",L=l.painter.shadowRenderer,N=F&&!!L&&L.enabled,j=new it(c.context.gl.LEQUAL,it.ReadOnly,c.depthRangeFor3D);let q=[0,0,0];if(N){const ie=c.style.directionalLight,Y=c.style.ambientLight;ie&&Y&&(q=xs(c.style,ie,Y))}const X=E&&E.constantOr(1),ee=(ie,Y)=>{let K,J,fe,se,Ie;Y?(K=X&&!p.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",fe=M.LINES):(K=X?"fillPattern":"fill",fe=M.TRIANGLES);for(const xe of m){const Me=d.getTile(xe);if(X&&!Me.patternsLoaded())continue;const Ue=Me.getBucket(p);if(!Ue)continue;const me=t?Ue.elevationBufferData:Ue.bufferData;if(me.isEmpty())continue;c.prepareDrawTile();const oe=me.programConfigurations.get(p.id),we=c.isTileAffectedByFog(xe),_e=[],ze=[];F&&(_e.push("ELEVATED_ROADS"),ze.push(me.elevatedLayoutVertexBuffer)),N&&_e.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),X&&(c.context.activeTexture.set(M.TEXTURE0),Me.imageAtlasTexture&&Me.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),oe.updatePaintBuffers());let Re=!1;if(D&&Me.imageAtlas){const Qe=Me.imageAtlas,ht=s.dZ.from(D),lt=ht.getPrimary().scaleSelf(s.q.devicePixelRatio).toString(),wt=ht.getSecondary(),At=Qe.patternPositions.get(lt),Ot=wt?Qe.patternPositions.get(wt.scaleSelf(s.q.devicePixelRatio).toString()):null;Re=!!At&&!!Ot,At&&oe.setConstantPatternPositions(At,Ot)}C>0&&(Re||oe.getPatternTransitionVertexBuffer("fill-pattern"))&&_e.push("FILL_PATTERN_TRANSITION");const Le=c.getOrCreateProgram(K,{config:oe,overrideFog:we,defines:_e}),Ze=c.translatePosMatrix(xe.projMatrix,Me,p.paint.get("fill-translate"),p.paint.get("fill-translate-anchor"));N&&L.setupShadows(Me.tileID.toUnwrapped(),Le,"vector-tile");const at=p.paint.get("fill-emissive-strength");if(Y){se=me.lineIndexBuffer,Ie=me.lineSegments;const Qe=c.terrain&&c.terrain.renderingToTexture?c.terrain.drapeBufferSize:[M.drawingBufferWidth,M.drawingBufferHeight];J=K==="fillOutlinePattern"&&X?If(Ze,at,c,Me,Qe,q,C):Ef(Ze,at,Qe,q)}else se=me.indexBuffer,Ie=me.triangleSegments,J=X?Fd(Ze,at,c,Me,q,C):Ld(Ze,at,q);c.uploadCommonUniforms(c.context,Le,xe.toUnwrapped());let dt=ie;(x==="road"&&!T||x==="offset")&&(dt=j),Le.draw(c,fe,dt,n||c.stencilModeForClipping(xe),y,mt.disabled,J,p.id,me.layoutVertexBuffer,se,Ie,p.paint,c.transform.zoom,oe,ze)}};c.renderPass===S&&ee(c.depthModeForSublayer(1,c.renderPass==="opaque"?it.ReadWrite:it.ReadOnly),!1),z==="none"&&c.renderPass==="translucent"&&p.paint.get("fill-antialias")&&ee(c.depthModeForSublayer(p.getPaintProperty("fill-outline-color")?2:0,it.ReadOnly),!0)}
vendor: 6,453 bytes, line 2760
2760function _l(l,t,n,c,d,p,m,y){n.resetLayerRenderingStats(l);const x=l.context,T=x.gl,S=l.transform,M=n.paint.get("fill-extrusion-pattern"),E=n.paint.get("fill-extrusion-pattern-cross-fade"),C=M.constantOr(null),D=M.constantOr(1),z=n.paint.get("fill-extrusion-opacity"),F=l.style.enable3dLights(),L=n.paint.get(F&&!D?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),N=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),L],j=n.layout.get("fill-extrusion-edge-radius"),q=j>0&&!n.paint.get("fill-extrusion-rounded-roof"),X=q?0:j,ee=S.projection.name==="globe"?s.e5():0,ie=S.projection.name==="globe",Y=ie?s.ah(S.zoom):0,K=[s.aD(S.center.lng),s.aH(S.center.lat)],J=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",fe=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(J?null:n.lut).toArray01().slice(0,3),se=n.paint.get("fill-extrusion-flood-light-intensity"),Ie=n.paint.get("fill-extrusion-vertical-scale"),xe=n.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Me=n.paint.get("fill-extrusion-height-alignment"),Ue=n.paint.get("fill-extrusion-base-alignment"),me=Qn(l,n.paint.get("fill-extrusion-cutoff-fade-range")),oe=[];let we;ie&&oe.push("PROJECTION_GLOBE_VIEW"),N[0]>0&&oe.push("FAUX_AO"),q&&oe.push("ZERO_ROOF_RADIUS"),y&&oe.push("HAS_CENTROID"),se>0&&oe.push("FLOOD_LIGHT"),me.shouldRenderCutoff&&oe.push("RENDER_CUTOFF"),xe&&oe.push("RENDER_WALL_MODE");const _e=l.renderPass==="shadow",ze=l.shadowRenderer,Re=_e&&!!ze,Le=_e?mt.disabled:mt.backCCW;l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0);let Ze=[0,0,0];if(ze){const Qe=l.style.directionalLight,ht=l.style.ambientLight;Qe&&ht&&(Ze=xs(l.style,Qe,ht)),_e||(oe.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ze.useNormalOffset&&oe.push("NORMAL_OFFSET")),we=oe.concat(["SHADOWS_SINGLE_CASCADE"])}const at=Re?"fillExtrusionDepth":D?"fillExtrusionPattern":"fillExtrusion",dt=n.getLayerRenderingStats();for(const Qe of c){const ht=t.getTile(Qe),lt=ht.getBucket(n);if(!lt||lt.projection.name!==S.projection.name)continue;let wt=!1;ze&&(wt=ze.getMaxCascadeForTile(Qe.toUnwrapped())===0);const At=l.isTileAffectedByFog(Qe),Ot=lt.programConfigurations.get(n.id);let Yt=!1;if(C&&ht.imageAtlas){const Qt=ht.imageAtlas,ni=s.dZ.from(C),kt=ni.getPrimary().scaleSelf(s.q.devicePixelRatio).toString(),di=ni.getSecondary(),ii=Qt.patternPositions.get(kt),Vi=di?Qt.patternPositions.get(di.scaleSelf(s.q.devicePixelRatio).toString()):null;Yt=!!ii&&!!Vi,ii&&Ot.setConstantPatternPositions(ii,Vi)}E>0&&(Yt||Ot.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&oe.push("FILL_EXTRUSION_PATTERN_TRANSITION");const Et=l.getOrCreateProgram(at,{config:Ot,defines:wt?we:oe,overrideFog:At});if(l.terrain&&l.terrain.setupElevationDraw(ht,Et,{useMeterToDem:!0}),!lt.centroidVertexBuffer){const Qt=Et.attributes.a_centroid_pos;Qt!==void 0&&T.vertexAttrib2f(Qt,0,0)}!_e&&ze&&ze.setupShadows(ht.tileID.toUnwrapped(),Et,"vector-tile"),D&&(l.context.activeTexture.set(T.TEXTURE0),ht.imageAtlasTexture&&ht.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Ot.updatePaintBuffers());const Kt=n.paint.get("fill-extrusion-vertical-gradient"),ti=1/lt.tileToMeter;let vi;if(_e&&ze){if(Ec(ht.tileID,lt.maxHeight,l))continue;const Qt=ze.calculateShadowPassMatrixFromTile(ht.tileID.toUnwrapped());vi=Dd(Qt,X,ti,Ie,Me,Ue)}else{const Qt=l.translatePosMatrix(Qe.expandedProjMatrix,ht,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),ni=S.projection.createInversionMatrix(S,Qe.canonical);vi=D?sa(Qt,l,Kt,z,N,X,ti,Qe,ht,ee,Me,Ue,Y,K,ni,fe,Ie,E):Bh(Qt,l,Kt,z,N,X,ti,Qe,ee,Me,Ue,Y,K,ni,fe,Ie,se,Ze)}l.uploadCommonUniforms(x,Et,Qe.toUnwrapped(),null,me);let Dt=lt.segments;if(S.projection.name==="mercator"&&!_e&&(Dt=lt.getVisibleSegments(ht.tileID,l.terrain,l.transform.getFrustum(0)),!Dt.get().length))continue;if(dt)if(_e)for(const Qt of Dt.get())dt.numRenderedVerticesInShadowPass+=Qt.primitiveLength;else for(const Qt of Dt.get())dt.numRenderedVerticesInTransparentPass+=Qt.primitiveLength;const Jt=[];(l.terrain||y)&&Jt.push(lt.centroidVertexBuffer),ie&&Jt.push(lt.layoutVertexExtBuffer),xe&&Jt.push(lt.wallVertexBuffer),Et.draw(l,x.gl.TRIANGLES,d,p,m,Le,vi,n.id,lt.layoutVertexBuffer,lt.indexBuffer,Dt,n.paint,l.transform.zoom,Ot,Jt)}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1)}class bo{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function an(l,t,n,c,d,p,m,y,x,T,S,M,E,C,D,z,F,L,N,j){const q=t.context,X=q.gl,ee=t.transform,ie=t.transform.zoom,Y=[],K=l.translate,J=l.translateAnchor,fe=l.edgeRadius,se=Qn(t,l.cutoffFadeRange);S==="clear"?(Y.push("CLEAR_SUBPASS"),j&&(Y.push("CLEAR_FROM_TEXTURE"),q.activeTexture.set(X.TEXTURE0),j.bind(X.LINEAR,X.CLAMP_TO_EDGE))):S==="sdf"&&Y.push("SDF_SUBPASS"),L&&Y.push("HAS_CENTROID"),se.shouldRenderCutoff&&Y.push("RENDER_CUTOFF");const Ie=(xe,Me,Ue,me,oe)=>{const we=Me.programConfigurations.get(c.id),_e=t.isTileAffectedByFog(xe),ze=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:we,defines:Y,overrideFog:_e}),Re=((Ze,at,dt,Qe,ht,lt,wt,At,Ot,Yt,Et)=>({u_matrix:at,u_opacity:dt,u_ao_pass:Qe?1:0,u_meter_to_tile:ht,u_ao:lt,u_flood_light_intensity:wt,u_flood_light_color:At,u_attenuation:Ot,u_edge_radius:Yt,u_fb:0,u_fb_size:Et,u_dynamic_offset:1}))(0,me,M,T,oe,[E,C*oe],D,z,F,ie>=17?0:fe*oe,j?j.size[0]:0),Le=[];L&&Le.push(Me.hiddenByLandmarkVertexBuffer),t.uploadCommonUniforms(q,ze,xe.toUnwrapped(),null,se),ze.draw(t,q.gl.TRIANGLES,p,m,y,x,Re,c.id,Me.vertexBuffer,Me.indexBuffer,Ue,c.paint,ie,we,Le)};for(const xe of d){const Me=n.getTile(xe),Ue=Me.getBucket(c);if(!Ue||Ue.projection.name!==ee.projection.name||!Ue.groundEffect||Ue.groundEffect&&!Ue.groundEffect.hasData())continue;const me=Ue.groundEffect,oe=1/Ue.tileToMeter;{const we=t.translatePosMatrix(xe.projMatrix,Me,K,J),_e=me.getDefaultSegment();Ie(xe,me,_e,we,oe)}if(N)for(let we=0;we<4;we++){const _e=s.e3[we](xe),ze=n.getTile(_e);if(!ze)continue;const Re=ze.getBucket(c);if(!Re||Re.projection.name!==ee.projection.name||!Re.groundEffect||Re.groundEffect&&!Re.groundEffect.hasData())continue;const Le=Re.groundEffect;let Ze,at;we===0?(Ze=[-s.aj,0,0],at=1):we===1?(Ze=[s.aj,0,0],at=0):we===2?(Ze=[0,-s.aj,0],at=3):(Ze=[0,s.aj,0],at=2);const dt=Le.regionSegments[at];if(!dt)continue;const Qe=new Float32Array(16);s.bo(Qe,xe.projMatrix,Ze),Ie(xe,Le,dt,t.translatePosMatrix(Qe,Me,K,J),oe)}}}
2760function gt(l,t,n,c,d,p,m){c.centroidVertexArray.length===0&&c.createCentroidsBuffer();const y=p?p.findDEMTileFor(n):null;if(!(y&&y.dem||m))return;p&&y&&y.dem&&c.selfDEMTileTimestamp!==y.dem._timestamp&&(c.borderDoneWithNeighborZ=[-1,-1,-1,-1],c.selfDEMTileTimestamp=y.dem._timestamp);const x=L=>new s.P(Math.ceil((L+s.e7)*s.e8),0),T=L=>{const N=t.getSource().minzoom,j=X=>{const ee=t.getTileByID(X);if(ee&&ee.hasData())return ee.getBucket(d)},q=[0,-1,1];for(const X of q){if(L.overscaledZ+X<N)continue;const ee=j(L.calculateScaledKey(L.overscaledZ+X));if(ee)return ee}},S=[0,0,0],M=(L,N)=>(S[0]=Math.min(L.min.y,N.min.y),S[1]=Math.max(L.max.y,N.max.y),S[2]=s.aj-N.min.x>L.max.x?N.min.x-s.aj:L.max.x,S),E=(L,N)=>(S[0]=Math.min(L.min.x,N.min.x),S[1]=Math.max(L.max.x,N.max.x),S[2]=s.aj-N.min.y>L.max.y?N.min.y-s.aj:L.max.y,S),C=[(L,N)=>M(L,N),(L,N)=>M(N,L),(L,N)=>E(L,N),(L,N)=>E(N,L)],D=(L,N,j,q,X,ee,ie)=>{if(!p)return 0;const Y=[[ee?j:L,ee?L:j,0],[ee?j:N,ee?N:j,0]],K=ie<0?s.aj+ie:ie,J=[ee?K:(L+N)/2,ee?(L+N)/2:K,0];return j===0&&ie<0||j!==0&&ie>0?p.getForTilePoints(X,[J],!0,q):Y.push(J),p.getForTilePoints(n,Y,!0,y),Math.max(Y[0][2],Y[1][2],J[2])/p.exaggeration()};for(let L=0;L<4;L++){const N=c.borderFeatureIndices[L];if(N.length===0)continue;const j=s.e3[L](n),q=T(j);if(!(q&&q instanceof s.e4))continue;const X=p?p.findDEMTileFor(j):null;if(!(X&&X.dem||m)||(p&&X&&X.dem&&c.borderDEMTileTimestamp[L]!==X.dem._timestamp&&(c.borderDoneWithNeighborZ[L]=-1,c.borderDEMTileTimestamp[L]=X.dem._timestamp),c.borderDoneWithNeighborZ[L]===q.canonical.z))continue;q.centroidVertexArray.length===0&&q.createCentroidsBuffer();const ee=(L<2?1:5)-L,ie=q.borderDoneWithNeighborZ[ee]!==c.canonical.z,Y=q.borderFeatureIndices[ee];let K=0;if(c.canonical.z!==q.canonical.z){for(const J of N)c.showCentroid(c.featuresOnBorder[J]);if(ie)for(const J of Y)q.showCentroid(q.featuresOnBorder[J]);c.borderDoneWithNeighborZ[L]=q.canonical.z,q.borderDoneWithNeighborZ[ee]=c.canonical.z}for(const J of N){const fe=c.featuresOnBorder[J],se=c.centroidData[fe.centroidDataIndex],Ie=fe.borders[L];let xe;for(;K<Y.length;){xe=q.featuresOnBorder[Y[K]];const Me=xe.borders[ee];if(Me[1]>Ie[0]+3||Me[0]>Ie[0]-3)break;q.showCentroid(xe),K++}if(xe&&K<Y.length){const Me=K;let Ue=0;for(;!(xe.borders[ee][0]>Ie[1]-3)&&(Ue++,++K!==Y.length);)xe=q.featuresOnBorder[Y[K]];xe=q.featuresOnBorder[Y[Me]];let me=!1;if(Ue>=1){const _e=xe.borders[ee];Math.abs(Ie[0]-_e[0])<3&&Math.abs(Ie[1]-_e[1])<3&&(Ue=1,me=!0,K=Me+1)}else if(Ue===0){c.showCentroid(fe);continue}const oe=q.centroidData[xe.centroidDataIndex];m&&me&&(((z=se).flags|(F=oe).flags)&s.e6?(z.flags|=s.e6,F.flags|=s.e6):(z.flags&=~s.e6,F.flags&=~s.e6));const we=fe.intersectsCount()>1||xe.intersectsCount()>1;if(Ue>1)K=Me,se.centroidXY=oe.centroidXY=new s.P(0,0);else if(X&&X.dem&&!we){const _e=C[L](se,oe),ze=L%2?s.aj-1:0,Re=D(_e[0],Math.min(s.aj-1,_e[1]),ze,X,j,L<2,_e[2]);se.centroidXY=oe.centroidXY=x(Re)}else we?se.centroidXY=oe.centroidXY=new s.P(0,0):(se.centroidXY=c.encodeBorderCentroid(fe),oe.centroidXY=q.encodeBorderCentroid(xe));c.writeCentroidToBuffer(se),q.writeCentroidToBuffer(oe)}else c.showCentroid(fe)}c.borderDoneWithNeighborZ[L]=q.canonical.z,q.borderDoneWithNeighborZ[ee]=c.canonical.z}var z,F;(c.needsCentroidUpdate||!c.centroidVertexBuffer&&c.centroidVertexArray.length!==0)&&c.uploadCentroid(l)}const Yh=[1,0,0],Mf=[0,1,0],Cf=[0,0,1];function Ec(l,t,n){const c=n.transform,d=n.shadowRenderer;if(!d)return!0;const p=l.toUnwrapped(),m=c.tileSize*d._cascades[n.currentShadowCascade].scale;let y=t;if(c.elevation){const z=c.elevation.getMinMaxForTile(l);z&&(y+=z.max)}const x=[...d.shadowDirection];x[2]=-x[2];const T=d.computeSimplifiedTileShadowVolume(p,y,m,x);if(!T)return!1;const S=[Yh,Mf,Cf,x,[x[0],0,x[2]],[0,x[1],x[2]]],M=c.projection.name==="globe",E=c.scaleZoom(m),C=s.cy.fromInvProjectionMatrix(c.invProjMatrix,c.worldSize,E,!M),D=d.getCurrentCascadeFrustum();return C.intersectsPrecise(T.vertices,T.planes,S)===0||D.intersectsPrecise(T.vertices,T.planes,S)===0}function Ic(l){const{painter:t,source:n,layer:c,coords:d}=l,p=l.defines,m=t.context,y=t.renderPass==="shadow",x=t.renderPass==="light-beam",T=t.shadowRenderer;let S;T&&(S=p.concat(["SHADOWS_SINGLE_CASCADE"]));const M=s.e9(t.transform.center.lat,t.transform.zoom);for(const E of d){const C=n.getTile(E),D=C.getBucket(c);if(!D)continue;let z=!1;T&&(z=T.getMaxCascadeForTile(E.toUnwrapped())===0);const F=D.programConfigurations.get(c.id);let L,N,j=t.translatePosMatrix(E.expandedProjMatrix,C,[0,0],"map");if(j=s.cP(s.bz(),j,[1,1,l.verticalScale]),y&&T){if(Ec(C.tileID,D.maxHeight*M,t))continue;let q=T.calculateShadowPassMatrixFromTile(C.tileID.toUnwrapped());q=s.cP(s.bz(),q,[1,1,l.verticalScale]),N=Od(q),L=t.getOrCreateProgram("buildingDepth",{config:F,defines:z?S:p,overrideFog:!1})}else if(x)L=t.getOrCreateProgram("buildingBloom",{config:F,defines:z?S:p,overrideFog:!1}),N=Vh(j);else{const q=t.transform.calculatePosMatrix(E.toUnwrapped(),t.transform.worldSize);s.cP(q,q,[1,1,l.verticalScale]);const X=s.bz();s.cP(X,q,[1,-1,1/M]),s.bi(X,X),s.ea(X,X),N=Nh(j,X),L=t.getOrCreateProgram("building",{config:F,defines:z?S:p,overrideFog:!1}
vendor: 16,384 bytes, line 2760
2760),T&&T.setupShadowsFromMatrix(q,L,!0)}if(t.uploadCommonUniforms(m,L,E.toUnwrapped(),null,null),x){const q=D.bloomGeometry;L.draw(t,m.gl.TRIANGLES,l.depthMode,xt.disabled,l.blendMode,mt.disabled,N,c.id,q.layoutVertexBuffer,q.indexBuffer,q.segmentsBucket,c.paint,t.transform.zoom,F,[q.layoutAttenuationBuffer,q.layoutColorBuffer])}else L.draw(t,m.gl.TRIANGLES,l.depthMode,xt.disabled,l.blendMode,y?mt.disabled:mt.backCW,N,c.id,D.layoutVertexBuffer,D.indexBuffer,D.segments,c.paint,t.transform.zoom,F,[D.layoutNormalBuffer,D.layoutColorBuffer])}}function Hd(l){return[l[0]*s.eb,l[1]*s.eb,l[2]*s.eb,0]}function Ac(l,t,n,c,d,p,m,y,x){const T=c.getSource(),S=n.globeSharedBuffers;if(!S)return;let M,E,C;if(t&&(M=c.getTile(t)),T instanceof s.aP?(E=T.texture,C=s.dE(0,0,n.transform)):M&&t&&(E=M.texture,C=s.dE(t.canonical.z,t.canonical.x,n.transform)),!E||!C)return;l||(C=s.cP(s.bz(),C,[1,-1,1]));const D=n.context,z=D.gl,F=d.paint.get("raster-resampling")==="nearest"?z.NEAREST:z.LINEAR,L=n.colorModeForDrapableLayerRenderPass(p),N=m.defines;N.push("GLOBE_POLES");const j=new it(z.LEQUAL,it.ReadWrite,n.depthRangeFor3D),q=Float32Array.from(n.transform.expandedFarZProjMatrix),X=Float32Array.from(s.bh(s.dD(new s.cA(0,0,0))));n.terrain&&n.terrain.prepareDrawTile(),D.activeTexture.set(z.TEXTURE0),E.bind(F,z.CLAMP_TO_EDGE),D.activeTexture.set(z.TEXTURE1),E.bind(F,z.CLAMP_TO_EDGE),"useMipmap"in E&&D.extTextureFilterAnisotropic&&n.transform.pitch>20&&z.texParameterf(z.TEXTURE_2D,D.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,D.extTextureFilterAnisotropicMax);const[ee,ie,Y,K]=t?S.getPoleBuffers(t.canonical.z,!1):S.getPoleBuffers(0,!0),J=d.paint.get("raster-elevation");let fe;l?(fe=ee,n.renderDefaultNorthPole=J!==0):(fe=ie,n.renderDefaultSouthPole=J!==0);const se=Hd(m.mix),Ie=((Me,Ue,me,oe,we,_e,ze,Re,Le,Ze,at,dt,Qe)=>jh(Me,Ue,me,new Float32Array(16),new Float32Array(9),[0,0],oe,[0,0],[0,0,0,0],1,{opacity:1,mix:0},_e,[0,0],Re,2,Ze,at,dt,1,0,Qe))(q,X,C,s.ah(n.transform.zoom),0,d,0,J,0,se,m.offset,m.range,p),xe=n.getOrCreateProgram("raster",{defines:N});n.uploadCommonUniforms(D,xe,null),xe.draw(n,z.TRIANGLES,j,x,L,y,Ie,d.id,fe,Y,K)}function Pf(l){const t=l._nearZ,n=l.projection.farthestPixelDistance(l),c=n-t,d=.2*l.height,p=t+d;return[t,n,(p-d-t)/c,(p-t)/c]}function zf(l,t,n,c){if(l)return t instanceof ko&&l instanceof Us?t.getTextureDescriptor(l,n,!0):{texture:l.texture,mix:Hd(c.mix),offset:c.offset,buffer:0,tileSize:1}}var pn=s.ec([{name:"a_index",type:"Int16",components:1}]);class Kh{constructor(t,n,c,d){const p={width:c[0],height:c[1],data:null},m=t.gl;this.targetColorTexture=new s.T(t,p,m.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new s.T(t,p,m.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(n,d),this.lastInvalidatedAt=0}updateParticleTexture(t,n){if(this.particleTextureDimension===n.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const c=this.context.gl,d=n.width*n.height;this.particleTexture0=new s.T(this.context,n,c.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new s.T(this.context,n,c.RGBA8,{premultiply:!1,useMipmap:!1});const p=new s.ed;p.reserve(d);for(let m=0;m<d;m++)p.emplaceBack(m);this.particleIndexBuffer=this.context.createVertexBuffer(p,pn.members,!0),this.particleSegment=s.bd.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=n.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=s.q.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function Wr(l,t,n){if(!l)return null;const c=t.getTextureDescriptor(l,n,!0);if(!c)return null;let{texture:d,mix:p,offset:m,tileSize:y,buffer:x,format:T}=c;if(!d||!T)return null;let S=!1;return T==="uint32"&&(S=!0,p[3]=0,p=xc(s.ee,p,[0,n.paint.get("raster-particle-max-speed")]),m=$o(s.ee,m,[0,n.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[x/(y+2*x),y/(y+2*x)],tileSize:y,scalarData:S,scale:p,offset:m,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function Jo(l){const t=l._nearZ,n=l.projection.farthestPixelDistance(l),c=n-t,d=.2*l.height,p=t+d;return[t,n,(p-d-t)/c,(p-t)/c]}const $d=new s.am(1,0,0,1),Jh=new s.am(0,1,0,1),Qh=new s.am(0,0,1,1),eu=new s.am(1,0,1,1),Zd=new s.am(0,1,1,1);function eo(l,t,n,c,d,p){for(let m=0;m<n.length;m++)if(d){const T=new s.am(c.r*.8,c.g*.8,c.b*.8,1);fi(l,t,n[m],c,-1,-1,p),fi(l,t,n[m],c,-1,1,p),fi(l,t,n[m],c,1,1,p),fi(l,t,n[m],c,1,-1,p),fi(l,t,n[m],T,0,0,p)}else fi(l,t,n[m],c,0,0,p)}function fi(l,t,n,c,d,p,m){const y=l.context,x=l.transform,T=y.gl,S=x.projection.name==="globe",M=S?["PROJECTION_GLOBE_VIEW"]:[];let E=s.bw(n.projMatrix);if(S&&s.ah(x.zoom)>0){const se=s.bg(n.canonical,x),Ie=s.ef(se);E=s.az(new Float32Array(16),x.globeMatrix,Ie),s.az(E,x.projMatrix,E)}const C=s.bz();C[12]+=2*d/(s.q.devicePixelRatio*x.width),C[13]+=2*p/(s.q.devicePixelRatio*x.height),s.az(E,C,E);const D=l.getOrCreateProgram("debug",{defines:M}),z=t.getTileByID(n.key);l.terrain&&l.terrain.setupElevationDraw(z,D);const F=it.disabled,L=xt.disabled,N=l.colorModeForRenderPass(),j="$debug";y.activeTexture.set(T.TEXTURE0),l.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),S?z._makeGlobeTileDebugBuffers(l.context,x):z._makeDebugTileBoundsBuffers(l.context,x.projection);const q=z._tileDebugBuffer||l.debugBuffer,X=z._tileDebugIndexBuffer||l.debugIndexBuffer,ee=z._tileDebugSegments||l.debugSegments;if(D.draw(l,T.LINE_STRIP,F,L,N,mt.disabled,Uh(E,c.toPremultipliedRenderColor(null)),j,q,X,ee,null,null,null,[z._globeTileDebugBorderBuffer]),m){const se=z.latestRawTileData,Ie=Math.floor((se&&se.byteLength||0)/1024);let xe=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(xe+=` => ${n.overscaledZ}`),xe+=` ${z.state}`,xe+=` ${Ie}kb`,function(Me,Ue){Me.initDebugOverlayCanvas();const me=Me.debugOverlayCanvas,oe=Me.context.gl,we=Me.debugOverlayCanvas.getContext("2d");we.clearRect(0,0,me.width,me.height),we.shadowColor="white",we.shadowBlur=2,we.lineWidth=1.5,we.strokeStyle="white",we.textBaseline="top",we.font="bold 36px Open Sans, sans-serif",we.fillText(Ue,5,5),we.strokeText(Ue,5,5),Me.debugOverlayTexture.update(me),Me.debugOverlayTexture.bind(oe.LINEAR,oe.CLAMP_TO_EDGE)}(l,xe)}const ie=t.getTile(n).tileSize,Y=512/Math.min(ie,512)*(n.overscaledZ/x.zoom)*.5,K=z._tileDebugTextBuffer||l.debugBuffer,J=z._tileDebugTextIndexBuffer||l.quadTriangleIndexBuffer,fe=z._tileDebugTextSegments||l.debugSegments;D.draw(l,T.TRIANGLES,F,L,Pt.alphaBlended,mt.disabled,Uh(E,s.am.transparent.toPremultipliedRenderColor(null),Y),j,K,J,fe,null,null,null,[z._globeTileDebugTextBuffer])}function gl(l,t,n,c){yl(l,0,t+n/2,l.transform.width,n,c)}function Mc(l,t,n,c){yl(l,t-n/2,0,n,l.transform.height,c)}function yl(l,t,n,c,d,p){const m=l.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*s.q.devicePixelRatio,n*s.q.devicePixelRatio,c*s.q.devicePixelRatio,d*s.q.devicePixelRatio),m.clear({color:p}),y.disable(y.SCISSOR_TEST)}const Wd=s.ec([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Xd}=Wd;function Qo(l,t,n,c){l.emplaceBack(t,n,c)}class As{constructor(t){this.vertexArray=new s.eg,this.indices=new s.a_,Qo(this.vertexArray,-1,-1,1),Qo(this.vertexArray,1,-1,1),Qo(this.vertexArray,-1,1,1),Qo(this.vertexArray,1,1,1),Qo(this.vertexArray,-1,-1,-1),Qo(this.vertexArray,1,-1,-1),Qo(this.vertexArray,-1,1,-1),Qo(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=t.createVertexBuffer(this.vertexArray,Xd),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=s.bd.simpleSegment(0,0,36,12)}}function Wn(l,t,n,c,d,p){const m=l.context.gl,y=t.paint.get("sky-atmosphere-color"),x=t.paint.get("sky-atmosphere-halo-color"),T=t.paint.get("sky-atmosphere-sun-intensity"),S=((M,E,C,D,z)=>({u_matrix_3f:M,u_sun_direction:E,u_sun_intensity:C,u_color_tint_r:[D.r,D.g,D.b,D.a],u_color_tint_m:[z.r,z.g,z.b,z.a],u_luminance:5e-5}))(s.ei(s.dJ(),c),d,T,y.toPremultipliedRenderColor(null),x.toPremultipliedRenderColor(null));m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+p,t.skyboxTexture,0),n.draw(l,m.TRIANGLES,it.disabled,xt.disabled,Pt.unblended,mt.frontCW,S,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const Ge=s.ec([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Je{constructor(t){const n=new s.ej;n.emplaceBack(-1,1,1,0,0),n.emplaceBack(1,1,1,1,0),n.emplaceBack(1,-1,1,1,1),n.emplaceBack(-1,-1,1,0,1);const c=new s.a_;c.emplaceBack(0,1,2),c.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(n,Ge.members),this.indexBuffer=t.createIndexBuffer(c),this.segments=s.bd.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const la=s.ec([{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_fade_opacity",components:1}]);class Yi{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class ue{constructor(t){this.colorModeAlphaBlendedWriteRGB=new Pt([1,ys,1,ys],s.am.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Pt([1,0,1,0],s.am.transparent,[!1,!1,!1,!0]),this.params=new Yi,this.updateNeeded=!0,t.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),t.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),t.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),t.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(t){const n=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Je(n);const c=this.params.sizeRange,d=this.params.intensityRange,p=function(S){const M=s.el(30),E=[];for(let C=0;C<S;++C){const D=2*Math.PI*M(),z=Math.acos(1-2*M())-.5*Math.PI;E.push(s.d2(Math.cos(z)*Math.cos(D),Math.cos(z)*Math.sin(D),Math.sin(z)))}return E}(this.params.starsCount),m=s.el(300),y=new s.ek,x=new s.a_;let T=0;for(let S=0;S<p.length;++S){const M=s.c1([],p[S],200),E=Math.max(0,1+.01*c*(1*m()-.5)),C=Math.max(0,1+.01*d*(1*m()-.5));y.emplaceBack(M[0],M[1],M[2],-1,-1,E,C),y.emplaceBack(M[0],M[1],M[2],1,-1,E,C),y.emplaceBack(M[0],M[1],M[2],1,1,E,C),y.emplaceBack(M[0],M[1],M[2],-1,1,E,C),x.emplaceBack(T+0,T+1,T+2),x.emplaceBack(T+0,T+2,T+3),T+=4}this.starsVx=n.createVertexBuffer(y,la.members),this.starsIdx=n.createIndexBuffer(x),this.starsSegments=s.bd.simpleSegment(0,0,y.length,x.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(t,n){const c=t.context,d=c.gl,p=t.transform,m=new it(d.LEQUAL,it.ReadOnly,[0,1]),y=s.ah(p.zoom),x=t.style.getLut(n.scope),T=n.properties.get("color-use-theme")==="none",S=n.properties.get("color").toNonPremultipliedRenderColor(T?null:x).toArray01(),M=n.properties.get("high-color-use-theme")==="none",E=n.properties.get("high-color").toNonPremultipliedRenderColor(M?null:x).toArray01(),C=n.properties.get("space-color-use-theme")==="none",D=n.properties.get("space-color").toNonPremultipliedRenderColor(C?null:x).toArray01(),z=5e-4,F=s.em(n.properties.get("horizon-blend"),0,1,z,.25),L=s.dy(t,c,p)&&F===z?p.worldSize/(2*Math.PI*1.025)-1:p.globeRadius,N=t.frameCounter/1e3%1,j=s.ae(p.globeCenterInViewSpace),q=Math.sqrt(Math.pow(j,2)-Math.pow(L,2)),X=Math.acos(q/j),ee=ie=>{const Y=p.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];ie&&Y.push("ALPHA_PASS");const K=t.getOrCreateProgram("globeAtmosphere",{defines:Y}),J=((se,Ie,xe,Me,Ue,me,oe,we,_e,ze,Re,Le)=>({u_frustum_tl:se,u_frustum_tr:Ie,u_frustum_br:xe,u_frustum_bl:Me,u_horizon:Ue,u_transition:me,u_fadeout_range:oe,u_color:we,u_high_color:_e,u_space_color:ze,u_temporal_offset:Re,u_horizon_angle:Le}))(p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.frustumCorners.horizon,y,F,S,E,D,N,X);t.uploadCommonUniforms(c,K);const fe=this.atmosphereBuffer;fe&&K.draw(t,d.TRIANGLES,m,xt.disabled,ie?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,mt.backCW,J,ie?"atmosphere_glow_alpha":"atmosphere_glow",fe.vertexBuffer,fe.indexBuffer,fe.segments)};ee(!1),ee(!0)}drawStars(t,n){const c=s.ay(n.properties.get("star-intensity"),0,1);if(c===0)return;const d=t.context,p=d.gl,m=t.transform,y=t.getOrCreateProgram("stars"),x=s.c3([]);s.c5(x,x,-m._pitch),s.c4(x,x,-m.angle),s.c5(x,x,s.al(m._center.lat)),s.en(x,x,-s.al(m._center.lng));const T=s.c8(new Float32Array(16),x),S=s.az([],m.starsProjMatrix,T),M=s.ei([],T),E=s.eo([],M),C=[0,1,0];s.dL(C,C,E),s.c1(C,C,this.params.sizeMultiplier);const D=[1,0,0];s.dL(D,D,E),s.c1(D,D,this.params.sizeMultiplier);const z=(F=C,L=D,N=c,{u_matrix:Float32Array.from(S),u_up:F,u_right:L,u_intensity_multiplier:N});var F,L,N;t.uploadCommonUniforms(d,y),this.starsVx&&this.starsIdx&&y.draw(t,p.TRIANGLES,it.disabled,xt.disabled,this.colorModeAlphaBlendedWriteRGB,mt.disabled,z,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class Yd{constructor(){this.visibleTiles=[]}updateBorders(t,n){const c=[],d=[],p=t._getRenderableCoordinates(!1,!0);for(const x of p){const T=t.getTile(x);if(!T.hasData())continue;const S=T.getBucket(n);S&&(S.isEmpty()||(c.push(x.key),d.push({bucket:S,tileID:x.canonical})))}let m=c.length!==this.visibleTiles.length;if(!m){c.sort();for(let x=0;x<c.length;x++)if(c[x]!==this.visibleTiles[x]){m=!0;break}}if(!m)return;const y=new Set;this.visibleTiles=c,d.sort((x,T)=>x.tileID.z-T.tileID.z||x.tileID.x-T.tileID.x||x.tileID.y-T.tileID.y);for(const x of d){const T=new Array,S=new Array,M=x.bucket;for(const E of M.featuresOnBorder)y.has(E.featureId)?S.push(E.footprintIndex):(y.add(E.featureId),T.push(E.footprintIndex));M.updateFootprintHiddenFlags(T,s.ep,!1),M.updateFootprintHiddenFlags(S,s.ep,!0)}}}function xl(l,t){const n=[...l],c=t.cameraWorldSizeForFog/t.worldSize,d=s.bx([]);return s.cP(d,d,[c,c,1]),s.az(n,d,n),s.az(n,t.worldToFogMatrix,n),n}function vl(l,t,n,c,d){const p=n.material,m=c.context,{baseColorTexture:y,metallicRoughnessTexture:x}=p.pbrMetallicRoughness,{normalTexture:T,occlusionTexture:S,emissionTexture:M}=p;function E(D,z,F){if(D&&(l.push(z),m.activeTexture.set(m.gl.TEXTURE0+F),D.gfxTexture)){const{minFilter:L,magFilter:N,wrapS:j,wrapT:q}=D.sampler;D.gfxTexture.bindExtraParam(L,N,j,q)}}E(y,"HAS_TEXTURE_u_baseColorTexture",Zr.BaseColor),E(x,"HAS_TEXTURE_u_metallicRoughnessTexture",Zr.MetallicRoughness),E(T,"HAS_TEXTURE_u_normalTexture",Zr.Normal),E(S,"HAS_TEXTURE_u_occlusionTexture",Zr.Occlusion),E(M,"HAS_TEXTURE_u_emissionTexture",Zr.Emission),d&&(d.texture||(d.texture=new s.et(c.context,d.image,[d.image.height,d.image.height,d.image.height],m.gl.RGBA8)),m.activeTexture.set(m.gl.TEXTURE0+Zr.LUT),d.texture&&d.texture.bind(m.gl.LINEAR,m.gl.CLAMP_TO_EDGE),l.push("APPLY_LUT_ON_GPU")),n.texcoordBuffer&&(l.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(n.texcoordBuffer)),n.colorBuffer&&(l.push(n.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(n.colorBuffer)),n.normalBuffer&&(l.push("HAS_ATTRIBUTE_a_normal_3f"),t.push(n.normalBuffer)),n.pbrBuffer&&(l.push("HAS_ATTRIBUTE_a_pbr"),l.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),t.push(n.pbrBuffer)),p.alphaMode!=="OPAQUE"&&p.alphaMode!=="MASK"||l.push("UNPREMULT_TEXTURE_IN_SHADER"),p.defined||l.push("DIFFUSE_SHADED");const C=c.shadowRenderer;C&&(l.push("RENDER_SHADOWS","DEPTH_TEXTURE"),C.useNormalOffset&&l.push("NORMAL_OFFSET"))}function ca(l,t,n,c,d,p){const m=n.paint.
2760get("model-opacity").constantOr(1),y=t.context,x=new it(t.context.gl.LEQUAL,it.ReadWrite,t.depthRangeFor3D),T=t.transform,S=l.mesh,M=S.material,E=M.pbrMetallicRoughness,C=t.style.fog;let D;D=t.transform.projection.zAxisUnit==="pixels"?[...l.nodeModelMatrix]:s.az([],c.zScaleMatrix,l.nodeModelMatrix),s.az(D,c.negCameraPosMatrix,D);const z=s.bi([],D);s.ea(z,z);const F=n.paint.get("model-color-use-theme").constantOr("default")==="none",L=n.paint.get("model-emissive-strength").constantOr(0),N=qh(new Float32Array(l.worldViewProjection),new Float32Array(D),new Float32Array(z),null,t,m,E.baseColorFactor,M.emissiveFactor,E.metallicFactor,E.roughnessFactor,M,L,n),j={defines:[]},q=[],X=t.shadowRenderer;X&&(X.useNormalOffset=!1),vl(j.defines,q,S,t,F?null:n.lut);let ee=null;if(C){const K=xl(l.nodeModelMatrix,t.transform);if(ee=new Float32Array(K),T.projection.name!=="globe"){const J=S.aabb.min,fe=S.aabb.max,[se,Ie]=C.getOpacityForBounds(K,J[0],J[1],fe[0],fe[1]);j.overrideFog=se>=Pe||Ie>=Pe}}const ie=Qn(t,n.paint.get("model-cutoff-fade-range"));ie.shouldRenderCutoff&&j.defines.push("RENDER_CUTOFF");const Y=t.getOrCreateProgram("model",j);t.uploadCommonUniforms(y,Y,null,ee,ie),t.renderPass!=="shadow"&&X&&X.setupShadowsFromMatrix(l.nodeModelMatrix,Y),Y.draw(t,y.gl.TRIANGLES,x,d,p,S.material.doubleSided?mt.disabled:mt.backCCW,N,n.id,S.vertexBuffer,S.indexBuffer,S.segments,n.paint,t.transform.zoom,void 0,q)}function tu(l,t,n,c,d,p,m){let y;y=l.projection.name==="globe"?s.er(n,l):[...n],s.az(y,y,t.matrix);const x=s.az([],c,y);if(t.meshes)for(const T of t.meshes){if(T.material.alphaMode!=="BLEND"){m.push({mesh:T,depth:0,modelIndex:d,worldViewProjection:x,nodeModelMatrix:y});continue}const S=s.ad([],T.centroid,x);!l.isOrthographic&&S[2]<=0||p.push({mesh:T,depth:S[2],modelIndex:d,worldViewProjection:x,nodeModelMatrix:y})}if(t.children)for(const T of t.children)tu(l,T,n,c,d,p,m)}function Cc(l,t,n,c){const d=n.shadowRenderer;if(!d)return;const p=d.getShadowPassDepthMode(),m=d.getShadowPassColorMode(),y=d.calculateShadowPassMatrixFromMatrix(t),x=jd(y);n.getOrCreateProgram("modelDepth",{defines:n._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(n,n.context.gl.TRIANGLES,p,xt.disabled,m,mt.backCCW,x,c.id,l.vertexBuffer,l.indexBuffer,l.segments,c.paint,n.transform.zoom,void 0,void 0)}function ha(l,t,n){const c=t.updateZoomBasedPaintProperties(),d=function(p,m,y){let x,T,S,M=p.terrain?p.terrain.exaggeration():0;if(p.terrain&&M>0){const E=p.terrain,C=E.findDEMTileFor(y);C&&C.dem?x=s.eu.create(E,y,C):M=0}if(M===0&&(m.terrainElevationMin=0,m.terrainElevationMax=0),M===m.validForExaggeration&&(M===0||x&&x._demTile&&x._demTile.tileID===m.validForDEMTile.id&&x._dem._timestamp===m.validForDEMTile.timestamp))return!1;for(const E in m.instancesPerModel){const C=m.instancesPerModel[E];for(let D=0;D<C.instancedDataArray.length;++D){const z=(x?M*x.getElevationAt(0|C.instancedDataArray.float32[16*D],0|C.instancedDataArray.float32[16*D+1],!0,!0):0)+C.instancesEvaluatedElevation[D];C.instancedDataArray.float32[16*D+6]=z,T=T?Math.min(m.terrainElevationMin,z):z,S=S?Math.max(m.terrainElevationMax,z):z}}return m.terrainElevationMin=T||0,m.terrainElevationMax=S||0,m.validForExaggeration=M,m.validForDEMTile=x&&x._demTile?{id:x._demTile.tileID,timestamp:x._dem._timestamp}:{id:void 0,timestamp:0},!0}(l,t,n);(c||d)&&(t.uploaded=!1,t.upload(l.context))}const to={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new s.d6([0,0,0],[s.aj,s.aj,0])};function Rf(l,t){const n=1<<l.canonical.z,c=t.getFreeCameraOptions().position,d=t.elevation,p=l.canonical.x/n,m=(l.canonical.x+1)/n,y=l.canonical.y/n,x=(l.canonical.y+1)/n;let T=t._centerAltitude;if(d){const C=d.getMinMaxForTile(l);C&&C.max>T&&(T=C.max)}const S=s.ay(c.x,p,m)-c.x,M=s.ay(c.y,y,x)-c.y,E=s.cb(T,t.center.lat)-c.z;return t._zoomFromMercatorZ(Math.sqrt(S*S+M*M+E*E))}function iu(l,t,n,c,d,p,m){const y=l.context,x=l.renderPass==="shadow",T=l.shadowRenderer,S=x&&T?T.getShadowPassDepthMode():new it(y.gl.LEQUAL,it.ReadWrite,l.depthRangeFor3D),M=l.isTileAffectedByFog(p);if(n.meshes)for(const E of n.meshes){const C=["MODEL_POSITION_ON_GPU"],D=[];let z,F,L;c.instancedDataArray.length>20&&C.push("INSTANCED_ARRAYS");const N=Qn(l,t.paint.get("model-cutoff-fade-range"));if(N.shouldRenderCutoff&&C.push("RENDER_CUTOFF"),x&&T)z=l.getOrCreateProgram("modelDepth",{defines:C}),F=jd(m.shadowTileMatrix,m.shadowTileMatrix,Float32Array.from(n.matrix
2760)),L=T.getShadowPassColorMode();else{vl(C,D,E,l,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),z=l.getOrCreateProgram("model",{defines:C,overrideFog:M});const q=E.material,X=q.pbrMetallicRoughness,ee=t.paint.get("model-opacity").constantOr(1),ie=t.paint.get("model-emissive-strength").constantOr(0);F=qh(p.expandedProjMatrix,Float32Array.from(n.matrix),new Float32Array(16),null,l,ee,X.baseColorFactor,q.emissiveFactor,X.metallicFactor,X.roughnessFactor,q,ie,t,d),T&&(m.shadowUniformsInitialized?z.setShadowUniformValues(y,T.getShadowUniformValues()):(T.setupShadows(p.toUnwrapped(),z,"model-tile"),m.shadowUniformsInitialized=!0)),L=N.shouldRenderCutoff||ee<1||q.alphaMode!=="OPAQUE"?Pt.alphaBlended:Pt.unblended}l.uploadCommonUniforms(y,z,p.toUnwrapped(),null,N);const j=E.material.doubleSided?mt.disabled:mt.backCCW;if(c.instancedDataArray.length>20)D.push(c.instancedDataBuffer),z.draw(l,y.gl.TRIANGLES,S,xt.disabled,L,j,F,t.id,E.vertexBuffer,E.indexBuffer,E.segments,t.paint,l.transform.zoom,void 0,D,c.instancedDataArray.length);else{const q=x?"u_instance":"u_normal_matrix";for(let X=0;X<c.instancedDataArray.length;++X)F[q]=new Float32Array(c.instancedDataArray.arrayBuffer,64*X,16),z.draw(l,y.gl.TRIANGLES,S,xt.disabled,L,j,F,t.id,E.vertexBuffer,E.indexBuffer,E.segments,t.paint,l.transform.zoom,void 0,D)}}if(n.children)for(const E of n.children)iu(l,t,E,c,d,p,m)}const Pc=[1,-1,1];function ru(l,t,n,c){if(!n.modelManager)return!0;const d=n.modelManager;if(!n.shadowRenderer)return!0;const p=n.shadowRenderer,m=t.aabb;let y=!0,x=l.maxHeight;if(x===0){let S=0;for(const M in l.instancesPerModel){const E=d.getModel(M,c);E?S=Math.max(S,Math.max(Math.max(E.aabb.max[0],E.aabb.max[1]),E.aabb.max[2])):y=!1}x=l.maxScale*S*1.41+l.maxVerticalOffset,y&&(l.maxHeight=x)}m.max[2]=x,m.min[2]+=l.terrainElevationMin,m.max[2]+=l.terrainElevationMax,s.ad(m.min,m.min,t.tileMatrix),s.ad(m.max,m.max,t.tileMatrix);const T=m.intersects(p.getCurrentCascadeFrustum());return n.currentShadowCascade===0&&(l.isInsideFirstShadowMapFrustum=T===2),T===0}function Kd(l,t){const n=l.uniformValues.u_cutoff_params[0],c=l.uniformValues.u_cutoff_params[1],d=l.uniformValues.u_cutoff_params[2],p=l.uniformValues.u_cutoff_params[3];return c===n||p===d?1:s.ay(((t-n)/(c-n)-d)/(p-d),0,1)}function Jd(l,t,n,c){if(t.pitch<20)return 1;const d=t.getWorldToCameraMatrix();s.az(d,d,l);const p=s.bR(n.min[0],n.min[1],n.min[2],1);let m=s.aA(s.ev(),p,d),y=m,x=m;p[1]=n.max[1],m=s.aA(s.ev(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,p[0]=n.max[0],m=s.aA(s.ev(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,p[1]=n.min[1],m=s.aA(s.ev(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x;const T=s.ay(c[0],0,1),S=100*t.pixelsPerMeter*s.ay(c[1],0,1),M=s.ay(c[2],0,1),E=s.ew(s.ev(),y,x,T),C=Math.tan(.5*t.fovX),D=-E[2]*C;if(S===0)return E[1]<-Math.abs(D)?M:1;const z=(-Math.abs(D)-E[1])/S,F=(N,j,q)=>(1-q)*N+q*j,L=s.ay(F(1,M,z),M,1);return F(1,L,s.ay((t.pitch-20)/20,0,1))}class zc{}class bl{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,n,c){{const M=this._storage.get(n.id);if(M)return M.lastUsedFrameIdx=t,M.buf}const d=c.gl,p=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),m=new ArrayBuffer(p),y=new Int16Array(m);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(m));const x=new s.ey;for(let M=0;M<p/2;M+=3){const E=y[M],C=y[M+1],D=y[M+2];x.emplaceBack(E,C),x.emplaceBack(C,D),x.emplaceBack(D,E)}const T=c.bindVertexArrayOES.current,S=new zc;return S.buf=new Xo(c,x),S.lastUsedFrameIdx=t,this._storage.set(n.id,S),c.bindVertexArrayOES.set(T),S.buf}update(t){for(const[n,c]of this._storage)t-c.lastUsedFrameIdx>30&&(c.buf.destroy(),this._storage.delete(n))}destroy(){for(const[t,n]of this._storage)n.buf.destroy(),this._storage.delete(t)}}class ua{constructor(t){this.occluderSize=30,this.depthOffset=-1e-4,t.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),t.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const Qd=s.ec([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class Df{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class Vr{constructor(t,n){this.revealStart=11,this.revealRange=2,t.registerParameter(this,[...n,"Reveal"],"revealStart",{min:0,max:17,step:.05}
vendor: 8,772 bytes, line 2760
2760),t.registerParameter(this,[...n,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}const Lf=s.ec([{type:"Float32",name:"a_pos_2f",components:2}]);class wl{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,n){const c=t.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const m=new s.ez,y=new s.a_;m.emplaceBack(-1,-1),m.emplaceBack(1,-1),m.emplaceBack(1,1),m.emplaceBack(-1,1),y.emplaceBack(0,1,2),y.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(m,Lf.members),this.vignetteIdx=t.context.createIndexBuffer(y)}const d=s.bd.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,c);const m={u_vignetteShape:(p={vignetteShape:[n.start,n.range,Math.pow(10,n.fadePower)],vignetteColor:[n.color.r,n.color.g,n.color.b,n.color.a*n.strength]}).vignetteShape,u_vignetteColor:p.vignetteColor};c.draw(t,t.context.gl.TRIANGLES,it.disabled,xt.disabled,Pt.alphaBlended,mt.disabled,m,"vignette",this.vignetteVx,this.vignetteIdx,d)}var p}}class Ci{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,n){const c=t.getFreeCameraOptions().position,d=c.toAltitude(),p=c.toLngLat(),m=s.al(p.lng),y=s.al(p.lat),x=t.pixelsPerMeter/n,T=m*s.eB,S=s.eB*Math.log(Math.tan(Math.PI/4+y/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 M=-this._offsetYPrev+S,E=-this._elevationPrev+d;this._accumulatedOffsetX+=(-this._offsetXPrev+T)*x,this._accumulatedOffsetY+=M*x,this._accumulatedElevation+=E*x,this._offsetXPrev=T,this._offsetYPrev=S,this._elevationPrev=d}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function $t(l,t){return[-(l[0]-Math.floor(l[0]/t)*t),-(l[1]-Math.floor(l[1]/t)*t),-(l[2]-Math.floor(l[2]/t)*t)]}function nu(l){const t=s.el(1323123451230),n=[];for(let c=0;c<l;++c){const d=2*t()-1,p=2*t()-1,m=2*t()-1;n.push(s.d2(d,p,m))}return n}function ln(l,t,n,c,d){const p=s.ay((d-n)/(c-n),0,1);return(1-p)*l+p*t}class da{constructor(t){this._movement=new Ci,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new wl,this._ppmScaleFactor=t}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(t,n){const c=t.transform;this._movement.update(c,this._ppmScaleFactor);const d=c.starsProjMatrix,p=s.c3([]);s.c5(p,p,s.al(90)-c._pitch),s.c4(p,p,-c.angle);const m=s.c8(new Float32Array(16),p),y=s.eA(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),x=s.ea([],y),T=s.az([],x,m),S=Date.now()/1e3;return this._accumulatedTimeFromStart+=(S-this._prevTime)*n,this._prevTime=S,{projectionMatrix:d,modelviewMatrix:T}}}class pa extends da{constructor(t){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new Vr(t.tp,["Precipitation","Rain"]),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(t){const n=t.context;if(!this.particlesVx){const c=nu(this.particlesCount),d=new s.eC,p=new s.a_;let m=0;const y=s.el(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],S=[2*y()-1,y(),y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...S),d.emplaceBack(T[0],T[1],T[2],1,-1,...S),d.emplaceBack(T[0],T[1],T[2],1,1,...S),d.emplaceBack(T[0],T[1],T[2],-1,1,...S),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m+=4}this.particlesVx=n.createVertexBuffer(d,Qd.members),this.particlesIdx=n.createIndexBuffer(p)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.rain)return;const n=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},c=t.transform.zoom;if(n.revealStart>c)return;const d=ln(0,1,n.revealStart,n.revealStart+n.revealRange,c);if(!this.particlesVx||!this.particlesIdx)return;const p=structuredClone(this._params);let m=[-p.direction.x,p.direction.y,-100];s.au(m,m);const y=structuredClone(this._vignetteParams);y.strength*=d,p.overrideStyleParameters||(p.intensity=t.style.rain.state.density,p.timeFactor=t.style.rain.state.intensity,p.color=structuredClone(t.style.rain.state.color),m=structuredClone(t.style.rain.state.direction),p.screenThinning.intensity=t.style.rain.state.centerThinning,p.dropletSizeX=t.style.rain.state.dropletSize[0],p.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],p.distortionStrength=100*t.style.rain.state.distortionStrength,y.strength=1,y.color=structuredClone(t.style.rain.state.vignetteColor));const x=this.updateOnRender(t,p.timeFactor),T=t.context,S=T.gl,M=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new s.T(T,{width:t.width,height:t.height,data:null},S.RGBA8)),p.distortionStrength>0&&(T.activeTexture.set(S.TEXTURE0),this.screenTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),S.copyTexSubImage2D(S.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const E=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(T,E),T.activeTexture.set(S.TEXTURE0),this.screenTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const C=[p.color.r,p.color.g,p.color.b,p.color.a],D=(z,F)=>{const L=$t(this._movement.getPosition(),z),N=p.dropletSizeX,j=p.dropletSizeX*p.dropletSizeYScale,q=t.width/2,X=t.height/2,ee=ln(0,p.screenThinning.start,0,1,p.screenThinning.intensity),ie=ln(.001,p.screenThinning.range,0,1,p.screenThinning.intensity),Y=ln(0,p.screenThinning.particleOffset,0,1,p.screenThinning.intensity),K=(J={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:L,velocityConeAperture:p.velocityConeAperture,velocity:p.velocity,boxSize:z,rainDropletSize:[N,j],distortionStrength:p.distortionStrength,rainDirection:m,color:C,screenSize:[M.width,M.height],thinningCenterPos:[q,X],thinningShape:[ee,ie,Math.pow(10,p.screenThinning.fadePower)],thinningAffectedRatio:p.screenThinning.affectedRatio,thinningParticleOffset:Y,shapeDirectionalPower:p.shapeDirPower,shapeNormalPower:p.shapeNormalPower,mode:F?0:1},{u_modelview:Float32Array.from(J.modelview),u_projection:Float32Array.from(J.projection),u_time:J.time,u_cam_pos:J.camPos,u_texScreen:0,u_velocityConeAperture:J.velocityConeAperture,u_velocity:J.velocity,u_boxSize:J.boxSize,u_rainDropletSize:J.rainDropletSize,u_distortionStrength:J.distortionStrength,u_rainDirection:J.rainDirection,u_color:J.color,u_screenSize:J.screenSize,u_thinningCenterPos:J.thinningCenterPos,u_thinningShape:J.thinningShape,u_thinningAffectedRatio:J.thinningAffectedRatio,u_thinningParticleOffset:J.thinningParticleOffset,u_shapeDirectionalPower:J.shapeDirectionalPower,u_shapeNormalPower:J.shapeNormalPower,u_mode:J.mode});var J;const fe=Math.round(p.intensity*this.particlesCount),se=s.bd.simpleSegment(0,0,4*fe,2*fe);E.draw(t,S.TRIANGLES,it.disabled,xt.disabled,Pt.alphaBlended,mt.disabled,K,"rain_particles",this.particlesVx,this.particlesIdx,se)};p.distortionStrength>0&&D(p.boxSize,!0),D(p.boxSize,!1),this._vignette.draw(t,y)}}const Ms=s.ec([{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}]);class ou extends da{constructor(t){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new Vr(t.tp,["Precipitation","Snow"]),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const n=t.context;if(!this.particlesVx){const c=nu(this.particlesCount),d=new s.eD,p=new s.a_;let m=0;const y=s.el(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],S=y(),M=y(),E=y(),C=[x/c.length,S,M,E],D=[y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...C,...D),d.emplaceBack(T[0],T[1],T[2],1,-1,...C,...D),d.emplaceBack(T[0],T[1],T[2],1,1,...C,...D),d.emplaceBack(T[0],T[1],T[2],-1,1,...C,...D),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m
2760+=4}this.particlesVx=n.createVertexBuffer(d,Ms.members),this.particlesIdx=n.createIndexBuffer(p)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.snow)return;const n=structuredClone(this._params);let c=[-n.direction.x,n.direction.y,-100];s.au(c,c);const d=structuredClone(this._vignetteParams),p=n.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},m=t.transform.zoom;if(p.revealStart>m)return;const y=ln(0,1,p.revealStart,p.revealStart+p.revealRange,m);d.strength*=y,n.overrideStyleParameters||(n.intensity=t.style.snow.state.density,n.timeFactor=t.style.snow.state.intensity,n.color=structuredClone(t.style.snow.state.color),c=structuredClone(t.style.snow.state.direction),n.screenThinning.intensity=t.style.snow.state.centerThinning,n.billboardSize=2.79*t.style.snow.state.flakeSize,d.strength=1,d.color=structuredClone(t.style.snow.state.vignetteColor));const x=this.updateOnRender(t,n.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const T=t.context,S=T.gl,M=t.transform,E=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(T,E),((C,D,z)=>{const F=$t(this._movement.getPosition(),C),L=M.width/2,N=M.height/2,j=ln(0,z.screenThinning.start,0,1,z.screenThinning.intensity),q=ln(.001,z.screenThinning.range,0,1,z.screenThinning.intensity),X=ln(0,z.screenThinning.particleOffset,0,1,z.screenThinning.intensity),ee=(ie={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:F,velocityConeAperture:z.velocityConeAperture,velocity:z.velocity,horizontalOscillationRadius:z.horizontalOscillationRadius,horizontalOscillationRate:z.horizontalOscillationRate,boxSize:C,billboardSize:1*z.billboardSize,simpleShapeParameters:[z.shapeFadeStart,z.shapeFadePower],screenSize:[M.width,M.height],thinningCenterPos:[L,N],thinningShape:[j,q,Math.pow(10,z.screenThinning.fadePower)],thinningAffectedRatio:z.screenThinning.affectedRatio,thinningParticleOffset:X,color:[z.color.r,z.color.g,z.color.b,z.color.a],direction:c},{u_modelview:Float32Array.from(ie.modelview),u_projection:Float32Array.from(ie.projection),u_time:ie.time,u_cam_pos:ie.camPos,u_velocityConeAperture:ie.velocityConeAperture,u_velocity:ie.velocity,u_horizontalOscillationRadius:ie.horizontalOscillationRadius,u_horizontalOscillationRate:ie.horizontalOscillationRate,u_boxSize:ie.boxSize,u_billboardSize:ie.billboardSize,u_simpleShapeParameters:ie.simpleShapeParameters,u_screenSize:ie.screenSize,u_thinningCenterPos:ie.thinningCenterPos,u_thinningShape:ie.thinningShape,u_thinningAffectedRatio:ie.thinningAffectedRatio,u_thinningParticleOffset:ie.thinningParticleOffset,u_particleColor:ie.color,u_direction:ie.direction});var ie;const Y=Math.round(z.intensity*this.particlesCount),K=s.bd.simpleSegment(0,0,4*Y,2*Y);this.particlesVx&&this.particlesIdx&&E.draw(t,S.TRIANGLES,it.disabled,xt.disabled,Pt.alphaBlended,mt.disabled,ee,"snow_particles",this.particlesVx,this.particlesIdx,K)})(n.boxSize,0,n),this._vignette.draw(t,d)}}const su={symbol:function(l,t,n,c,d){if(l.renderPass!=="translucent")return;const p=xt.disabled,m=l.colorModeForRenderPass(),y=n.layout.get("text-variable-anchor"),x=n.layout.get("text-size-scale-range"),T=s.ay(l.scaleFactor,x[0],x[1]);y&&function(E,C,D,z,F,L,N,j){const q=C.transform,X=F==="map",ee=L==="map";for(const ie of E){const Y=z.getTile(ie),K=Y.getBucket(D);if(!K||!K.text||!K.text.segments.get().length)continue;const J=s.bH(K.textSizeData,q.zoom,j),fe=$l(ie,K.getProjection(),q),se=q.calculatePixelsToTileUnitsMatrix(Y),Ie=Ja(fe,Y.tileID.canonical,ee,X,q,K.getProjection(),se),xe=K.hasIconTextFit()&&K.hasIconData();J&&qd(K,X,ee,N,q,Ie,ie,Math.pow(2,q.zoom-Y.tileID.overscaledZ),J,xe)}}(c,l,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),d,T);const S=n.paint.get("icon-opacity").constantOr(1)!==0,M=n.paint.get("text-opacity").constantOr(1)!==0;n.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(S||M)?Xh(l,t,n,c,p,m):(S&&Xh(l,t,n,c,p,m,{onlyIcons:!0}),M&&Xh(l,t,n,c,p,m,{onlyText:!0})),t.map.showCollisionBoxes&&(Zh(l,t,n,c,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),Zh(l,t,n,c,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,n,c){if(l.renderPass!=="translucent")return;const d=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),y=n.layout.get("
vendor: 5,854 bytes, line 2760
2760circle-sort-key").constantOr(1)!==void 0,x=n.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const T=l.context,S=T.gl,M=l.transform,E=!(!l.terrain||!l.terrain.enabled),C=n.layout.get("circle-elevation-reference"),D=l.depthModeForSublayer(0,it.ReadOnly),z=new it(l.context.gl.LEQUAL,it.ReadOnly,l.depthRangeFor3D),F=C==="none"||E?D:z,L=xt.disabled,N=l.colorModeForDrapableLayerRenderPass(x),j=M.projection.name==="globe",q=[s.aD(M.center.lng),s.aH(M.center.lat)],X=[];for(let ie=0;ie<c.length;ie++){const Y=c[ie],K=t.getTile(Y),J=K.getBucket(n);if(!J||J.projection.name!==M.projection.name)continue;const fe=J.programConfigurations.get(n.id),se=J.layoutVertexBuffer,Ie=J.globeExtVertexBuffer,xe=J.indexBuffer,Me=s.dW(n),Ue=[Ie],me=l.isTileAffectedByFog(Y);j&&Me.push("PROJECTION_GLOBE_VIEW"),Me.push("DEPTH_D24"),l.terrain&&M.depthOcclusionForSymbolsAndCircles&&Me.push("DEPTH_OCCLUSION"),J.hasElevation&&!l.terrain&&(Me.push("ELEVATED_ROADS"),Ue.push(J.elevatedLayoutVertexBuffer));const oe=l.getOrCreateProgram("circle",{config:fe,defines:Me,overrideFog:me}),we=M.projection.createInversionMatrix(M,Y.canonical),_e={programConfiguration:fe,program:oe,layoutVertexBuffer:se,dynamicBuffers:Ue,indexBuffer:xe,uniformValues:s.dX(l,Y,K,we,q,n),tile:K};if(y){const ze=J.segments.get();for(const Re of ze)X.push({segments:new s.bd([Re]),sortKey:Re.sortKey,state:_e})}else X.push({segments:J.segments,sortKey:0,state:_e})}y&&X.sort((ie,Y)=>ie.sortKey-Y.sortKey);const ee={useDepthForOcclusion:M.depthOcclusionForSymbolsAndCircles};for(const ie of X){const{programConfiguration:Y,program:K,layoutVertexBuffer:J,dynamicBuffers:fe,indexBuffer:se,uniformValues:Ie,tile:xe}=ie.state,Me=ie.segments;l.terrain&&l.terrain.setupElevationDraw(xe,K,ee),l.uploadCommonUniforms(T,K,xe.tileID.toUnwrapped()),K.draw(l,S.TRIANGLES,F,L,N,mt.disabled,Ie,n.id,J,se,Me,n.paint,M.zoom,Y,fe)}},heatmap:function(l,t,n,c){if(n.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const d=l.context,p=d.gl,m=xt.disabled,y=new Pt([p.ONE,p.ONE,p.ONE,p.ONE],s.am.transparent,[!0,!0,!0,!0]);(function(C,D,z,F){const L=C.gl,N=D.width*F,j=D.height*F;C.activeTexture.set(L.TEXTURE1),C.viewport.set([0,0,N,j]);let q=z.heatmapFbo;if(!q||q&&(q.width!==N||q.height!==j)){q&&q.destroy();const X=L.createTexture();L.bindTexture(L.TEXTURE_2D,X),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MIN_FILTER,L.LINEAR),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MAG_FILTER,L.LINEAR),q=z.heatmapFbo=C.createFramebuffer(N,j,!0,null),function(ee,ie,Y,K,J,fe){const se=ee.gl;se.texImage2D(se.TEXTURE_2D,0,ee.extRenderToTextureHalfFloat?se.RGBA16F:se.RGBA,J,fe,0,se.RGBA,ee.extRenderToTextureHalfFloat?se.HALF_FLOAT:se.UNSIGNED_BYTE,null),K.colorAttachment.set(Y)}(C,0,X,q,N,j)}else L.bindTexture(L.TEXTURE_2D,q.colorAttachment.get()),C.bindFramebuffer.set(q.framebuffer)})(d,l,n,l.transform.projection.name==="globe"?.5:.25),d.clear({color:s.am.transparent});const x=l.transform,T=x.projection.name==="globe",S=T?["PROJECTION_GLOBE_VIEW"]:[],M=T?mt.frontCCW:mt.disabled,E=[s.aD(x.center.lng),s.aH(x.center.lat)];for(let C=0;C<c.length;C++){const D=c[C];if(t.hasRenderableParent(D))continue;const z=t.getTile(D),F=z.getBucket(n);if(!F||F.projection.name!==x.projection.name)continue;const L=l.isTileAffectedByFog(D),N=F.programConfigurations.get(n.id),j=l.getOrCreateProgram("heatmap",{config:N,defines:S,overrideFog:L}),{zoom:q}=l.transform;l.terrain&&l.terrain.setupElevationDraw(z,j),l.uploadCommonUniforms(d,j,D.toUnwrapped());const X=x.projection.createInversionMatrix(x,D.canonical);j.draw(l,p.TRIANGLES,it.disabled,m,y,M,Bd(l,D,z,X,E,q,n.paint.get("heatmap-intensity")),n.id,F.layoutVertexBuffer,F.indexBuffer,F.segments,n.paint,l.transform.zoom,N,T?[F.globeExtVertexBuffer]:null)}d.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(d,p){const m=d.context,y=m.gl,x=p.heatmapFbo;if(!x)return;m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,x.colorAttachment.get()),m.activeTexture.set(y.TEXTURE1);let T=p.colorRampTexture;T||(T=p.colorRampTexture=new s.T(m,p.colorRamp,y.RGBA8)),T.bind(y.LINEAR,y.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,y.TRIANGLES,it.disabled,xt.disabled,d.colorModeForRenderPass(),mt.disabled,((S,M,E,C)=>({u_image:0,u_color_ramp:1,u_opacity:M.paint.get("heatmap-opacity")}))(0,p),p.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,p.paint,d.transform.zoom)}(l,n))},line:function(l,t,n,c){if(l.renderPass!=="translucent")return;const d=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(d.constantOr(1)===0||p.constantOr(1)===0)return;const m=n.paint.get("line-emissive-strength"),y=n.paint.get("line-occlusion-opacity"),x=n.layout.get("line-elevation-reference"),T=n.layout.get("line-width-unit")==="meters",S=x==="sea",M=!(!l.terrain||!l.terrain.enabled),E=l.context,C=E.gl;if(n.hasElevatedBuckets&&l.transform.projection.name==="globe")return;const D=n.layout.get("line-cross-slope"),z=D!==void 0,F=D<1,L=l.colorModeForDrapableLayerRenderPass(m),N=l.terrain&&l.terrain.renderingToTexture,j=N?1:s.q.devicePixelRatio,q=n.paint.get("line-dasharray"),X=q.constantOr(1),ee=n.layout.get("line-cap"),ie=q.constantOr(null),Y=ee.constantOr(null),K=n.paint.get("line-pattern"),J=K.constantOr(1),fe=n.paint.get("line-pattern-cross-fade"),se=K.constantOr(null),Ie=n.paint.get("line-opacity").constantOr(1);let xe=!J&&Ie!==1||l.depthOcclusion&&y>0&&y<1;const Me=n.paint.get("line-gradient"),Ue=J?"linePattern":"line",me=s.dY(n);let oe;if(N&&l.terrain&&l.terrain.clipOrMaskOverlapStencilType()&&(xe=!1),y!==0&&l.depthOcclusion){const Re=n.paint._values["line-opacity"];
vendor: 4,992 bytes, line 2760
2760Re&&Re.value&&Re.value.kind==="constant"?oe=Re.value:s.w(`Occlusion opacity for layer ${n.id} is supported only when line-opacity isn't data-driven.`)}p.value.kind!=="constant"&&p.value.isLineProgressConstant===!1&&me.push("VARIABLE_LINE_WIDTH");const we=(Re,Le,Ze,at,dt,Qe)=>{for(const ht of Re){const lt=t.getTile(ht);if(J&&!lt.patternsLoaded())continue;const wt=lt.getBucket(n);if(!wt||wt.elevationType!=="none"&&!dt||wt.elevationType==="none"&&dt)continue;l.prepareDrawTile();const At=[...Le],Ot=l.shadowRenderer,Yt=wt.elevationType==="road"&&!!Ot&&Ot.enabled;let Et=[0,0,0];if(Yt){const Wt=l.style.directionalLight,oi=l.style.ambientLight;Wt&&oi&&(Et=xs(l.style,Wt,oi)),At.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Kt=wt.programConfigurations.get(n.id);let ti=!1;if(se&&lt.imageAtlas){const Wt=s.dZ.from(se),oi=Wt.getPrimary().scaleSelf(j).toString(),yi=lt.imageAtlas.patternPositions.get(oi),sr=Wt.getSecondary(),rr=sr?lt.imageAtlas.patternPositions.get(sr.scaleSelf(j).toString()):null;ti=!!yi&&!!rr,yi&&Kt.setConstantPatternPositions(yi,rr)}fe>0&&(ti||Kt.getPatternTransitionVertexBuffer("line-pattern"))&&At.push("LINE_PATTERN_TRANSITION");const vi=l.isTileAffectedByFog(ht),Dt=l.getOrCreateProgram(Ue,{config:Kt,defines:At,overrideFog:vi});if(!J&&ie&&Y&&lt.lineAtlas){const Wt=lt.lineAtlas.getDash(ie,Y);Wt&&Kt.setConstantPatternPositions(Wt)}Yt&&Ot.setupShadows(lt.tileID.toUnwrapped(),Dt,"vector-tile");let[Jt,Qt]=n.paint.get("line-trim-offset");(Y==="round"||Y==="square")&&Jt!==Qt&&(Jt===0&&(Jt-=1),Qt===1&&(Qt+=1));const ni=N?ht.projMatrix:null,kt=T?1/wt.tileToMeter/s.aw(lt,1,l.transform.zoom):1,di=T?1/wt.tileToMeter/s.aw(lt,1,Math.floor(l.transform.zoom)):1,ii=J?s.d_(l,lt,n,ni,j,kt,di,[Jt,Qt],Et,fe):s.d$(l,lt,n,ni,wt.lineClipsArray.length,j,kt,di,[Jt,Qt],Et);if(Me){const Wt=wt.gradients[n.id];let oi=Wt.texture;if(n.gradientVersion!==Wt.version){let yi=256;if(n.stepInterpolant){const sr=t.getSource().maxzoom,rr=ht.canonical.z===sr?Math.ceil(1<<l.transform.maxZoom-ht.canonical.z):1;yi=s.ay(s.e0(wt.maxLineLength/s.aj*1024*rr),256,E.maxTextureSize)}Wt.gradient=s.e1({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:yi,image:Wt.gradient||void 0,clips:wt.lineClipsArray}),Wt.texture?Wt.texture.update(Wt.gradient):Wt.texture=new s.T(E,Wt.gradient,C.RGBA8),Wt.version=n.gradientVersion,oi=Wt.texture}E.activeTexture.set(C.TEXTURE1),oi.bind(n.stepInterpolant?C.NEAREST:C.LINEAR,C.CLAMP_TO_EDGE)}X&&(E.activeTexture.set(C.TEXTURE0),lt.lineAtlasTexture&&lt.lineAtlasTexture.bind(C.LINEAR,C.REPEAT),Kt.updatePaintBuffers()),J&&(E.activeTexture.set(C.TEXTURE0),lt.imageAtlasTexture&&lt.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),Kt.updatePaintBuffers()),dt&&!S&&l.terrain.setupElevationDraw(lt,Dt),l.uploadCommonUniforms(E,Dt,ht.toUnwrapped());const Vi=Wt=>{oe!=null&&(oe.value=Ie*y),Dt.draw(l,C.TRIANGLES,Ze,Wt,L,mt.disabled,ii,n.id,wt.layoutVertexBuffer,wt.indexBuffer,wt.segments,n.paint,l.transform.zoom,Kt,[wt.layoutVertexBuffer2,wt.patternVertexBuffer,wt.zOffsetVertexBuffer]),oe!=null&&(oe.value=Ie)};if(xe&&!dt){const Wt=l.stencilModeForClipping(ht).ref;Wt===0&&N&&E.clear({stencil:0});const oi={func:C.EQUAL,mask:255};ii.u_alpha_discard_threshold=.8,Vi(new xt(oi,Wt,255,C.KEEP,C.KEEP,C.INVERT)),ii.u_alpha_discard_threshold=0,Vi(new xt(oi,Wt,255,C.KEEP,C.KEEP,C.KEEP))}else ii.u_alpha_discard_threshold=xe&&dt&&Qe?.8:0,Vi(dt?at:l.stencilModeForClipping(ht))}};let _e=l.depthModeForSublayer(0,it.ReadOnly);const ze=new it(l.depthOcclusion?C.GREATER:C.LEQUAL,it.ReadOnly,l.depthRangeFor3D);if(n.hasNonElevatedBuckets){const Re=!N&&l.terrain;y!==0&&Re?s.w(`Occlusion opacity for layer ${n.id} is supported on terrain only if the layer has line-z-offset enabled.`):Re?s.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${n.id}.`):we(c,me,_e,xt.disabled,!1,!0)}if(n.hasElevatedBuckets){x==="hd-road-markup"?M||(_e=ze,me.push("ELEVATED_ROADS")):(me.push("ELEVATED"),_e=ze,z&&me.push(F?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),S&&me.push("ELEVATION_REFERENCE_SEA"));const Re=xe?l.stencilModeFor3D():xt.disabled;l.forceTerrainMode=!0,we(c,me,_e,Re,!0,!0),xe&&we(c,me,_e,Re,!0,!1),l.forceTerrainMode=!1}xe&&(l.resetStencilClippingMasks(),N&&E.clear({stencil:0})),y===0||l.depthOcclusion||N||l.layersWithOcclusionOpacity.push(l.currentLayer)},fill:function(l,t,n,c){const d=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const m=n.paint.get("fill-emissive-strength"),y=l.colorModeForDrapableLayerRenderPass(m),x=n.paint.get("fill-pattern"),T=l.opaquePassEnabledForLayer()&&!x.constantOr(1)&&d.constantOr(s.am.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";let S="none";n.layout.get("fill-elevation-reference")!=="none"?S="road":n.paint.get("fill-z-offset").constantOr(1)!==0&&(S="offset");const M=!(!l.terrain||!l.terrain.enabled),E={painter:l,sourceCache:t,layer:n,coords:c,colorMode:y,elevationType:S,terrainEnabled:M,pass:T};
2760if(l.renderPass!=="shadow")if(S!=="offset"){if(Sc(E,!1),S==="road"){const C=!M&&l.renderPass==="translucent";C&&rt(l,t,n,c,"geometry"),Sc(E,!0,xt.disabled),C&&function(D){const{painter:z,sourceCache:F,layer:L,coords:N,colorMode:j}=D,q=z.context.gl,X=D.painter.shadowRenderer,ee=!!X&&X.enabled,ie=new it(z.context.gl.LEQUAL,it.ReadOnly,z.depthRangeFor3D);let Y=[0,0,0];if(ee){const J=z.style.directionalLight,fe=z.style.ambientLight;J&&fe&&(Y=xs(z.style,J,fe))}const K=J=>{for(const fe of N){const se=F.getTile(fe),Ie=se.getBucket(L);if(!Ie)continue;const xe=Ie.elevatedStructures;if(!xe)continue;let Me,Ue;if(J?(Me=xe.renderableBridgeSegments,Ue=xe.bridgeProgramConfigurations.get(L.id)):(Me=xe.renderableTunnelSegments,Ue=xe.tunnelProgramConfigurations.get(L.id)),!Me||Me.segments[0].primitiveLength===0)continue;Ue.updatePaintBuffers(),z.prepareDrawTile();const me=z.isTileAffectedByFog(fe),oe=[];ee&&oe.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const we=z.getOrCreateProgram("elevatedStructures",{config:Ue,overrideFog:me,defines:oe}),_e=z.translatePosMatrix(fe.projMatrix,se,L.paint.get("fill-translate"),L.paint.get("fill-translate-anchor"));ee&&X.setupShadows(se.tileID.toUnwrapped(),we,"vector-tile");const ze=Af(_e,Y);z.uploadCommonUniforms(z.context,we,fe.toUnwrapped()),we.draw(z,q.TRIANGLES,ie,xt.disabled,j,mt.backCCW,ze,L.id,xe.vertexBuffer,xe.indexBuffer,Me,L.paint,z.transform.zoom,Ue,[xe.vertexBufferNormal])}};K(!0),K(!1)}(E)}}else Sc(E,!1,l.stencilModeFor3D());else l.shadowRenderer&&S==="road"&&!M&&function(C){const{painter:D,sourceCache:z,layer:F,coords:L}=C,N=D.context.gl,j=C.painter.shadowRenderer;for(const q of L){const X=z.getTile(q),ee=X.getBucket(F);if(!ee)continue;const ie=ee.elevatedStructures;if(!ie||!ie.shadowCasterSegments||ie.shadowCasterSegments.segments[0].primitiveLength===0)continue;D.prepareDrawTile();const Y=ee.bufferData.programConfigurations.get(F.id),K=D.isTileAffectedByFog(q),J=D.getOrCreateProgram("elevatedStructuresDepth",{config:Y,overrideFog:K}),fe=j.calculateShadowPassMatrixFromTile(X.tileID.toUnwrapped());D.uploadCommonUniforms(D.context,J,q.toUnwrapped());const se={u_matrix:fe,u_depth_bias:0};J.draw(D,N.TRIANGLES,j.getShadowPassDepthMode(),xt.disabled,j.getShadowPassColorMode(),mt.disabled,se,F.id,ie.vertexBuffer,ie.indexBuffer,ie.shadowCasterSegments,F.paint,D.transform.zoom,Y)}}(E)},"fill-extrusion":function(l,t,n,c){const d=n.paint.get("fill-extrusion-opacity"),p=l.context,m=p.gl,y=l.terrain,x=y&&y.renderingToTexture;if(d===0)return;const T=l.conflationActive&&l.style.isLayerClipped(n,t.getSource()),S=l.style.order.indexOf(n.fqid);if(T&&function(M,E,C,D,z){for(const F of D){const L=E.getTile(F).getBucket(C);L&&(L.updateReplacement(F,M.replacementSource,z),L.uploadCentroid(M.context))}}(l,t,n,c,S),y||T)for(const M of c){const E=t.getTile(M).getBucket(n);E&&gt(l.context,t,M,E,n,y,T)}if(l.renderPass==="shadow"&&l.shadowRenderer){const M=l.shadowRenderer;if(y&&d<.65&&n._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof s.ab)return;const E=M.getShadowPassDepthMode(),C=M.getShadowPassColorMode();_l(l,t,n,c,E,xt.disabled,C,T)}else if(l.renderPass==="translucent"){const M=!n.paint.get("fill-extrusion-pattern").constantOr(1),E=n.paint.get("fill-extrusion-color").constantOr(s.am.white);if(!x&&E.a!==0){const C=new it(l.context.gl.LEQUAL,it.ReadWrite,l.depthRangeFor3D);d===1&&M?_l(l,t,n,c,C,xt.disabled,Pt.unblended,T):(_l(l,t,n,c,C,xt.disabled,Pt.disabled,T),_l(l,t,n,c,C,l.stencilModeFor3D(),l.colorModeForRenderPass(),T),l.resetStencilClippingMasks())}if(l.style.enable3dLights()&&M&&(!y&&l.transform.projection.name!=="globe"||x)){const C=n.paint.get("fill-extrusion-opacity"),D=n.paint.get("fill-extrusion-ambient-occlusion-intensity"),z=n.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),F=n.paint.get("fill-extrusion-flood-light-intensity"),L=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",N=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(L?null:n.lut).toArray01().slice(0,3),j=D>0&&z>0,q=F>0,X=(Y,K,J)=>(1-J)*Y+J*K,ee=new bo;ee.translate=n.paint.get("fill-extrusion-translate"),ee.translateAnchor=n.paint.get("fill-extrusion-translate-anchor"),ee.edgeRadius=n.layout.get("fill-extrusion-edge-radius"),ee.cutoffFadeRange=n.paint.get("fill-extrusion-cutoff-fade-range");const ie=Y=>{const K=l.depthModeForSublayer(1,it.ReadOnly,m.LEQUAL,!0),J=n.paint.get(Y?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),fe=X(.1,3,J),se=l._showOverdrawInspector;if(!se){const Ie=new xt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),xe=new Pt([m.ONE,m.ONE,m.ONE,m.ONE],s.am.transparent,[!1,!1,!1,!0],m.MIN);an(ee,l,t,n,c,K,Ie,xe,mt.disabled,Y,"sdf",C,D,z,F,N,fe,T,!1)}{const Ie=se?xt.disabled:new xt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),xe=se?l.colorModeForRenderPass():new Pt([m.ONE_MINUS_DST_ALPHA,m.DST_ALPHA,m.ONE,m.ONE],s.am.transparent,[!0,!0,!0,!0]);an(ee,l,t,n,c,K,Ie,xe,mt.disabled,Y,"color",C,D,z,F,N,fe,T,!1)}};if(x){const Y=(K,J,fe)=>{const se=l.depthModeForSublayer(1,it.ReadOnly,m.LEQUAL,!1),Ie=n.paint.get(K?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),xe=X(.1,3,Ie);{const Me=new Pt([m.ONE,m.ONE,m.ONE,m.ONE],s.am.transparent,[!1,!1,!1,!0]);an(ee,l,t,n,c,se,xt.disabled,Me,mt.disabled,K,"clear",C,D,z,F,N,xe,T,J)}{const Me=new xt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),Ue=new Pt([m.ONE,m.ONE,m.ONE,m.ONE],s.am.transparent,[!1,!1,!1,!0],m.MIN);an(ee,l,t,n,c,se,Me,Ue,mt.disabled,K,"sdf",C,D,z,F,N,xe,T,J)}{const Me=K?m.ZERO:m.ONE_MINUS_DST_ALPHA,Ue=new xt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),me=new Pt([Me,m.DST_ALPHA,m.ONE_MINUS_DST_ALPHA,m.ZERO],s.am.transparent,[!0,!0,!0,!0]);an(ee,l,t,n,c,se,Ue,me,mt.disabled,K,"color",C,D,z,F,N,xe,T,J)}{const Me=new Pt([m.ONE,m.ONE,m.ONE,K?m.ZERO:m.ONE],s.am.transparent,[!1,!1,!1,!0],K?m.FUNC_ADD:m.MAX);an(ee,l,t,n,c,se,xt.disabled,Me,mt.disabled,K,"clear",C,D,z,F,N,xe,T,J,fe)}};if(j||q){let K;if(l.prepareDrawTile(),y){const J=y.drapeBufferSize[0],fe=y.drapeBufferSize[1];K=y.framebufferCopyTexture,K&&(!K||K.size[0]===J&&K.size[1]===fe)||(K&&K.destroy(),K=y.framebufferCopyTexture=new s.T(p,new s.r({width:J,height:fe}),m.RGBA8)),K.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.copyTexSubImage2D(m.TEXTURE_2D,0,0,0,0,0,J,fe)}j&&Y(!0,!1,K),q&&Y(!1,!0,K)}}else j&&ie(!0),q&&ie(!1),(j||q)&&l.resetStencilClippingMasks()}}},building:function(l,t,n,c){l.currentLayer<l.firstLightBeamLayer&&(l.firstLightBeamLayer=l.currentLayer);const d=n.paint.get("building-ambient-occlusion-ground-intensity"),p=n.paint.get("building-ambient-occlusion-ground-radius"),m=n.paint.get("building-ambient-occlusion-ground-attenuation");let y=d>0&&p>0,x=!0;const T=n.paint.get("building-vertical-scale");T<1&&(x=!1);const S=l.conflationActive&&l.style.isLayerClipped(n,t.getSource()),M=l.style.order.indexOf(n.fqid);if(function(E,C,D,z,F,L){for(const N of L){const j=C.getTile(N).getBucket(D);j&&(F&&j.updateReplacement(N,E.replacementSource,z),j.uploadUpdatedIndexBuffer(E.context))}}(l,t,n,M,S,c),function(E,C,D,z){for(const F of z){const L=C.getTile(F).getBucket(D);L&&L.needsEvaluation(E,D)&&(L.evaluate(D),L.uploadUpdatedColorBuffer(E.context))}}(l,t,n,c),n.resetLayerRenderingStats(l),l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0),l.renderPass==="shadow"&&l.shadowRenderer){const E=l.shadowRenderer,C=[],D=E.getShadowPassDepthMode();Ic({painter:l,source:t,layer:n,coords:c,defines:C,blendMode:E.getShadowPassColorMode(),depthMode:D,verticalScale:T})}else if(l.renderPass==="translucent"){y&&function(z,F,L,N,j,q,X,ee,ie,Y,K,J,fe){const se=z.context.gl,Ie=z.depthModeForSublayer(1,it.ReadOnly,se.LEQUAL,!0),xe=.1*(1-(Me=K))+3*Me;var Me;const Ue=z._showOverdrawInspector,me=J,oe=new bo;Ue||an(oe,z,F,L,N,Ie,new xt({func:se.ALWAYS,mask:255},255,255,se.KEEP,se.KEEP,se.REPLACE),new Pt([se.ONE,se.ONE,se.ONE,se.ONE],s.am.transparent,[!1,!1,!1,!0],se.MIN),mt.disabled,j,"sdf",1,X,ee,0,Y,xe,me,!1);{const we=Ue?xt.disabled:new xt({func:se.EQUAL,mask:255},255,255,se.KEEP,se.DECR,se.DECR),_e=Ue?z.colorModeForRenderPass():new Pt([se.ONE_MINUS_DST_ALPHA,se.DST_ALPHA,se.ONE,se.ONE],s.am.transparent,[!0,!0,!0,!0]);an(oe,z,F,L,N,Ie,we,_e,mt.disabled,j,"color",1,X,ee,0,Y,xe,me,!1)}}(l,t,n,c,!0,0,d,p,0,[0,0,0],m,S);let E=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];x&&(E=E.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),l.shadowRenderer.useNormalOffset&&(E=E.concat("NORMAL_OFFSET"));const C=new it(l.context.gl.LEQUAL,it.ReadWrite,l.depthRangeFor3D),D=l.colorModeForRenderPass();Ic({painter:l,source:t,layer:n,coords:c,defines:E,blendMode:D,depthMode:C,verticalScale:T})}else if(l.renderPass==="light-beam"){const E=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],C=new it(l.context.gl.LEQUAL,it.ReadOnly,l.depthRangeFor3D);Ic({painter:l,source:t,layer:n,coords:c,defines:E,blendMode:Pt.alphaBlended,depthMode:C,verticalScale:T})}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1),l.resetStencilClippingMasks()},hillshade:function(l,t,n,c){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent"||l.style.disableElevatedTerrain)return;const d=l.context,p=l.terrain&&l.terrain.renderingToTexture,[m,y]=l.renderPass!=="translucent"||p?[{},c]:l.stencilConfigForOverlap(c);for(const x of y){const T=t.getTile(x);
2760if(T.needsHillshadePrepare&&l.renderPass==="offscreen")wd(l,T,n);else if(l.renderPass==="translucent"){const S=l.depthModeForSublayer(0,it.ReadOnly),M=n.paint.get("hillshade-emissive-strength"),E=l.colorModeForDrapableLayerRenderPass(M),C=p&&l.terrain?l.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ];gf(l,x,T,n,S,C,E)}}d.viewport.set([0,0,l.width,l.height]),l.resetStencilClippingMasks()},raster:function(l,t,n,c,d,p){if(l.renderPass!=="translucent"||n.paint.get("raster-opacity")===0)return;const m=l.transform.projection.name==="globe",y=n.paint.get("raster-elevation")!==0,x=y&&m;if(l.renderElevatedRasterBackface&&!x)return;const T=l.context,S=T.gl,M=t.getSource(),E=function(ee,ie,Y,K){const J=ie.paint.get("raster-color"),fe=ee.type==="raster-array",se=[],Ie=ie.paint.get("raster-resampling"),xe=ie.paint.get("raster-color-mix");let Me=ie.paint.get("raster-color-range");const Ue=[xe[0],xe[1],xe[2],0],me=xe[3];let oe=Ie==="nearest"?K.NEAREST:K.LINEAR;if(fe&&(se.push("RASTER_ARRAY"),J||se.push("RASTER_COLOR"),Ie==="linear"&&se.push("RASTER_ARRAY_LINEAR"),oe=K.NEAREST,!Me&&ee.rasterLayers)){const we=ee.rasterLayers.find(({id:_e})=>_e===ie.sourceLayer);we&&we.fields&&we.fields.range&&(Me=we.fields.range)}if(Me=Me||[0,1],J){se.push("RASTER_COLOR"),Y.activeTexture.set(K.TEXTURE2),ie.updateColorRamp(Me);let we=ie.colorRampTexture;we||(we=ie.colorRampTexture=new s.T(Y,ie.colorRamp,K.RGBA8)),we.bind(K.LINEAR,K.CLAMP_TO_EDGE)}return{mix:Ue,range:Me,offset:me,defines:se,resampling:oe}}(M,n,T,S);if(M instanceof s.aP&&!c.length&&!m)return;const C=n.paint.get("raster-emissive-strength"),D=l.colorModeForDrapableLayerRenderPass(C),z=l.terrain&&l.terrain.renderingToTexture,F=!l.options.moving,L=n.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;if(M instanceof s.aP&&!c.length&&(M.onNorthPole||M.onSouthPole)){const ee=y?l.stencilModeFor3D():xt.disabled;return void Ac(!!M.onNorthPole,null,l,t,n,C,E,mt.disabled,ee)}if(!c.length)return;const[N,j]=M instanceof s.aP||z?[{},c]:l.stencilConfigForOverlap(c),q=j[j.length-1].overscaledZ;x&&E.defines.push("PROJECTION_GLOBE_VIEW"),y&&E.defines.push("RENDER_CUTOFF");const X=(ee,ie,Y)=>{for(const K of ee){const J=K.toUnwrapped(),fe=t.getTile(K);if(z&&(!fe||!fe.hasData()))continue;T.activeTexture.set(S.TEXTURE0);const se=zf(fe,M,n,E);if(!se||!se.texture)continue;const{texture:Ie,mix:xe,offset:Me,tileSize:Ue,buffer:me}=se;let oe,we;z?(oe=it.disabled,we=K.projMatrix):y?(oe=new it(S.LEQUAL,it.ReadWrite,l.depthRangeFor3D),we=m?Float32Array.from(l.transform.expandedFarZProjMatrix):l.transform.calculateProjMatrix(J,F)):(oe=l.depthModeForSublayer(K.overscaledZ-q,n.paint.get("raster-opacity")===1?it.ReadWrite:it.ReadOnly,S.LESS),we=l.transform.calculateProjMatrix(J,F));const _e=l.terrain&&z?l.terrain.stencilModeForRTTOverlap(K):N[K.overscaledZ],ze=p?0:n.paint.get("raster-fade-duration");fe.registerFadeDuration(ze);const Re=t.findLoadedParent(K,0),Le=sn(fe,Re,t,l.transform,ze);let Ze,at;l.terrain&&l.terrain.prepareDrawTile(),T.activeTexture.set(S.TEXTURE0),Ie.bind(L,S.CLAMP_TO_EDGE),T.activeTexture.set(S.TEXTURE1),Re?(Re.texture&&Re.texture.bind(L,S.CLAMP_TO_EDGE),Ze=Math.pow(2,Re.tileID.overscaledZ-fe.tileID.overscaledZ),at=[fe.tileID.canonical.x*Ze%1,fe.tileID.canonical.y*Ze%1]):Ie.bind(L,S.CLAMP_TO_EDGE),"useMipmap"in Ie&&T.extTextureFilterAnisotropic&&l.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const dt=l.transform;let Qe;const ht=y?Pf(dt):[0,0,0,0];let lt,wt,At,Ot,Yt,Et=0;if(x&&M instanceof s.aP&&M.coordinates.length>3)lt=Float32Array.from(s.bh(s.dD(new s.cA(0,0,0)))),wt=Float32Array.from(dt.globeMatrix),At=Float32Array.from(s.dz(dt)),Ot=[s.aD(dt.center.lng),s.aH(dt.center.lat)],Qe=M.elevatedGlobePerspectiveTransform,Yt=M.elevatedGlobeGridMatrix||new Float32Array(9);else if(x){const Dt=s.dA(K.canonical);Et=s.dB(Dt.getCenter().lat),lt=Float32Array.from(s.bh(s.dD(K.canonical))),wt=Float32Array.from(dt.globeMatrix),At=Float32Array.from(s.dz(dt)),Ot=[s.aD(dt.center.lng),s.aH(dt.center.lat)],Qe=[0,0],Yt=Float32Array.from(s.dC(K.canonical,Dt,Et,dt.worldSize/dt._pixelsPerMercatorPixel))}else Qe=M instanceof s.aP?M.perspectiveTransform:[0,0],lt=new Float32Array(16),wt=new Float32Array(9),At=new Float32Array(16),Ot=[0,0],Yt=new Float32Array(9);const Kt=jh(we,lt,wt,At,Yt,at||[0,0],s.ah(l.transform.zoom),Ot,ht,Ze||1,Le,n,Qe,y?n.paint.get("raster-elevation"):0,2,xe,Me,E.range,Ue,me,C),ti=l.isTileAffectedByFog(K),vi=l.getOrCreateProgram("raster",{defines:E.defines,overrideFog:ti});if(l.uploadCommonUniforms(T,vi,J),M instanceof s.aP){const Dt=M.elevatedGlobeVertexBuffer,Jt=M.elevatedGlobeIndexBuffer;if(z||!m)M.boundsBuffer&&M.boundsSegments&&vi.draw(l,S.TRIANGLES,oe,xt.disabled,D,mt.disabled,Kt,n.id,M.boundsBuffer,l.quadTriangleIndexBuffer,M.boundsSegments);else if(Dt&&Jt){const Qt=dt.zoom<=s.cX?M.elevatedGlobeSegments:M.getSegmentsForLongitude(dt.center.lng);Qt&&vi.draw(l,S.TRIANGLES,oe,xt.disabled,D,ie,Kt,n.id,Dt,Jt,Qt)}}else if(x){oe=new it(S.LEQUAL,it.ReadOnly,l.depthRangeFor3D);const Dt=l.globeSharedBuffers;if(Dt){const[Jt,Qt,ni]=Dt.getGridBuffers(Et,!1);vi.draw(l,S.TRIANGLES,oe,Y||_e,l.colorModeForRenderPass(),ie,Kt,n.id,Jt,Qt,ni)}}else{const{tileBoundsBuffer:Dt,tileBoundsIndexBuffer:Jt,tileBoundsSegments:Qt}=l.getTileBoundsBuffers(fe);vi.draw(l,S.TRIANGLES,oe,_e,D,mt.disabled,Kt,n.id,Dt,Jt,Qt)}}if(!(M instanceof s.aP)&&x)for(const K of ee){const J=K.canonical.y===(1<<K.canonical.z)-1;K.canonical.y===0&&Ac(!0,K,l,t,n,C,E,ie,Y||xt.disabled),J&&Ac(!1,K,l,t,n,C,E,ie===mt.frontCW?mt.backCW:mt.frontCW,Y||xt.disabled)}};x?X(j,l.renderElevatedRasterBackface?mt.backCW:mt.frontCW,l.stencilModeFor3D()):X(j,mt.disabled,void 0),l.resetStencilClippingMasks()},"raster-particle":function(l,t,n,c,d,p){l.renderPass==="offscreen"&&function(m,y,x,T){if(!T.length)return;
vendor: 14,975 bytes, line 2760
2760const S=m.context,M=S.gl,E=y.getSource();if(!(E instanceof ko))return;const C=Math.ceil(Math.sqrt(x.paint.get("raster-particle-count")));let D=x.particlePositionRGBAImage;if(!D||D.width!==C){const j=function(q){const X=q*q,ee=new Uint8Array(4*X),ie=function(K){return K|=0,K=Math.imul(2747636419^K,2654435769),K=Math.imul(K^K>>>16,2654435769),((K=Math.imul(K^K>>>16,2654435769))>>>0)/4294967296},Y=1/1.1;for(let K=0;K<X;K++){const J=Y*(ie(2*K+0)+Wo),fe=Y*(ie(2*K+1)+Wo),se=255*J%1,Ie=255*fe%1,xe=se,Me=fe-Ie/255,Ue=Ie;ee[4*K+0]=255*(J-se/255),ee[4*K+1]=255*xe,ee[4*K+2]=255*Me,ee[4*K+3]=255*Ue}return ee}(C);D=x.particlePositionRGBAImage=new s.r({width:C,height:C},j)}let z=x.particleFramebuffer;z?z.width!==C&&(z.destroy(),z=x.particleFramebuffer=S.createFramebuffer(C,C,!0,null)):z=x.particleFramebuffer=S.createFramebuffer(C,C,!0,null);const F=[];for(const j of T){const q=y.getTile(j);if(!(q instanceof Us))continue;const X=Wr(q,E,x);if(!X)continue;const ee=[q.tileSize,q.tileSize];let ie=x.tileFramebuffer;ie||(ie=x.tileFramebuffer=S.createFramebuffer(ee[0],ee[1],!0,null));let Y=q.rasterParticleState;Y||(Y=q.rasterParticleState=new Kh(S,j,ee,D));const K=Y.update(x.lastInvalidatedAt);Y.particleTextureDimension!==C&&Y.updateParticleTexture(j,D);const J=Y.targetColorTexture;Y.targetColorTexture=Y.backgroundColorTexture,Y.backgroundColorTexture=J;const fe=Y.particleTexture0;Y.particleTexture0=Y.particleTexture1,Y.particleTexture1=fe,F.push([j,X,Y,K])}if(F.length===0)return;const L=s.q.now(),N=x.previousDrawTimestamp?.001*(L-x.previousDrawTimestamp):.0167;if(x.previousDrawTimestamp=L,x.hasColorMap()){S.activeTexture.set(M.TEXTURE0+2);let j=x.colorRampTexture;j||(j=x.colorRampTexture=new s.T(S,x.colorRamp,M.RGBA8)),j.bind(M.LINEAR,M.CLAMP_TO_EDGE)}S.bindFramebuffer.set(x.tileFramebuffer.framebuffer),function(j,q,X){const ee=j.context,ie=ee.gl,Y=q.tileFramebuffer;ee.activeTexture.set(ie.TEXTURE0);const K={u_texture:0,u_opacity:1.05*(fe=q.paint.get("raster-particle-fade-opacity-factor"))/(fe+.05)},J=j.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var fe;for(const se of X){const[,,Ie,xe]=se;Y.colorAttachment.set(Ie.targetColorTexture.texture),ee.viewport.set([0,0,Y.width,Y.height]),ee.clear({color:s.am.transparent}),xe&&(Ie.backgroundColorTexture.bind(ie.NEAREST,ie.CLAMP_TO_EDGE),J.draw(j,ie.TRIANGLES,it.disabled,xt.disabled,Pt.alphaBlended,mt.disabled,K,q.id,j.viewportBuffer,j.quadTriangleIndexBuffer,j.viewportSegments))}}(m,x,F),function(j,q,X,ee){const ie=j.context,Y=ie.gl,K=X.tileFramebuffer,J=j.transform.projection.name==="globe",fe=X.paint.get("raster-particle-max-speed");for(const se of ee){const[Ie,xe,Me]=se;ie.activeTexture.set(Y.TEXTURE0+0),xe.texture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),K.colorAttachment.set(Me.targetColorTexture.texture);const Ue=j.getOrCreateProgram("rasterParticleDraw",{defines:xe.defines,overrideFog:!1});ie.activeTexture.set(Y.TEXTURE0+1);const me=xe.scalarData?[]:[0,1,2,3].map(_e=>s.e3[_e](Ie));me.push(Ie);const oe=Ie.canonical.x,we=Ie.canonical.y;for(const _e of me){const ze=q.getTile(J?_e.wrapped():_e);if(!ze)continue;const Re=ze.rasterParticleState;if(!Re)continue;const Le=_e.canonical.x+(1<<_e.canonical.z)*(_e.wrap-Ie.wrap),Ze=_e.canonical.y;Re.particleTexture0.bind(Y.NEAREST,Y.CLAMP_TO_EDGE);const at=Nd(1,Re.particleTexture0.size[0],[Le-oe,Ze-we],0,xe.texture.size,2,fe,xe.textureOffset,xe.scale,xe.offset);Ue.draw(j,Y.POINTS,it.disabled,xt.disabled,Pt.alphaBlended,mt.disabled,at,X.id,Re.particleIndexBuffer,void 0,Re.particleSegment)}}}(m,y,x,F),S.bindFramebuffer.set(x.particleFramebuffer.framebuffer),function(j,q,X,ee){const ie=j.context,Y=ie.gl,K=q.paint.get("raster-particle-max-speed"),J=ee*q.paint.get("raster-particle-speed-factor")*.15,fe=function(Ie){return Math.pow(Ie,6)}(.01+1*q.paint.get("raster-particle-reset-rate-factor")),se=q.particleFramebuffer;ie.viewport.set([0,0,se.width,se.height]);for(const Ie of X){const[,xe,Me]=Ie;ie.activeTexture.set(Y.TEXTURE0+0),xe.texture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),ie.activeTexture.set(Y.TEXTURE0+1);const Ue=Me.particleTexture0;Ue.bind(Y.NEAREST,Y.CLAMP_TO_EDGE);const me=Vd(1,Ue.size[0],0,xe.texture.size,K,J,fe,xe.textureOffset,xe.scale,xe.offset);se.colorAttachment.set(Me.particleTexture1.texture),ie.clear({color:s.am.transparent}),j.getOrCreateProgram("rasterParticleUpdate",{defines:xe.defines}).draw(j,Y.TRIANGLES,it.disabled,xt.disabled,Pt.unblended,mt.disabled,me,q.id,j.viewportBuffer,j.quadTriangleIndexBuffer,j.viewportSegments)}}(m,x,F,N)}(l,t,n,c),l.renderPass==="translucent"&&(function(m,y,x,T,S){const M=m.context,E=M.gl,C=y.getSource().tileSize,D=5*(1-s.af(s.cI,s.cI+1,m.transform.zoom))*C+x.paint.get("raster-particle-elevation"),z=!m.options.moving,F=m.transform.projection.name==="globe";if(!T.length)return;const[L,N]=m.stencilConfigForOverlap(T),j=[];F&&j.push("PROJECTION_GLOBE_VIEW");const q=m.stencilModeFor3D();for(const X of N){const ee=X.toUnwrapped(),ie=y.getTile(X);if(!ie.rasterParticleState)continue;const Y=ie.rasterParticleState,K=100;ie.registerFadeDuration(K);const J=y.findLoadedParent(X,0),fe=sn(ie,J,y,m.transform,K);let se,Ie;m.terrain&&m.terrain.prepareDrawTile(),M.activeTexture.set(E.TEXTURE0),Y.targetColorTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),M.activeTexture.set(E.TEXTURE1),J&&J.rasterParticleState?(J.rasterParticleState.targetColorTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),se=Math.pow(2,J.tileID.overscaledZ-ie.tileID.overscaledZ),Ie=[ie.tileID.canonical.x*se%1,ie.tileID.canonical.y*se%1]):Y.targetColorTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE);const xe=F?Float32Array.from(m.transform.expandedFarZProjMatrix):m.transform.calculateProjMatrix(ee,z),Me=m.transform,Ue=Jo(Me),me=s.dA(X.canonical),oe=s.dB(me.getCenter().lat);let we,_e,ze,Re,Le;F?(we=Float32Array.from(s.bh(s.dD(X.canonical))),_e=Float32Array.from(Me.globeMatrix),ze=Float32Array.from(s.dz(Me)),Re=[s.aD(Me.center.lng),s.aH(Me.center.lat)],Le=Float32Array.from(s.dC(X.canonical,me,oe,Me.worldSize/Me._pixelsPerMercatorPixel))):(we=new Float32Array(16),_e=new Float32Array(9),ze=new Float32Array(16),Re=[0,0],Le=new Float32Array(9));const Ze=vc(xe,we,_e,ze,Le,Ie||[0,0],s.ah(m.transform.zoom),Re,Ue,se||1,fe,D),at=m.isTileAffectedByFog(X),dt=m.getOrCreateProgram("rasterParticle",{defines:j,overrideFog:at});if(m.uploadCommonUniforms(M,dt,ee),F){const Qe=new it(E.LEQUAL,it.ReadOnly,m.depthRangeFor3D),ht=0,lt=m.globeSharedBuffers;if(lt){const[wt,At,Ot]=lt.getGridBuffers(oe,ht!==0);dt.draw(m,E.TRIANGLES,Qe,q,Pt.alphaBlended,m.renderElevatedRasterBackface?mt.frontCCW:mt.backCCW,Ze,x.id,wt,At,Ot)}}else{const Qe=m.depthModeForSublayer(0,it.ReadOnly),ht=L[X.overscaledZ],{tileBoundsBuffer:lt,tileBoundsIndexBuffer:wt,tileBoundsSegments:At}=m.getTileBoundsBuffers(ie);dt.draw(m,E.TRIANGLES,Qe,ht,Pt.alphaBlended,mt.disabled,Ze,x.id,lt,wt,At)}}m.resetStencilClippingMasks()}(l,t,n,c),l.style.map.triggerRepaint())},background:function(l,t,n,c){const d=n.paint.get("background-color"),p=n.paint.get("background-color-use-theme").constantOr("default")==="none",m=n.paint.get("background-opacity"),y=n.paint.get("background-emissive-strength"),x=n.paint.get("background-pitch-alignment")==="viewport";if(m===0)return;const T=l.context,S=T.gl,M=l.transform,E=M.tileSize,C=n.paint.get("background-pattern");let D;if(C!==void 0&&(C===null||(D=l.imageManager.getPattern(s.I.from(C.toString()),n.scope,l.style.getLut(n.scope)),!D)))return;const z=!C&&d.a===1&&m===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==z)return;const F=xt.disabled,L=l.depthModeForSublayer(0,z==="opaque"?it.ReadWrite:it.ReadOnly),N=l.colorModeForDrapableLayerRenderPass(y),j=C?"backgroundPattern":"background";let q,X=c;if(X||(q=l.getBackgroundTiles(),X=Object.values(q).map(ee=>ee.tileID)),C&&(T.activeTexture.set(S.TEXTURE0),l.imageManager.bind(l.context,n.scope)),x){const ee=l.getOrCreateProgram(j,{overrideFog:!1,overrideRtt:!0}),ie=new Float32Array(s.bx([])),Y=new s.aM(0,0,0,0,0),K=C?Gh(ie,y,m,l,0,n.scope,D,x,{tileID:Y,tileSize:E}):Ud(ie,y,m,d.toPremultipliedRenderColor(p?null:n.lut));ee.draw(l,S.TRIANGLES,L,F,N,mt.disabled,K,n.id,l.viewportBuffer,l.quadTriangleIndexBuffer,l.viewportSegments)}else for(const ee of X){const ie=l.isTileAffectedByFog(ee),Y=l.getOrCreateProgram(j,{overrideFog:ie}),K=ee.toUnwrapped(),J=c?ee.projMatrix:l.transform.calculateProjMatrix(K);l.prepareDrawTile();const fe=t?t.getTile(ee):q?q[ee.key]:new ds(ee,E,M.zoom,l),se=C?Gh(J,y,m,l,0,n.scope,D,x,{tileID:ee,tileSize:E}):Ud(J,y,m,d.toPremultipliedRenderColor(p?null:n.lut));l.uploadCommonUniforms(T,Y,K);const{tileBoundsBuffer:Ie,tileBoundsIndexBuffer:xe,tileBoundsSegments:Me}=l.getTileBoundsBuffers(fe);Y.draw(l,S.TRIANGLES,L,F,N,mt.disabled,se,n.id,Ie,xe,Me)}},sky:function(l,t,n){const c=l._atmosphere?s.ah(l.transform.zoom):1,d=n.paint.get("sky-opacity")*c;if(d===0)return;const p=l.context,m=n.paint.get("sky-type"),y=new it(p.gl.LEQUAL,it.ReadOnly,[0,1]),x=l.frameCounter/1e3%1;m==="atmosphere"?l.renderPass==="offscreen"?n.needsSkyboxCapture(l)&&(function(T,S,M,E){const C=T.context,D=C.gl;let z=S.skyboxFbo;if(!z){z=S.skyboxFbo=C.createFramebuffer(32,32,!0,null),S.skyboxGeometry=new As(C),S.skyboxTexture=C.gl.createTexture(),D.bindTexture(D.TEXTURE_CUBE_MAP,S.skyboxTexture),D.texParameteri(D.TEXTURE_CUBE_MAP,D.TEXTURE_WRAP_S,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_CUBE_MAP,D.TEXTURE_WRAP_T,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_CUBE_MAP,D.TEXTURE_MIN_FILTER,D.LINEAR),D.texParameteri(D.TEXTURE_CUBE_MAP,D.TEXTURE_MAG_FILTER,D.LINEAR);for(let j=0;j<6;++j)D.texImage2D(D.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,D.RGBA,32,32,0,D.RGBA,D.UNSIGNED_BYTE,null)}C.bindFramebuffer.set(z.framebuffer),C.viewport.set([0,0,32,32]);const F=S.getCenter(T,!0),L=T.getOrCreateProgram("skyboxCapture"),N=new Float64Array(16);s.bx(N),s.eh(N,N,.5*-Math.PI),Wn(T,S,L,N,F,0),s.bx(N),s.eh(N,N,.5*Math.PI),Wn(T,S,L,N,F,1),s.bx(N),s.cR(N,N,.5*-Math.PI),Wn(T,S,L,N,F,2),s.bx(N),s.cR(N,N,.5*Math.PI),Wn(T,S,L,N,F,3),s.bx(N),Wn(T,S,L,N,F,4),s.bx(N),s.eh(N,N,Math.PI),Wn(T,S,L,N,F,5),C.viewport.set([0,0,T.width,T.height])}(l,n),n.markSkyboxValid(l)):l.renderPass==="sky"&&function(T,S,M,E,C){const D=T.context,z=D.gl,F=T.transform,L=T.getOrCreateProgram("skybox");D.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_CUBE_MAP,S.skyboxTexture);const N=((j,q,X,ee,ie)=>({u_matrix:j,u_sun_direction:q,u_cubemap:0,u_opacity:ee,u_temporal_offset:ie}))(F.skyboxMatrix,S.getCenter(T,!1),0,E,C);T.uploadCommonUniforms(D,L),L.draw(T,z.TRIANGLES,M,xt.disabled,T.colorModeForRenderPass(),mt.backCW,N,"skybox",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(l,n,y,d,x):m==="gradient"&&l.renderPass==="sky"&&function(T,S,M,E,C){const D=T.context,z=D.gl,F=T.transform,L=T.getOrCreateProgram("skyboxGradient");S.skyboxGeometry||(S.skyboxGeometry=new As(D)),D.activeTexture.set(z.TEXTURE0);let N=S.colorRampTexture;N||(N=S.colorRampTexture=new s.T(D,S.colorRamp,z.RGBA8)),N.bind(z.LINEAR,z.CLAMP_TO_EDGE);const j=((q,X,ee,ie,Y)=>({u_matrix:q,u_color_ramp:0,u_center_direction:X,u_radius:s.al(ee),u_opacity:ie,u_temporal_offset:Y}))(F.skyboxMatrix,S.getCenter(T,!1),S.paint.get("sky-gradient-radius"),E,C);T.uploadCommonUniforms(D,L),L.draw(T,z.TRIANGLES,M,xt.disabled,T.colorModeForRenderPass(),mt.backCW,j,"skyboxGradient",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(l,n,y,d,x)},custom:function(l,t,n,c){const d=l.context,p=n.implementation;if(!l.transform.projection.unsupportedLayers||!l.transform.projection.unsupportedLayers.includes("custom")||l.terrain&&(l.terrain.renderingToTexture||l.renderPass==="offscreen")&&n.isDraped(t)){if(l.renderPass==="offscreen"){const m=p.prerender;if(m){if(l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;m.call(p,d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),s.ah(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else m.call(p,d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState()}}else if(l.renderPass==="translucent"){if(l.terrain&&l.terrain.renderingToTexture){const y=p.renderToTile;if(y){const x=c[0].canonical,T={x:x.x+c[0].wrap*(p.wrapTileId?0:1<<x.z),y:x.y,z:x.z};d.setDepthMode(it.disabled),d.setStencilMode(xt.disabled),d.setColorMode(l.colorModeForRenderPass()),l.setCustomLayerDefaults(),y.call(p,d.gl,T),d.setDirty(),l.setBaseState()}return}l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),d.setStencilMode(xt.disabled);const m=p.renderingMode==="3d"?new it(l.context.gl.LEQUAL,it.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,it.ReadOnly);if(d.setDepthMode(m),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;p.render(d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),s.ah(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else p.render(d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState(),d.bindFramebuffer.set(null)}}else s.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(l,t,n,c){if(l.renderPass==="opaque")return;const d=n.paint.get("model-opacity").constantOr(1);if(d===0)return;const p=n.paint.get("model-cast-shadows");if(l.renderPass==="shadow"&&(!p||l.terrain&&d<.65&&n._transitionablePaint._values["model-opacity"].value.expression instanceof s.ab))return;const m=l.shadowRenderer,y=n.paint.get("model-receive-shadows");m&&(m.useNormalOffset=!0,y||(m.enabled=!1));const x=()=>{m&&(m.useNormalOffset=!0,y||(m.enabled=!0))},T=t.getSource();if(l.renderPass==="light-beam"&&T.type!=="batched-model")return;if(T.type==="vector"||T.type==="geojson")return function(L,N,j,q,X){const ee=L.transform;if(ee.projection.name!=="mercator")return void s.w(`Drawing 3D models for ${ee.projection.name} projection is not yet implemented`);const ie=ee.getFreeCameraOptions().position;if(!L.modelManager)return;const Y=L.modelManager;j.modelManager=Y;const K=L.shadowRenderer;if(!j._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const J=j._unevaluatedLayout._values["model-id"],fe=Object.assign({},j.layout.get("model-id").parameters),se=L.style.order.indexOf(j.fqid);for(const Ie of q){const xe=N.getTile(Ie).getBucket(j);if(!xe||xe.projection.name!==ee.projection.name)continue;const Me=xe.getModelUris();Me&&!xe.modelsRequested&&(Y.addModelsFromBucket(Me,X),xe.modelsRequested=!0);const Ue=Rf(Ie,ee);fe.zoom=Ue;const me=J.possiblyEvaluate(fe);if(ha(L,xe,Ie),to.shadowUniformsInitialized=!1,to.useSingleShadowCascade=!!K&&K.getMaxCascadeForTile(Ie.toUnwrapped())===0,L.renderPass==="shadow"&&K){if(L.currentShadowCascade===1&&xe.isInsideFirstShadowMapFrustum)continue;const _e=ee.calculatePosMatrix(Ie.toUnwrapped(),ee.worldSize);if(to.tileMatrix.set(_e),to.shadowTileMatrix=Float32Array.from(K.calculateShadowPassMatrixFromMatr
2760ix(_e)),to.aabb.min.fill(0),to.aabb.max[0]=to.aabb.max[1]=s.aj,to.aabb.max[2]=0,ru(xe,to,L,j.scope))continue}const oe=1<<Ie.canonical.z,we=[((ie.x-Ie.wrap)*oe-Ie.canonical.x)*s.aj,(ie.y*oe-Ie.canonical.y)*s.aj,ie.z*oe*s.aj];L.conflationActive&&Object.keys(xe.instancesPerModel).length>0&&L.style.isLayerClipped(j,N.getSource())&&xe.updateReplacement(Ie,L.replacementSource,se,X)&&(xe.uploaded=!1,xe.upload(L.context));for(let _e in xe.instancesPerModel){const ze=xe.instancesPerModel[_e];ze.features.length>0&&(_e=me.evaluate(ze.features[0].feature,{}));const Re=Y.getModel(_e,X);if(Re||Y.hasURLBeenRequested(_e)||xe.modelUris.includes(_e)||(xe.modelUris.push(_e),xe.modelsRequested=!1),Re&&Re.uploaded)for(const Le of Re.nodes)iu(L,j,Le,ze,we,Ie,to)}}}(l,t,n,c,T.type==="vector"?n.scope:""),void x();if(!T.loaded())return;if(T.type==="batched-model")return function(L,N,j,q){j.resetLayerRenderingStats(L);const X=L.context,ee=L.transform,ie=L.style.fog,Y=L.shadowRenderer;if(ee.projection.name!=="mercator")return void s.w(`Drawing 3D landmark models for ${ee.projection.name} projection is not yet implemented`);const K=L.transform.getFreeCameraOptions().position,J=s.c1([],[K.x,K.y,K.z],L.transform.worldSize),fe=s.eq([],J),se=s.bx([]),Ie=s.e9(ee.center.lat,ee.zoom),xe=s.bn([],[1,1,1/Ie]);s.bo(se,se,fe);const Me=j.paint.get("model-opacity").constantOr(1),Ue=new it(X.gl.LEQUAL,it.ReadWrite,L.depthRangeFor3D),me=new it(X.gl.LEQUAL,it.ReadOnly,L.depthRangeFor3D),oe=new s.d6([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),we=L.renderPass==="shadow",_e=we&&Y?Y.getCurrentCascadeFrustum():ee.getFrustum(ee.scaleZoom(ee.worldSize)),ze=j.paint.get("model-front-cutoff"),Re=ze[2]<1,Le=Qn(L,j.paint.get("model-cutoff-fade-range")),Ze=j.getLayerRenderingStats();(function(at,dt,Qe,ht){const lt=at.terrain?at.terrain.exaggeration():0,wt=at.transform.zoom;for(const At of ht){const Ot=dt.getTile(At).getBucket(Qe);Ot&&(Ot.setFilter(Qe.filter),at.conflationActive&&Ot.updateReplacement(At,at.replacementSource),Ot.evaluateTransform(at,Qe),at.terrain&&lt>0&&Ot.elevationUpdate(at.terrain,lt,At,Qe.source),Ot.needsReEvaluation(at,wt,Qe)&&Ot.evaluate(Qe))}})(L,N,j,q),function(){let at,dt,Qe;Re?(at=q.length-1,dt=-1,Qe=-1):(at=0,dt=q.length,Qe=1);const ht=new Float64Array(16),lt=s.cx(),wt=new s.P(0,0);for(let At=at;At!==dt;At+=Qe){const Ot=q[At],Yt=N.getTile(Ot).getBucket(j);if(!Yt||!Yt.uploaded)continue;let Et=!1;Y&&(Et=Y.getMaxCascadeForTile(Ot.toUnwrapped())===0);const Kt=ee.calculatePosMatrix(Ot.toUnwrapped(),ee.worldSize),ti=Yt.modelTraits;!we&&Re&&(s.bi(ht,Kt),s.ad(lt,J,ht),wt.x=lt[0],wt.y=lt[1]);const vi=[];Yt.setFilter(j.filter);for(const Dt of Yt.getNodesInfo()){if(Dt.hiddenByReplacement||!Dt.node.meshes)continue;const Jt=Dt.node;let Qt=0;L.terrain&&Jt.elevation&&(Qt=Jt.elevation*L.terrain.exaggeration());const ni=(()=>{const Sr=Dt.aabb;return oe.min=[...Sr.min],oe.max=[...Sr.max],oe.min[2]+=Qt,oe.max[2]+=Qt,s.ad(oe.min,oe.min,Kt),s.ad(oe.max,oe.max,Kt),oe})(),kt=Dt.evaluatedScale;if(kt[0]<=1&&kt[1]<=1&&kt[2]<=1&&ni.intersects(_e)===0)continue;if(!we&&Re){const Sr=.16666666666666666;Dt.cameraCollisionOpacity=J[0]>ni.min[0]&&J[0]<ni.max[0]&&J[1]>ni.min[1]&&J[1]<ni.max[1]&&J[2]*Ie<ni.max[2]&&Jt.footprint&&s.bY(wt,Jt.footprint)?Math.max(Dt.cameraCollisionOpacity-Sr,0):Math.min(1,Dt.cameraCollisionOpacity+Sr)}const di=[...Kt],ii=1/s.d4(Ot.canonical),Vi=Jt.anchor?Jt.anchor[0]:0,Wt=Jt.anchor?Jt.anchor[1]:0;s.bo(di,di,[Vi*(kt[0]-1)+Dt.evaluatedTranslation[0]*ii,Wt*(kt[1]-1)+Dt.evaluatedTranslation[1]*ii,Qt+Dt.evaluatedTranslation[2]]),s.cn(kt,s.es)||s.cP(di,di,kt);const oi=s.az([],di,Jt.matrix),yi=s.az([],ee.expandedFarZProjMatrix,oi),sr=s.az([],ee.expandedFarZProjMatrix,di),rr=s.aA([],[Vi,Wt,Qt,1],yi)[2];Jt.hidden=!1;let ar=Me;we||(Re&&(ar*=Dt.cameraCollisionOpacity,ar*=Jd(di,ee,Dt.aabb,ze)),ar*=Kd(Le,rr)),ar!==0?vi.push({nodeInfo:Dt,depth:rr,opacity:ar,wvpForNode:yi,wvpForTile:sr,nodeModelMatrix:oi,tileModelMatrix:di}):Jt.hidden=!0}we||vi.sort((Dt,Jt)=>!Re||Dt.opacity===1&&Jt.opacity===1?Dt.depth<Jt.depth?-1:1:Dt.opacity===1?-1:Jt.opacity===1?1:Dt.depth>Jt.depth?-1:1);
2760for(const Dt of vi){const Jt=Dt.nodeInfo,Qt=Jt.node;let ni=s.az([],xe,Dt.tileModelMatrix);s.az(ni,se,ni);const kt=s.bi([],ni);s.ea(kt,kt),s.cP(kt,kt,Pc),ni=s.az(ni,ni,Qt.matrix);const di=L.renderPass==="light-beam",ii=j.paint.get("model-color-use-theme").constantOr("default")==="none",Vi=ti&s.ex.HasMapboxMeshFeatures,Wt=Vi?0:Jt.evaluatedRMEA[0][2];for(let oi=0;oi<Qt.meshes.length;++oi){const yi=Qt.meshes[oi],sr=oi===Qt.lightMeshIndex;let rr=Dt.wvpForNode;if(sr){if(!di&&!L.terrain&&L.shadowRenderer){L.currentLayer<L.firstLightBeamLayer&&(L.firstLightBeamLayer=L.currentLayer);continue}rr=Dt.wvpForTile}else if(di)continue;const ar={defines:[]},Sr=[];if(!we&&Y&&(Y.useNormalOffset=!!yi.normalBuffer),vl(ar.defines,Sr,yi,L,ii?null:j.lut),Vi||ar.defines.push("DIFFUSE_SHADED"),Et&&ar.defines.push("SHADOWS_SINGLE_CASCADE"),Ze&&(we?Ze.numRenderedVerticesInShadowPass+=yi.vertexArray.length:Ze.numRenderedVerticesInTransparentPass+=yi.vertexArray.length),we){Cc(yi,Dt.nodeModelMatrix,L,j);continue}let Xn=null;if(ie){const zr=xl(Dt.nodeModelMatrix,L.transform);if(Xn=new Float32Array(zr),ee.projection.name!=="globe"){const Ji=yi.aabb.min,Zi=yi.aabb.max,[wi,fr]=ie.getOpacityForBounds(zr,Ji[0],Ji[1],Zi[0],Zi[1]);ar.overrideFog=wi>=Pe||fr>=Pe}}const Yr=yi.material;let fn;Yr.occlusionTexture&&Yr.occlusionTexture.offsetScale&&(fn=Yr.occlusionTexture.offsetScale,ar.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const Pr=L.getOrCreateProgram("model",ar);!we&&Y&&Y.setupShadowsFromMatrix(Dt.tileModelMatrix,Pr,Y.useNormalOffset),L.uploadCommonUniforms(X,Pr,null,Xn);const Mn=Yr.pbrMetallicRoughness;Mn.metallicFactor=.9,Mn.roughnessFactor=.5;const Gn=qh(new Float32Array(rr),new Float32Array(ni),new Float32Array(kt),new Float32Array(Qt.matrix),L,Dt.opacity,Mn.baseColorFactor,Yr.emissiveFactor,Mn.metallicFactor,Mn.roughnessFactor,Yr,Wt,j,[0,0,0],fn);!sr&&(Jt.hasTranslucentParts||Dt.opacity<1)&&Pr.draw(L,X.gl.TRIANGLES,Ue,xt.disabled,Pt.disabled,mt.backCCW,Gn,j.id,yi.vertexBuffer,yi.indexBuffer,yi.segments,j.paint,L.transform.zoom,void 0,Sr),Pr.draw(L,X.gl.TRIANGLES,sr?me:Ue,xt.disabled,sr||Dt.opacity<1||Jt.hasTranslucentParts?Pt.alphaBlended:Pt.unblended,mt.backCCW,Gn,j.id,yi.vertexBuffer,yi.indexBuffer,yi.segments,j.paint,L.transform.zoom,void 0,Sr)}}}}()}(l,t,n,c),void x();if(T.type!=="model")return;const S=T.getModels(),M=[],E=l.transform.getFreeCameraOptions().position,C=s.c1([],[E.x,E.y,E.z],l.transform.worldSize);s.eq(C,C);const D=[],z=[];let F=0;for(const L of S){const N=n.paint.get("model-rotation").constantOr(null),j=n.paint.get("model-scale").constantOr(null),q=n.paint.get("model-translation").constantOr(null);L.computeModelMatrix(l,N,j,q,!0,!0,!1);const X=s.bx([]),ee=s.e9(L.position.lat,l.transform.zoom),ie=s.bn([],[1,1,1/ee]);s.bo(X,X,C),M.push({zScaleMatrix:ie,negCameraPosMatrix:X});for(const Y of L.nodes)tu(l.transform,Y,L.matrix,l.transform.expandedFarZProjMatrix,F,D,z);F++}if(D.sort((L,N)=>N.depth-L.depth),l.renderPass!=="shadow"){if(d===1)for(const L of z)ca(L,l,n,M[L.modelIndex],xt.disabled,l.colorModeForRenderPass());else{for(const L of z)ca(L,l,n,M[L.modelIndex],xt.disabled,Pt.disabled);for(const L of z)ca(L,l,n,M[L.modelIndex],l.stencilModeFor3D(),l.colorModeForRenderPass());l.resetStencilClippingMasks()}for(const L of D)ca(L,l,n,M[L.modelIndex],xt.disabled,l.colorModeForRenderPass());x()}else{for(const L of z)Cc(L.mesh,L.nodeModelMatrix,l,n);for(const L of D)Cc(L.mesh,L.nodeModelMatrix,l,n);x()}}},Rc={line:function(l,t,n){if(l.hasElevatedBuckets=!1,l.hasNonElevatedBuckets=!1,l._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||l._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(t){const c=t.getVisibleCoordinates();for(const d of c){const p=t.getTile(d).getBucket(l);if(p&&(p.elevationType!=="none"?l.hasElevatedBuckets=!0:l.hasNonElevatedBuckets=!0,l.hasElevatedBuckets&&l.hasNonElevatedBuckets))break}}}else l.hasNonElevatedBuckets=!0},model:function(l,t,n){const c=t.getSource();if(!c.loaded())return;if(c.type==="vector"||c.type==="geojson")return void(n.modelManager&&n.modelManager.upload(n,c.type==="vector"?l.scope:""));if(c.type==="batched-model"||c.type!=="model")return;const d=c.getModels();for(const p of d)p.upload(n.context)},raster:function(l,t,n){const c=t.getSource();if(!(c instanceof ko&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map(y=>t.getTileByID(y));for(const y of m)y.updateNeeded(l.id,p)&&c.prepareTile(y,d,l.id,p)},"raster-particle":function(l,t,n){const c=t.getSource();if(!(c instanceof ko&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-particle-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map(y=>t.getTileByID(y));for(const y of m)y.updateNeeded(l.id,p)&&c.prepareTile(y,d,l.id,p)}},Dc={fill:rt},En={fill:function(l,t,n,c){if(!n.layout||n.layout.get("fill-elevation-reference")==="none")return;const d=l.context.gl,p=new it(d.LEQUAL,it.ReadOnly,l.depthRangeFor3D),m=new xt({func:d.ALWAYS,mask:255},255,255,d.KEEP,d.KEEP,d.REPLACE),y=l.transform.getFreeCameraOptions().position,x=l.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const T of c){const S=t.getTile(T),M=S.getBucket(n);if(!M)continue;const E=M.elevatedStructures;if(!E||E.depthSegments.segments[0].primitiveLength===0)continue;const C=ml(T.toUnwrapped(),y),D=l.translatePosMatrix(T.projMatrix,S,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor")),z=yc(D,C,0,1,0);x.draw(l,d.TRIANGLES,p,m,Pt.disabled,mt.disabled,z,n.id,E.vertexBuffer,E.indexBuffer,E.depthSegments,n.paint,l.transform.zoom)}}};class es{constructor(t,n,c,d,p,m){this.context=new Tc(t,n),this.transform=c,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=p,this._timeStamp=s.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const y=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const T of y)this._debugParams.enabledLayers[T]=!0;p.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),p.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),p.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),p.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),p.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),p.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const T of y)p.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],T);this.occlusionParams=new ua(p),this.setup(),this.numSublayers=nn.maxUnderzooming+nn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new s.eE,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new pf(this),this._wireframeDebugCache=new bl,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const x=new s.r({width:1,height:1},Uint8Array.of(0,0,0,0));
vendor: 5,145 bytes, line 2760
2760this.emptyDepthTexture=new s.T(this.context,x,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=d,this.worldview=m}updateTerrain(t,n){const c=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(c||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new fc(this,t));const d=this._terrain;this.transform.elevation=c?d:null,d.update(t,this.transform,n),this.transform.elevation&&!d.enabled&&(this.transform.elevation=null)}_updateFog(t){const n=t.fog;if(!n||this.transform.projection.name==="globe"||n.getOpacity(this.transform.pitch)<1||n.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[c,d]=n.getFovAdjustedRange(this.transform._fov);if(c>d)return void(this.transform.fogCullDistSq=null);const p=c+.78*(d-c);this.transform.fogCullDistSq=p*p}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(t){t&&!this._terrain&&(this._terrain=new fc(this,this.style)),this._forceTerrainMode=t}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,n){if(this.width=t*s.q.devicePixelRatio,this.height=n*s.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style.order)this.style._mergedLayers[c].resize()}setup(){const t=this.context,n=new s.ba;n.emplaceBack(0,0),n.emplaceBack(s.aj,0),n.emplaceBack(0,s.aj),n.emplaceBack(s.aj,s.aj),this.tileExtentBuffer=t.createVertexBuffer(n,s.bc.members),this.tileExtentSegments=s.bd.simpleSegment(0,0,4,2);const c=new s.ba;c.emplaceBack(0,0),c.emplaceBack(s.aj,0),c.emplaceBack(0,s.aj),c.emplaceBack(s.aj,s.aj),this.debugBuffer=t.createVertexBuffer(c,s.bc.members),this.debugSegments=s.bd.simpleSegment(0,0,4,5);const d=new s.ba;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,s.bc.members),this.viewportSegments=s.bd.simpleSegment(0,0,4,2);const p=new s.aZ;p.emplaceBack(0,0,0,0),p.emplaceBack(s.aj,0,s.aj,0),p.emplaceBack(0,s.aj,0,s.aj),p.emplaceBack(s.aj,s.aj,s.aj,s.aj),this.mercatorBoundsBuffer=t.createVertexBuffer(p,s.bf.members),this.mercatorBoundsSegments=s.bd.simpleSegment(0,0,4,2);const m=new s.a_;m.emplaceBack(0,1,2),m.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(m);const y=new s.bb;for(const T of[0,1,3,2,0])y.emplaceBack(T);this.debugIndexBuffer=t.createIndexBuffer(y),this.emptyTexture=new s.T(t,new s.r({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=s.bz();const x=this.context.gl;this.stencilClearMode=new xt({func:x.ALWAYS,mask:0},0,255,x.ZERO,x.ZERO,x.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(t){return t._makeTileBoundsBuffers(this.context,this.transform.projection),t._tileBoundsBuffer?{tileBoundsBuffer:t._tileBoundsBuffer,tileBoundsIndexBuffer:t._tileBoundsIndexBuffer,tileBoundsSegments:t._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,t.TRIANGLES,it.disabled,this.stencilClearMode,Pt.disabled,mt.disabled,dc(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,n,c){if(!n||this.currentStencilSource===n.id||!t.isTileClipped()||!c||c.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let y=!1;for(const x of c)if(this._tileClippingMaskIDs[x.key]===void 0){y=!0;break}if(!y)return}this.currentStencilSource=n.id;const d=this.context,p=d.gl;this.nextStencilID+c.length>256&&this.clearStencil(),d.setColorMode(Pt.disabled),d.setDepthMode(it.disabled);const m=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const y of c){const x=n.getTile(y),T=this._tileClippingMaskIDs[y.key]=this.nextStencilID++,{tileBoundsBuffer:S,tileBoundsIndexBuffer:M,tileBoundsSegments:E}=this.getTileBoundsBuffers(x);m.draw(this,p.TRIANGLES,it.disabled,new xt({func:p.ALWAYS,mask:0},T,255,p.KEEP,p.KEEP,p.REPLACE),Pt.disabled,mt.disabled,dc(y.projMatrix),"$clipping",S,M,E)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new xt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const n=this.context.gl;return new xt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,c=t.sort((m,y)=>
2760y.overscaledZ-m.overscaledZ),d=c[c.length-1].overscaledZ,p=c[0].overscaledZ-d+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let y=0;y<p;y++)m[y+d]=new xt({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,c]}return[{[d]:xt.disabled},c]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Pt([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new s.am(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Pt.unblended:Pt.alphaBlended}colorModeForDrapableLayerRenderPass(t){const n=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?new Pt([n.ONE,n.ONE_MINUS_SRC_ALPHA,n.CONSTANT_ALPHA,n.ONE_MINUS_SRC_ALPHA],new s.am(0,0,0,t===void 0?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(t,n,c,d=!1){if(this.depthOcclusion)return new it(this.context.gl.GREATER,it.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!d)return it.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new it(c||this.context.gl.LEQUAL,n,[p,p])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,n=Math.ceil(this.width),c=Math.ceil(this.height),d=this.context.bindFramebuffer.get(),p=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===n&&this.depthFBO.height===c||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),n!==0&&c!==0&&(this.depthFBO=new Es(this.context,n,c,!1,"texture"),this.depthTexture=new s.T(this.context,{width:n,height:c,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(d),t.bindTexture(t.TEXTURE_2D,p),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,n,c,0,0,n,c,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(this._dt===0?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((t,n)=>t+n/this._fpsHistory.length,0))}render(t,n){const c=s.q.now();this._dt=c-this._timeStamp,this._timeStamp=c,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=n;const d=this.style._mergedLayers,p=!(!this.terrain||!this.terrain.enabled),m=()=>this.style._getOrder(p).filter(me=>{const oe=d[me];return!(oe.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[oe.type]});let y=m(),x=!1,T=!1,S=null;for(const me of y){const oe=d[me];oe.type==="circle"?x=!0:oe.type==="building"?S=oe:oe.type==="symbol"&&(oe.hasInitialOcclusionOpacityProperties?T=!0:x=!0)}let M=y.map(me=>d[me]);const E=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(s.q.now()),this.imageManager.beginFrame();let C=0,D=!1;for(const me in E){const oe=E[me];oe.used&&(oe.prepare(this.context),oe.getSource().usedInConflation&&++C)}let z=!1;for(const me of M)me.isHidden(this.transform.zoom)||(me.type==="clip"&&(z=!0),this.prepareLayer(me));const F={},L={},N={},j={},q={};for(const me in E){const oe=E[me];F[me]=oe.getVisibleCoordinates(),L[me]=F[me].slice().reverse(),N[me]=oe.getVisibleCoordinates(!0).reverse(),j[me]=oe.getShadowCasterCoordinates(),q[me]=oe.sortCoordinatesByDistance(F[me])}const X=me=>{const oe=this.style.getLayerSourceCache(me);return oe&&oe.used?oe.getSource():null};if(C||z||this._clippingActiveLastFrame){const me=[],oe=[];let we=0;for(const _e of M)this.isSourceForClippingOrConflation(_e,X(_e))&&(me.push(_e),oe.push(we)),we++;if(me&&(z||me.length>1)||this._clippingActiveLastFrame){z=!1;const _e=[];for(let ze=0;ze<me.length;ze++){const Re=me[ze],Le=oe[ze],Ze=this.style.getLayerSourceCache(Re);if(!Ze||!Ze.used||!Ze.getSource().usedInConflation&&Re.type!=="clip"&&Re.type!=="building")continue;let at=s.eF,dt=s.bW.None;const Qe=[];let ht=!0;if(Re.type==="building")at=s.eH;else if(Re.type==="clip"){at=Le;
vendor: 70,824 bytes, line 2760
2760for(const lt of Re.layout.get("clip-layer-types"))dt|=lt==="model"?s.bW.Model:lt==="symbol"?s.bW.Symbol:s.bW.FillExtrusion;for(const lt of Re.layout.get("clip-layer-scope"))Qe.push(lt);Re.isHidden(this.transform.zoom)?ht=!1:z=!0}ht&&_e.push({layer:Re.fqid,cache:Ze,order:at,clipMask:dt,clipScope:Qe})}this.replacementSource.setSources(_e),D=!0}}this._clippingActiveLastFrame=z,D||this.replacementSource.clear(),this.conflationActive=D,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let me=0;me<M.length;me++){const oe=M[me],we=oe.cutoffRange();if(this.longestCutoffRange=Math.max(we,this.longestCutoffRange),we>0){const _e=X(oe);_e&&(this.minCutoffZoom=Math.max(_e.minzoom,this.minCutoffZoom)),oe.minzoom&&(this.minCutoffZoom=Math.max(oe.minzoom,this.minCutoffZoom))}oe.is3D(p)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=me),this._lastOcclusionLayer=me)}const ee=this.style&&this.style.fog;ee?(this._fogVisible=ee.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=ee.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(N),this.opaquePassCutoff=0,y=m(),M=y.map(me=>d[me]));const ie=this._shadowRenderer;if(ie){ie.updateShadowParameters(this.transform,this.style.directionalLight);for(const me in E)for(const oe of F[me]){let we={min:0,max:0};this.terrain&&(we=this.terrain.getMinMaxForTile(oe)||we),ie.addShadowReceiver(oe.toUnwrapped(),we.min,we.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new s.eG(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new ue(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const Y=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),K=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(Y&&!this._snow&&(this._snow=new ou(this)),!Y&&this._snow&&(this._snow.destroy(),delete this._snow),K&&!this._rain&&(this._rain=new pa(this)),!K&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),S){this.buildingTileBorderManager||(this.buildingTileBorderManager=new Yd);const me=this.style.getLayerSourceCache(S);this.buildingTileBorderManager.updateBorders(me,S)}if(!zo.has(this.context.gl))return;this.renderPass="offscreen";for(const me of M){const oe=t.getLayerSourceCache(me);if(!me.hasOffscreenPass()||me.isHidden(this.transform.zoom))continue;const we=oe?L[oe.id]:void 0;(me.type==="custom"||me.type==="raster"||me.type==="raster-particle"||me.isSky()||we&&we.length)&&this.renderLayer(this,oe,me,we)}this.depthRangeFor3D=[0,1-(M.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,j)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const J=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),fe=(()=>{if(n.showOverdrawInspector)return s.am.black;const me=this.style.fog;if(me&&this.transform.projection.supportsFog){const oe=this.style.getLut(me.scope);if(!J){const we=me.properties.get("color-use-theme")==="none",_e=me.properties.get("color").toNonPremultipliedRenderColor(we?null:oe).toArray01();return new s.am(..._e)}if(J){const we=me.properties.get("space-color-use-theme")==="none",_e=me.properties.get("space-color").toNonPremultipliedRenderColor(we?null:oe).toArray01();return new s.am(..._e)}}return s.am.transparent})();if(this.context.clear({color:fe,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&J&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=y.length-1;this.currentLayer>=0;this.currentLayer--){const me=M[this.currentLayer],oe=t.getLayerSourceCache(me);if(me.isSky())continue;const we=oe?(me.is3D(p)?q:L)[oe.id]:void 0;this._renderTileClippingMasks(me,oe,we),this.renderLayer(this,oe,me,we)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&J&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||s.ah(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<y.length;this.currentLayer++){const me=M[this.currentLayer],oe=t.getLayerSourceCache(me);me.isSky()&&this.renderLayer(this,oe,me,oe?L[oe.id]:void 0)}function se(me,oe){let we;return oe&&(we=(me.type==="symbol"?N:me.is3D(p)?q:L)[oe.id]),we}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<y.length;){const me=M[this.currentLayer];if(me.type==="raster"||me.type==="raster-particle"){const oe=t.getLayerSourceCache(me);this.renderLayer(this,oe,me,se(me,oe))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let Ie=0;ie&&(Ie=ie.getShadowCastingLayerCount());let xe=!1,Me=-1;for(let me=0;me<y.length;++me){const oe=M[me];oe.isHidden(this.transform.zoom)||oe.is3D(p)&&(Me=me)}T&&Me===-1&&(x=!0);let Ue=!1;for(;this.currentLayer<y.length;){const me=M[this.currentLayer],oe=t.getLayerSourceCache(me);if(me.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(me)){if(me.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!Ue&&me.is3D(p)&&!p){const we=this.currentLayer,_e=ze=>{for(this.currentLayer=0;this.currentLayer<M.length;this.currentLayer++){const Re=M[this.currentLayer];if(Dc[Re.type]){const Le=this.style.getLayerSourceCache(Re);Dc[Re.type](this,Le,Re,se(Re,Le),ze)}}};_e("initialize"),_e("reset"),this.currentLayer=we,Ue=!0}if(x&&!xe&&this.terrain&&!this.transform.isOrthographic&&(xe=!0,this.blitDepth()),T&&Me!==-1&&this.currentLayer===Me+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(me,oe,oe?F[oe.id]:void 0),this.renderLayer(this,oe,me,se(me,oe)),!this.terrain&&ie&&Ie>0&&me.hasShadowPass()&&--Ie==0){{this.clearStencil(),this.resetStencilClippingMasks();const we=this.currentLayer;for(this.currentLayer=0;this.currentLayer<M.length;this.currentLayer++){const _e=M[this.currentLayer];if(En[_e.type]){const ze=this.style.getLayerSourceCache(_e);En[_e.type](this,ze,_e,se(_e,ze))}}this.currentLayer=we}if(ie.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const we=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=we;this.currentLayer++){const _e=M[this.currentLayer];if(!_e.hasLightBeamPass())continue;const ze=t.getLayerSourceCache(_e);this.renderLayer(this,ze,_e,ze?L[ze.id]:void 0)}this.currentLayer=we,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const we=this.currentLayer;this.depthOcclusion=!0;for(const _e of this.layersWithOcclusionOpacity){this.currentLayer=_e;const ze=M[this.currentLayer],Re=t.getLayerSourceCache(ze),Le=Re?L[Re.id]:void 0;this.terrain||this._renderTileClippingMasks(ze,Re,Re?F[Re.id]:void 0),this.renderLayer(this,Re,ze,Le)}this.depthOcclusion=!1,this.currentLayer=we,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 me=null;M.forEach(oe=>{const we=t.getLayerSourceCache(oe);we&&!oe.isHidden(this.transform.zoom)&&we.getVisibleCoordinates().length&&(!me||me.getSource().maxzoom<we.getSource().maxzoom)&&(me=we)}),me&&this.options.showTileBoundaries&&eo(this,me,me.getVisibleCoordinates(),s.am.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&eo(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new s.am(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(me){const oe=me.transform.padding;gl(me,me.transform.height-(oe.top||0),3,$d),gl(me,oe.bottom||0,3,Jh),Mc(me,oe.left||0,3,Qh),Mc(me,me.transform.width-(oe.right||0),3,eu);const we=me.transform.centerPoint;(function(_e,ze,Re,Le){yl(_e,ze-1,Re-10,2,20,Le),yl(_e,ze-10,Re-1,20,2,Le)})(me,we.x,me.transform.height-we.y,Zd)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),D||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:n}=this.transform.projection,c=!n||!n.includes(t.type);if(Rc[t.type]&&(c||this.terrain&&t.type==="custom")){const d=this.style.getLayerSourceCache(t);Rc[t.type](t,d,this)}this.gpuTimingEnd()}renderLayer(t,n,c,d){c.isHidden(this.transform.zoom)||(c.type==="background"||c.type==="sky"||c.type==="custom"||c.type==="model"||c.type==="raster"||c.type==="raster-particle"||d&&d.length)&&(this.id=c.id,this.gpuTimingStart(c),t.transform.projection.unsupportedLayers&&t.transform.projection.unsupportedLayers.includes(c.type)&&(!t.terrain||c.type!=="custom")||c.type==="clip"||su[c.type](t,n,c,d,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery,c=this.context.gl;let d=this.gpuTimers[t.id];d||(d=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:c.createQuery()}),d.calls++,c.beginQuery(n.TIME_ELAPSED_EXT,d.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,n=this.context.gl,c=n.createQuery();this.deferredRenderGpuTimeQueries.push(c),n.beginQuery(t.TIME_ELAPSED_EXT,c)}}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 t=this.gpuTimers;return this.gpuTimers={},t}collectDeferredRenderGpuQueries(){const t=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],t}queryGpuTimers(t){const n={};for(const c in t){const d=t[c],p=this.context.extTimerQuery,m=p.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;p.deleteQueryEXT(d.query),n[c]=m}return n}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const n=this.context.gl;let c=0;for(const d of t)c+=n.getQueryParameter(d,n.QUERY_RESULT)/1e6,n.deleteQuery(d);return c}translatePosMatrix(t,n,c,d,p){if(!c[0]&&!c[1])return t;const m=p?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(m){const T=Math.sin(m),S=Math.cos(m);c=[c[0]*S-c[1]*T,c[0]*T+c[1]*S]}const y=[p?c[0]:s.aw(n,c[0],this.transform.zoom),p?c[1]:s.aw(n,c[1],this.transform.zoom),0],x=new Float32Array(16);return s.bo(x,t,y),x}saveTileTexture(t){if(t.context!==this.context)return;const n=t.size[0],c=this._tileTextures[n];c?c.push(t):this._tileTextures[n]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(t,n,c){const d=c===void 0?this.terrain&&this.terrain.renderingToTexture:c,p=[];return this.style&&this.style.enable3dLights()&&(t==="globeRaster"||t==="terrainRaster"?(p.push("LIGHTING_3D_MODE"),p.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):d||p.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||p.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(p.push("TERRAIN"),this.linearFloatFilteringSupported()&&p.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&p.push("GLOBE"),!this._fogVisible||d||n!==void 0&&!n||p.push("FOG","FOG_DITHERING"),d&&p.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&p.push("OVERDRAW_INSPECTOR"),p}getOrCreateProgram(t,n){this.cache=this.cache||{};const c=n&&n.defines||[],d=n&&n.config,p=this.currentGlobalDefines(t,n&&n.overrideFog,n&&n.overrideRtt).concat(c),m=_c.cacheKey(hl[t],t,p,d);return this.cache[m]||(this.cache[m]=new _c(this.context,t,hl[t],d,Gd[t],p)),this.cache[m]}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 t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new s.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,n){if(this.style.enable3dLights()){const c=this.style.directionalLight,d=this.style.ambientLight;if(c&&d){const p=((m,y,x)=>{const T=m.properties.get("direction"),S=m.properties.get("color-use-theme")==="none",M=m.properties.get("color").toNonPremultipliedRenderColor(S?null:x.getLut(m.scope)).toArray01(),E=m.properties.get("intensity"),C=y.properties.get("color-use-theme")==="none",D=y.properties.get("color").toNonPremultipliedRenderColor(C?null:x.getLut(y.scope)).toArray01(),z=y.properties.get("intensity"),F=[T.x,T.y,T.z],L=s.dI(D,z),N=s.dI(M,E);return{u_lighting_ambient_color:L,u_lighting_directional_dir:F,u_lighting_directional_color:N,u_ground_radiance:Fh(F,N,L)}})(c,d,this.style);n.setLightsUniformValues(t,p)}}}uploadCommonUniforms(t,n,c,d,p){if(this.uploadCommonLightUniforms(t,n),this.terrain&&this.terrain.renderingToTexture)return;const m=this.style.fog;if(m){const y=m.getOpacity(this.transform.pitch),x=((T,S,M,E,C,D,z,F,L,N,j,q)=>{const X=T.transform,ee=S.properties.get("color-use-theme")==="none",ie=S.properties.get("color").toNonPremultipliedRenderColor(ee?null:T.style.getLut(S.scope)).toArray01();ie[3]=E;const Y=T.frameCounter/1e3%1,[K,J]=S.properties.get("vertical-range");return{u_fog_matrix:M?X.calculateFogTileMatrix(M):q||T.identityMat,u_fog_range:S.getFovAdjustedRange(X._fov),u_fog_color:ie,u_fog_horizon_blend:S.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(K,J),J],u_fog_temporal_offset:Y,u_frustum_tl:C,u_frustum_tr:D,u_frustum_br:z,u_frustum_bl:F,u_globe_pos:L,u_globe_radius:N,u_viewport:j,u_globe_transition:s.ah(X.zoom),u_is_globe:+(X.projection.name==="globe")}})(this,m,c,y,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*s.q.devicePixelRatio,this.transform.height*s.q.devicePixelRatio],d);n.setFogUniformValues(t,x)}p&&n.setCutoffUniformValues(t,p.uniformValues)}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){const t=this.canvasCopy();t&&(this.frameCopies.push(t),this.tileLoaded=!1)}canvasCopy(){const t=this.context.gl,n=t.createTexture();return t.bindTexture(t.TEXTURE_2D,n),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),n}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&&this.style.fog;return!!t&&t.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const t=this._backgroundTiles,n=this._backgroundTiles={},c=this.transform.coveringTiles({tileSize:512});for(const d of c)n[d.key]=t[d.key]||new ds(d,512,this.transform.tileZoom,this,void 0,this.worldview);return n}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(t,n){return!(!t.is3D(!(!this.terrain||!this.terrain.enabled))||t.type!=="clip"&&t.type!=="building"&&(t.minzoom&&t.minzoom>this.transform.zoom||(this.style._clipLayerPresent||t.sourceLayer!=="building"&&t.sourceLayer!=="procedural_buildings")&&(!n||n.type!=="batched-model")))}isTileAffectedByFog(t){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let n=this._cachedTileFogOpacities[t.key];return n||(this._cachedTileFogOpacities[t.key]=n=this.style.fog.getOpacityForTile(t)),n[0]>=Pe||n[1]>=Pe}setupDepthForOcclusion(t,n,c){const d=this.context,p=d.gl,m=!!c;var y;c||(c={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}),d.activeTexture.set(p.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],c.u_depth_range_unpack=[2/((y=this.depthRangeFor3D)[1]-y[0]),-1-2*y[0]/(y[1]-y[0])],c.u_occluder_half_size=.5*this.occlusionParams.occluderSize,c.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),d.activeTexture.set(p.TEXTURE0),m||n.setTerrainUniformValues(d,c)}}function fa(l,t){let n=!1,c=null;const d=()=>{c=null,n&&(l(),c=setTimeout(d,t),n=!1)};return()=>(n=!0,c||d(),c)}class Lc{constructor(t){this._hashName=t&&encodeURIComponent(t),s.aV(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=fa(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),t.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 t=this._map;if(!t)return"";const n=Fc(t);if(this._hashName){const c=this._hashName;let d=!1;const p=location.hash.slice(1).split("&").map(m=>{const y=m.split("=")[0];return y===c?(d=!0,`${y}=${n}`):m}).filter(m=>m);return d||p.push(`${c}=${n}`),`#${p.join("&")}`}return`#${n}`}_getCurrentHash(){const t=location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(n=c)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const n=this._getCurrentHash();if(n.length>=3&&!n.some(c=>isNaN(Number(c)))){const c=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(n[3]||0):t.getBearing();return t.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:c,pitch:+(n[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Fc(l,t){const n=l.getCenter(),c=Math.round(100*l.getZoom())/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,d),m=Math.round(n.lng*p)/p,y=Math.round(n.lat*p)/p,x=l.getBearing(),T=l.getPitch();let S=t?`/${m}/${y}/${c}`:`${c}/${y}/${m}`;return(x||T)&&(S+="/"+Math.round(10*x)/10),T&&(S+=`/${Math.round(T)}`),S}const ma={linearity:.3,easing:s.eI(0,0,.3,1)},ts=s.h({deceleration:2500,maxSpeed:1400},ma),au=s.h({deceleration:20,maxSpeed:1400},ma),io=s.h({deceleration:1e3,maxSpeed:360},ma),lu=s.h({deceleration:1e3,maxSpeed:90},ma);class Oc{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.q.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=s.q.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const n={zoom:0,bearing:0,pitch:0,pan:new s.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(n.pan.mag()){const p=ga(n.pan.mag(),c,s.h({},ts,t||{}));d.offset=n.pan.mult(p.amount/n.pan.mag()),d.center=this._map.transform.center,_a(d,p)}if(n.zoom){const p=ga(n.zoom,c,au);d.zoom=this._map.transform.zoom+p.amount,_a(d,p)}if(n.bearing){const p=ga(n.bearing,c,io);d.bearing=this._map.transform.bearing+s.ay(p.amount,-179,179),_a(d,p)}if(n.pitch){const p=ga(n.pitch,c,lu);d.pitch=this._map.transform.pitch+p.amount,_a(d,p)}if(d.zoom||d.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;d.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function _a(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function ga(l,t,n){const{maxSpeed:c,linearity:d,deceleration:p}=n,m=s.ay(l*d/(t/1e3),-c,c),y=Math.abs(m)/(p*d);return{easing:n.easing,duration:1e3*y,amount:m*(y/2)}}class Li extends s.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,c,d={}){const p=qn(n.getCanvasContainer(),c),m=n.unproject(p);super(t,s.h({point:p,lngLat:m,originalEvent:c},d)),this._defaultPrevented=!1,this.target=n}}class ya extends s.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,c){const d=t==="touchend"?c.changedTouches:c.touches,p=Co(n.getCanvasContainer(),d),m=p.map(x=>n.unproject(x)),y=p.reduce((x,T,S,M)=>x.add(T.div(M.length)),new s.P(0,0));super(t,{points:p,point:y,lngLats:m,lngLat:n.unproject(y),originalEvent:c}),this._defaultPrevented=!1}}class cu extends s.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n){super("wheel",{originalEvent:n}),this._defaultPrevented=!1}}class hu{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new cu(this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Li(t.type,this._map,t))}mouseup(t){this._map.fire(new Li(t.type,this._map,t))}preclick(t){const n=s.h({},t);n.type="preclick",this._map.fire(new Li(n.type,this._map,n))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||(this.preclick(t),this._map.fire(new Li(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new Li(t.type,this._map,t))}mouseover(t){this._map.fire(new Li(t.type,this._map,t))}mouseout(t){this._map.fire(new Li(t.type,this._map,t))}touchstart(t){return this._firePreventable(new ya(t.type,this._map,t))}touchmove(t){this._map.fire(new ya(t.type,this._map,t))}touchend(t){this._map.fire(new ya(t.type,this._map,t))}touchcancel(t){this._map.fire(new ya(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Cs{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new Li(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Li("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Li(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class uu{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(Ao(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const c=n,d=this._startPos,p=this._lastPos;if(!d||!p||p.equals(c)||!this._box&&c.dist(d)<this._clickTolerance)return;this._lastPos=c,this._box||(this._box=Bt("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const m=Math.min(d.x,c.x),y=Math.max(d.x,c.x),x=Math.min(d.y,c.y),T=Math.max(d.y,c.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${m}px,${x}px)`,this._box.style.width=y-m+"px",this._box.style.height=T-x+"px")})}mouseupWindow(t,n){if(!this._active)return;const c=this._startPos,d=n;if(c&&t.button===0){if(this.reset(),Ls(),c.x!==d.x||c.y!==d.y)return this._map.fire(new s.A("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(c,d,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),ao(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new s.A(t,{originalEvent:n}))}}function Tl(l,t){const n={};for(let c=0;c<l.length;c++)n[l[c].identifier]=t[c];return n}class du{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,n,c){(this.centroid||c.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=t.timeStamp),c.length===this.numTouches&&(this.centroid=function(d){const p=new s.P(0,0);for(const m of d)p._add(m);return p.div(d.length)}(n),this.touches=Tl(c,n)))}touchmove(t,n,c){if(this.aborted||!this.centroid)return;const d=Tl(c,n);for(const p in this.touches){const m=d[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,c){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),c.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class is{constructor(t){this.singleTap=new du(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,n,c){this.singleTap.touchstart(t,n,c)}touchmove(t,n,c){this.singleTap.touchmove(t,n,c)}touchend(t,n,c){const d=this.singleTap.touchend(t,n,c);if(d){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(d)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class pu{constructor(){this._zoomIn=new is({numTouches:1,numTaps:2}),this._zoomOut=new is({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,c){this._zoomIn.touchstart(t,n,c),this._zoomOut.touchstart(t,n,c)}touchmove(t,n,c){this._zoomIn.touchmove(t,n,c),this._zoomOut.touchmove(t,n,c)}touchend(t,n,c){const d=this._zoomIn.touchend(t,n,c),p=this._zoomOut.touchend(t,n,c);return d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()+1,around:m.unproject(d)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()-1,around:m.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const fu={0:1,2:2},kc={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class xa{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(t,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const c=Nl(t);this._correctButton(t,c)&&(this._lastPoint=n,this._eventButton=c)}mousemoveWindow(t,n){const c=this._lastPoint;if(c){if(t.preventDefault(),this._eventButton!=null&&function(d,p){const m=fu[p];return d.buttons===void 0||(d.buttons&m)!==m}(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(c)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(c,n)}}mouseupWindow(t){this._lastPoint&&Nl(t)===this._eventButton&&(this._moved&&Ls(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class mu extends xa{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class Bc extends xa{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?kc[t.pitchRotateKey]:void 0}_correctButton(t,n){return this._pitchRotateKey?n===0&&t[this._pitchRotateKey]:n===0&&t.ctrlKey||n===2}_move(t,n){const c=.8*(n.x-t.x);if(c)return this._active=!0,{bearingDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class _u extends xa{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?kc[t.pitchRotateKey]:void 0}_correctButton(t,n){return this._pitchRotateKey?n===0&&t[this._pitchRotateKey]:n===0&&t.ctrlKey||n===2}_move(t,n){const c=-.5*(n.y-t.y);if(c)return this._active=!0,{pitchDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class ep{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=n.clickTolerance||1,this.reset(),s.aV(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new s.P(0,0)}touchstart(t,n,c){return this._calculateTransform(t,n,c)}touchmove(t,n,c){if(this._active&&!(c.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(c.length===1&&!s.eJ())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,n,c)}}touchend(t,n,c){this._calculateTransform(t,n,c),this._active&&c.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,c){c.length>0&&(this._active=!0);const d=Tl(c,n),p=new s.P(0,0),m=new s.P(0,0);let y=0;for(const T in d){const S=d[T],M=this._touches[T];M&&(p._add(S),m._add(S.sub(M)),y++,d[T]=S)}if(this._touches=d,y<this._minTouches||!m.mag())return;const x=m.div(y);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(y),panDelta:x}}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=Bt("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 Nc{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,n,c){return{}}touchstart(t,n,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,c){const d=this._firstTwoTouches;if(!d)return;t.preventDefault();const[p,m]=d,y=Sl(c,n,p),x=Sl(c,n,m);if(!y||!x)return;const T=this._aroundCenter?null:y.add(x).div(2);return this._move([y,x],T,t)}touchend(t,n,c){if(!this._firstTwoTouches)return;const[d,p]=this._firstTwoTouches,m=Sl(c,n,d),y=Sl(c,n,p);m&&y||(this._active&&Ls(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Sl(l,t,n){for(let c=0;c<l.length;c++)if(l[c].identifier===n)return t[c]}function gu(l,t){return Math.log(l/t)/Math.LN2}class tp extends Nc{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const c=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(gu(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:gu(this._distance,c),pinchAround:n}}}function yu(l,t){return 180*l.angleWith(t)/Math.PI}class ip extends Nc{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n){const c=this._vector;if(this._vector=t[0].sub(t[1]),c&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:yu(this._vector,c),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,c=this._startVector;if(!c)return!1;const d=yu(t,c);return Math.abs(d)<n}}function Vc(l){return Math.abs(l.y)>Math.abs(l.x)}class rp extends Nc{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(t){this._lastPoints=t,Vc(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,c){const d=this._lastPoints;if(!d)return;const p=t[0].sub(d[0]),m=t[1].sub(d[1]);return this._map._cooperativeGestures&&!s.eJ()&&c.touches.length<3||(this._valid=this.gestureBeginsVertically(p,m,c.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(p.y+m.y)/2*-.5})}gestureBeginsVertically(t,n,c){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,p=n.mag()>=2;if(!d&&!p)return;if(!d||!p)return this._firstMove==null&&(this._firstMove=c),c-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return Vc(t)&&Vc(n)&&m}}const np={panStep:100,bearingStep:15,pitchStep:10};class op{constructor(){const t=np;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,c=0,d=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?c=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?c=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?d=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?d=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:y=>{const x=y.getZoom();y.easeTo({duration:300,easeId:"keyboardHandler",easing:sp,zoom:n?Math.round(x)+n*(t.shiftKey?2:1):x,bearing:y.getBearing()+c*this._bearingStep,pitch:y.getPitch()+d*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:y.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function sp(l){return l*(2-l)}const ap=4.000244140625,Ff=1/450;class Of{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Ff,s.aV(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||s.eJ()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=s.q.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,n!==0&&n%ap==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=n,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(d*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){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 n=qn(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:n,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 t=this._map.transform;this._type==="wheel"&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const n=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>ap?this._wheelZoomRate:this._defaultZoomRate;let S=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&S!==0&&(S=1/S);const M=n(),E=Math.pow(2,M),C=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):E;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(C*S))),this._type==="wheel"&&(this._startZoom=M,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const c=typeof this._targetZoom=="number"?this._targetZoom:n(),d=this._startZoom,p=this._easing;let m,y=!1;if(this._type==="wheel"&&d&&p){const T=Math.min((s.q.now()-this._lastWheelEventTime)/200,1),S=p(T);m=s.ai(d,c,S),T<1?this._frameId||(this._frameId=!0):y=!0}else m=c,y=!0;this._active=!0,y&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let x=m-n();return x*this._lastDelta<0&&(x=0),{noInertia:!0,needsRenderFrame:!y,zoomDelta:x,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=s.eK;if(this._prevEase){const c=this._prevEase,d=(s.q.now()-c.start)/c.duration,p=c.easing(d+.01)-c.easing(d),m=.27/Math.sqrt(p*p+1e-4)*.01,y=Math.sqrt(.0729-m*m);n=s.eI(m,y,.25,1)}return this._prevEase={start:s.q.now(),duration:t,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Bt("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class Ni{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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 lp{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,n){return t.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(t.shiftKey?-1:1),around:c.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class kf{constructor(){this._tap=new is({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(t,n,c){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=n[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(t,n,c))}touchmove(t,n,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=n[0],p=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,c)}touchend(t,n,c){this._tapTime?this._swipePoint&&c.length===0&&this.reset():this._tap.touchend(t,n,c)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class xu{constructor(t,n,c){this._el=t,this._mousePan=n,this._touchPan=c}enable(t){this._inertiaOptions=t||{},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 Bf{constructor(t,n,c){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class El{constructor(t,n,c,d){this._el=t,this._touchZoom=n,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Il=l=>l.zoom||l.drag||l.pitch||l.rotate;class vu extends s.A{}class Uc{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,n){const c=s.at([],n,t);this.radius=s.ae(c[2]<0?s.eM([],c,this.constants):[c[0],c[1],0])}projectRay(t){s.eM(t,t,this.constants),s.au(t,t),s.eN(t,t,this.constants);const n=s.c1([],t,this.radius);if(n[2]>0){const c=s.c1([],[0,0,1],s.bG(n,[0,0,1])),d=s.c1([],s.au([],[n[0],n[1],0]),this.radius),p=s.d5([],n,s.c1([],s.at([],s.d5([],d,c),n),2));n[0]=p[0],n[1]=p[1]}return n}}function Un(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class jc{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Oc(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Uc,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),s.aV(["handleEvent","handleWindowEvent"],this);const c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,p,m]of this._listeners){const y=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(p,y,m)}}destroy(){for(const[t,n,c]of this._listeners){const d=t===document?this.handleWindowEvent:this.handleEvent;t.removeEventListener(n,d,c)}}_addDefaultHandlers(t){const n=this._map,c=n.getCanvasContainer();this._add("mapEvent",new hu(n,t));const d=n.boxZoom=new uu(n,t);this._add("boxZoom",d);const p=new pu,m=new lp;n.doubleClickZoom=new Ni(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const y=new kf;this._add("tapDragZoom",y);const x=n.touchPitch=new rp(n);this._add("touchPitch",x);const T=new Bc(t),S=new _u(t);n.dragRotate=new Bf(t,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const M=new mu(t),E=new ep(n,t);n.dragPan=new xu(c,M,E),this._add("mousePan",M),this._add("touchPan",E,["touchZoom","touchRotate"]);const C=new ip,D=new tp;n.touchZoomRotate=new El(c,D,C,y),this._add("touchRotate",C,["touchPan","touchZoom"]),this._add("touchZoom",D,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Cs(n));const z=n.scrollZoom=new Of(n,this);this._add("scrollZoom",z,["mousePan"]);const F=n.keyboard=new op;this._add("keyboard",F);for(const L of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[L]&&n[L].enable(t[L])}_add(t,n,c){this._handlers.push({handlerName:t,handler:n,allowed:c}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Il(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(t,n,c){for(const d in t)if(d!==c&&(!n||n.indexOf(d)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const c of t)this._el.contains(c.target)&&n.push(c);return n}handleEvent(t,n){this._updatingCamera=!0;const c=t.type==="renderFrame",d=c?void 0:t,p={needsRenderFrame:!1},m={},y={},x=t.touches?this._getMapTouches(t.touches):void 0,T=x?Co(this._el,x):c?void 0:qn(this._el,t);for(const{handlerName:E,handler:C,allowed:D}of this._handlers){if(!C.isEnabled())continue;let z;this._blockedByActive(y,D,E)?C.reset():C[n||t.type]&&(z=C[n||t.type](t,T,x),this.mergeHandlerResult(p,m,z,E,d),z&&z.needsRenderFrame&&this._triggerRenderFrame()),(z||C.isActive())&&(y[E]=C)}const S={};for(const E in this._previousActiveHandlers)y[E]||(S[E]=d);this._previousActiveHandlers=y,(Object.keys(S).length||Un(p))&&(this._changes.push([p,m,S]),this._triggerRenderFrame()),(Object.keys(y).length||Un(p))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:M}=p;M&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],M(this._map))}mergeHandlerResult(t,n,c,d,p){if(!c)return;s.h(t,c);const m={handlerName:d,originalEvent:c.originalEvent||p};c.zoomDelta!==void 0&&(n.zoom=m),c.panDelta!==void 0&&(n.drag=m),c.pitchDelta!==void 0&&(n.pitch=m),c.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},c={};for(const[d,p,m]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new s.P(0,0))._add(d.panDelta)),d.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(t.around=d.around),d.aroundCoord!==void 0&&(t.aroundCoord=d.aroundCoord),d.pinchAround!==void 0&&(t.pinchAround=d.pinchAround),d.noInertia&&(t.noInertia=d.noInertia),s.h(n,p),s.h(c,m);this._updateMapTransform(t,n,c),this._changes=[]}_updateMapTransform(t,n,c){const d=this._map,p=d.transform,m=N=>[N.x,N.y,N.z];if((N=>{const j=this._eventsInProgress.drag;return j&&!this._handlersById[j.handlerName].isActive()})()&&!Un(t)){const N=p.zoom;p.cameraElevationReference="sea",this._originalZoom!=null&&p._orthographicProjectionAtLowPitch&&p.projection.name!=="globe"&&p.pitch===0?(p.cameraElevationReference="ground",p.zoom=this._originalZoom):(p.recenterOnTerrain(),p.cameraElevationReference="ground"),N!==p.zoom&&this._map._update(!0)}if(p._isCameraConstrained&&d._stop(!0),!Un(t))return void this._fireEvents(n,c,!0);let{panDelta:y,zoomDelta:x,bearingDelta:T,pitchDelta:S,around:M,aroundCoord:E,pinchAround:C}=t;p._isCameraConstrained&&(x>0&&(x=0),p._isCameraConstrained=!1),C!==void 0&&(M=C),(x||(N=>n[N]&&!this._eventsInProgress[N])("drag"))&&M&&(this._dragOrigin=m(p.pointCoordinate3D(M)),this._originalZoom=p.zoom,this._trackingEllipsoid.setup(p._camera.position,this._dragOrigin)),p.cameraElevationReference="sea",d._stop(!0),M=M||d.transform.centerPoint,T&&(p.bearing+=T),S&&(p.pitch+=S),p._updateCameraState();const D=[0,0,0];if(y)if(p.projection.name==="mercator"){const N=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(M).dir),j=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(M.sub(y)).dir);D[0]=j[0]-N[0],D[1]=j[1]-N[1]}else{const N=p.pointCoordinate(M);if(p.projection.name==="globe"){y=y.rotate(-p.angle);const j=p._pixelsPerMercatorPixel/p.worldSize;D[0]=-y.x*s.eL(s.aY(N.y))*j,D[1]=-y.y*s.eL(p.center.lat)*j}else{const j=p.pointCoordinate(M.sub(y));N&&j&&(D[0]=j.x-N.x,D[1]=j.y-N.y)}}const z=p.zoom,F=[0,0,0];if(x){const N=m(E||p.pointCoordinate3D(M)),j={dir:s.au([],s.at([],N,p._camera.position))};if(j.dir[2]<0){const q=p.zoomDeltaToMovement(N,x);s.c1(F,j.dir,q)}}const L=s.d5(D,D,F);p._translateCameraConstrained(L),x&&Math.abs(p.zoom-z)>1e-4&&p.recenterOnTerrain(),p.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,c,!0)}_fireEvents(t,n,c){const d=Il(this._eventsInProgress),p=Il(t),m={};for(const S in t){const{originalEvent:M}=t[S];this._eventsInProgress[S]||(m[`${S}start`]=M),this._eventsInProgress[S]=t[S]}!d&&p&&this._fireEvent("movestart",p.originalEvent);for(const S in m)this._fireEvent(S,m[S]);p&&this._fireEvent("move",p.originalEvent);for(const S in t){const{originalEvent:M}=t[S];this._fireEvent(S,M)}const y={};let x;for(const S in this._eventsInProgress){const{handlerName:M,originalEvent:E}=this._eventsInProgress[S];this._handlersById[M].isActive()||(delete this._eventsInProgress[S],x=n[M]||E,y[`${S}end`]=x)}for(const S in y)this._fireEvent(S,y[S]);const T=Il(this._eventsInProgress);if(c&&(d||p)&&!T){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=E=>E!==0&&-this._bearingSnap<E&&E<this._bearingSnap;S?(M(S.bearing||this._map.getBearing())&&(S.bearing=0),this._map.easeTo(S,{originalEvent:x})):(this._map.fire(new s.A("moveend",{originalEvent:x})),M(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new s.A(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{this._frameId=void 0,this.handleEvent(new vu("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const or="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class ro extends s.E{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this._respectPrefersReducedMotion=n.respectPrefersReducedMotion!==!1,s.aV(["_renderFrameCallback"],this)}getCenter(){return new s.ci(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,c){return t=s.P.convert(t).mult(-1),this.panTo(this.transform.center,s.h({offset:t},n),c)}panTo(t,n,c){return this.easeTo(s.h({center:t},n),c)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,c){return this.easeTo(s.h({zoom:t},n),c)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,c){return this.easeTo(s.h({bearing:t},n),c)}resetNorth(t,n){return this.rotateTo(0,s.h({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(s.h({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=s.aG.convert(t);const c=n&&n.bearing||0,d=n&&n.pitch||0,p=t.getNorthWest(),m=t.getSouthEast();return this._cameraForBounds(this.transform,p,m,c,d,n)}_extendPadding(t){const n={top:0,right:0,bottom:0,left:0};return t==null?s.h({},n,this.transform.padding):typeof t=="number"?{top:t,bottom:t,right:t,left:t}:s.h({},n,t)}_extendCameraOptions(t){return(t=s.h({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(t,n){const c=n.max[0]-n.min[0],d=n.max[1]-n.min[1];return c/d>t.aspect?c/(2*Math.tan(.5*t.fovX)*t.aspect):d/(2*Math.tan(.5*t.fovY)*t.aspect)}_cameraForBoundsOnGlobe(t,n,c,d,p,m){const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=p;const T=s.ci.convert(n),S=s.ci.convert(c),M=.5*(T.lat+S.lat),E=.5*(T.lng+S.lng),C=s.eO(M,E),D=s.au([],C),z=s.au([],s.bF([],D,[0,1,0])),F=s.bF([],z,D),L=[z[0],z[1],z[2],0,F[0],F[1],F[2],0,D[0],D[1],D[2],0,0,0,0,1],N=[C,s.eO(T.lat,T.lng),s.eO(S.lat,T.lng),s.eO(S.lat,S.lng),s.eO(T.lat,S.lng),s.eO(M,T.lng),s.eO(M,S.lng),s.eO(T.lat,E),s.eO(S.lat,E)];let j=s.d6.fromPoints(N.map(_e=>[s.bG(z,_e),s.bG(F,_e),s.bG(D,_e)]));const q=s.ad([],j.center,L);s.eP(q)===0&&s.eQ(q,0,0,1),s.au(q,q),s.c1(q,q,s.aB),y.center=s.eR(q);const X=y.getWorldToCameraMatrix(),ee=s.bi(new Float64Array(16),X);j=s.d6.applyTransform(j,s.az([],X,L));const ie=this._extendAABB(j,y,x,d);if(!ie)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");j=ie,s.ad(q,q,X);const Y=.5*(j.max[2]-j.min[2]),K=this._minimumAABBFrustumDistance(y,j),J=s.c1([],[0,0,1],Y),fe=s.d5(J,q,J),se=K+(y.pitch===0?0:s.bD(q,fe)),Ie=y.globeCenterInViewSpace,xe=s.at([],q,[Ie[0],Ie[1],Ie[2]]);s.au(xe,xe),s.c1(xe,xe,se);const Me=s.d5([],q,xe);s.ad(Me,Me,ee);const Ue=s.eB/s.aB,me=s.ae(Me),oe=s.cb(Math.max(me*Ue-s.eB,Number.EPSILON),0),we=Math.min(y.zoomFromMercatorZAdjusted(oe),x.maxZoom);return we>.5*(s.cX+s.cI)?(y.setProjection({name:"mercator"}),y.zoom=we,this._cameraForBounds(y,n,c,d,p,m)):{center:y.center,zoom:we,bearing:d,pitch:p}}_extendAABB(t,n,c,d){const p=.5*((c.padding.left||0)+(c.padding.right||0)),m=.5*((c.padding.top||0)+(c.padding.bottom||0)),y=m,x=p,T=p,S=m,M=n.width-(x+T),E=n.height-(y+S),C=s.at([],t.max,t.min),D=Math.min(M/C[0],E/C[1]),z=Math.min(n.scaleZoom(n.scale*D),c.maxZoom);if(isNaN(z))return null;const F=n.scale/n.zoomScale(z),L=new s.d6([t.min[0]-x*F,t.min[1]-S*F,t.min[2]],[t.max[0]+T*F,t.max[1]+y*F,t.max[2]]),N=(typeof c.offset.x=="number"&&typeof c.offset.y=="number"?new s.P(c.offset.x,c.offset.y):s.P.convert(c.offset)).rotate(-s.al(d));return L.center[0]-=N.x*F,L.center[1]+=N.y*F,L}queryTerrainElevation(t,n){const c=this.transform.elevation;return c?(n=s.h({},{exaggerated:!0},n),c.getAtPoint(s.ac.fromLngLat(t),null,n.exaggerated)):null}_cameraForBounds(t,n,c,d,p,m){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,n,c,d,p,m);const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=p;const T=s.ci.convert(n),S=s.ci.convert(c),M=new s.ci(T.lng,S.lat),E=new s.ci(S.lng,T.lat),C=y.project(T),D=y.project(S),z=this.queryTerrainElevation(T),F=this.queryTerrainElevation(S),L=this.queryTerrainElevation(M),N=this.queryTerrainElevation(E),j=[[C.x,C.y,Math.min(z||0,F||0,L||0,N||0)],[D.x,D.y,Math.max(z||0,F||0,L||0,N||0)]];let q=s.d6.fromPoints(j);const X=y.getWorldToCameraMatrix(),ee=s.bi(new Float64Array(16),X);q=s.d6.applyTransform(q,X);const ie=this._extendAABB(q,y,x,d);if(!ie)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");q=ie;const Y=.5*s.at([],q.max,q.min)[2],K=this._minimumAABBFrustumDistance(y,q),J=[0,0,1,0];s.aA(J,J,X),s.eS(J,J);const fe=s.c1([],J,K+Y),se=s.d5([],q.center,fe);s.ad(q.center,q.center,ee),s.ad(se,se,ee);const Ie=y.unproject(new s.P(q.center[0],q.center[1])),xe=s.eT(y.projection,Ie),Me=Math.pow(2,xe),Ue=Math.min(y._zoomFromMercatorZ(se[2]*y.pixelsPerMeter*Me/y.worldSize),x.maxZoom);return y.mercatorFromTransition&&Ue<.5*(s.cX+s.cI)?(y.setProjection({name:"globe"}),y.zoom=Ue,this._cameraForBounds(y,n,c,d,p,m)):{center:Ie,zoom:Ue,bearing:d,pitch:p}}fitBounds(t,n,c){const d=this.cameraForBounds(t,n);return this._fitInternal(d,n,c)}fitScreenCoordinates(t,n,c,d,p){const m=s.P.convert(t),y=s.P.convert(n),x=new s.P(Math.min(m.x,y.x),Math.min(m.y,y.y)),T=new s.P(Math.max(m.x,y.x),Math.max(m.y,y.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(m,y))return this;const S=this.transform.pointLocation3D(x),M=this.transform.pointLocation3D(T),E=this.transform.pointLocation3D(new s.P(x.x,T.y)),C=this.transform.pointLocation3D(new s.P(T.x,x.y)),D=[Math.min(S.lng,M.lng,E.lng,C.lng),Math.min(S.lat,M.lat,E.lat,C.lat)],z=[Math.max(S.lng,M.lng,E.lng,C.lng),Math.max(S.lat,M.lat,E.lat,C.lat)],F=d&&d.pitch?d.pitch:this.getPitch(),L=this._cameraForBounds(this.transform,D,z,c,F,d);return this._fitInternal(L,d,p)}_fitInternal(t,n,c){return t?(n=s.h(t,n)).linear?this.easeTo(n,c):this.flyTo(n,c):this}jumpTo(t,n){this.stop();const c=t.preloadOnly?this.transform.clone():this.transform;let d=!1,p=!1,m=!1;"zoom"in t&&c.zoom!==+t.zoom&&(d=!0,c.zoom=+t.zoom),t.center!==void 0&&(c.center=s.ci.convert(t.center)),"bearing"in t&&c.bearing!==+t.bearing&&(p=!0,c.bearing=+t.bearing),"pitch"in t&&c.pitch!==+t.pitch&&(m=!0,c.pitch=+t.pitch);const y=typeof t.padding=="number"?this._extendPadding(t.padding):t.padding;if(t.padding!=null&&!c.isPaddingEqual(y))if(t.retainPadding===!1){const x=c.clone();x.padding=y,c.setLocationAtPoint(c.center,x.centerPoint)}else c.padding=y;return t.preloadOnly?(this._preloadTiles(c),this):(this.fire(new s.A("movestart",n)).fire(new s.A("move",n)),d&&this.fire(new s.A("zoomstart",n)).fire(new s.A("zoom",n)).fire(new s.A("zoomend",n)),p&&this.fire(new s.A("rotatestart",n)).fire(new s.A("rotate",n)).fire(new s.A("rotateend",n)),m&&this.fire(new s.A("pitchstart",n)).fire(new s.A("pitch",n)).fire(new s.A("pitchend",n)),this.fire(new s.A("moveend",n)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||s.w(or),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,n){const c=this.transform;if(!c.projection.supportsFreeCamera)return s.w(or),this;this.stop();const d=c.zoom,p=c.pitch,m=c.bearing;c.setFreeCameraOptions(t);const y=d!==c.zoom,x=p!==c.pitch,T=m!==c.bearing;return this.fire(new s.A("movestart",n)).fire(new s.A("move",n)),y&&this.fire(new s.A("zoomstart",n)).fire(new s.A("zoom",n)).fire(new s.A("zoomend",n)),T&&this.fire(new s.A("rotatestart",n)).fire(new s.A("rotate",n)).fire(new s.A("rotateend",n)),x&&this.fire(new s.A("pitchstart",n)).fire(new s.A("pitch",n)).fire(new s.A("pitchend",n)),this.fire(new s.A("moveend",n)),this}easeTo(t,n){this._stop(!1,t.easeId),((t=s.h({offset:[0,0],duration:500,easing:s.eK},t)).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?+t.zoom:d,T="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,M=this._extendPadding(t.padding),E=s.P.convert(t.offset);let C,D,z;if(c.projection.name==="globe"){const J=s.ac.fromLngLat(c.center),fe=E.rotate(-c.angle);J.x+=fe.x/c.worldSize,J.y+=fe.y/c.worldSize;const se=J.toLngLat(),Ie=s.ci.convert(t.center||se);this._normalizeCenter(Ie),C=c.centerPoint.add(fe),D=new s.P(J.x,J.y).mult(c.worldSize),z=new s.P(s.aD(Ie.lng),s.aH(Ie.lat)).mult(c.worldSize).sub(D)}else{C=c.centerPoint.add(E);const J=c.pointLocation(C),fe=s.ci.convert(t.center||J);this._normalizeCenter(fe),D=c.project(J),z=c.project(fe).sub(D)}const F=c.zoomScale(x-d);let L,N;t.around&&(L=s.ci.convert(t.around),N=c.locationPoint(L));const j=this._zooming||x!==d,q=this._rotating||p!==T,X=this._pitching||S!==m,ee=!c.isPaddingEqual(M),ie=t.retainPadding===!1?c.clone():c,Y=J=>fe=>{if(j&&(J.zoom=s.ai(d,x,fe)),q&&(J.bearing=s.ai(p,T,fe)),X&&(J.pitch=s.ai(m,S,fe)),ee&&(ie.interpolatePadding(y,M,fe),C=ie.centerPoint.add(E)),L)J.setLocationAtPoint(L,N);else{const se=J.zoomScale(J.zoom-d),Ie=x>d?Math.min(2,F):Math.max(.5,F),xe=Math.pow(Ie,1-fe),Me=J.unproject(D.add(z.mult(fe*xe)).mult(se));J.setLocationAtPoint(J.renderWorldCopies?Me.wrap():Me,C)}return t.preloadOnly||this._fireMoveEvents(n),J};if(t.preloadOnly){const J=this._emulate(Y,t.duration,c);return this._preloadTiles(J),this}const K={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=j,this._rotating=q,this._pitching=X,this._padding=ee,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,K),this._ease(Y(c),J=>{c.cameraElevationReference==="sea"&&c.recenterOnTerrain(),this._afterEase(n,J)},t),this}_prepareEase(t,n,c={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),n||c.moving||this.fire(new s.A("movestart",t)),this._zooming&&!c.zooming&&this.fire(new s.A("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new s.A("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new s.A("pitchstart",t))}_fireMoveEvents(t){this.fire(new s.A("move",t)),this._zooming&&this.fire(new s.A("zoom",t)),this._rotating&&this.fire(new s.A("rotate",t)),this._pitching&&this.fire(new s.A("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const c=this._zooming,d=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new s.A("zoomend",t)),d&&this.fire(new s.A("rotateend",t)),p&&this.fire(new s.A("pitchend",t)),this.fire(new s.A("moveend",t))}flyTo(t,n){if(this._prefersReducedMotion(t)){const _e=s.aF(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(_e,n)}this.stop(),t=s.h({offset:[0,0],speed:1.2,curve:1.42,easing:s.eK},t);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?s.ay(+t.zoom,c.minZoom,c.maxZoom):d,T="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,M=this._extendPadding(t.padding),E=c.zoomScale(x-d),C=s.P.convert(t.offset);let D=c.centerPoint.add(C);const z=c.pointLocation(D),F=s.ci.convert(t.center||z);this._normalizeCenter(F);const L=c.project(z),N=c.project(F).sub(L);let j=t.curve;const q=Math.max(c.width,c.height),X=q/E,ee=N.mag();if("minZoom"in t){const _e=s.ay(Math.min(t.minZoom,d,x),c.minZoom,c.maxZoom),ze=q/c.zoomScale(_e-d);j=Math.sqrt(ze/ee*2)}const ie=j*j;function Y(_e){const ze=(X*X-q*q+(_e?-1:1)*ie*ie*ee*ee)/(2*(_e?X:q)*ie*ee);return Math.log(Math.sqrt(ze*ze+1)-ze)}function K(_e){return(Math.exp(_e)-Math.exp(-_e))/2}function J(_e){return(Math.exp(_e)+Math.exp(-_e))/2}const fe=Y(0);let se=function(_e){return J(fe)/J(fe+j*_e)},Ie=function(_e){return q*((J(fe)*(K(ze=fe+j*_e)/J(ze))-K(fe))/ie)/ee;var ze},xe=(Y(1)-fe)/j;if(Math.abs(ee)<1e-6||!isFinite(xe)){if(Math.abs(q-X)<1e-6)return this.easeTo(t,n);const _e=X<q?-1:1;xe=Math.abs(Math.log(X/q))/j,Ie=function(){return 0},se=function(ze){return Math.exp(_e*j*ze)}}t.duration="duration"in t?+t.duration:1e3*xe/("screenSpeed"in t?+t.screenSpeed/j:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const Me=p!==T,Ue=S!==m,me=!c.isPaddingEqual(M),oe=t.retainPadding===!1?c.clone():c,we=_e=>ze=>{const Re=ze*xe,Le=1/se(Re);_e.zoom=ze===1?x:d+_e.scaleZoom(Le),Me&&(_e.bearing=s.ai(p,T,ze)),Ue&&(_e.pitch=s.ai(m,S,ze)),me&&(oe.interpolatePadding(y,M,ze),D=oe.centerPoint.add(C));const Ze=ze===1?F:_e.unproject(L.add(N.mult(Ie(Re))).mult(Le));return _e.setLocationAtPoint(_e.renderWorldCopies?Ze.wrap():Ze,D),_e._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(n),_e};if(t.preloadOnly){const _e=this._emulate(we,t.duration,c);return this._preloadTiles(_e),this}return this._zooming=!0,this._rotating=Me,this._pitching=Ue,this._padding=me,this._prepareEase(n,!1),this._ease(we(c),()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(t){}_cancelRenderFrame(t){}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const c=this._onEaseEnd;this._onEaseEnd=void 0,c.call(this,n)}if(!t){const c=this.handlers;c&&c.stop(!1)}return this}_ease(t,n,c){c.animate===!1||c.duration===0?(t(1),n()):(this._easeStart=s.q.now(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((s.q.now()-this._easeStart)/this._easeOptions.duration,1),n=this._onEaseFrame;n&&n(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=s.bQ(t,-180,180);const c=Math.abs(t-n);return Math.abs(t-360-n)<c&&(t-=360),Math.abs(t+360-n)<c&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(n.maxBounds||n.projection.name!=="globe"&&!n.renderWorldCopies)return;const c=t.lng-n.center.lng;t.lng+=c>180?-360:c<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&s.q.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,n,c){const d=Math.ceil(15*n/1e3),p=[],m=t(c.clone());for(let y=0;y<=d;y++){const x=m(y/d);p.push(x.clone())}return p}_preloadTiles(t,n){}}class va{constructor(t={}){this.options=t,s.aV(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const n=this.options&&this.options.compact,c=t._getUIString("AttributionControl.ToggleAttribution");this._map=t,this._container=Bt("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Bt("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",c);const d=Bt("span","mapboxgl-ctrl-icon",this._compactButton);return d.setAttribute("aria-hidden","true"),d.setAttribute("title",c),this._innerContainer=Bt("div","mapboxgl-ctrl-attrib-inner",this._container),n&&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),n===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","fal
2760se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||s.e.ACCESS_TOKEN}];if(t){const c=n.reduce((d,p,m)=>(p.value&&(d+=`${p.key}=${p.value}${m<n.length-1?"&":""}`),d),"?");t.href=`${s.e.FEEDBACK_URL}/${c}#${Fc(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const n=this._map.style._mergedSourceCaches;for(const d in n){const p=n[d];if(p.used){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t.sort((d,p)=>d.length-p.length),t=t.filter((d,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(d)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const c=t.join(" | ");c!==this._attribHTML&&(this._attribHTML=c,t.length?(this._innerContainer.innerHTML=c,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 Al{constructor(){s.aV(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=Bt("div","mapboxgl-ctrl");const n=Bt("a","mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://www.mapbox.com/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),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(t){t&&t.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(Object.entries(t).length===0)return!0;for(const n in t){const c=t[n].getSource();if(c.hasOwnProperty("mapbox_logo")&&!c.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<250?n.classList.add("mapboxgl-compact"):n.classList.remove("mapboxgl-compact")}}}class bu{constructor(){s.aV(["_onIndoorUpdate"],this)}onAdd(t){return this._map=t,this._container=Bt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("indoorupdate",n=>this._onIndoorUpdate({selectedFloorId:n.selectedFloorId,floors:n.floors})),this._container}_createButton(t,n){const c=Bt("button",t,this._container);return c.type="button",c.addEventListener("click",n),c}_setButtonTitle(t,n){this._map&&(t.setAttribute("aria-label",n),t.innerHTML=`<strong>${n}</strong>`,t.firstElementChild&&t.firstElementChild.setAttribute("title",n))}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("indoorupdate",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(t){if(!t||!t.floors)return void(this._container.style.display="none");const n=this._model;this._model=t,this._container.style.display="inline-block";const c=t.floors.sort((d,p)=>d.levelOrder-p.levelOrder);
vendor: 9,454 bytes, line 2760
2760n?(Array.from(this._container.children).forEach(d=>d.remove()),this.addCurrentFloors(c)):this.addCurrentFloors(c)}addCurrentFloors(t){for(const n of t){const c=this._createButton("mapboxgl-ctrl-level-button",()=>{this._map._selectIndoorFloor(n.id),Array.from(this._container.children).forEach(d=>{d.classList.remove("mapboxgl-ctrl-level-button-selected")}),c.classList.add("mapboxgl-ctrl-level-button-selected")});this._setButtonTitle(c,n.shortName),this._model&&n.id===this._model.selectedFloorId&&(this._map._selectIndoorFloor(n.id),c.classList.add("mapboxgl-ctrl-level-button-selected")),this._container.append(c)}}}class cp{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,c=n?this._queue.concat(n):this._queue;for(const d of c)if(d.id===t)return void(d.cancelled=!0)}run(t=0){const n=this._currentlyRunning=this._queue;this._queue=[];for(const c of n)if(!c.cancelled&&(c.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Ml{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const n=s.dx((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}isEasing(t){return t>=this._startTime&&t<=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,n,c){this._start=this.getValue(n),this._end=t,this._startTime=n,this._endTime=n+c}}const Nf={"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 hp extends s.A{constructor(t,n,c,d){const{point:p,lngLat:m,originalEvent:y,target:x}=t;super(t.type,{point:p,lngLat:m,originalEvent:y,target:x}),this.preventDefault=()=>{t.preventDefault()},this.id=n,this.interaction=c,this.feature=d}}class wu{constructor(t){this.map=t,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(t,n){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const c=n.filter;let d=n.type;c&&this.filters.set(t,s.b3(c)),d==="mouseover"&&(d="mouseenter"),d==="mouseout"&&(d="mouseleave");const p=this.interactionsByType.get(d)||new Map;d==="mouseenter"||d==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,n)):p.size===0&&this.map.on(d,this.handleType),p.size===0&&this.interactionsByType.set(d,p),p.set(t,n),this.typeById.set(t,d)}get(t){const n=this.typeById.get(t);if(!n)return;const c=this.interactionsByType.get(n);return c?c.get(t):void 0}remove(t){const n=this.typeById.get(t);if(!n)return;this.typeById.delete(t),this.filters.delete(t);const c=this.interactionsByType.get(n);c&&(c.delete(t),n==="mouseenter"||n==="mouseleave"?(this.delegatedInteractions.delete(t),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):c.size===0&&this.map.off(n,this.handleType))}queryTargets(t,n){const c=[];for(const[d,p]of n)p.target&&c.push({targetId:d,target:p.target,filter:this.filters.get(d)});return this.map.style.queryRenderedTargets(t,c,this.map.transform)}handleMove(t){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const n=this.queryTargets(t.point,Array.from(this.delegatedInteractions).reverse());n.length&&(t.type="mouseenter",this.handleType(t,n));const c=new Map;for(const[d,{feature:p}]of this.prevHoveredFeatures)this.hoveredFeatures.has(d)||c.set(p.id,p);c.size&&(t.type="mouseleave",this.handleType(t,Array.from(c.values())))}handleOut(t){const n=Array.from(this.hoveredFeatures.values()).map(({feature:c})=>c);n.length&&(t.type="mouseleave",this.handleType(t,n)),this.hoveredFeatures.clear()}handleType(t,n){const c=t.type==="mouseenter";if(c&&!this.interactionsByType.has(t.type))return void s.w("mouseenter interaction required for mouseleave to work.");const d=Array.from(this.interactionsByType.get(t.type)).reverse(),p=!!n;n=n||this.queryTargets(t.point,d);let m=!1;const y=new Set;for(const x of n){for(const[T,S]of d){if(!S.target)continue;const M=x.variants?x.variants[T]:null;if(M){for(const E of M){if(jl(E,x,y,T))continue;const C=new s.dr(x,E),D=Ga(E,x,T);p&&(C.state=this.map.getFeatureState(C));const z=c?this.prevHoveredFeatures.get(D):null,F=new hp(t,T,S,C),L=z?z.stop:S.handler(F);if(c&&this.hoveredFeatures.set(D,{feature:x,stop:L}),L!==!1){m=!0;break}}if(m)break}}if(m)break}if(!m)for(const[x,T]of d){const{handler:S,target:M}=T;if(!M&&S(new hp(t,x,T,null))!==!1)break}}}function Tu(l,t){if(Array.isArray(l)&&Array.isArray(t)){const n=new Set(l),c=new Set(t);return n.size===c.size&&l.every(d=>c.has(d))}return s.bv(l,t)}const Cl={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},ba={showCompass:!0,showZoom:!0,visualizePitch:!1};class wo{constructor(t,n,c=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Bc({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,c&&(this.mousePitch=new _u({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),s.aV(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),Ao()}move(t,n){const c=this.map,d=this.mouseRotate.mousemoveWindow(t,n),p=d&&d.bearingDelta;if(p&&c.setBearing(c.getBearing()+p),this.mousePitch){const m=this.mousePitch.mousemoveWindow(t,n),y=m&&m.pitchDelta;y&&c.setPitch(c.getPitch()+y)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){ao(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(s.h({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),qn(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,qn(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Co(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=Co(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.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 jn(l,t,n){if(l=new s.ci(l.lng,l.lat),t){const c=new s.ci(l.lng-360,l.lat),d=new s.ci(l.lng+360,l.lat),p=360*Math.ceil(Math.abs(l.lng-n.center.lng)/360),m=n.locationPoint3D(l).distSqr(t),y=t.x<0||t.y<0||t.x>n.width||t.y>n.height;n.locationPoint3D(c).distSqr(t)<m&&(y||Math.abs(c.lng-n.center.lng)<p)?l=c:n.locationPoint3D(d).distSqr(t)<m&&(y||Math.abs(d.lng-n.center.lng)<p)&&(l=d)}for(;Math.abs(l.lng-n.center.lng)>180;){const c=n.locationPoint3D(l);if(c.x>=0&&c.y>=0&&c.x<=n.width&&c.y<=n.height)break;l.lng>n.center.lng?l.lng-=360:l.lng+=360}return l}
2760const In={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%)"},Xr={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class An extends s.E{constructor(t,n){super(),(t instanceof HTMLElement||n)&&(t=s.h({element:t},n)),s.aV(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:c="center",color:d="#3FB1CE",scale:p=1,draggable:m=!1,clickTolerance:y=0,rotation:x=Xr.rotation,rotationAlignment:T=Xr.rotationAlignment,pitchAlignment:S=Xr.pitchAlignment,occludedOpacity:M=Xr.occludedOpacity,altitude:E=Xr.altitude}=t||{};this._anchor=c,this._color=d,this._scale=p,this._draggable=m,this._clickTolerance=y,this._rotation=x,this._rotationAlignment=T,this._pitchAlignment=S,this._occludedOpacity=M,this._altitude=E,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=s.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=s.P.convert(t&&t.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",z=>{z.preventDefault()}),this._element.addEventListener("mousedown",z=>{z.preventDefault()});const C=this._element.classList;for(const z in In)C.remove(`mapboxgl-marker-anchor-${z}`);C.add(`mapboxgl-marker-anchor-${this._anchor}`);const D=t&&t.className?t.className.trim().split(/\s+/):[];C.add(...D),this._popup=null}_createDefaultMarker(){const t=Bt("div"),n=Jr("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},t);if(this._altitude===0){const c=Jr("radialGradient",{id:"shadowGradient"},Jr("defs",{},n));Jr("stop",{offset:"10%","stop-opacity":.4},c),Jr("stop",{offset:"100%","stop-opacity":.05},c),Jr("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},n)}return Jr("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"},n),Jr("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"},n),Jr("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},n),t}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&&(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=s.ci.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(t){return t===this._altitude||(this._defaultMarker&&(this._altitude===0&&t!==0||this._altitude!==0&&t===0)&&(this._element=this._createDefaultMarker()),this._altitude=t||Xr.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(t){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")),t){if(!("offset"in t.options)){const d=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
vendor: 7,438 bytes, lines 2760-2765
27600,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,t._marker=this,t._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(t){const n=t.code,c=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&c!==32&&c!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,c=this._element;this._popup&&(n===c||c.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?(t.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(t.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const t=this._map,n=this._pos;if(!t||!n)return!1;const c=t.unproject(n,this._altitude),d=t.getFreeCameraOptions();if(!d.position)return!1;const p=d.position.toLngLat();return p.distanceTo(c)<.9*p.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const n=this._pos;if(!n||n.x<0||n.x>t.transform.width||n.y<0||n.y>t.transform.height)return void this._clearFadeTimer();const c=t.unproject(n,this._altitude);let d;t._showingGlobe()&&s.eW(t.transform,this._lngLat)?d=0:(d=1-t._queryFogOpacity(c),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(d*=this._occludedOpacity)),this._element.style.opacity=`${d}`,this._element.style.pointerEvents=d>0?"auto":"none",this._popup&&this._popup._setOpacity(d),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const n=this._offset.mult(this._scale);this._element.style.transform=`
2761            translate(${t.x}px,${t.y}px)
2762            ${In[this._anchor]}
2763            ${this._calculateXYTransform()} ${this._calculateZTransform()}
2764            translate(${n.x}px,${n.y}px)
2765        `}_calculateXYTransform(){const t=this._pos,n=this._map,c=this.getPitchAlignment();if(!n||!t||c!=="map")return"";if(!n._showingGlobe()){const x=n.getPitch();return x?`rotateX(${x}deg)`:""}const d=s.cU(s.eX(n.transform,this._lngLat)),p=t.sub(s.eY(n.transform)),m=Math.abs(p.x)+Math.abs(p.y);if(m===0)return"";const y=d/m;return`rotateX(${-p.y*y}deg) rotateY(${p.x*y}deg)`}_calculateZTransform(){const t=this._pos,n=this._map;if(!n||!t)return"";let c=0;const d=this.getRotationAlignment();if(d==="map")if(n._showingGlobe()){const p=n.project(new s.ci(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),m=n.project(new s.ci(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(p);c=s.cU(Math.atan2(m.y,m.x))-90}else c=-n.getBearing();else if(d==="horizon"){const p=s.af(4,6,n.getZoom()),m=s.eY(n.transform);m.y+=p*n.transform.height;const y=t.sub(m),x=s.cU(Math.atan2(y.y,y.x));c=(x>90?x-270:x+90)*(1-p)}return c+=this._rotation,c?`rotateZ(${c}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const n=this._map;n&&(n.transform.renderWorldCopies&&(this._lngLat=jn(this._lngLat,this._pos,n.transform)),this._pos=n.project(this._lngLat,this._altitude),t===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),n._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(n._showingGlobe()||n.getTerrain()||n.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=s.P.convert(t),this._update(),this}addClassName(t){return this._element.classList.add(t),this}removeClassName(t){return this._element.classList.remove(t),this}toggleClassName(t){return this._element.classList.toggle(t)}_onMove(t){const n=this._map;if(!n)return;const c=this._pointerdownPos,d=this._positionDelta;if(c&&d){if(!this._isDragging){const p=this._clickTolerance||n._clickTolerance;if(t.point.dist(c)<p)return;this._isDragging=!0}this._pos=t.point.sub(d),this._lngLat=n.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new s.A("dragstart"))),this.fire(new s.A("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new s.A("dragend")),this._state="inactive"}_addDragHandler(t){const n=this._map,c=this._pos;n&&c&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(c),this._pointerdownPos=t.point,this._state="pending",n.on("mousemove",this._onMove),n.on("touchmove",this._onMove),n.once("mouseup",this._onUp),n.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const n=this._map;return n&&(t?(n.on("mousedown",this._addDragHandler),n.on("touchstart",this._addDragHandler)):(n.off("mousedown",this._addDragHandler),n.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||Xr.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||Xr.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t||Xr.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||Xr.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Vf={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},Uf={maxWidth:100,unit:"metric"},jf={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},Gf={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},up=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ur(l=new s.P(0,0),t="bottom"){if(typeof l=="number"){const n=Math.round(Math.sqrt(.5*Math.pow(l,2)));switch(t){case"top":return new s.P(0,l);case"top-left":return new s.P(n,n);case"top-right":return new s.P(-n,n);case"bottom":return new s.P(0,-l);case"bottom-left":return new s.P(n,-n);case"bottom-right":return new s.P(-n,-n);case"left":return new s.P(l,0);case"right":return new s.P(-l,0)}return new s.P(0,0)}return l instanceof s.P||Array.isArray(l)?s.P.convert(l):s.P.convert(l[t]||[0,0])}return{version:Gr,supported:cs.supported,setRTLTextPlugin:s.f0,getRTLTextPluginStatus:s.e$,Map:class extends ro{constructor(l){so.mark($i.create);const t=l;if((l=s.h({}
2765,Cl,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(l.antialias&&s.eU(window)&&(l.antialias=!1,s.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new gh(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies,null,null),l),this._repaint=!!l.repaint,this._interactive=l.interactive,this._minTileCacheSize=l.minTileCacheSize,this._maxTileCacheSize=l.maxTileCacheSize,this._failIfMajorPerformanceCaveat=l.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=l.preserveDrawingBuffer,this._antialias=l.antialias,this._trackResize=l.trackResize,this._bearingSnap=l.bearingSnap,this._refreshExpiredTiles=l.refreshExpiredTiles,this._fadeDuration=l.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=l.crossSourceCollisions,this._collectResourceTiming=l.collectResourceTiming,this._language=this._parseLanguage(l.language),this._worldview=l.worldview,this._renderTaskQueue=new cp,this._domRenderTaskQueue=new cp,this._controls=[],this._markers=[],this._popups=[],this._mapId=s.a$(),this._locale=s.h({},Nf,l.locale),this._clickTolerance=l.clickTolerance,this._cooperativeGestures=l.cooperativeGestures,this._performanceMetricsCollection=l.performanceMetricsCollection,this._tessellationStep=l.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=l.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Ml(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=l.scaleFactor,this._requestManager=new lr(l.transformRequest,l.accessToken,l.testMode),this._silenceAuthErrors=!!l.testMode,this._contextCreateOptions=l.contextCreateOptions?Object.assign({},l.contextCreateOptions):{},typeof l.container=="string"){const n=document.getElementById(l.container);if(!n)throw new Error(`Container '${l.container.toString()}' not found.`);this._container=n}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(this._container.childNodes.length>0&&s.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."),l.maxBounds&&this.setMaxBounds(l.maxBounds),this._spriteFormat=l.spriteFormat,s.aV(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new Df),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},()=>{this.setScaleFactor(this._scaleFactor)}),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 jc(this,l),this._localFontFamily=l.localFontFamily,this._localIdeographFontFamily=l.localIdeographFontFamily,(l.style||!l.testMode)&&this.setStyle(l.style||s.e.DEFAULT_STYLE,{config:l.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),l.projection&&this.setProjection(l.projection),this.indoor=new mf(this),l.hash&&(this._hash=new Lc(typeof l.hash=="string"&&l.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){t.center==null&&t.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch});const n=l.bounds;n&&(this.resize(),this.fitBounds(n,s.h({},l.fitBoundsOptions,{duration:0})))}this.resize(),l.attributionControl&&this.addControl(new va({customAttribution:l.customAttribution}
vendor: 10,879 bytes, line 2765
2765)),this._logoControl=new Al,this.addControl(this._logoControl,l.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new s.A(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new s.A(`${n.dataType}dataloading`,n))}),this._interactions=new wu(this)}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new s.z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=l.onAdd(this);this._controls.push(l);const c=this._controlPositions[t];return t.indexOf("bottom")!==-1?c.insertBefore(n,c.firstChild):c.appendChild(n),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new s.z(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(l){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 t=!this._moving;return t&&this.fire(new s.A("movestart",l)).fire(new s.A("move",l)),this.fire(new s.A("resize",l)),t&&this.fire(new s.A("moveend",l)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(l){return this.transform.setMaxBounds(s.aG.convert(l)),this._update()}setMinZoom(l){if((l=l??-2)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l?this.setZoom(l):this.fire(new s.A("zoomstart")).fire(new s.A("zoom")).fire(new s.A("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l??22)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l?this.setZoom(l):this.fire(new s.A("zoomstart")).fire(new s.A("zoom")).fire(new s.A("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l?this.setPitch(l):this.fire(new s.A("pitchstart")).fire(new s.A("pitch")).fire(new s.A("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l?this.setPitch(l):this.fire(new s.A("pitchstart")).fire(new s.A("pitch")).fire(new s.A("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(l){return this._scaleFactor=l,this.painter.scaleFactor=l,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers(t=>t.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(l){return l==="auto"?navigator.language:Array.isArray(l)?l.length===0?void 0:l.map(t=>t==="auto"?navigator.language:t):l}setLanguage(l){const t=this._parseLanguage(l);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const n of this._controls)n._setLanguage&&n._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(l){return this.style&&l!==this._worldview?(this._worldview=l,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(l){return this._lazyInitEmptyStyle(),l?typeof l=="string"&&(l={name:l}):l=null,this._useExplicitProjection=!!l,this._prioritizeAndUpdateProjection(l,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const l=this.transform,t=l.projection.name;let n;t==="globe"&&l.zoom>=s.cI?(l.setMercatorFromTransition(),n=!0):t==="mercator"&&l.zoom<s.cI&&(l.setProjection({name:"globe"}),n=!0),n&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(l,t){return this._updateProjection(l||t||{name:"mercator"})}_updateProjection(l){let t;return t=l.name==="globe"&&this.transform.zoom>=s.cI?this.transform.setMercatorFromTransition():this.transform.setProjection(l),this.style.applyProjectionUpdate(),t&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(l,t){return this.transform.locationPoint3D(s.ci.convert(l),t)}unproject(l,t){return this.transform.pointLocation3D(s.P.convert(l),t)}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(l,t,n){const c=d=>{let p=[];if(Array.isArray(t)){const m=t.filter(y=>this.getLayer(y));p=m.length?this.queryRenderedFeatures(d,{layers:m}):[]}else p=this.queryRenderedFeatures(d,{target:t});return p};if(l==="mouseenter"||l==="mouseover"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:m=>{const y=c(m.point);y.length?d||(d=!0,n.call(this,new Li(l,this,m.originalEvent,{features:y}))):d=!1},mouseout:()=>{d=!1}}}}if(l==="mouseleave"||l==="mouseout"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:y=>{c(y.point).length?d=!0:d&&(d=!1,n.call(this,new Li(l,this,y.originalEvent)))},mouseout:y=>{d&&(d=!1,n.call(this,new Li(l,this,y.originalEvent)))}}}}{const d=p=>{const m=c(p.point);m.length&&(p.features=m,n.call(this,p),delete p.features)};return{listener:n,targets:t,delegates:{[l]:d}}}}on(l,t,n){if(typeof t=="function"||n===void 0)return super.on(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(c);for(const d in c.delegates)this.on(d,c.delegates[d]);return this}once(l,t,n){if(typeof t=="function"||n===void 0)return super.once(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,n);for(const d in c.delegates)this.once(d,c.delegates[d]);return this}off(l,t,n){if(typeof t=="function"||n===void 0)return super.off(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._delegatedListeners?this._delegatedListeners[l]:void 0;return c&&(d=>{for(let p=0;p<d.length;p++){const m=d[p];if(m.listener===n&&Tu(m.targets,t)){for(const y in m.delegates)this.off(y,m.delegates[y]);return d.splice(p,1),this}}})(c),this}queryRenderedFeatures(l,t){if(!this.style)return[];if(l===void 0||l instanceof s.P||Array.isArray(l)||t!==void 0||(t=l,l=void 0),l=l||[[0,0],[this.transform.width,this.transform.height]],!t){const p=this.style.queryRenderedFeatures(l,void 0,this.transform),m=this.style.queryRenderedFeatureset(l,void 0,this.transform);return p.concat(m)}let n=!0;if(t.target&&(n=this._isTargetValid(t.target),n&&!t.layers))return this.style.queryRenderedFeatureset(l,t,this.transform);let c=!0;if(t.layers&&Array.isArray(t.layers)){for(const p of t.layers)if(!this._isValidId(p)){c=!1;break}if(c&&!t.target)return this.style.queryRenderedFeatures(l,t,this.transform)}let d=[];return c&&(d=d.concat(this.style.queryRenderedFeatures(l,t,this.transform))),n&&(d=d.concat(this.style.queryRenderedFeatureset(l,t,this.transform))),d}querySourceFeatures(l,t){return!l||typeof l=="string"&&!this._isValidId(l)?[]:this.style.querySourceFeatures(l,t)}isPointOnSurface(l){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&s.w(`${t} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(s.P.convert(l))}addInteraction(l,t){return this._interactions.add(l,t),this}removeInteraction(l){return this._interactions.remove(l),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(l){return this._cooperativeGestures=l,this}setStyle(l,t){return t=s.h({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t),this.style&&l&&t.diff!==!1&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&!t.config?(this.style._diffStyle(l,(n,c)=>{if(n){const d=typeof n=="string"?n:n instanceof Error?n.message:n.error;s.w(`Unable to perform style diff: ${d}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}else c&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(l,t))}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),l){const n=s.h({},t);t&&t.config&&(n.initialConfig=t.config,delete n.config),this.style=new Nn(this,n).load(l),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Nn(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():(s.w("There is no style added to the map."),!1)}_isValidId(l){return l==null?(this.fire(new s.z(new Error("IDs can't be empty."))),!1):!s.dk(l)||(this.fire(new s.z(new Error(`IDs can't 
2765contain special symbols: "${l}".`))),!1)}_isTargetValid(l){return"featuresetId"in l?this._isValidId("importId"in l?l.importId:l.featuresetId):"layerId"in l&&this._isValidId(l.layerId)}_areTargetsValid(l){if(Array.isArray(l)){for(const t of l)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(l)}addSource(l,t){return this._isValidId(l)?(this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)):this}isSourceLoaded(l){return!!this._isValidId(l)&&!!this.style&&this.style._isSourceCacheLoaded(l)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(l,t,n){this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,n)}removeSource(l){return this._isValidId(l)?(this.style.removeSource(l),this._updateTerrain(),this._update(!0)):this}getSource(l){return this._isValidId(l)?this.style.getOwnSource(l):null}addImage(l,t,{pixelRatio:n=1,sdf:c=!1,stretchX:d,stretchY:p,content:m}={}){this._lazyInitEmptyStyle();const y=s.I.from(l);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:x,height:T,data:S}=s.q.getImageData(t);this.style.addImage(y,{data:new s.r({width:x,height:T},S),pixelRatio:n,stretchX:d,stretchY:p,content:m,sdf:c,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new s.z(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:x,height:T}=t,S=t;this.style.addImage(y,{data:new s.r({width:x,height:T},new Uint8Array(S.data)),pixelRatio:n,stretchX:d,stretchY:p,content:m,sdf:c,usvg:!1,version:0,userImage:S}),S.onAdd&&S.onAdd(this,l)}}updateImage(l,t){this._lazyInitEmptyStyle();const n=s.I.from(l),c=this.style.getImage(n);if(!c)return void this.fire(new s.z(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap?s.q.getImageData(t):t,{width:p,height:m,data:y}=d;if(p===void 0||m===void 0)return void this.fire(new s.z(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(p!==(c.usvg?c.icon.usvg_tree.width:c.data.width)||m!==(c.usvg?c.icon.usvg_tree.height:c.data.height))return void this.fire(new s.z(new Error(`The width and height of the updated image (${p}, ${m})
2766                must be that same as the previous version of the image
2767                (${c.data.width}, ${c.data.height})`)));const x=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let T=!1;c.usvg?(c.data=new s.r({width:p,height:m},new Uint8Array(y)),c.usvg=!1,c.icon=void 0,T=!0):c.data.replace(y,x),this.style.updateImage(n,c,T)}hasImage(l){return l?!!this.style&&!!this.style.getImage(s.I.from(l)):(this.fire(new s.z(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(s.I.from(l))}loadImage(l,t){s.o(this._requestManager.transformRequest(l,s.R.Image),(n,c)=>{t(n,c instanceof HTMLImageElement?s.q.getImageData(c):c)})}listImages(){return this.style.listImages().map(l=>l.name)}addModel(l,t){this._lazyInitEmptyStyle(),this.style.addModel(l,t)}hasModel(l){return l?this.style.hasModel(l):(this.fire(new s.z(new Error("Missing required model id"))),!1)}removeModel(l){this.style.removeModel(l)}listModels(){return this.style.listModels()}addLayer(l,t){return this._isValidId(l.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)):this}getSlot(l){const t=this.getLayer(l);return t&&t.slot||null}setSlot(l,t){return this.style.setSlot(l,t),this.style.mergeLayers(),this._update(!0)}addImport(l,t){return this.style.addImport(l,t).catch(n=>this.fire(new s.z(new Error("Failed to add import",n)))),this}updateImport(l,t){return typeof t!="string"&&t.id!==l?(this.removeImport(l),this.addImport(t)):(this.style.updateImport(l,t),this._update(!0))}removeImport(l){return this.style.removeImport(l),this}moveImport(l,t){return this.style.moveImport(l,t),this._update(!0)}moveLayer(l,t){return this._isValidId(l)?(this.style.moveLayer(l,t),this._update(!0)):this}removeLayer(l){return this._isValidId(l)?(this.style.removeLayer(l),this._update(!0)):this}getLayer(l){if(!this._isValidId(l))return null;const t=this.style.getOwnLayer(l);return t?t.type==="custom"?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(l,t,n){return this._isValidId(l)?(this.style.setLayerZoomRange(l,t,n),this._update(!0)):this}setFilter(l,t,n={}){return this._isValidId(l)?(this.style.setFilter(l,t,n),this._update(!0)):this}getFilter(l){return this._isValidId(l)?this.style.getFilter(l):null}setPaintProperty(l,t,n,c={}){return this._isValidId(l)?(this.style.setPaintProperty(l,t,n,c),this._update(!0)):this}getPaintProperty(l,t){return this._isValidId(l)?this.style.getPaintProperty(l,t):null}setLayoutProperty(l,t,n,c={}){return this._isValidId(l)?(this.style.setLayoutProperty(l,t,n,c),this._update(!0)):this}getLayoutProperty(l,t){return this._isValidId(l)?this.style.getLayoutProperty(l,t):null}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(l){return this.style.setGlyphsUrl(l),this._update(!0)}getSchema(l){return this.style.getSchema(l)}setSchema(l,t){return this.style.setSchema(l,t),this._update(!0)}getConfig(l){return this.style.getConfig(l)}setConfig(l,t){return this.style.setConfig(l,t),this._update(!0)}getConfigProperty(l,t){return this.style.getConfigProperty(l,t)}setConfigProperty(l,t,n){return this.style.setConfigProperty(l,t,n),this._update(!0)}getFeaturesetDescriptors(l){return this.style.getFeaturesetDescriptors(l)}setLights(l){if(this._lazyInitEmptyStyle(),l&&l.length===1&&l[0].type==="flat"){const t=l[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(l),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const l=this.style.getLights()||[];return l.length===0&&l.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),l}setLight(l,t={}
vendor: 18,628 bytes, line 2767
2767){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:l}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(l){return this._lazyInitEmptyStyle(),!l&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(l),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(l){return this._lazyInitEmptyStyle(),this.style.setFog(l),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(l){return this._lazyInitEmptyStyle(),this.style.setSnow(l),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(l){return this._lazyInitEmptyStyle(),this.style.setRain(l),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(l){return this._lazyInitEmptyStyle(),this.style.setColorTheme(l),this._update(!0)}setImportColorTheme(l,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(l,t),this._update(!0)}setCamera(l){return this.style.setCamera(l),this._triggerCameraUpdate(l)}_triggerCameraUpdate(l){return this._update(this.transform.setOrthographicProjectionAtLowPitch(l["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(l){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(s.ci.convert(l),this.transform):0}setFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.setFeatureState(l,t),this._update())}removeFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.removeFeatureState(l,t),this._update())}getFeatureState(l){return l.source&&!this._isValidId(l.source)?null:this.style.getFeatureState(l)}_selectIndoorFloor(l){this.indoor.selectFloor(l)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new bu),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const l=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let n,c,d,p=this._container;for(;p&&(!c||!d);){const m=window.getComputedStyle(p).transform;m&&m!=="none"&&(n=m.match(/matrix.*\((.+)\)/)[1].split(", "),n[0]&&n[0]!=="0"&&n[0]!=="1"&&(c=n[0]),n[3]&&n[3]!=="0"&&n[3]!=="1"&&(d=n[3])),p=p.parentElement}this._containerWidth=c?Math.abs(l/c):l,this._containerHeight=d?Math.abs(t/d):t}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&s.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 l=this._container;l.classList.add("mapboxgl-map"),(this._missingCSSCanary=Bt("div","mapboxgl-canary",l)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=Bt("div","mapboxgl-canvas-container",l);this._canvas=Bt("canvas","mapboxgl-canvas",t),this._interactive&&(t.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 n=this._controlContainer=Bt("div","mapboxgl-control-container",l),c=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(d=>{c[d]=Bt("div",`mapboxgl-ctrl-${d}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(l,t){const n=s.q.devicePixelRatio||1;this._canvas.width=n*Math.ceil(l),this._canvas.height=n*Math.ceil(t),this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_addMarker(l){this._markers.push(l)}_removeMarker(l){const t=this._markers.indexOf(l);t!==-1&&this._markers.splice(t,1)}_addPopup(l){this._popups.push(l)}_removePopup(l){const t=this._popups.indexOf(l);t!==-1&&this._popups.splice(t,1)}_setupPainter(){const l=s.h({},cs.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",l);t?(Ro(t,!0),this.painter=new es(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp,this._worldview),this.on("data",n=>{n.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),s.l.testSupport(t)):this.fire(new s.z(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.A("webglcontextlost",{originalEvent:l}))}_contextRestored(l){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.reloadModels(),this.style.clearSources()),this._update(),this.fire(new s.A("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.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(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_requestDomTask(l){!this.loaded()||this.loaded()&&!this.isMoving()?l():this._domRenderTaskQueue.add(l)}_render(l){let t;this.fire(new s.A("renderstart")),++this._frameId;const n=this.painter.context.extTimerQuery,c=s.q.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=d.createQuery(),d.beginQuery(n.TIME_ELAPSED_EXT,t)),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(l),this._domRenderTaskQueue.run(l),this._removed)return;this._updateProjectionTransition();const p=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const T=this.transform.zoom,S=this.transform.pitch,M=s.q.now(),E=new s.aa(T,{now:M,fadeDuration:p,pitch:S,transition:this.style.transition,worldview:this._worldview});this.style.update(E)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let m=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),m=this._updateAverageElevation(c),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):m=this._updateAverageElevation(c);const y=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,p,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),y&&(this._placementDirty=y.needsRerender),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:p,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new s.A("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,so.mark($i.load),this.fire(new s.A("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const T=s.q.now()-c;d.endQuery(n.TIME_ELAPSED_EXT),setTimeout(()=>{const S=d.getQueryParameter(t,d.QUERY_RESULT)/1e6;d.deleteQuery(t),this.fire(new s.A("gpu-timing-frame",{cpuTime:T,gpuTime:S}))},50)}if(this.listens("gpu-timing-layer")){const T=this.painter.collectGpuTimers();setTimeout(()=>{const S=this.painter.queryGpuTimers(T);this.fire(new s.A("gpu-timing-layer",{layerTimes:S}))},50)}if(this.listens("gpu-timing-deferred-render")){const T=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const S=this.painter.queryGpuTimeDeferredRender(T);this.fire(new s.A("gpu-timing-deferred-render",{gpuTime:S}))},50)}const x=this._sourcesDirty||this._styleDirty||this._placementDirty||m;if(x||this._repaint)this.triggerRepaint();else{const T=this.idle();if(T&&(m=this._updateAverageElevation(c,!0)),m)this.triggerRepaint();else if(this._triggerFrame(!1),T&&(this.fire(new s.A("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const S=this._calculateSpeedIndex();this.fire(new s.A("speedindexcompleted",{speedIndex:S})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||x||(this._fullyLoaded=!0,so.mark($i.fullLoad),this._performanceMetricsCollection&&cr(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(l){for(const t of this._markers)l&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!l||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(l,t=!1){const n=d=>(this.transform.averageElevation=d,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&n(0);const c=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(c||(t||l-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(l)){const d=this.transform.averageElevation;let p=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(p)?p=0:this._averageElevationLastSampledAt=l;const m=Math.abs(d-p);if(m>1){if(this._isInitialLoad||c)return this._averageElevation.jumpTo(p),n(p);this._averageElevation.easeTo(p,l,300)}else if(m>1e-4)return this._averageElevation.jumpTo(p),n(p)}return!!this._averageElevation.isEasing(l)&&n(this._averageElevation.getValue(l))}_authenticate(){tr(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,l=>{if(l&&(l.message===Cr||l.status===401)){const t=this.painter.context.gl;Ro(t,!1),this._logoControl instanceof Al&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new s.z(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/")))}}),Vl(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Ri(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const l=this._isDragging();this.painter.updateTerrain(this.style,l)}_calculateSpeedIndex(){const l=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const n=this.painter.context.gl,c=n.createFramebuffer();function d(p){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,p,0);const m=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,m),m}return n.bindFramebuffer(n.FRAMEBUFFER,c),this._canvasPixelComparison(d(l),t.canvasCopies.map(d),t.timeStamps)}_canvasPixelComparison(l,t,n){let c=n[1]-n[0];const d=l.length/4;for(let p=0;p<t.length;p++){const m=t[p];let y=0;for(let x=0;x<m.length;x+=4)m[x]===l[x]&&m[x+1]===l[x+1]&&m[x+2]===l[x+2]&&m[x+3]===l[x+3]&&(y+=1);c+=(n[p+2]-n[p+1])*(1-y/d)}return c}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.indoor.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 l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.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),zo.delete(this.painter.context.gl),Qr.remove(),Os.remove(),this._removed=!0,this.fire(new s.A("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(l){this._renderNextFrame=this._renderNextFrame||l,this.style&&!this._frame&&(this._frame=s.q.frame(t=>{const n=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,n&&this._render(t)}))}_preloadTiles(l){const t=this.style?this.style.getSourceCaches():[];return s.bt(t,(n,c)=>n._preloadTiles(l,c),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(l){this._showParseStatus!==l&&(this._showParseStatus=l,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(l){this._showTerrainWireframe!==l&&(this._showTerrainWireframe=l,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(l){this._showLayers2DWireframe!==l&&(this._showLayers2DWireframe=l,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(l){this._showLayers3DWireframe!==l&&(this._showLayers3DWireframe=l,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(l){this._speedIndexTiming!==l&&(this._speedIndexTiming=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,this._tp.refreshUI(),l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(l){this._showTileAABBs!==l&&(this._showTileAABBs=l,this._tp.refreshUI(),l&&this._update())}_setCacheLimits(l,t){s.eV(l,t)}get version(){return Gr}},NavigationControl:class{constructor(l={}){this.options=s.h({},ba,l),this._container=Bt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(s.aV(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>{this._map&&this._map.zoomIn({},{originalEvent:t})}),Bt("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",t=>{this._map&&this._map.zoomOut({},{originalEvent:t})}),Bt("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.aV(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{const n=this._map;n&&(this.options.visualizePitch?n.resetNorthPitch({},{originalEvent:t}):n.resetNorth({},{originalEvent:t}))}),this._compassIcon=Bt("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map;if(!l)return;
vendor: 1,461 bytes, line 2767
2767const t=l.getZoom(),n=t===l.getMaxZoom(),c=t===l.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())}_rotateCompassArrow(){const l=this._map;if(!l)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(l.transform.pitch*(Math.PI/180)),.5)}) rotateX(${l.transform.pitch}deg) rotateZ(${l.transform.angle*(180/Math.PI)}deg)`:`rotate(${l.transform.angle*(180/Math.PI)}deg)`;l._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(l){return this._map=l,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),l.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&l.on("pitch",this._rotateCompassArrow),l.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new wo(l,this._compass,this.options.visualizePitch)),this._container}onRemove(){const l=this._map;l&&(this._container.remove(),this.options.showZoom&&l.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&l.off("pitch",this._rotateCompassArrow),l.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}
2767_createButton(l,t){const n=Bt("button",l,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(l,t){if(!this._map)return;const n=this._map._getUIString(`NavigationControl.${t}`);l.setAttribute("aria-label",n),l.firstElementChild&&l.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends s.E{constructor(l={}){super();const t=navigator.geolocation;this.options=s.h({geolocation:t},Vf,l),s.aV(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=fa(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(l){return this._map=l,this._container=Bt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){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(l){const t=(n=!!this.options.geolocation)=>{this._supportsGeolocation=n,l(n)};this._supportsGeolocation!==void 0?l(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(n=>t(n.state!=="denied")).catch(()=>t()):t()}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),n=l.coords;return!!t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new s.A("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.A("geolocate",l)),this._finish()}}_updateCamera(l){const t=new s.ci(l.coords.longitude,l.coords.latitude),n=l.coords.accuracy,c=this._map.getBearing(),d=s.h({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),d,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new s.ci(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map.transform,t=s.cb(1,l._center.lat)*l.worldSize,n=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}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(l){if(this._map){if(this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.A("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=Bt("button","mapboxgl-ctrl-geolocate",this._container),Bt("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){s.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2767se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Bt("div","mapboxgl-user-location"),this._dotElement.appendChild(Bt("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Bt("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new An({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Bt("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new An({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new s.A("trackuserlocationend")))})}}_onDeviceOrientation(l){this._userLocationDotMarker&&(l.webkitCompassHeading?this._heading=l.webkitCompassHeading:l.absolute===!0&&(this._heading=-1*l.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return s.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new s.A("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new s.A("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.A("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let l;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(l={maximumAge:6e5,timeout:0},this._noTimeout=!0):(l=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,l),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const l=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=>{t==="granted"&&l()}).catch(console.error):l()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
2767se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:va,ScaleControl:class{constructor(l={}){this.options=s.h({},Uf,l),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),s.aV(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const l=this.options.maxWidth||100,t=this._map,n=t._containerHeight/2,c=t._containerWidth/2-l/2,d=t.unproject([c,n]),p=t.unproject([c+l,n]),m=d.distanceTo(p);if(this.options.unit==="imperial"){const y=3.2808*m;y>5280?this._setScale(l,y/5280,"mile"):this._setScale(l,y,"foot")}else this.options.unit==="nautical"?this._setScale(l,m/1852,"nautical-mile"):m>=1e3?this._setScale(l,m/1e3,"kilometer"):this._setScale(l,m,"meter")}_setScale(l,t,n){this._map._requestDomTask(()=>{const c=function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let y=p/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(y),m*y}(t),d=c/t;this._container.innerHTML=this._isNumberFormatSupported&&n!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:n}).format(c):`${c}&nbsp;${jf[n]}`,this._container.style.width=l*d+"px"})}onAdd(l){return this._map=l,this._language=l.getLanguage(),this._container=Bt("div","mapboxgl-ctrl mapboxgl-ctrl-scale",l.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(l){this._language=l,this._update()}setUnit(l){this.options.unit=l,this._update()}},FullscreenControl:class{constructor(l={}){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:s.w("Full screen control 'container' must be a DOM element.")),s.aV(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=Bt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.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 l=this._fullscreenButton=Bt("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Bt("span","mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",l)}_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:bu,Popup:class extends s.E{constructor(l){super(),this.options=s.h(Object.create(Gf),l),this._altitude=this.options.altitude,s.aV(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(l&&l.className?l.className.trim().split(/\s+/):[])}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&l.on("preclick",this._onClose),this.options.closeOnMove&&l.on("move",this._onClose),l.on("remove",this.remove),this._update(),l._addPopup(this),this._focusFirstElement(),this._trackPointer?(l.on("mousemove",this._onMouseEvent),l.on("mouseup",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")):l.on("move",this._update),this.fire(new s.A("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const l=this._map;return l&&(l.off("move",this._update),l.off("move",this._onClose),l.off("preclick",this._onClose),l.off("click",this._onClose),l.off("remove",this.remove),l.off("mousemove",this._onMouseEvent),l.off("mouseup",this._onMouseEvent),l.off("drag",this._onMouseEvent),l._canvasContainer&&l._canvasContainer.classList.remove("mapboxgl-track-pointer"),l._removePopup(this),this._map=void 0),this.fire(new s.A("close")),this}getLngLat(){return this._lngLat}setLngLat(l){this._lngLat=s.ci.convert(l),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(l){return this._altitude=l,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const l=this._map;return l&&(l.off("move",this._update),l.on("mousemove",this._onMouseEvent),l.on("drag",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),n=document.createElement("body");let c;for(n.innerHTML=l;c=n.firstChild,c;
vendor: 3,989 bytes, line 2767
2767)t.appendChild(c);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=Bt("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(l),this.options.closeButton){const n=this._closeButton=Bt("button","mapboxgl-popup-close-button",t);n.type="button",n.setAttribute("aria-label","Close popup"),n.innerHTML='<span aria-hidden="true">&#215;</span>',n.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(l){return this._classList.add(l),this._updateClassList(),this}removeClassName(l){return this._classList.delete(l),this._updateClassList(),this}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){let t;return this._classList.delete(l)?t=!1:(this._classList.add(l),t=!0),this._updateClassList(),t}_onMouseEvent(l){this._update(l.point)}_getAnchor(l){if(this.options.anchor)return this.options.anchor;const t=this._map,n=this._container,c=this._pos;if(!t||!n||!c)return"bottom";const d=n.offsetWidth,p=n.offsetHeight,m=c.x<d/2,y=c.x>t.transform.width-d/2;if(c.y+l<p)return m?"top-left":y?"top-right":"top";if(c.y>t.transform.height-p){if(m)return"bottom-left";if(y)return"bottom-right"}return m?"left":y?"right":"bottom"}_updateClassList(){const l=this._container;if(!l)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),l.className=t.join(" ")}_update(l){const t=this._map,n=this._content;if(!t||!this._lngLat&&!this._trackPointer||!n)return;let c=this._container;if(c||(c=this._container=Bt("div","mapboxgl-popup",t.getContainer()),this._tip=Bt("div","mapboxgl-popup-tip",c),c.appendChild(n)),this.options.maxWidth&&c.style.maxWidth!==this.options.maxWidth&&(c.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=jn(this._lngLat,this._pos,t.transform)),!this._trackPointer||l){const d=this._pos=this._trackPointer&&l instanceof s.P?l:t.project(this._lngLat,this._altitude),p=Ur(this.options.offset),m=this._anchor=this._getAnchor(p.y),y=Ur(this.options.offset,m),x=d.add(y).round();t._requestDomTask(()=>{this._container&&m&&(this._container.style.transform=`${In[m]} translate(${x.x}px,${x.y}px)`)})}if(!this._marker&&t._showingGlobe()){const d=s.eW(t.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(up);l&&l.focus()}_onClose(){this.remove()}_setOpacity(l){this._container&&(this._container.style.opacity=`${l}`),this._content&&(this._content.style.pointerEvents=l?"auto":"none")}},Marker:An,Style:Nn,LngLat:s.ci,LngLatBounds:s.aG,Point:s.P,MercatorCoordinate:s.ac,FreeCameraOptions:md,Evented:s.E,config:s.e,prewarm:s.e_,clearPrewarmedResources:s.eZ,get accessToken(){return s.e.ACCESS_TOKEN},set accessToken(l){s.e.ACCESS_TOKEN=l},get baseApiUrl(){return s.e.API_URL},set baseApiUrl(l){s.e.API_URL=l},get workerCount(){return s.f7.workerCount},set workerCount(l){s.f7.workerCount=l},get maxParallelImageRequests(){return s.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){s.e.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){s.f6(l)},get workerUrl(){return s.f5.workerUrl},set workerUrl(l){s.f5.workerUrl=l},get workerClass(){return s.f5.workerClass},set workerClass(l){s.f5.workerClass=l},get workerParams(){return s.f5.workerParams},set workerParams(l){s.f5.workerParams=l},get dracoUrl(){return s.f4()},set dracoUrl(l){s.f3(l)},get meshoptUrl(){return s.f2()},set meshoptUrl(l){s.f1(l)},setNow:s.q.setNow,restoreNow:s.q.restoreNow}});var K0=lf;return K0})})(W0);var Ab=W0.exports;const zb=Ib(Ab);export{zb as m};

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.