import{a as Ae,b as qt,c as nd,d as Wle,e as Tc,f as d3,g as u3,h as He}from"./chunk-JTGFI4FN.js";var aF=Wle((Q8,X8)=>{"use strict";(function(t,i){typeof Q8=="object"&&typeof X8<"u"?X8.exports=i():typeof define=="function"&&define.amd?define(i):(t=typeof globalThis<"u"?globalThis:t||self,t.mapboxgl=i())})(Q8,function(){"use strict";var t,i,e;function n(r,p){if(!t)t=p;else if(!i)i=p;else{var x="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 = {}; ("+t+")(sharedChunk); ("+i+")(sharedChunk); self.onerror = null;",S={};t(S),e=p(S),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(e.workerUrl=window.URL.createObjectURL(new Blob([x],{type:"text/javascript"})))}}n(["exports"],function(r){var p=1e-6,x=typeof Float32Array<"u"?Float32Array:Array;function S(c,s){var l=s[0],u=s[1],h=s[2],g=s[3],_=l*g-h*u;return _?(c[0]=g*(_=1/_),c[1]=-u*_,c[2]=-h*_,c[3]=l*_,c):null}function O(){var c=new x(9);return x!=Float32Array&&(c[1]=0,c[2]=0,c[3]=0,c[5]=0,c[6]=0,c[7]=0),c[0]=1,c[4]=1,c[8]=1,c}function B(c,s){var l=s[0],u=s[1],h=s[2],g=s[3],_=s[4],b=s[5],C=s[6],T=s[7],A=s[8];return c[0]=_*A-b*T,c[1]=h*T-u*A,c[2]=u*b-h*_,c[3]=b*C-g*A,c[4]=l*A-h*C,c[5]=h*g-l*b,c[6]=g*T-_*C,c[7]=u*C-l*T,c[8]=l*_-u*g,c}function K(c,s,l){var u=s[0],h=s[1],g=s[2],_=s[3],b=s[4],C=s[5],T=s[6],A=s[7],D=s[8],M=l[0],L=l[1],F=l[2],j=l[3],H=l[4],G=l[5],ie=l[6],ne=l[7],se=l[8];return c[0]=M*u+L*_+F*T,c[1]=M*h+L*b+F*A,c[2]=M*g+L*C+F*D,c[3]=j*u+H*_+G*T,c[4]=j*h+H*b+G*A,c[5]=j*g+H*C+G*D,c[6]=ie*u+ne*_+se*T,c[7]=ie*h+ne*b+se*A,c[8]=ie*g+ne*C+se*D,c}function re(){var c=new x(16);return x!=Float32Array&&(c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=0,c[12]=0,c[13]=0,c[14]=0),c[0]=1,c[5]=1,c[10]=1,c[15]=1,c}function te(c){return c[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=1,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=1,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c}function Ie(c,s){var l=s[0],u=s[1],h=s[2],g=s[3],_=s[4],b=s[5],C=s[6],T=s[7],A=s[8],D=s[9],M=s[10],L=s[11],F=s[12],j=s[13],H=s[14],G=s[15],ie=l*b-u*_,ne=l*C-h*_,se=l*T-g*_,_e=u*C-h*b,ye=u*T-g*b,Ce=h*T-g*C,De=A*j-D*F,Me=A*H-M*F,lt=A*G-L*F,Ne=D*H-M*j,dt=D*G-L*j,vt=M*G-L*H,ut=ie*vt-ne*dt+se*Ne+_e*lt-ye*Me+Ce*De;return ut?(c[0]=(b*vt-C*dt+T*Ne)*(ut=1/ut),c[1]=(h*dt-u*vt-g*Ne)*ut,c[2]=(j*Ce-H*ye+G*_e)*ut,c[3]=(M*ye-D*Ce-L*_e)*ut,c[4]=(C*lt-_*vt-T*Me)*ut,c[5]=(l*vt-h*lt+g*Me)*ut,c[6]=(H*se-F*Ce-G*ne)*ut,c[7]=(A*Ce-M*se+L*ne)*ut,c[8]=(_*dt-b*lt+T*De)*ut,c[9]=(u*lt-l*dt-g*De)*ut,c[10]=(F*ye-j*se+G*ie)*ut,c[11]=(D*se-A*ye-L*ie)*ut,c[12]=(b*Me-_*Ne-C*De)*ut,c[13]=(l*Ne-u*Me+h*De)*ut,c[14]=(j*ne-F*_e-H*ie)*ut,c[15]=(A*_e-D*ne+M*ie)*ut,c):null}function Pe(c,s,l){var u=s[0],h=s[1],g=s[2],_=s[3],b=s[4],C=s[5],T=s[6],A=s[7],D=s[8],M=s[9],L=s[10],F=s[11],j=s[12],H=s[13],G=s[14],ie=s[15],ne=l[0],se=l[1],_e=l[2],ye=l[3];return c[0]=ne*u+se*b+_e*D+ye*j,c[1]=ne*h+se*C+_e*M+ye*H,c[2]=ne*g+se*T+_e*L+ye*G,c[3]=ne*_+se*A+_e*F+ye*ie,c[4]=(ne=l[4])*u+(se=l[5])*b+(_e=l[6])*D+(ye=l[7])*j,c[5]=ne*h+se*C+_e*M+ye*H,c[6]=ne*g+se*T+_e*L+ye*G,c[7]=ne*_+se*A+_e*F+ye*ie,c[8]=(ne=l[8])*u+(se=l[9])*b+(_e=l[10])*D+(ye=l[11])*j,c[9]=ne*h+se*C+_e*M+ye*H,c[10]=ne*g+se*T+_e*L+ye*G,c[11]=ne*_+se*A+_e*F+ye*ie,c[12]=(ne=l[12])*u+(se=l[13])*b+(_e=l[14])*D+(ye=l[15])*j,c[13]=ne*h+se*C+_e*M+ye*H,c[14]=ne*g+se*T+_e*L+ye*G,c[15]=ne*_+se*A+_e*F+ye*ie,c}function ct(c,s,l){var u,h,g,_,b,C,T,A,D,M,L,F,j=l[0],H=l[1],G=l[2];return s===c?(c[12]=s[0]*j+s[4]*H+s[8]*G+s[12],c[13]=s[1]*j+s[5]*H+s[9]*G+s[13],c[14]=s[2]*j+s[6]*H+s[10]*G+s[14],c[15]=s[3]*j+s[7]*H+s[11]*G+s[15]):(h=s[1],g=s[2],_=s[3],b=s[4],C=s[5],T=s[6],A=s[7],D=s[8],M=s[9],L=s[10],F=s[11],c[0]=u=s[0],c[1]=h,c[2]=g,c[3]=_,c[4]=b,c[5]=C,c[6]=T,c[7]=A,c[8]=D,c[9]=M,c[10]=L,c[11]=F,c[12]=u*j+b*H+D*G+s[12],c[13]=h*j+C*H+M*G+s[13],c[14]=g*j+T*H+L*G+s[14],c[15]=_*j+A*H+F*G+s[15]),c}function bt(c,s,l){var u=l[0],h=l[1],g=l[2];return c[0]=s[0]*u,c[1]=s[1]*u,c[2]=s[2]*u,c[3]=s[3]*u,c[4]=s[4]*h,c[5]=s[5]*h,c[6]=s[6]*h,c[7]=s[7]*h,c[8]=s[8]*g,c[9]=s[9]*g,c[10]=s[10]*g,c[11]=s[11]*g,c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15],c}function ci(c,s,l){var u=Math.sin(l),h=Math.cos(l),g=s[4],_=s[5],b=s[6],C=s[7],T=s[8],A=s[9],D=s[10],M=s[11];return s!==c&&(c[0]=s[0],c[1]=s[1],c[2]=s[2],c[3]=s[3],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15]),c[4]=g*h+T*u,c[5]=_*h+A*u,c[6]=b*h+D*u,c[7]=C*h+M*u,c[8]=T*h-g*u,c[9]=A*h-_*u,c[10]=D*h-b*u,c[11]=M*h-C*u,c}function Oi(c,s,l){var u=Math.sin(l),h=Math.cos(l),g=s[0],_=s[1],b=s[2],C=s[3],T=s[8],A=s[9],D=s[10],M=s[11];return s!==c&&(c[4]=s[4],c[5]=s[5],c[6]=s[6],c[7]=s[7],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15]),c[0]=g*h-T*u,c[1]=_*h-A*u,c[2]=b*h-D*u,c[3]=C*h-M*u,c[8]=g*u+T*h,c[9]=_*u+A*h,c[10]=b*u+D*h,c[11]=C*u+M*h,c}function Rn(c,s,l){var u=Math.sin(l),h=Math.cos(l),g=s[0],_=s[1],b=s[2],C=s[3],T=s[4],A=s[5],D=s[6],M=s[7];return s!==c&&(c[8]=s[8],c[9]=s[9],c[10]=s[10],c[11]=s[11],c[12]=s[12],c[13]=s[13],c[14]=s[14],c[15]=s[15]),c[0]=g*h+T*u,c[1]=_*h+A*u,c[2]=b*h+D*u,c[3]=C*h+M*u,c[4]=T*h-g*u,c[5]=A*h-_*u,c[6]=D*h-b*u,c[7]=M*h-C*u,c}function $n(c,s){return c[0]=s[0],c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=s[1],c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=s[2],c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c}function Ur(c,s,l){var u,h,g,_=l[0],b=l[1],C=l[2],T=Math.sqrt(_*_+b*b+C*C);return T
0&&(g=1/Math.sqrt(g)),c[0]=s[0]*g,c[1]=s[1]*g,c[2]=s[2]*g,c}function _o(c,s){return c[0]*s[0]+c[1]*s[1]+c[2]*s[2]}function Mo(c,s,l){var u=s[0],h=s[1],g=s[2],_=l[0],b=l[1],C=l[2];return c[0]=h*C-g*b,c[1]=g*_-u*C,c[2]=u*b-h*_,c}function Ca(c,s,l,u){var h=s[0],g=s[1],_=s[2];return c[0]=h+u*(l[0]-h),c[1]=g+u*(l[1]-g),c[2]=_+u*(l[2]-_),c}function wo(c,s,l){var u=s[0],h=s[1],g=s[2],_=l[3]*u+l[7]*h+l[11]*g+l[15];return c[0]=(l[0]*u+l[4]*h+l[8]*g+l[12])/(_=_||1),c[1]=(l[1]*u+l[5]*h+l[9]*g+l[13])/_,c[2]=(l[2]*u+l[6]*h+l[10]*g+l[14])/_,c}function Ed(c,s,l){var u=s[0],h=s[1],g=s[2];return c[0]=u*l[0]+h*l[3]+g*l[6],c[1]=u*l[1]+h*l[4]+g*l[7],c[2]=u*l[2]+h*l[5]+g*l[8],c}function Ad(c,s,l){var u=l[0],h=l[1],g=l[2],_=l[3],b=s[0],C=s[1],T=s[2],A=h*T-g*C,D=g*b-u*T,M=u*C-h*b;return c[0]=b+_*(A+=A)+h*(M+=M)-g*(D+=D),c[1]=C+_*D+g*A-u*M,c[2]=T+_*M+u*D-h*A,c}function Ep(c){return c[0]=0,c[1]=0,c[2]=0,c}function xl(c,s){return c[0]===s[0]&&c[1]===s[1]&&c[2]===s[2]}var Co=$s,Ap=Sd,Dd=hs;function Dp(){var c=new x(4);return x!=Float32Array&&(c[0]=0,c[1]=0,c[2]=0,c[3]=0),c}function Ia(c,s,l){return c[0]=s[0]*l,c[1]=s[1]*l,c[2]=s[2]*l,c[3]=s[3]*l,c}function kd(c,s){var l=s[0],u=s[1],h=s[2],g=s[3],_=l*l+u*u+h*h+g*g;return _>0&&(_=1/Math.sqrt(_)),c[0]=l*_,c[1]=u*_,c[2]=h*_,c[3]=g*_,c}function $a(c,s,l){var u=s[0],h=s[1],g=s[2],_=s[3];return c[0]=l[0]*u+l[4]*h+l[8]*g+l[12]*_,c[1]=l[1]*u+l[5]*h+l[9]*g+l[13]*_,c[2]=l[2]*u+l[6]*h+l[10]*g+l[14]*_,c[3]=l[3]*u+l[7]*h+l[11]*g+l[15]*_,c}function Uc(){var c=new x(4);return x!=Float32Array&&(c[0]=0,c[1]=0,c[2]=0),c[3]=1,c}function jc(c){return c[0]=0,c[1]=0,c[2]=0,c[3]=1,c}function cu(c,s,l){l*=.5;var u=s[0],h=s[1],g=s[2],_=s[3],b=Math.sin(l),C=Math.cos(l);return c[0]=u*C+_*b,c[1]=h*C+g*b,c[2]=g*C-h*b,c[3]=_*C-u*b,c}function du(c,s,l){l*=.5;var u=s[0],h=s[1],g=s[2],_=s[3],b=Math.sin(l),C=Math.cos(l);return c[0]=u*C-g*b,c[1]=h*C+_*b,c[2]=g*C+u*b,c[3]=_*C-h*b,c}fn(),Dp();var Ta,jl,S_,uu=kd,dm=(Ta=fn(),jl=$o(1,0,0),S_=$o(0,1,0),function(c,s,l){var u=_o(s,l);return u<-.999999?(Mo(Ta,jl,s),Dd(Ta)<1e-6&&Mo(Ta,S_,s),Fr(Ta,Ta),(function(h,g,_){_*=.5;var b=Math.sin(_);h[0]=b*g[0],h[1]=b*g[1],h[2]=b*g[2],h[3]=Math.cos(_)})(c,Ta,Math.PI),c):u>.999999?(c[0]=0,c[1]=0,c[2]=0,c[3]=1,c):(Mo(Ta,s,l),c[0]=Ta[0],c[1]=Ta[1],c[2]=Ta[2],c[3]=1+u,uu(c,c))});function qs(){var c=new x(2);return x!=Float32Array&&(c[0]=0,c[1]=0),c}function Hc(c,s){var l=new x(2);return l[0]=c,l[1]=s,l}function E_(c,s,l){return c[0]=s,c[1]=l,c}function lh(c,s,l){return c[0]=s[0]+l[0],c[1]=s[1]+l[1],c}function Md(c,s,l){return c[0]=s[0]-l[0],c[1]=s[1]-l[1],c}function hu(c,s,l){return c[0]=s[0]*l,c[1]=s[1]*l,c}function kp(c){var s=c[0],l=c[1];return Math.sqrt(s*s+l*l)}function po(c,s){var l=s[0],u=s[1],h=l*l+u*u;return h>0&&(h=1/Math.sqrt(h)),c[0]=s[0]*h,c[1]=s[1]*h,c}function Fs(c,s){return c[0]*s[0]+c[1]*s[1]}Uc(),Uc(),O();var A_,Mp,Gc=Md;function D_(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}qs();var k_=(function(){if(Mp)return A_;function c(s,l,u,h){this.cx=3*s,this.bx=3*(u-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*l,this.by=3*(h-l)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=l,this.p2x=u,this.p2y=h}return Mp=1,A_=c,c.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,l){if(l===void 0&&(l=1e-6),s<0)return 0;if(s>1)return 1;for(var u=s,h=0;h<8;h++){var g=this.sampleCurveX(u)-s;if(Math.abs(g)g?b=u:C=u,u=.5*(C-b)+b;return u},solve:function(s,l){return this.sampleCurveY(this.solveCurveX(s,l))}},A_})(),Ev=D_(k_);function It(c,s){this.x=c,this.y=s}function pu(c,s){if(Array.isArray(c)){if(!Array.isArray(s)||c.length!==s.length)return!1;for(let l=0;l=1)return 1;let s=c*c,l=s*c;return 4*(c<.5?l:3*(c-s)+l-.75)}function Te(c,s,l,u){let h=new Ev(c,s,l,u);return function(g){return h.solve(g)}}let be=Te(.25,.1,.25,1);function ve(c,s,l){return Math.min(l,Math.max(s,c))}function Ke(c,s,l){return(l=ve((l-c)/(s-c),0,1))*l*(3-2*l)}function Oe(c,s,l){let u=l-s,h=((c-s)%u+u)%u+s;return h===s?l:h}function Ye(c,s,l){if(!c.length)return l(null,[]);let u=c.length,h=new Array(c.length),g=null;c.forEach((_,b)=>{s(_,(C,T)=>{C&&(g=C),h[b]=T,--u==0&&l(g,h)})})}let Mt=1;function mt(){return Mt++}function gi(c){return c<=1?1:Math.pow(2,Math.ceil(Math.log2(c)))}function Ri(c,s){c.forEach(l=>{s[l]&&(s[l]=s[l].bind(s))})}function ji(c,s,l){let u={};for(let h in c)u[h]=s.call(this,c[h],h,c);return u}function yn(c,s,l){let u={};for(let h in c)s.call(this,c[h],h,c)&&(u[h]=c[h]);return u}function hn(c){return Array.isArray(c)?c.map(hn):typeof c=="object"&&c?ji(c,hn):c}function In(c,s){for(let l=0;l=0)return!0;return!1}let Or={};function vn(c){Or[c]||(typeof console<"u"&&console.warn(c),Or[c]=!0)}function Eo(c,s,l){return(l.y-c.y)*(s.x-c.x)>(s.y-c.y)*(l.x-c.x)}function Qo(c){let s=0;for(let l,u,h=0,g=c.length,_=g-1;h@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(l,u,h,g)=>{let _=h||g;return s[u]=!_||_.toLowerCase(),""}),s["max-age"]){let l=parseInt(s["max-age"],10);isNaN(l)?delete s["max-age"]:s["max-age"]=l}return s}let Io=null;function To(c,s){return[c[4*s],c[4*s+1],c[4*s+2],c[4*s+3]]}function Wr(c,s,l,u){for(;s>1;c[h]>1;c[h]<=u?s=h+1:l=h}return s}function qa(c){return c>0?1/(1.001-c):1+c}function Hl(c){return c>0?1-1/(1.001-c):-c}function fu(c,s,l){return(c-s.min)*(l.max-l.min)/(s.max-s.min)+l.min}let Sa={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(!Sa.API_URL)return null;try{let c=new URL(Sa.API_URL);return c.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":c.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.3.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function hm(c){return Sa.API_URL_REGEX.test(c)}function rD(c){return Sa.API_SPRITE_REGEX.test(c)}let ch,pm,M_,R_,dh,O_;function iC(){return ch==null&&(ch=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),ch}let Rd={now:()=>R_!==void 0?R_:performance.now(),setNow(c){R_=c},restoreNow(){R_=void 0},frame(c){let s=requestAnimationFrame(c);return{cancel:()=>cancelAnimationFrame(s)}},getImageData(c,s=0){let{width:l,height:u}=c;dh||(dh=document.createElement("canvas"));let h=dh.getContext("2d",{willReadFrequently:!0});if(!h)throw new Error("failed to create canvas 2d context");return(l>dh.width||u>dh.height)&&(dh.width=l,dh.height=u),h.clearRect(-s,-s,l+2*s,u+2*s),h.drawImage(c,0,0,l,u),h.getImageData(-s,-s,l+2*s,u+2*s)},resolveURL:c=>(pm||(pm=document.createElement("a")),pm.href=c,pm.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(M_==null&&(M_=window.matchMedia("(prefers-reduced-motion: reduce)")),M_.matches)},hasCanvasFingerprintNoise(){if(O_!==void 0)return O_;if(!iC())return O_=!1,!1;let c=new OffscreenCanvas(85,1),s=c.getContext("2d",{willReadFrequently:!0}),l=0;for(let h=0;h0?`?${g}`:""}`}let Gl="mapbox-tiles",$c=500,mu=50,qc=["language","worldview","jobid"],Wa,Rp;function rC(){try{return caches}catch{}}function P_(){let c=rC();c&&Wa==null&&(Wa=c.open(Gl))}let uh=1/0,L_={supported:!1,testSupport:function(c){!$l&&fm&&(oC?mm(c):F_=c)}},F_,fm,$l=!1,oC=!1,Dv=typeof self<"u"?self:{};function mm(c){let s=c.createTexture();c.bindTexture(c.TEXTURE_2D,s);try{if(c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,fm),c.isContextLost())return;L_.supported=!0}catch{}c.deleteTexture(s),$l=!0}Dv.document&&(fm=Dv.document.createElement("img"),fm.onload=function(){F_&&mm(F_),F_=null,oC=!0},fm.onerror=function(){$l=!0,F_=null},fm.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let kv={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(kv);class sC extends Error{constructor(s,l,u){l===401&&hm(u)&&(s+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(s),this.status=l,this.url=u}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}let Mv=Er()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,On=function(c,s){if(!(/^file:/.test(l=c.url)||/^file:/.test(Mv())&&!/^\w+:/.test(l))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return(function(u,h){let g=new AbortController,_=new Request(u.url,{method:u.method||"GET",body:u.body,credentials:u.credentials,headers:u.headers,referrer:Mv(),referrerPolicy:u.referrerPolicy,signal:g.signal}),b=!1,C=!1,T=(A=_.url).indexOf("sku=")>0&&hm(A);var A;u.type==="json"&&_.headers.set("Accept","application/json");let D=(L,F,j)=>{if(C)return;if(L&&L.message!=="SecurityError"&&vn(L.toString()),F&&j)return M(F);let H=Date.now();fetch(_).then(G=>{if(G.ok){let ie=T?G.clone():null;return M(G,ie,H)}return h(new sC(G.statusText,G.status,u.url))}).catch(G=>{G.name!=="AbortError"&&h(new Error(`${G.message} ${u.url}`))})},M=(L,F,j)=>{(u.type==="arrayBuffer"?L.arrayBuffer():u.type==="json"?L.json():L.text()).then(H=>{C||(F&&j&&(function(G,ie,ne){if(P_(),Wa==null)return;let se=Qn(ie.headers.get("Cache-Control")||"");if(se["no-store"])return;let _e={status:ie.status,statusText:ie.statusText,headers:new Headers};ie.headers.forEach((De,Me)=>_e.headers.set(Me,De)),se["max-age"]&&_e.headers.set("Expires",new Date(ne+1e3*se["max-age"]).toUTCString());let ye=_e.headers.get("Expires");if(!ye||new Date(ye).getTime()-ne<42e4)return;let Ce=Av(G.url,{persistentParams:qc});if(ie.status===206){let De=G.headers.get("Range");if(!De)return;_e.status=200,Ce=nC(Ce,{range:De})}(function(De,Me){if(Rp===void 0)try{new Response(new ReadableStream),Rp=!0}catch{Rp=!1}Rp?Me(De.body):De.blob().then(Me).catch(lt=>vn(lt.message))})(ie,De=>{let Me=new Response((lt=ie.status)!==200&<!==404&&[101,103,204,205,304].includes(lt)?null:De,_e);var lt;P_(),Wa?.then(Ne=>Ne.put(Ce,Me)).catch(Ne=>vn(Ne.message))})})(_,F,j),b=!0,h(null,H,L.headers.get("Cache-Control"),L.headers.get("Expires")))}).catch(H=>{C||h(new Error(H.message))})};return T?(function(L,F){if(P_(),Wa==null)return F(null);Wa.then(j=>{let H=Av(L.url,{persistentParams:qc}),G=L.headers.get("Range");G&&(H=nC(H,{range:G})),j.match(H).then(ie=>{let ne=(function(se){if(!se)return!1;let _e=new Date(se.headers.get("Expires")||0),ye=Qn(se.headers.get("Cache-Control")||"");return Number(_e)>Date.now()&&!ye["no-cache"]})(ie);j.delete(H).catch(F),ne&&j.put(H,ie.clone()).catch(F),F(null,ie,ne)}).catch(F)}).catch(F)})(_,D):D(null,null),{cancel:()=>{C=!0,b||g.abort()}}})(c,s);if(Er(self)&&self.worker.actor)return self.worker.actor.send("getResource",c,s,void 0,!0)}var l;return(function(u,h){let g=new XMLHttpRequest;g.open(u.method||"GET",u.url,!0),u.type==="arrayBuffer"&&(g.responseType="arraybuffer");for(let _ in u.headers)g.setRequestHeader(_,u.headers[_]);return u.type==="json"&&(g.responseType="text",g.setRequestHeader("Accept","application/json")),g.withCredentials=u.credentials==="include",g.onerror=()=>{h(new Error(g.statusText))},g.onload=()=>{if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let _=g.response;if(u.type==="json")try{_=JSON.parse(g.response)}catch(b){return h(b)}h(null,_,g.getResponseHeader("Cache-Control"),g.getResponseHeader("Expires"))}else h(new sC(g.statusText,g.status,u.url))},g.send(u.body),{cancel:()=>g.abort()}})(c,s)},gm=function(c,s){return On(Object.assign(c,{type:"arrayBuffer"}),s)};function oD(c){let s=document.createElement("a");return s.href=c,s.protocol===location.protocol&&s.host===location.host}let sD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=",Rv,hh;Rv=[],hh=0;let _m=function(c,s){if(L_.supported&&(c.headers||(c.headers={}),c.headers.accept="image/webp,*/*"),hh>=Sa.MAX_PARALLEL_IMAGE_REQUESTS){let g={requestParameters:c,callback:s,cancelled:!1,cancel(){this.cancelled=!0}};return Rv.push(g),g}hh++;let l=!1,u=()=>{if(!l)for(l=!0,hh--;Rv.length&&hh{u(),g?s(g):_&&(self.createImageBitmap?(function(T,A){let D=new Blob([new Uint8Array(T)],{type:"image/png"});createImageBitmap(D).then(M=>{A(null,M)}).catch(M=>{A(new Error(`Could not load image because of ${M.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})})(_,(T,A)=>s(T,A,b,C)):(function(T,A){let D=new Image;D.onload=()=>{A(null,D),URL.revokeObjectURL(D.src),D.onload=null,requestAnimationFrame(()=>{D.src=sD})},D.onerror=()=>A(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."));let M=new Blob([new Uint8Array(T)],{type:"image/png"});D.src=T.byteLength?URL.createObjectURL(M):sD})(_,(T,A)=>s(T,A,b,C)))});return{cancel:()=>{h.cancel(),u()}}};var N_,Ov,aD,Op={exports:{}},lD={exports:{}},aC={exports:{}},ym=(function(){if(aD)return Op.exports;aD=1;var c=(N_||(N_=1,lD.exports=function(l,u){var h,g,_,b,C,T,A,D;for(g=l.length-(h=3&l.length),_=u,C=3432918353,T=461845907,D=0;D>>16)*C&65535)<<16)&4294967295)<<15|A>>>17))*T+(((A>>>16)*T&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(b>>>16)&65535)<<16);switch(A=0,h){case 3:A^=(255&l.charCodeAt(D+2))<<16;case 2:A^=(255&l.charCodeAt(D+1))<<8;case 1:_^=A=(65535&(A=(A=(65535&(A^=255&l.charCodeAt(D)))*C+(((A>>>16)*C&65535)<<16)&4294967295)<<15|A>>>17))*T+(((A>>>16)*T&65535)<<16)&4294967295}return _^=l.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0}),lD.exports),s=(Ov||(Ov=1,aC.exports=function(l,u){for(var h,g=l.length,_=u^g,b=0;g>=4;)h=1540483477*(65535&(h=255&l.charCodeAt(b)|(255&l.charCodeAt(++b))<<8|(255&l.charCodeAt(++b))<<16|(255&l.charCodeAt(++b))<<24))+((1540483477*(h>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),g-=4,++b;switch(g){case 3:_^=(255&l.charCodeAt(b+2))<<16;case 2:_^=(255&l.charCodeAt(b+1))<<8;case 1:_=1540483477*(65535&(_^=255&l.charCodeAt(b)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0}),aC.exports);return Op.exports=c,Op.exports.murmur3=c,Op.exports.murmur2=s,Op.exports})(),Pv=D_(ym);class Wc{constructor(s,...l){Object.assign(this,l[0]||{}),this.type=s}}class B_ extends Wc{constructor(s,l={}){super("error",Object.assign({error:s},l))}}function Lv(c,s,l){l[c]&&l[c].indexOf(s)!==-1||(l[c]=l[c]||[],l[c].push(s))}function ql(c,s,l){if(l&&l[c]){let u=l[c].indexOf(s);u!==-1&&l[c].splice(u,1)}}class Pp{on(s,l){return this._listeners=this._listeners||{},Lv(s,l,this._listeners),this}off(s,l){return ql(s,l,this._listeners),ql(s,l,this._oneTimeListeners),this}once(s,l){return l?(this._oneTimeListeners=this._oneTimeListeners||{},Lv(s,l,this._oneTimeListeners),this):new Promise(u=>{this.once(s,u)})}fire(s,l){let u=typeof s=="string"?new Wc(s,l):s,h=u.type;if(this.listens(h)){u.target=this;let g=this._listeners&&this._listeners[h]?this._listeners[h].slice():[];for(let C of g)C.call(this,u);let _=this._oneTimeListeners&&this._oneTimeListeners[h]?this._oneTimeListeners[h].slice():[];for(let C of _)ql(h,C,this._oneTimeListeners),C.call(this,u);let b=this._eventedParent;if(b){let C=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(u,C),b.fire(u)}}else u instanceof B_&&console.error(u.error);return this}listens(s){return!!(this._listeners&&this._listeners[s]&&this._listeners[s].length>0||this._oneTimeListeners&&this._oneTimeListeners[s]&&this._oneTimeListeners[s].length>0||this._eventedParent&&this._eventedParent.listens(s))}setEventedParent(s,l){return this._eventedParent=s,this._eventedParentData=l,this}}class Wl{constructor(s){typeof s=="string"?this.name=s:(this.name=s.name,this.iconsetId=s.iconsetId)}static from(s){return new Wl(s)}static toString(s){return s.iconsetId?`${s.name}${s.iconsetId}`:s.name}static parse(s){let[l,u]=s.split("");return new Wl({name:l,iconsetId:u})}static isEqual(s,l){return s.name===l.name&&s.iconsetId===l.iconsetId}toString(){return Wl.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var lC,Fv={},cC=(function(){if(lC)return Fv;lC=1;var c={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function s(g){return(g=Math.round(g))<0?0:g>255?255:g}function l(g){return s(g[g.length-1]==="%"?parseFloat(g)/100*255:parseInt(g))}function u(g){return(_=g[g.length-1]==="%"?parseFloat(g)/100:parseFloat(g))<0?0:_>1?1:_;var _}function h(g,_,b){return b<0?b+=1:b>1&&(b-=1),6*b<1?g+(_-g)*b*6:2*b<1?_:3*b<2?g+(_-g)*(2/3-b)*6:g}try{Fv.parseCSSColor=function(g){var _,b=g.replace(/ /g,"").toLowerCase();if(b in c)return c[b].slice();if(b[0]==="#")return b.length===4?(_=parseInt(b.substr(1),16))>=0&&_<=4095?[(3840&_)>>4|(3840&_)>>8,240&_|(240&_)>>4,15&_|(15&_)<<4,1]:null:b.length===7&&(_=parseInt(b.substr(1),16))>=0&&_<=16777215?[(16711680&_)>>16,(65280&_)>>8,255&_,1]:null;var C=b.indexOf("("),T=b.indexOf(")");if(C!==-1&&T+1===b.length){var A=b.substr(0,C),D=b.substr(C+1,T-(C+1)).split(","),M=1;switch(A){case"rgba":if(D.length!==4)return null;M=u(D.pop());case"rgb":return D.length!==3?null:[l(D[0]),l(D[1]),l(D[2]),M];case"hsla":if(D.length!==4)return null;M=u(D.pop());case"hsl":if(D.length!==3)return null;var L=(parseFloat(D[0])%360+360)%360/360,F=u(D[1]),j=u(D[2]),H=j<=.5?j*(F+1):j+F-j*F,G=2*j-H;return[s(255*h(G,H,L+1/3)),s(255*h(G,H,L)),s(255*h(G,H,L-1/3)),M];default:return null}}return null}}catch{}return Fv})();class er{constructor(s,l,u,h=1){this.r=s,this.g=l,this.b=u,this.a=h}static parse(s){if(!s)return;if(s instanceof er)return s;if(typeof s!="string")return;let l=cC.parseCSSColor(s);return l?new er(l[0]/255,l[1]/255,l[2]/255,l[3]):void 0}toString(){let[s,l,u,h]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*s)},${Math.round(255*l)},${Math.round(255*u)},${h})`}toNonPremultipliedRenderColor(s){let{r:l,g:u,b:h,a:g}=this;return new cD(s,l,u,h,g)}toPremultipliedRenderColor(s){let{r:l,g:u,b:h,a:g}=this;return new Nv(s,l*g,u*g,h*g,g)}clone(){return new er(this.r,this.g,this.b,this.a)}}class dC{constructor(s,l,u,h,g,_=!1){if(this.premultiplied=!1,this.premultiplied=_,s){let b=s.image.height,C=b*b;this.premultiplied?(l=g===0?0:l/g*(b-1),u=g===0?0:u/g*(b-1),h=g===0?0:h/g*(b-1)):(l*=b-1,u*=b-1,h*=b-1);let T=Math.floor(l),A=Math.floor(u),D=Math.floor(h),M=Math.ceil(l),L=Math.ceil(u),F=Math.ceil(h),j=l-T,H=u-A,G=h-D,ie=s.image.data,ne=4*(T+A*C+D*b),se=4*(T+A*C+F*b),_e=4*(T+L*C+D*b),ye=4*(T+L*C+F*b),Ce=4*(M+A*C+D*b),De=4*(M+A*C+F*b),Me=4*(M+L*C+D*b),lt=4*(M+L*C+F*b);if(ne<0||lt>=ie.length)throw new Error("out of range");this.r=Ti(Ti(Ti(ie[ne],ie[se],G),Ti(ie[_e],ie[ye],G),H),Ti(Ti(ie[Ce],ie[De],G),Ti(ie[Me],ie[lt],G),H),j)/255*(this.premultiplied?g:1),this.g=Ti(Ti(Ti(ie[ne+1],ie[se+1],G),Ti(ie[_e+1],ie[ye+1],G),H),Ti(Ti(ie[Ce+1],ie[De+1],G),Ti(ie[Me+1],ie[lt+1],G),H),j)/255*(this.premultiplied?g:1),this.b=Ti(Ti(Ti(ie[ne+2],ie[se+2],G),Ti(ie[_e+2],ie[ye+2],G),H),Ti(Ti(ie[Ce+2],ie[De+2],G),Ti(ie[Me+2],ie[lt+2],G),H),j)/255*(this.premultiplied?g:1),this.a=g}else this.r=l,this.g=u,this.b=h,this.a=g}toArray(){let{r:s,g:l,b:u,a:h}=this;return[255*s,255*l,255*u,h]}toHslaArray(){let{r:s,g:l,b:u,a:h}=this;if(this.premultiplied){if(h===0)return[0,0,0,0];let F=1/h;s*=F,l*=F,u*=F}let g=Math.min(Math.max(s,0),1),_=Math.min(Math.max(l,0),1),b=Math.min(Math.max(u,0),1),C=Math.min(g,_,b),T=Math.max(g,_,b),A=T-C,D=.5*(C+T);if(A===0)return[0,0,100*D,h];let M=D>.5?A/(2-T-C):A/(T+C),L;switch(T){case g:L=60*((_-b)/A+(_Ti(u,s[h],l))}er.black=new er(0,0,0,1),er.white=new er(1,1,1,1),er.transparent=new er(0,0,0,0),er.red=new er(1,0,0,1),er.blue=new er(0,0,1,1);var Kl=Object.freeze({__proto__:null,array:uC,color:function(c,s,l){return new er(Ti(c.r,s.r,l),Ti(c.g,s.g,l),Ti(c.b,s.b,l),Ti(c.a,s.a,l))},number:Ti});class Kc extends Error{constructor(s,l){super(l),this.message=l,this.key=s}}class Bv{constructor(s,l=[]){this.parent=s,this.bindings={};for(let[u,h]of l)this.bindings[u]=h}concat(s){return new Bv(this,s)}get(s){if(this.bindings[s])return this.bindings[s];if(this.parent)return this.parent.get(s);throw new Error(`${s} not found in scope.`)}has(s){return!!this.bindings[s]||!!this.parent&&this.parent.has(s)}}let Od={kind:"null"},fi={kind:"number"},tr={kind:"string"},sr={kind:"boolean"},wl={kind:"color"},Lp={kind:"object"},qn={kind:"value"},zv={kind:"collator"},ph={kind:"formatted"},z_={kind:"resolvedImage"};function Ea(c,s){return{kind:"array",itemType:c,N:s}}function Jo(c){if(c.kind==="array"){let s=Jo(c.itemType);return typeof c.N=="number"?`array<${s}, ${c.N}>`:c.itemType.kind==="value"?"array":`array<${s}>`}return c.kind}let uF=[Od,fi,tr,sr,wl,ph,Lp,Ea(qn),z_];function V_(c,s){if(s.kind==="error")return null;if(c.kind==="array"){if(s.kind==="array"&&(s.N===0&&s.itemType.kind==="value"||!V_(c.itemType,s.itemType))&&(typeof c.N!="number"||c.N===s.N))return null}else{if(c.kind===s.kind)return null;if(c.kind==="value"){for(let l of uF)if(!V_(l,s))return null}}return`Expected ${Jo(c)} but found ${Jo(s)} instead.`}function hC(c,s){return s.some(l=>l.kind===c.kind)}function U_(c,s){return s.some(l=>l==="null"?c===null:l==="array"?Array.isArray(c):l==="object"?c&&!Array.isArray(c)&&typeof c=="object":l===typeof c)}function j_(c,s){return c.kind==="array"&&s.kind==="array"?c.N===s.N&&j_(c.itemType,s.itemType):c.kind===s.kind}class fh{constructor(s,l,u){this.sensitivity=s?l?"variant":"case":l?"accent":"base",this.locale=u,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(s,l){return this.collator.compare(s,l)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Vv{constructor(s,l,u,h,g){this.text=s.normalize?s.normalize():s,this.image=l,this.scale=u,this.fontStack=h,this.textColor=g}}class Ka{constructor(s){this.sections=s}static fromString(s){return new Ka([new Vv(s,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(s=>s.text.length!==0||!!s.image&&s.image.hasPrimary())}static factory(s){return s instanceof Ka?s:Ka.fromString(s)}toString(){return this.sections.length===0?"":this.sections.map(s=>s.text).join("")}serialize(){let s=["format"];for(let l of this.sections){if(l.image){let h=l.image.getPrimary().id.toString();s.push(["image",h]);continue}s.push(l.text);let u={};l.fontStack&&(u["text-font"]=["literal",l.fontStack.split(",")]),l.scale&&(u["font-scale"]=l.scale),l.textColor&&(u["text-color"]=["rgba"].concat(l.textColor.toNonPremultipliedRenderColor(null).toArray())),s.push(u)}return s}}class Yc{constructor(s,l={}){if(this.id=Wl.from(s),this.options=Object.assign({},l),l.transform){let{a:u,b:h,c:g,d:_,e:b,f:C}=l.transform;this.options.transform=new DOMMatrix([u,h,g,_,b,C])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){let{a:s,b:l,c:u,d:h,e:g,f:_}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:s,b:l,c:u,d:h,e:g,f:_}})}static parse(s){let l,u,h,g;try{({name:l,iconsetId:u,params:h,transform:g}=JSON.parse(s)||{})}catch{return null}if(!l)return null;let{a:_,b,c:C,d:T,e:A,f:D}=g||{};return new Yc({name:l,iconsetId:u},{params:h,transform:new DOMMatrix([_,b,C,T,A,D])})}scaleSelf(s,l){return this.options.transform.scaleSelf(s,l),this}}class cl{constructor(s,l,u,h,g=!1){this.primaryId=Wl.from(s),this.primaryOptions=l,u&&(this.secondaryId=Wl.from(u)),this.secondaryOptions=h,this.available=g}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Yc(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Yc(this.secondaryId,this.secondaryOptions):null}static from(s){return typeof s=="string"?cl.build({name:s}):s}static build(s,l,u,h){return!s||typeof s=="object"&&!("name"in s)?null:new cl(s,u,l,h)}}function dD(c,s,l,u){return typeof c=="number"&&c>=0&&c<=255&&typeof s=="number"&&s>=0&&s<=255&&typeof l=="number"&&l>=0&&l<=255?u===void 0||typeof u=="number"&&u>=0&&u<=1?null:`Invalid rgba value [${[c,s,l,u].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof u=="number"?[c,s,l,u]:[c,s,l]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function vm(c){if(c===null||typeof c=="string"||typeof c=="boolean"||typeof c=="number"||c instanceof er||c instanceof fh||c instanceof Ka||c instanceof cl)return!0;if(Array.isArray(c)){for(let s of c)if(!vm(s))return!1;return!0}if(typeof c=="object"){for(let s in c)if(!vm(c[s]))return!1;return!0}return!1}function _s(c){if(c===null)return Od;if(typeof c=="string")return tr;if(typeof c=="boolean")return sr;if(typeof c=="number")return fi;if(c instanceof er)return wl;if(c instanceof fh)return zv;if(c instanceof Ka)return ph;if(c instanceof cl)return z_;if(Array.isArray(c)){let s=c.length,l;for(let u of c){let h=_s(u);if(l){if(l===h)continue;l=qn;break}l=h}return Ea(l||qn,s)}return Lp}function dl(c){let s=typeof c;return c===null?"":s==="string"||s==="number"||s==="boolean"?String(c):c instanceof Ka||c instanceof cl||c instanceof er?c.toString():JSON.stringify(c)}class Ji{constructor(s,l){this.type=s,this.value=l}static parse(s,l){if(s.length!==2)return l.error(`'literal' expression requires exactly one argument, but found ${s.length-1} instead.`);if(!vm(s[1]))return l.error("invalid value");let u=s[1],h=_s(u),g=l.expectedType;return h.kind!=="array"||h.N!==0||!g||g.kind!=="array"||typeof g.N=="number"&&g.N!==0||(h=g),new Ji(h,u)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof er?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Ka?this.value.serialize():this.value}}class Yt{constructor(s){this.name="ExpressionEvaluationError",this.message=s}toJSON(){return this.message}}let H_={string:tr,number:fi,boolean:sr,object:Lp};class Di{constructor(s,l){this.type=s,this.args=l}static parse(s,l){if(s.length<2)return l.error("Expected at least one argument.");let u,h=1,g=s[0];if(g==="array"){let b,C;if(s.length>2){let T=s[1];if(typeof T!="string"||!(T in H_)||T==="object")return l.error('The item type argument of "array" must be one of string, number, boolean',1);b=H_[T],h++}else b=qn;if(s.length>3){if(s[2]!==null&&(typeof s[2]!="number"||s[2]<0||s[2]!==Math.floor(s[2])))return l.error('The length argument to "array" must be a positive integer literal',2);C=s[2],h++}u=Ea(b,C)}else u=H_[g];let _=[];for(;hs.outputDefined())}serialize(){let s=this.type,l=[s.kind];if(s.kind==="array"){let u=s.itemType;if(u.kind==="string"||u.kind==="number"||u.kind==="boolean"){l.push(u.kind);let h=s.N;(typeof h=="number"||this.args.length>1)&&l.push(h)}}return l.concat(this.args.map(u=>u.serialize()))}}class Fp{constructor(s){this.type=ph,this.sections=s}static parse(s,l){if(s.length<2)return l.error("Expected at least one argument.");let u=s[1];if(!Array.isArray(u)&&typeof u=="object")return l.error("First argument must be an image or text section.");let h=[],g=!1;for(let _=1;_<=s.length-1;++_){let b=s[_];if(g&&typeof b=="object"&&!Array.isArray(b)){g=!1;let C=null;if(b["font-scale"]&&(C=l.parseObjectValue(b["font-scale"],_,"font-scale",fi),!C))return null;let T=null;if(b["text-font"]&&(T=l.parseObjectValue(b["text-font"],_,"text-font",Ea(tr)),!T))return null;let A=null;if(b["text-color"]&&(A=l.parseObjectValue(b["text-color"],_,"text-color",wl),!A))return null;let D=h[h.length-1];D.scale=C,D.font=T,D.textColor=A}else{let C=l.parse(s[_],_,qn);if(!C)return null;let T=C.type.kind;if(T!=="string"&&T!=="value"&&T!=="null"&&T!=="resolvedImage")return l.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");g=!0,h.push({content:C,scale:null,font:null,textColor:null})}}return new Fp(h)}evaluate(s){return new Ka(this.sections.map(l=>{let u=l.content.evaluate(s);return j_(_s(u),z_)?new Vv("",u,null,null,null):new Vv(dl(u),null,l.scale?l.scale.evaluate(s):null,l.font?l.font.evaluate(s).join(","):null,l.textColor?l.textColor.evaluate(s):null)}))}eachChild(s){for(let l of this.sections)s(l.content),l.scale&&s(l.scale),l.font&&s(l.font),l.textColor&&s(l.textColor)}outputDefined(){return!1}serialize(){let s=["format"];for(let l of this.sections){s.push(l.content.serialize());let u={};l.scale&&(u["font-scale"]=l.scale.serialize()),l.font&&(u["text-font"]=l.font.serialize()),l.textColor&&(u["text-color"]=l.textColor.serialize()),s.push(u)}return s}}class bm{constructor(s,l,u,h){this._imageWarnHistory={},this.type=z_,this.namePrimary=s,this.nameSecondary=l,u&&(this.paramsPrimary=u.params,this.iconsetIdPrimary=u.iconset?u.iconset.id:void 0),h&&(this.paramsSecondary=h.params,this.iconsetIdSecondary=h.iconset?h.iconset.id:void 0)}static parse(s,l){if(s.length<2)return l.error("Expected two or more arguments.");let u=1,h=[];function g(){if(uWl.isEqual(_,g)),h.available){let _=h.getSecondary()?h.getSecondary().id:null;_&&(h.available=s.availableImages.some(b=>Wl.isEqual(b,_)))}}return h}eachChild(s){if(s(this.namePrimary),this.paramsPrimary)for(let l in this.paramsPrimary)this.paramsPrimary[l]&&s(this.paramsPrimary[l]);if(this.nameSecondary&&(s(this.nameSecondary),this.paramsSecondary))for(let l in this.paramsSecondary)this.paramsSecondary[l]&&s(this.paramsSecondary[l])}outputDefined(){return!1}serializeOptions(s,l){let u={};if(l&&(u.iconset={id:l}),s){u.params={};for(let h in s)s[h]&&(u.params[h]=s[h].serialize())}return Object.keys(u).length>0?u:void 0}serialize(){let s=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){let l=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);l&&s.push(l)}if(this.nameSecondary&&(s.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){let l=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);l&&s.push(l)}return s}}function Li(c){return G_(c)?"string":$_(c)?"number":fC(c)?"boolean":Array.isArray(c)?"array":c===null?"null":pC(c)?"object":typeof c}function pC(c){return c!=null&&!Array.isArray(c)&&typeof c!="function"&&!(c instanceof String||c instanceof Number||c instanceof Boolean)&&typeof c=="object"}function G_(c){return typeof c=="string"||c instanceof String}function $_(c){return typeof c=="number"||c instanceof Number}function fC(c){return typeof c=="boolean"||c instanceof Boolean}let Uv={"to-boolean":sr,"to-color":wl,"to-number":fi,"to-string":tr};class Vo{constructor(s,l){this.type=s,this.args=l}static parse(s,l){if(s.length<2)return l.error("Expected at least one argument.");let u=s[0],h=[],g=Od;if(u==="to-array"){if(!Array.isArray(s[1]))return null;let _=s[1].length;if(l.expectedType){if(l.expectedType.kind!=="array")return l.error(`Expected ${l.expectedType.kind} but found array.`);g=Ea(l.expectedType.itemType,_)}else{if(!(_>0&&vm(s[1][0])))return null;g=Ea(_s(s[1][0]),_)}for(let b=0;b<_;b++){let C=s[1][b],T;if(Array.isArray(C))T=l.parse(C,void 0,g.itemType);else{let A=Li(C);if(A!==g.itemType.kind)return l.error(`Expected ${g.itemType.kind} but found ${A}.`);T=l.registry.literal.parse(["literal",C===void 0?null:C],l)}if(!T)return null;h.push(T)}}else{if((u==="to-boolean"||u==="to-string")&&s.length!==2)return l.error("Expected one argument.");g=Uv[u];for(let _=1;_4?`Invalid rbga value ${JSON.stringify(l)}: expected an array containing either three or four numeric values.`:dD(l[0],l[1],l[2],l[3]),!u))return new er(l[0]/255,l[1]/255,l[2]/255,l[3])}throw new Yt(u||`Could not parse color from value '${typeof l=="string"?l:String(JSON.stringify(l))}'`)}if(this.type.kind==="number"){let l=null;for(let u of this.args){if(l=u.evaluate(s),l===null)return 0;let h=Number(l);if(!isNaN(h))return h}throw new Yt(`Could not convert ${JSON.stringify(l)} to number.`)}return this.type.kind==="formatted"?Ka.fromString(dl(this.args[0].evaluate(s))):this.type.kind==="resolvedImage"?cl.build(dl(this.args[0].evaluate(s))):this.type.kind==="array"?this.args.map(l=>l.evaluate(s)):dl(this.args[0].evaluate(s))}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every(s=>s.outputDefined())}serialize(){if(this.type.kind==="formatted")return new Fp([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new bm(this.args[0]).serialize();let s=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(l=>{s.push(l.serialize())}),s}}let mC=["Unknown","Point","LineString","Polygon"];class gu{constructor(s,l,u){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=s,this.options=l,this.iconImageUseTheme=u}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?mC[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(s){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){let s=this.featureDistanceData.center,l=this.featureDistanceData.scale,{x:u,y:h}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(u*l-s[0])+this.featureDistanceData.bearing[1]*(h*l-s[1])}return 0}parseColor(s){let l=this._parseColorCache[s];return l||(l=this._parseColorCache[s]=er.parse(s)),l}getConfig(s){return this.options?this.options.get(s):null}}class Ya{constructor(s,l,u,h,g){this.name=s,this.type=l,this._evaluate=u,this.args=h,this._overloadIndex=g}evaluate(s){if(!this._evaluate){let l=Ya.definitions[this.name];this._evaluate=Array.isArray(l)?l[2]:l.overloads[this._overloadIndex][1]}return this._evaluate(s,this.args)}eachChild(s){this.args.forEach(s)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(s=>s.serialize()))}static parse(s,l){let u=s[0],h=Ya.definitions[u];if(!h)return l.error(`Unknown expression "${u}". If you wanted a literal array, use ["literal", [...]].`,0);let g=Array.isArray(h)?h[0]:h.type,_=Array.isArray(h)?[[h[1],h[2]]]:h.overloads,b=[],C=null,T=-1;for(let[A,D]of _){if(Array.isArray(A)&&A.length!==s.length-1)continue;b.push(A),T++,C=new ib(l.registry,l.path,null,l.scope,void 0,l._scope,l.options,l.iconImageUseTheme);let M=[],L=!1;for(let F=1;FM)).map(mh).join(" | "),D=[];for(let M=1;Ml;){if(u-l>600){let C=u-l+1,T=s-l+1,A=Math.log(C),D=.5*Math.exp(2*A/3),M=.5*Math.sqrt(A*D*(C-D)/C)*(T-C/2<0?-1:1);uD(c,s,Math.max(l,Math.floor(s-T*D/C+M)),Math.min(u,Math.floor(s+(C-T)*D/C+M)),h)}let g=c[s],_=l,b=u;for(q_(c,l,s),h(c[u],g)>0&&q_(c,l,u);_0;)b--}h(c[l],g)===0?q_(c,l,b):(b++,q_(c,b,u)),b<=s&&(l=b+1),s<=b&&(u=b-1)}}function q_(c,s,l){let u=c[s];c[s]=c[l],c[l]=u}function hF(c,s){return cs?1:0}function jv(c){let s=0;for(let l,u,h=0,g=c.length,_=g-1;h=s[2]||c[1]<=s[1]||c[3]>=s[3])}function pF(c,s,l){let u=c[0]-s[0],h=c[1]-s[1],g=c[0]-l[0],_=c[1]-l[1];return u*_-g*h==0&&u*g<=0&&h*_<=0}function wm(c,s,l=!1){let u=!1;for(let b=0,C=s.length;b(h=c)[1]!=(_=F)[1]>h[1]&&h[0]<(_[0]-g[0])*(h[1]-g[1])/(_[1]-g[1])+g[0]&&(u=!u)}}var h,g,_;return u}function hD(c,s,l,u){let h=u[0]-l[0],g=u[1]-l[1],_=(c[0]-l[0])*g-h*(c[1]-l[1]),b=(s[0]-l[0])*g-h*(s[1]-l[1]);return _>0&&b<0||_<0&&b>0}function Hv(c,s,l,u){return(h=[u[0]-l[0],u[1]-l[1]])[0]*(g=[s[0]-c[0],s[1]-c[1]])[1]-h[1]*g[0]!=0&&!(!hD(c,s,l,u)||!hD(l,u,c,s));var h,g}function Gv(c){let s=new It(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),l=new It(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let u of c[0])s.x>u.x&&(s.x=u.x),s.y>u.y&&(s.y=u.y),l.xl[2]){let h=.5*u,g=c[0]-l[0]>h?-u:l[0]-c[0]>h?u:0;g===0&&(g=c[0]-l[2]>h?-u:l[2]-c[0]>h?u:0),c[0]+=g}xm(s,c)}function mD(c,s,l,u){let h=Math.pow(2,u.z)*gh,g=[u.x*gh,u.y*gh],_=[];if(!c)return _;for(let b of c)for(let C of b){let T=[C.x+g[0],C.y+g[1]];fD(T,s,l,h),_.push(T)}return _}function gD(c,s,l,u){let h=Math.pow(2,u.z)*gh,g=[u.x*gh,u.y*gh],_=[];if(!c)return _;for(let C of c){let T=[];for(let A of C){let D=[A.x+g[0],A.y+g[1]];xm(s,D),T.push(D)}_.push(T)}if(s[2]-s[0]<=h/2){(b=s)[0]=b[1]=1/0,b[2]=b[3]=-1/0;for(let C of _)for(let T of C)fD(T,s,l,h)}var b;return _}class Bp{constructor(s,l){this.type=sr,this.geojson=s,this.geometries=l}static parse(s,l){if(s.length!==2)return l.error(`'within' expression requires exactly one argument, but found ${s.length-1} instead.`);if(vm(s[1])){let u=s[1];if(u.type==="FeatureCollection")for(let h=0;hl)return Wv(g,_,(l-(u-b))/b)}return s[s.length-1]}pointToSegmentDistance(s,l,u){let[h,g]=l,_=Yl(u[0]-h)*this.kx,b=(u[1]-g)*this.ky;if(_!==0||b!==0){let C=(Yl(s[0]-h)*this.kx*_+(s[1]-g)*this.ky*b)/(_*_+b*b);C>1?(h=u[0],g=u[1]):C>0&&(h+=_/this.kx*C,g+=b/this.ky*C)}return _=Yl(s[0]-h)*this.kx,b=(s[1]-g)*this.ky,Math.sqrt(_*_+b*b)}pointOnLine(s,l){let u=1/0,h=s[0][0],g=s[0][1],_=0,b=0;for(let C=0;C1?(T=s[C+1][0],A=s[C+1][1]):L>0&&(T+=D/this.kx*L,A+=M/this.ky*L)),D=Yl(l[0]-T)*this.kx,M=(l[1]-A)*this.ky;let F=D*D+M*M;Fg.index||h.index===g.index&&h.t>g.t){let T=h;h=g,g=T}let _=[h.point],b=h.index+1,C=g.index;!yC(u[b],_[0])&&b<=C&&_.push(u[b]);for(let T=b+1;T<=C;T++)_.push(u[T]);return yC(u[C],g.point)||_.push(g.point),_}lineSliceAlong(s,l,u){let h=0,g=[];for(let _=0;_s&&g.length===0&&g.push(Wv(b,C,(s-(h-T))/T)),h>=l)return g.push(Wv(b,C,(l-(h-T))/T)),g;h>s&&g.push(C)}return g}bufferPoint(s,l){let u=l/this.ky,h=l/this.kx;return[s[0]-h,s[1]-u,s[0]+h,s[1]+u]}bufferBBox(s,l){let u=l/this.ky,h=l/this.kx;return[s[0]-h,s[1]-u,s[2]+h,s[3]+u]}insideBBox(s,l){return Yl(s[0]-l[0])>=0&&Yl(s[0]-l[2])<=0&&s[1]>=l[1]&&s[1]<=l[3]}}function yC(c,s){return c[0]===s[0]&&c[1]===s[1]}function Wv(c,s,l){let u=Yl(s[0]-c[0]);return[c[0]+u*l,c[1]+(s[1]-c[1])*l]}function Yl(c){for(;c<-180;)c+=360;for(;c>180;)c-=360;return c}class Kv{constructor(s=[],l=(u,h)=>uh?1:0){if(this.data=s,this.length=this.data.length,this.compare=l,this.length>0)for(let u=(this.length>>1)-1;u>=0;u--)this._down(u)}push(s){this.data.push(s),this._up(this.length++)}pop(){if(this.length===0)return;let s=this.data[0],l=this.data.pop();return--this.length>0&&(this.data[0]=l,this._down(0)),s}peek(){return this.data[0]}_up(s){let{data:l,compare:u}=this,h=l[s];for(;s>0;){let g=s-1>>1,_=l[g];if(u(h,_)>=0)break;l[s]=_,s=g}l[s]=h}_down(s){let{data:l,compare:u}=this,h=this.length>>1,g=l[s];for(;s=0)break;l[s]=l[_],s=_}l[s]=g}}var Pt=8192;function vC(c,s){return s.dist-c.dist}let Tm=100,Sm=50;function K_(c){let s=[1/0,1/0,-1/0,-1/0];if(s.length!==c.length)return!1;for(let l=0;l=c[0]&&c[1]c[1])return[null,null];let l=Y_(c);if(s){if(l===2)return[c,null];let u=Math.floor(l/2);return[[c[0],c[0]+u],[c[0]+u,c[1]]]}{if(l===1)return[c,null];let u=Math.floor(l/2)-1;return[[c[0],c[0]+u],[c[0]+u+1,c[1]]]}}function Cc(c,s){let l=[1/0,1/0,-1/0,-1/0];if(!Pd(s,c.length))return l;for(let u=s[0];u<=s[1];++u)xm(l,c[u]);return l}function bn(c){let s=[1/0,1/0,-1/0,-1/0];for(let l=0;ls[2]&&(u=c[0]-s[2]),c[1]>s[3]&&(h=c[1]-s[3]),c[3]=u)return u;if(Zc(h,g)){if(yD(c,s))return 0}else if(yD(s,c))return 0;let _=u;for(let b of c)for(let C=0,T=b.length,A=T-1;C=g)continue;let A=T.range1;if(Y_(A)<=b){if(!Pd(A,c.length))return NaN;if(s){let D=wF(c,A,l,u);if((g=Math.min(g,D))===0)return g}else for(let D=A[0];D<=A[1];++D){let M=xF(c[D],l,u);if((g=Math.min(g,M))===0)return g}}else{let D=Yv(A,s);if(D[0]!==null){let M=Em(Cc(c,D[0]),C,u);M=_)continue;let D=A.range1,M=A.range2;if(Y_(D)<=C&&Y_(M)<=T){if(!Pd(D,c.length)||!Pd(M,l.length))return NaN;if(s&&u?_=Math.min(_,vF(c,D,l,M,h)):s||u?s&&!u?_=Math.min(_,_D(l,M,c,D,h)):!s&&u&&(_=Math.min(_,_D(c,D,l,M,h))):_=Math.min(_,bF(c,D,l,M,h)),_===0)return _}else{let L=Yv(D,s),F=Yv(M,u);Qv(b,_,h,c,l,L[0],F[0]),Qv(b,_,h,c,l,L[0],F[1]),Qv(b,_,h,c,l,L[1],F[0]),Qv(b,_,h,c,l,L[1],F[1])}}return _}function xC(c,s,l,u,h=1/0){let g=h,_=Cc(c,[0,c.length-1]);for(let b of l)if(!(g!==1/0&&Em(_,Cc(b,[0,b.length-1]),u)>=g)&&(g=Math.min(g,vD(c,s,b,!0,u,g)),g===0))return g;return g}function Xv(c,s,l,u,h=1/0){let g=h,_=Cc(c,[0,c.length-1]);for(let b of l){if(g!==1/0&&Em(_,bn(b),u)>=g)continue;let C=IF(c,s,b,u,g);if(isNaN(C))return C;if((g=Math.min(g,C))===0)return g}return g}function wC(c){return c==="Point"||c==="MultiPoint"||c==="LineString"||c==="MultiLineString"||c==="Polygon"||c==="MultiPolygon"}class zp{constructor(s,l){this.type=fi,this.geojson=s,this.geometries=l}static parse(s,l){if(s.length!==2)return l.error(`'distance' expression requires either one argument, but found ' ${s.length-1} instead.`);if(vm(s[1])){let u=s[1];if(u.type==="FeatureCollection"){for(let h=0;h{s&&!Am(l)&&(s=!1)}),s}function Jv(c){if(c instanceof Ya&&c.name==="feature-state")return!1;let s=!0;return c.eachChild(l=>{s&&!Jv(l)&&(s=!1)}),s}function eb(c){if(c instanceof km)return new Set([c.key]);let s=new Set;return c.eachChild(l=>{s=new Set([...s,...eb(l)])}),s}function Dm(c,s){if(c instanceof Ya&&s.indexOf(c.name)>=0)return!1;let l=!0;return c.eachChild(u=>{l&&!Dm(u,s)&&(l=!1)}),l}function bD(c,s,l){return[c,s,l].filter(Boolean).join("")}function CC(c,s){switch(c){case"string":return dl(s);case"number":return+s;case"boolean":return!!s;case"color":return er.parse(s);case"formatted":return Ka.fromString(dl(s));case"resolvedImage":return cl.build(dl(s))}return s}function xD(c,s,l,u){return u!==void 0&&(c=u*Math.round(c/u)),s!==void 0&&cl&&(c=l),c}class km{constructor(s,l,u,h=!1){this.type=s,this.key=l,this.scope=u,this.featureConstant=h}static parse(s,l){let u=l.expectedType;if(u==null&&(u=qn),s.length<2||s.length>3)return l.error("Invalid number of arguments for 'config' expression.");let h=l.parse(s[1],1);if(!(h instanceof Ji))return l.error("Key name of 'config' expression must be a string literal.");let g,_=!0,b=dl(h.value);if(s.length>=3){let C=l.parse(s[2],2);if(!(C instanceof Ji))return l.error("Scope of 'config' expression must be a string literal.");g=dl(C.value)}if(l.options){let C=bD(b,g,l._scope),T=l.options.get(C);T&&(_=Am(T.value||T.default))}return new km(u,b,g,_)}evaluate(s){let l=bD(this.key,this.scope,s.scope),u=s.getConfig(l);if(!u)return null;let{type:h,value:g,values:_,minValue:b,maxValue:C,stepValue:T}=u,A=u.default.evaluate(s),D=A;if(g){let M=s.scope;s.scope=(M||"").split("").slice(1).join(""),D=g.evaluate(s),s.scope=M}return h&&(D=CC(h,D)),D===void 0||b===void 0&&C===void 0&&T===void 0||(typeof D=="number"?D=xD(D,b,C,T):Array.isArray(D)&&(D=D.map(M=>typeof M=="number"?xD(M,b,C,T):M))),g!==void 0&&D!==void 0&&_&&!_.includes(D)&&(D=A,h&&(D=CC(h,D))),(h&&h!==this.type||D!==void 0&&!j_(_s(D),this.type))&&(D=CC(this.type.kind,D)),D}eachChild(){}outputDefined(){return!1}serialize(){let s=["config",this.key];return this.scope&&s.concat(this.scope),s}}class tb{constructor(s,l){this.type=l.type,this.name=s,this.boundExpression=l}static parse(s,l){if(s.length!==2||typeof s[1]!="string")return l.error("'var' expression requires exactly one string literal argument.");let u=s[1];return l.scope.has(u)?new tb(u,l.scope.get(u)):l.error(`Unknown variable "${u}". Make sure "${u}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(s){return this.boundExpression.evaluate(s)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class ib{constructor(s,l=[],u,h=new Bv,g=[],_,b,C){this.registry=s,this.path=l,this.key=l.map(T=>typeof T=="string"?`['${T}']`:`[${T}]`).join(""),this.scope=h,this.errors=g,this.expectedType=u,this._scope=_,this.options=b,this.iconImageUseTheme=C}parse(s,l,u,h,g={}){return l||u?this.concat(l,null,u,h)._parse(s,g):this._parse(s,g)}parseObjectValue(s,l,u,h,g,_={}){return this.concat(l,u,h,g)._parse(s,_)}_parse(s,l){function u(h,g,_){return _==="assert"?new Di(g,[h]):_==="coerce"?new Vo(g,[h]):h}if(s!==null&&typeof s!="string"&&typeof s!="boolean"&&typeof s!="number"||(s=["literal",s]),Array.isArray(s)){if(s.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let h=typeof s[0]=="string"?this.registry[s[0]]:void 0;if(h){let g=h.parse(s,this);if(!g)return null;if(this.expectedType){let _=this.expectedType,b=g.type;if(_.kind!=="string"&&_.kind!=="number"&&_.kind!=="boolean"&&_.kind!=="object"&&_.kind!=="array"||b.kind!=="value")if(_.kind!=="color"&&_.kind!=="formatted"&&_.kind!=="resolvedImage"||b.kind!=="value"&&b.kind!=="string"){if(this.checkSubtype(_,b))return null}else g=u(g,_,l.typeAnnotation||"coerce");else g=u(g,_,l.typeAnnotation||"assert")}if(!(g instanceof Ji)&&g.type.kind!=="resolvedImage"&&IC(g)){let _=new gu(this._scope,this.options,this.iconImageUseTheme);try{g=new Ji(g.type,g.evaluate(_))}catch(b){return this.error(b.message),null}}return g}return Vo.parse(["to-array",s],this)}return this.error(s===void 0?"'undefined' value invalid. Use null instead.":typeof s=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof s} instead.`)}concat(s,l,u,h){let g=typeof s=="number"?this.path.concat(s):this.path;g=typeof l=="string"?g.concat(l):g;let _=h?this.scope.concat(h):this.scope;return new ib(this.registry,g,u||null,_,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(s,...l){let u=`${this.key}${l.map(h=>`[${h}]`).join("")}`;this.errors.push(new Kc(u,s))}checkSubtype(s,l){let u=V_(s,l);return u&&this.error(u),u}}function IC(c){if(c instanceof tb)return IC(c.boundExpression);if(c instanceof Ya&&c.name==="error"||c instanceof Ks||c instanceof Bp||c instanceof zp||c instanceof km)return!1;let s=c instanceof Vo||c instanceof Di,l=!0;return c.eachChild(u=>{l=s?l&&IC(u):l&&u instanceof Ji}),!!l&&Am(c)&&Dm(c,["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 nb(c,s){let l=c.length-1,u,h,g=0,_=l,b=0;for(;g<=_;)if(b=Math.floor((g+_)/2),u=c[b],h=c[b+1],u<=s){if(b===l||ss))throw new Yt("Input is not a number.");_=b-1}return 0}class Z_{constructor(s,l,u){this.type=s,this.input=l,this.labels=[],this.outputs=[];for(let[h,g]of u)this.labels.push(h),this.outputs.push(g)}static parse(s,l){if(s.length-1<4)return l.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if((s.length-1)%2!=0)return l.error("Expected an even number of arguments.");let u=l.parse(s[1],1,fi);if(!u)return null;let h=[],g=null;l.expectedType&&l.expectedType.kind!=="value"&&(g=l.expectedType);for(let _=1;_=b)return l.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',T);let D=l.parse(C,A,g);if(!D)return null;g=g||D.type,h.push([b,D])}return new Z_(g,u,h)}evaluate(s){let l=this.labels,u=this.outputs;if(l.length===1)return u[0].evaluate(s);let h=this.input.evaluate(s);if(h<=l[0])return u[0].evaluate(s);let g=l.length;return h>=l[g-1]?u[g-1].evaluate(s):u[nb(l,h)].evaluate(s)}eachChild(s){s(this.input);for(let l of this.outputs)s(l)}outputDefined(){return this.outputs.every(s=>s.outputDefined())}serialize(){let s=["step",this.input.serialize()];for(let l=0;l0&&s.push(this.labels[l]),s.push(this.outputs[l].serialize());return s}}let wD=.95047,CD=1.08883,ID=4/29,_h=6/29,TD=3*_h*_h,SD=_h*_h*_h,TF=Math.PI/180,SF=180/Math.PI;function TC(c){return c>SD?Math.pow(c,1/3):c/TD+ID}function rb(c){return c>_h?c*c*c:TD*(c-ID)}function ob(c){return 255*(c<=.0031308?12.92*c:1.055*Math.pow(c,1/2.4)-.055)}function yh(c){return(c/=255)<=.04045?c/12.92:Math.pow((c+.055)/1.055,2.4)}function SC(c){let s=yh(c.r),l=yh(c.g),u=yh(c.b),h=TC((.4124564*s+.3575761*l+.1804375*u)/wD),g=TC((.2126729*s+.7151522*l+.072175*u)/1);return{l:116*g-16,a:500*(h-g),b:200*(g-TC((.0193339*s+.119192*l+.9503041*u)/CD)),alpha:c.a}}function EC(c){let s=(c.l+16)/116,l=isNaN(c.a)?s:s+c.a/500,u=isNaN(c.b)?s:s-c.b/200;return s=1*rb(s),l=wD*rb(l),u=CD*rb(u),new er(ob(3.2404542*l-1.5371385*s-.4985314*u),ob(-.969266*l+1.8760108*s+.041556*u),ob(.0556434*l-.2040259*s+1.0572252*u),c.alpha)}function EF(c,s,l){let u=s-c;return c+l*(u>180||u<-180?u-360*Math.round(u/360):u)}let Vp={forward:SC,reverse:EC,interpolate:function(c,s,l){return{l:Ti(c.l,s.l,l),a:Ti(c.a,s.a,l),b:Ti(c.b,s.b,l),alpha:Ti(c.alpha,s.alpha,l)}}},Up={forward:function(c){let{l:s,a:l,b:u}=SC(c),h=Math.atan2(u,l)*SF;return{h:h<0?h+360:h,c:Math.sqrt(l*l+u*u),l:s,alpha:c.a}},reverse:function(c){let s=c.h*TF,l=c.c;return EC({l:c.l,a:Math.cos(s)*l,b:Math.sin(s)*l,alpha:c.alpha})},interpolate:function(c,s,l){return{h:EF(c.h,s.h,l),c:Ti(c.c,s.c,l),l:Ti(c.l,s.l,l),alpha:Ti(c.alpha,s.alpha,l)}}};var ED=Object.freeze({__proto__:null,hcl:Up,lab:Vp});class Zl{constructor(s,l,u,h,g){this.type=s,this.operator=l,this.interpolation=u,this.input=h,this.labels=[],this.outputs=[];for(let[_,b]of g)this.labels.push(_),this.outputs.push(b)}static interpolationFactor(s,l,u,h){let g=0;if(s.name==="exponential")g=sb(l,s.base,u,h);else if(s.name==="linear")g=sb(l,1,u,h);else if(s.name==="cubic-bezier"){let _=s.controlPoints;g=new Ev(_[0],_[1],_[2],_[3]).solve(sb(l,1,u,h))}return g}static parse(s,l){let[u,h,g,..._]=s;if(!Array.isArray(h)||h.length===0)return l.error("Expected an interpolation type expression.",1);if(h[0]==="linear")h={name:"linear"};else if(h[0]==="exponential"){let T=h[1];if(typeof T!="number")return l.error("Exponential interpolation requires a numeric base.",1,1);h={name:"exponential",base:T}}else{if(h[0]!=="cubic-bezier")return l.error(`Unknown interpolation type ${String(h[0])}`,1,0);{let T=h.slice(1);if(T.length!==4||T.some(A=>typeof A!="number"||A<0||A>1))return l.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);h={name:"cubic-bezier",controlPoints:T}}}if(s.length-1<4)return l.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if(s.length-1>3&&(s.length-1)%2!=0)return l.error("Expected an even number of arguments.");if(g=l.parse(g,2,fi),!g)return null;let b=[],C=null;u==="interpolate-hcl"||u==="interpolate-lab"?C=wl:l.expectedType&&l.expectedType.kind!=="value"&&(C=l.expectedType);for(let T=0;T<_.length;T+=2){let A=_[T],D=_[T+1],M=T+3,L=T+4;if(typeof A!="number")return l.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',M);if(b.length&&b[b.length-1][0]>=A)return l.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',M);let F=l.parse(D,L,C);if(!F)return null;C=C||F.type,b.push([A,F])}return C.kind==="number"||C.kind==="color"||C.kind==="array"&&C.itemType.kind==="number"&&typeof C.N=="number"?new Zl(C,u,h,g,b):l.error(`Type ${Jo(C)} is not interpolatable.`)}evaluate(s){let l=this.labels,u=this.outputs;if(l.length===1)return u[0].evaluate(s);let h=this.input.evaluate(s);if(h<=l[0])return u[0].evaluate(s);let g=l.length;if(h>=l[g-1])return u[g-1].evaluate(s);let _=nb(l,h),b=Zl.interpolationFactor(this.interpolation,h,l[_],l[_+1]),C=u[_].evaluate(s),T=u[_+1].evaluate(s);return this.operator==="interpolate"?Kl[this.type.kind.toLowerCase()](C,T,b):this.operator==="interpolate-hcl"?Up.reverse(Up.interpolate(Up.forward(C),Up.forward(T),b)):Vp.reverse(Vp.interpolate(Vp.forward(C),Vp.forward(T),b))}eachChild(s){s(this.input);for(let l of this.outputs)s(l)}outputDefined(){return this.outputs.every(s=>s.outputDefined())}serialize(){let s;s=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];let l=[this.operator,s,this.input.serialize()];for(let u=0;uV_(h,b.type));return new Q_(_?qn:u,g)}evaluate(s){let l,u=null,h=0;for(let g of this.args){if(h++,u=g.evaluate(s),u&&u instanceof cl&&!u.available&&(l||(l=u),u=null,h===this.args.length))return l;if(u!==null)break}return u}eachChild(s){this.args.forEach(s)}outputDefined(){return this.args.every(s=>s.outputDefined())}serialize(){let s=["coalesce"];return this.eachChild(l=>{s.push(l.serialize())}),s}}class ab{constructor(s,l){this.type=l.type,this.bindings=[].concat(s),this.result=l}evaluate(s){return this.result.evaluate(s)}eachChild(s){for(let l of this.bindings)s(l[1]);s(this.result)}static parse(s,l){if(s.length<4)return l.error(`Expected at least 3 arguments, but found ${s.length-1} instead.`);let u=[];for(let g=1;g=u.length)throw new Yt("Array index out of bounds: index exceeds array size");if(l!==Math.floor(l))throw new Yt("Array index must be an integer. Use at-interpolated for fractional indices");return u[l]}eachChild(s){s(this.index),s(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class DC{constructor(s,l,u){this.type=s,this.index=l,this.input=u}static parse(s,l){if(s.length!==3)return l.error(`Expected 2 arguments, but found ${s.length-1} instead.`);let u=l.parse(s[1],1,fi),h=l.parse(s[2],2,Ea(l.expectedType||qn));return u&&h?new DC(h.type.itemType,u,h):null}evaluate(s){let l=this.index.evaluate(s),u=this.input.evaluate(s);if(l<0)throw new Yt(`Array index out of bounds: ${l} < 0.`);if(l>u.length-1)throw new Yt(`Array index out of bounds: ${l} > ${u.length-1}.`);if(l===Math.floor(l))return u[l];let h=Math.floor(l),g=Math.ceil(l),_=u[h],b=u[g];if(typeof _!="number"||typeof b!="number")throw new Yt(`Cannot interpolate between non-number values at index ${l}.`);let C=l-h;return _*(1-C)+b*C}eachChild(s){s(this.index),s(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class lb{constructor(s,l){this.type=sr,this.needle=s,this.haystack=l}static parse(s,l){if(s.length!==3)return l.error(`Expected 2 arguments, but found ${s.length-1} instead.`);let u=l.parse(s[1],1,qn),h=l.parse(s[2],2,qn);return u&&h?hC(u.type,[sr,tr,fi,Od,qn])?new lb(u,h):l.error(`Expected first argument to be of type boolean, string, number or null, but found ${Jo(u.type)} instead`):null}evaluate(s){let l=this.needle.evaluate(s),u=this.haystack.evaluate(s);if(u==null)return!1;if(!U_(l,["boolean","string","number","null"]))throw new Yt(`Expected first argument to be of type boolean, string, number or null, but found ${Jo(_s(l))} instead.`);if(!U_(u,["string","array"]))throw new Yt(`Expected second argument to be of type array or string, but found ${Jo(_s(u))} instead.`);return u.indexOf(l)>=0}eachChild(s){s(this.needle),s(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class X_{constructor(s,l,u){this.type=fi,this.needle=s,this.haystack=l,this.fromIndex=u}static parse(s,l){if(s.length<=2||s.length>=5)return l.error(`Expected 3 or 4 arguments, but found ${s.length-1} instead.`);let u=l.parse(s[1],1,qn),h=l.parse(s[2],2,qn);if(!u||!h)return null;if(!hC(u.type,[sr,tr,fi,Od,qn]))return l.error(`Expected first argument to be of type boolean, string, number or null, but found ${Jo(u.type)} instead`);if(s.length===4){let g=l.parse(s[3],3,fi);return g?new X_(u,h,g):null}return new X_(u,h)}evaluate(s){let l=this.needle.evaluate(s),u=this.haystack.evaluate(s);if(!U_(l,["boolean","string","number","null"]))throw new Yt(`Expected first argument to be of type boolean, string, number or null, but found ${Jo(_s(l))} instead.`);if(!U_(u,["string","array"]))throw new Yt(`Expected second argument to be of type array or string, but found ${Jo(_s(u))} instead.`);if(this.fromIndex){let h=this.fromIndex.evaluate(s);return u.indexOf(l,h)}return u.indexOf(l)}eachChild(s){s(this.needle),s(this.haystack),this.fromIndex&&s(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){let s=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),s]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Mm{constructor(s,l,u,h,g,_){this.inputType=s,this.type=l,this.input=u,this.cases=h,this.outputs=g,this.otherwise=_}static parse(s,l){if(s.length<5)return l.error(`Expected at least 4 arguments, but found only ${s.length-1}.`);if(s.length%2!=1)return l.error("Expected an even number of arguments.");let u,h;l.expectedType&&l.expectedType.kind!=="value"&&(h=l.expectedType);let g={},_=[];for(let T=2;TNumber.MAX_SAFE_INTEGER)return M.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof F=="number"&&Math.floor(F)!==F)return M.error("Numeric branch labels must be integer values.");if(u){if(M.checkSubtype(u,_s(F)))return null}else u=_s(F);if(g[String(F)]!==void 0)return M.error("Branch labels must be unique.");g[String(F)]=_.length}let L=l.parse(D,T,h);if(!L)return null;h=h||L.type,_.push(L)}let b=l.parse(s[1],1,qn);if(!b)return null;let C=l.parse(s[s.length-1],s.length-1,h);return C?b.type.kind!=="value"&&l.concat(1).checkSubtype(u,b.type)?null:new Mm(u,h,b,g,_,C):null}evaluate(s){let l=this.input.evaluate(s);return(j_(_s(l),this.inputType)&&this.outputs[this.cases[l]]||this.otherwise).evaluate(s)}eachChild(s){s(this.input),this.outputs.forEach(s),s(this.otherwise)}outputDefined(){return this.outputs.every(s=>s.outputDefined())&&this.otherwise.outputDefined()}serialize(){let s=["match",this.input.serialize()],l=Object.keys(this.cases).sort(),u=[],h={};for(let _ of l){let b=h[this.cases[_]];b===void 0?(h[this.cases[_]]=u.length,u.push([this.cases[_],[_]])):u[b][1].push(_)}let g=_=>this.inputType.kind==="number"?Number(_):_;for(let[_,b]of u)s.push(b.length===1?g(b[0]):b.map(g)),s.push(this.outputs[_].serialize());return s.push(this.otherwise.serialize()),s}}class kC{constructor(s,l,u){this.type=s,this.branches=l,this.otherwise=u}static parse(s,l){if(s.length<4)return l.error(`Expected at least 3 arguments, but found only ${s.length-1}.`);if(s.length%2!=0)return l.error("Expected an odd number of arguments.");let u;l.expectedType&&l.expectedType.kind!=="value"&&(u=l.expectedType);let h=[];for(let _=1;_l.outputDefined())&&this.otherwise.outputDefined()}serialize(){let s=["case"];return this.eachChild(l=>{s.push(l.serialize())}),s}}class J_{constructor(s,l,u,h){this.type=s,this.input=l,this.beginIndex=u,this.endIndex=h}static parse(s,l){if(s.length<=2||s.length>=5)return l.error(`Expected 3 or 4 arguments, but found ${s.length-1} instead.`);let u=l.parse(s[1],1,qn),h=l.parse(s[2],2,fi);if(!u||!h)return null;if(!hC(u.type,[Ea(qn),tr,qn]))return l.error(`Expected first argument to be of type array or string, but found ${Jo(u.type)} instead`);if(s.length===4){let g=l.parse(s[3],3,fi);return g?new J_(u.type,u,h,g):null}return new J_(u.type,u,h)}evaluate(s){let l=this.input.evaluate(s),u=this.beginIndex.evaluate(s);if(!U_(l,["string","array"]))throw new Yt(`Expected first argument to be of type array or string, but found ${Jo(_s(l))} instead.`);if(this.endIndex){let h=this.endIndex.evaluate(s);return l.slice(u,h)}return l.slice(u)}eachChild(s){s(this.input),s(this.beginIndex),this.endIndex&&s(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){let s=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),s]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class MC{constructor(s,l){this.type=Ea(tr),this.str=s,this.delimiter=l}static parse(s,l){if(s.length!==3)return l.error(`Expected 2 arguments, but found ${s.length-1} instead.`);let u=l.parse(s[1],1,tr),h=l.parse(s[2],2,tr);return u&&h?new MC(u,h):void 0}evaluate(s){let l=this.str.evaluate(s),u=this.delimiter.evaluate(s);return l.split(u)}eachChild(s){s(this.str),s(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function AD(c,s){return c==="=="||c==="!="?s.kind==="boolean"||s.kind==="string"||s.kind==="number"||s.kind==="null"||s.kind==="value":s.kind==="string"||s.kind==="number"||s.kind==="value"}function RC(c,s,l,u){return u.compare(s,l)===0}function jp(c,s,l){let u=c!=="=="&&c!=="!=";return class zre{constructor(g,_,b){this.type=sr,this.lhs=g,this.rhs=_,this.collator=b,this.hasUntypedArgument=g.type.kind==="value"||_.type.kind==="value"}static parse(g,_){if(g.length!==3&&g.length!==4)return _.error("Expected two or three arguments.");let b=g[0],C=_.parse(g[1],1,qn);if(!C)return null;if(!AD(b,C.type))return _.concat(1).error(`"${b}" comparisons are not supported for type '${Jo(C.type)}'.`);let T=_.parse(g[2],2,qn);if(!T)return null;if(!AD(b,T.type))return _.concat(2).error(`"${b}" comparisons are not supported for type '${Jo(T.type)}'.`);if(C.type.kind!==T.type.kind&&C.type.kind!=="value"&&T.type.kind!=="value")return _.error(`Cannot compare types '${Jo(C.type)}' and '${Jo(T.type)}'.`);u&&(C.type.kind==="value"&&T.type.kind!=="value"?C=new Di(T.type,[C]):C.type.kind!=="value"&&T.type.kind==="value"&&(T=new Di(C.type,[T])));let A=null;if(g.length===4){if(C.type.kind!=="string"&&T.type.kind!=="string"&&C.type.kind!=="value"&&T.type.kind!=="value")return _.error("Cannot use collator to compare non-string types.");if(A=_.parse(g[3],3,zv),!A)return null}return new zre(C,T,A)}evaluate(g){let _=this.lhs.evaluate(g),b=this.rhs.evaluate(g);if(u&&this.hasUntypedArgument){let C=_s(_),T=_s(b);if(C.kind!==T.kind||C.kind!=="string"&&C.kind!=="number")throw new Yt(`Expected arguments for "${c}" to be (string, string) or (number, number), but found (${C.kind}, ${T.kind}) instead.`)}if(this.collator&&!u&&this.hasUntypedArgument){let C=_s(_),T=_s(b);if(C.kind!=="string"||T.kind!=="string")return s(g,_,b)}return this.collator?l(g,_,b,this.collator.evaluate(g)):s(g,_,b)}eachChild(g){g(this.lhs),g(this.rhs),this.collator&&g(this.collator)}outputDefined(){return!0}serialize(){let g=[c];return this.eachChild(_=>{g.push(_.serialize())}),g}}}let AF=jp("==",function(c,s,l){return s===l},RC),DF=jp("!=",function(c,s,l){return s!==l},function(c,s,l,u){return!RC(0,s,l,u)}),kF=jp("<",function(c,s,l){return s",function(c,s,l){return s>l},function(c,s,l,u){return u.compare(s,l)>0}),MF=jp("<=",function(c,s,l){return s<=l},function(c,s,l,u){return u.compare(s,l)<=0}),RF=jp(">=",function(c,s,l){return s>=l},function(c,s,l,u){return u.compare(s,l)>=0});class OC{constructor(s,l,u,h,g,_){this.type=tr,this.number=s,this.locale=l,this.currency=u,this.unit=h,this.minFractionDigits=g,this.maxFractionDigits=_}static parse(s,l){if(s.length!==3)return l.error("Expected two arguments.");let u=l.parse(s[1],1,fi);if(!u)return null;let h=s[2];if(typeof h!="object"||Array.isArray(h))return l.error("NumberFormat options argument must be an object.");let g=null;if(h.locale&&(g=l.parseObjectValue(h.locale,2,"locale",tr),!g))return null;let _=null;if(h.currency&&(_=l.parseObjectValue(h.currency,2,"currency",tr),!_))return null;let b=null;if(h.unit&&(b=l.parseObjectValue(h.unit,2,"unit",tr),!b))return null;let C=null;if(h["min-fraction-digits"]&&(C=l.parseObjectValue(h["min-fraction-digits"],2,"min-fraction-digits",fi),!C))return null;let T=null;return h["max-fraction-digits"]&&(T=l.parseObjectValue(h["max-fraction-digits"],2,"max-fraction-digits",fi),!T)?null:new OC(u,g,_,b,C,T)}evaluate(s){return new Intl.NumberFormat(this.locale?this.locale.evaluate(s):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(s):void 0,unit:this.unit?this.unit.evaluate(s):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(s):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(s):void 0}).format(this.number.evaluate(s))}eachChild(s){s(this.number),this.locale&&s(this.locale),this.currency&&s(this.currency),this.unit&&s(this.unit),this.minFractionDigits&&s(this.minFractionDigits),this.maxFractionDigits&&s(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let s={};return this.locale&&(s.locale=this.locale.serialize()),this.currency&&(s.currency=this.currency.serialize()),this.unit&&(s.unit=this.unit.serialize()),this.minFractionDigits&&(s["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(s["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),s]}}class PC{constructor(s){this.type=fi,this.input=s}static parse(s,l){if(s.length!==2)return l.error(`Expected 1 argument, but found ${s.length-1} instead.`);let u=l.parse(s[1],1);return u?u.type.kind!=="array"&&u.type.kind!=="string"&&u.type.kind!=="value"?l.error(`Expected argument of type string or array, but found ${Jo(u.type)} instead.`):new PC(u):null}evaluate(s){let l=this.input.evaluate(s);if(typeof l=="string"||Array.isArray(l))return l.length;throw new Yt(`Expected value to be of type string or array, but found ${Jo(_s(l))} instead.`)}eachChild(s){s(this.input)}outputDefined(){return!1}serialize(){let s=["length"];return this.eachChild(l=>{s.push(l.serialize())}),s}}function LC(c){return function(){c=1831565813+(c|=0)|0;let s=Math.imul(c^c>>>15,1|c);return s=s+Math.imul(s^s>>>7,61|s)^s,((s^s>>>14)>>>0)/4294967296}}let Rm={"==":AF,"!=":DF,">":cb,"<":kF,">=":RF,"<=":MF,array:Di,at:AC,"at-interpolated":DC,boolean:Di,case:kC,coalesce:Q_,collator:Ks,format:Fp,image:bm,in:lb,"index-of":X_,interpolate:Zl,"interpolate-hcl":Zl,"interpolate-lab":Zl,length:PC,let:ab,literal:Ji,match:Mm,number:Di,"number-format":OC,object:Di,slice:J_,step:Z_,string:Di,"to-boolean":Vo,"to-color":Vo,"to-number":Vo,"to-string":Vo,var:tb,within:Bp,distance:zp,config:km,split:MC};function DD(c,[s,l,u,h]){s=s.evaluate(c),l=l.evaluate(c),u=u.evaluate(c);let g=h?h.evaluate(c):1,_=dD(s,l,u,g);if(_)throw new Yt(_);return new er(s/255,l/255,u/255,g)}function FC(c,[s,l,u,h]){s=s.evaluate(c),l=l.evaluate(c),u=u.evaluate(c);let g=h?h.evaluate(c):1,_=(function(T,A,D,M){return typeof T=="number"&&T>=0&&T<=360?typeof A=="number"&&A>=0&&A<=100&&typeof D=="number"&&D>=0&&D<=100?M===void 0||typeof M=="number"&&M>=0&&M<=1?null:`Invalid hsla value [${[T,A,D,M].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof M=="number"?[T,A,D,M]:[T,A,D]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof M=="number"?[T,A,D,M]:[T,A,D]).join(", ")}]: 'h' must be between 0 and 360.`})(s,l,u,g);if(_)throw new Yt(_);let b=`hsla(${s}, ${l}%, ${u}%, ${g})`,C=er.parse(b);if(!C)throw new Yt(`Failed to parse HSLA color: ${b}`);return C}function NC(c,s){return c in s}function db(c,s){let l=s[c];return l===void 0?null:l}function Hp(c){return{type:c}}function Gp(c){return{result:"success",value:c}}function vh(c){return{result:"error",value:c}}function BC(c,s){return!!c&&!!c.parameters&&c.parameters.indexOf(s)>-1}function ub(c){return c["property-type"]==="data-driven"}function zC(c){return BC(c.expression,"measure-light")}function VC(c){return BC(c.expression,"zoom")}function hb(c){return!!c.expression&&c.expression.interpolated}function pb(c){return typeof c=="object"&&c!==null&&!Array.isArray(c)}function UC(c){return c}function fb(c,s){let l=s.type==="color",u=c.stops&&typeof c.stops[0][0]=="object",h=u||!(u||c.property!==void 0),g=c.type||(hb(s)?"exponential":"interval");if(l&&((c=Object.assign({},c)).stops&&(c.stops=c.stops.map(T=>[T[0],er.parse(T[1])])),c.default=er.parse(c.default?c.default:s.default)),c.colorSpace&&c.colorSpace!=="rgb"&&!ED[c.colorSpace])throw new Error(`Unknown color space: ${c.colorSpace}`);let _,b,C;if(g==="exponential")_=MD;else if(g==="interval")_=kD;else if(g==="categorical"){_=OF,b=Object.create(null);for(let T of c.stops)b[T[0]]=T[1];C=typeof c.stops[0][0]}else{if(g!=="identity")throw new Error(`Unknown function type "${g}"`);_=PF}if(u){let T={},A=[];for(let L=0;LL[0]),evaluate:({zoom:L},F)=>MD({stops:D,base:c.base},s,L).evaluate(L,F)}}if(h){let T=g==="exponential"?{name:"exponential",base:c.base!==void 0?c.base:1}:null;return{kind:"camera",interpolationType:T,interpolationFactor:Zl.interpolationFactor.bind(void 0,T),zoomStops:c.stops.map(A=>A[0]),evaluate:({zoom:A})=>_(c,s,A,b,C)}}return{kind:"source",evaluate(T,A){let D=A&&A.properties?A.properties[c.property]:void 0;return D===void 0?Om(c.default,s.default):_(c,s,D,b,C)}}}function Om(c,s,l){return c!==void 0?c:s!==void 0?s:l!==void 0?l:void 0}function OF(c,s,l,u,h){return Om(typeof l===h?u[l]:void 0,c.default,s.default)}function kD(c,s,l){if(!$_(l))return Om(c.default,s.default);let u=c.stops.length;if(u===1||l<=c.stops[0][0])return c.stops[0][1];if(l>=c.stops[u-1][0])return c.stops[u-1][1];let h=nb(c.stops.map(g=>g[0]),l);return c.stops[h][1]}function MD(c,s,l){let u=c.base!==void 0?c.base:1;if(!$_(l))return Om(c.default,s.default);let h=c.stops.length;if(h===1||l<=c.stops[0][0])return c.stops[0][1];if(l>=c.stops[h-1][0])return c.stops[h-1][1];let g=nb(c.stops.map(A=>A[0]),l),_=(function(A,D,M,L){let F=L-M,j=A-M;return F===0?0:D===1?j/F:(Math.pow(D,j)-1)/(Math.pow(D,F)-1)})(l,u,c.stops[g][0],c.stops[g+1][0]),b=c.stops[g][1],C=c.stops[g+1][1],T=Kl[s.type]||UC;if(c.colorSpace&&c.colorSpace!=="rgb"){let A=ED[c.colorSpace];T=(D,M)=>A.reverse(A.interpolate(A.forward(D),A.forward(M),_))}return typeof b.evaluate=="function"?{evaluate(...A){let D=b.evaluate.apply(void 0,A),M=C.evaluate.apply(void 0,A);if(D!==void 0&&M!==void 0)return T(D,M,_)}}:T(b,C,_)}function PF(c,s,l){return s.type==="color"?l=er.parse(l):s.type==="formatted"?l=Ka.fromString(l.toString()):s.type==="resolvedImage"?l=cl.build(l.toString()):Li(l)===s.type||s.type==="enum"&&s.values[l]||(l=void 0),Om(l,c.default,s.default)}Ya.register(Rm,{error:[{kind:"error"},[tr],(c,[s])=>{throw new Yt(s.evaluate(c))}],typeof:[tr,[qn],(c,[s])=>Jo(_s(s.evaluate(c)))],"to-rgba":[Ea(fi,4),[wl],(c,[s])=>s.evaluate(c).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Ea(fi,4),[wl],(c,[s])=>s.evaluate(c).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[wl,[fi,fi,fi],DD],rgba:[wl,[fi,fi,fi,fi],DD],hsl:[wl,[fi,fi,fi],FC],hsla:[wl,[fi,fi,fi,fi],FC],has:{type:sr,overloads:[[[tr],(c,[s])=>NC(s.evaluate(c),c.properties())],[[tr,Lp],(c,[s,l])=>NC(s.evaluate(c),l.evaluate(c))]]},get:{type:qn,overloads:[[[tr],(c,[s])=>db(s.evaluate(c),c.properties())],[[tr,Lp],(c,[s,l])=>db(s.evaluate(c),l.evaluate(c))]]},"feature-state":[qn,[tr],(c,[s])=>db(s.evaluate(c),c.featureState||{})],properties:[Lp,[],c=>c.properties()],"geometry-type":[tr,[],c=>c.geometryType()],worldview:[tr,[],c=>c.globals.worldview||""],id:[qn,[],c=>c.id()],zoom:[fi,[],c=>c.globals.zoom],pitch:[fi,[],c=>c.globals.pitch||0],"distance-from-center":[fi,[],c=>c.distanceFromCenter()],"measure-light":[fi,[tr],(c,[s])=>c.measureLight(s.evaluate(c))],"heatmap-density":[fi,[],c=>c.globals.heatmapDensity||0],"line-progress":[fi,[],c=>c.globals.lineProgress||0],"raster-value":[fi,[],c=>c.globals.rasterValue||0],"raster-particle-speed":[fi,[],c=>c.globals.rasterParticleSpeed||0],"sky-radial-progress":[fi,[],c=>c.globals.skyRadialProgress||0],accumulated:[qn,[],c=>c.globals.accumulated===void 0?null:c.globals.accumulated],"+":[fi,Hp(fi),(c,s)=>{let l=0;for(let u of s)l+=u.evaluate(c);return l}],"*":[fi,Hp(fi),(c,s)=>{let l=1;for(let u of s)l*=u.evaluate(c);return l}],"-":{type:fi,overloads:[[[fi,fi],(c,[s,l])=>s.evaluate(c)-l.evaluate(c)],[[fi],(c,[s])=>-s.evaluate(c)]]},"/":[fi,[fi,fi],(c,[s,l])=>s.evaluate(c)/l.evaluate(c)],"%":[fi,[fi,fi],(c,[s,l])=>s.evaluate(c)%l.evaluate(c)],ln2:[fi,[],()=>Math.LN2],pi:[fi,[],()=>Math.PI],e:[fi,[],()=>Math.E],"^":[fi,[fi,fi],(c,[s,l])=>Math.pow(s.evaluate(c),l.evaluate(c))],sqrt:[fi,[fi],(c,[s])=>Math.sqrt(s.evaluate(c))],log10:[fi,[fi],(c,[s])=>Math.log(s.evaluate(c))/Math.LN10],ln:[fi,[fi],(c,[s])=>Math.log(s.evaluate(c))],log2:[fi,[fi],(c,[s])=>Math.log2(s.evaluate(c))],sin:[fi,[fi],(c,[s])=>Math.sin(s.evaluate(c))],cos:[fi,[fi],(c,[s])=>Math.cos(s.evaluate(c))],tan:[fi,[fi],(c,[s])=>Math.tan(s.evaluate(c))],asin:[fi,[fi],(c,[s])=>Math.asin(s.evaluate(c))],acos:[fi,[fi],(c,[s])=>Math.acos(s.evaluate(c))],atan:[fi,[fi],(c,[s])=>Math.atan(s.evaluate(c))],min:[fi,Hp(fi),(c,s)=>Math.min(...s.map(l=>l.evaluate(c)))],max:[fi,Hp(fi),(c,s)=>Math.max(...s.map(l=>l.evaluate(c)))],abs:[fi,[fi],(c,[s])=>Math.abs(s.evaluate(c))],round:[fi,[fi],(c,[s])=>{let l=s.evaluate(c);return l<0?-Math.round(-l):Math.round(l)}],floor:[fi,[fi],(c,[s])=>Math.floor(s.evaluate(c))],ceil:[fi,[fi],(c,[s])=>Math.ceil(s.evaluate(c))],"filter-==":[sr,[tr,qn],(c,[s,l])=>c.properties()[s.value]===l.value],"filter-id-==":[sr,[qn],(c,[s])=>c.id()===s.value],"filter-type-==":[sr,[tr],(c,[s])=>c.geometryType()===s.value],"filter-<":[sr,[tr,qn],(c,[s,l])=>{let u=c.properties()[s.value],h=l.value;return typeof u==typeof h&&u{let l=c.id(),u=s.value;return typeof l==typeof u&&l":[sr,[tr,qn],(c,[s,l])=>{let u=c.properties()[s.value],h=l.value;return typeof u==typeof h&&u>h}],"filter-id->":[sr,[qn],(c,[s])=>{let l=c.id(),u=s.value;return typeof l==typeof u&&l>u}],"filter-<=":[sr,[tr,qn],(c,[s,l])=>{let u=c.properties()[s.value],h=l.value;return typeof u==typeof h&&u<=h}],"filter-id-<=":[sr,[qn],(c,[s])=>{let l=c.id(),u=s.value;return typeof l==typeof u&&l<=u}],"filter->=":[sr,[tr,qn],(c,[s,l])=>{let u=c.properties()[s.value],h=l.value;return typeof u==typeof h&&u>=h}],"filter-id->=":[sr,[qn],(c,[s])=>{let l=c.id(),u=s.value;return typeof l==typeof u&&l>=u}],"filter-has":[sr,[qn],(c,[s])=>s.value in c.properties()],"filter-has-id":[sr,[],c=>c.id()!==null&&c.id()!==void 0],"filter-type-in":[sr,[Ea(tr)],(c,[s])=>s.value.indexOf(c.geometryType())>=0],"filter-id-in":[sr,[Ea(qn)],(c,[s])=>s.value.indexOf(c.id())>=0],"filter-in-small":[sr,[tr,Ea(qn)],(c,[s,l])=>l.value.indexOf(c.properties()[s.value])>=0],"filter-in-large":[sr,[tr,Ea(qn)],(c,[s,l])=>(function(u,h,g,_){for(;g<=_;){let b=g+_>>1;if(h[b]===u)return!0;h[b]>u?_=b-1:g=b+1}return!1})(c.properties()[s.value],l.value,0,l.value.length-1)],all:{type:sr,overloads:[[[sr,sr],(c,[s,l])=>s.evaluate(c)&&l.evaluate(c)],[Hp(sr),(c,s)=>{for(let l of s)if(!l.evaluate(c))return!1;return!0}]]},any:{type:sr,overloads:[[[sr,sr],(c,[s,l])=>s.evaluate(c)||l.evaluate(c)],[Hp(sr),(c,s)=>{for(let l of s)if(l.evaluate(c))return!0;return!1}]]},"!":[sr,[sr],(c,[s])=>!s.evaluate(c)],"is-supported-script":[sr,[tr],(c,[s])=>{let l=c.globals&&c.globals.isSupportedScript;return!l||l(s.evaluate(c))}],upcase:[tr,[tr],(c,[s])=>s.evaluate(c).toUpperCase()],downcase:[tr,[tr],(c,[s])=>s.evaluate(c).toLowerCase()],concat:[tr,Hp(qn),(c,s)=>s.map(l=>dl(l.evaluate(c))).join("")],"resolved-locale":[tr,[zv],(c,[s])=>s.evaluate(c).resolvedLocale()],random:[fi,[fi,fi,qn],(c,s)=>{let[l,u,h]=s.map(_=>_.evaluate(c));if(l>u||l===u)return l;let g;if(typeof h=="string")g=(function(_){let b=0;if(_.length===0)return b;for(let C=0;C<_.length;C++)b=(b<<5)-b+_.charCodeAt(C),b|=0;return b})(h);else{if(typeof h!="number")throw new Yt(`Invalid seed input: ${h}`);g=h}return l+LC(g)()*(u-l)}]});class mb{constructor(s,l,u,h,g){this.expression=s,this._warningHistory={},this._evaluator=new gu(u,h,g),this._defaultValue=l?(function(_){return _.type==="color"&&(pb(_.default)||Array.isArray(_.default))?new er(0,0,0,0):_.type==="color"?er.parse(_.default)||null:_.default===void 0?null:_.default})(l):null,this._enumValues=l&&l.type==="enum"?l.values:null,this.configDependencies=eb(s)}evaluateWithoutErrorHandling(s,l,u,h,g,_,b,C){return this._evaluator.globals=s,this._evaluator.feature=l,this._evaluator.featureState=u,this._evaluator.canonical=h||null,this._evaluator.availableImages=g||null,this._evaluator.formattedSection=_,this._evaluator.featureTileCoord=b||null,this._evaluator.featureDistanceData=C||null,this.expression.evaluate(this._evaluator)}evaluate(s,l,u,h,g,_,b,C,T){this._evaluator.globals=s,this._evaluator.feature=l||null,this._evaluator.featureState=u||null,this._evaluator.canonical=h||null,this._evaluator.availableImages=g||null,this._evaluator.formattedSection=_||null,this._evaluator.featureTileCoord=b||null,this._evaluator.featureDistanceData=C||null,this._evaluator.iconImageUseTheme=T||null;try{let A=this.expression.evaluate(this._evaluator);if(A==null||typeof A=="number"&&A!=A)return this._defaultValue;if(this._enumValues&&!(A in this._enumValues))throw new Yt(`Expected value to be one of ${Object.keys(this._enumValues).map(D=>JSON.stringify(D)).join(", ")}, but found ${JSON.stringify(A)} instead.`);return A}catch(A){return this._warningHistory[A.message]||(this._warningHistory[A.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${A.message}`)),this._defaultValue}}}function jC(c){return Array.isArray(c)&&c.length>0&&typeof c[0]=="string"&&c[0]in Rm}function Ld(c,s,l,u,h){let g=new ib(Rm,[],s?(function(b){let C={color:wl,string:tr,number:fi,enum:tr,boolean:sr,formatted:ph,resolvedImage:z_};return b.type==="array"?Ea(C[b.value]||qn,b.length):C[b.type]})(s):void 0,void 0,void 0,l,u,h),_=g.parse(c,void 0,void 0,void 0,s&&s.type==="string"?{typeAnnotation:"coerce"}:void 0);return _?Gp(new mb(_,s,l,u,h)):vh(g.errors)}class ey{constructor(s,l,u,h){this.kind=s,this._styleExpression=l,this.isLightConstant=u,this.isLineProgressConstant=h,this.isStateDependent=s!=="constant"&&!Jv(l.expression),this.configDependencies=eb(l.expression)}evaluateWithoutErrorHandling(s,l,u,h,g,_){return this._styleExpression.evaluateWithoutErrorHandling(s,l,u,h,g,_)}evaluate(s,l,u,h,g,_,b){return this._styleExpression.evaluate(s,l,u,h,g,_,void 0,void 0,b)}}class bh{constructor(s,l,u,h,g,_){this.kind=s,this.zoomStops=u,this._styleExpression=l,this.isStateDependent=s!=="camera"&&!Jv(l.expression),this.isLightConstant=g,this.isLineProgressConstant=_,this.configDependencies=eb(l.expression),this.interpolationType=h}evaluateWithoutErrorHandling(s,l,u,h,g,_){return this._styleExpression.evaluateWithoutErrorHandling(s,l,u,h,g,_)}evaluate(s,l,u,h,g,_){return this._styleExpression.evaluate(s,l,u,h,g,_)}interpolationFactor(s,l,u){return this.interpolationType?Zl.interpolationFactor(this.interpolationType,s,l,u):0}}function HC(c,s,l,u,h){if((c=Ld(c,s,l,u,h)).result==="error")return c;let g=c.value.expression,_=Am(g);if(!_&&!ub(s))return vh([new Kc("","data expressions not supported")]);let b=Dm(g,["zoom","pitch","distance-from-center"]);if(!b&&!VC(s))return vh([new Kc("","zoom expressions not supported")]);let C=Dm(g,["measure-light"]);if(!C&&!zC(s))return vh([new Kc("","measure-light expression not supported")]);let T=Dm(g,["line-progress"]);if(!T&&!(function(M){return BC(M.expression,"line-progress")})(s))return vh([new Kc("","line-progress expression not supported")]);let A=s.expression&&s.expression.relaxZoomRestriction,D=_b(g);return D||b||A?D instanceof Kc?vh([D]):D instanceof Zl&&!hb(s)?vh([new Kc("",'"interpolate" expressions cannot be used with this property')]):Gp(D?new bh(_&&T?"camera":"composite",c.value,D.labels,D instanceof Zl?D.interpolation:void 0,C,T):new ey(_&&T?"constant":"source",c.value,C,T)):vh([new Kc("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class gb{constructor(s,l){this._parameters=s,this._specification=l,Object.assign(this,fb(this._parameters,this._specification))}static deserialize(s){return new gb(s._parameters,s._specification)}static serialize(s){return{_parameters:s._parameters,_specification:s._specification}}}function _b(c){let s=null;if(c instanceof ab)s=_b(c.result);else if(c instanceof Q_){for(let l of c.args)if(s=_b(l),s)break}else(c instanceof Z_||c instanceof Zl)&&c.input instanceof Ya&&c.input.name==="zoom"&&(s=c);return s instanceof Kc||c.eachChild(l=>{let u=_b(l);u instanceof Kc?s=u:s&&u&&s!==u&&(s=new Kc("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),s}var ty,yb,RD=(function(){if(yb)return ty;yb=1,ty=s;var c=3;function s(l,u,h){var g=this.cells=[];if(l instanceof ArrayBuffer){this.arrayBuffer=l;var _=new Int32Array(this.arrayBuffer);l=_[0],this.d=(u=_[1])+2*(h=_[2]);for(var b=0;b=M[j+0]&&g>=M[j+1])?(C[F]=!0,b.push(D[F])):C[F]=!1}}},s.prototype._forEachCell=function(l,u,h,g,_,b,C,T){for(var A=this._convertToCellCoord(l),D=this._convertToCellCoord(u),M=this._convertToCellCoord(h),L=this._convertToCellCoord(g),F=A;F<=M;F++)for(var j=D;j<=L;j++){var H=this.d*j+F;if((!T||T(this._convertFromCellCoord(F),this._convertFromCellCoord(j),this._convertFromCellCoord(F+1),this._convertFromCellCoord(j+1)))&&_.call(this,l,u,h,g,H,b,C,T))return}},s.prototype._convertFromCellCoord=function(l){return(l-this.padding)/this.scale},s.prototype._convertToCellCoord=function(l){return Math.max(0,Math.min(this.d-1,Math.floor(l*this.scale)+this.padding))},s.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var l=this.cells,u=c+this.cells.length+1+1,h=0,g=0;g=0||(h[g]=xh(c[g],s)));c instanceof Error&&(h.message=c.message)}if(h.$name)throw new Error("$name property is reserved for worker serialization logic.");return u!=="Object"&&(h.$name=u),h}throw new Error("can't serialize object of type "+typeof c)}function wh(c){if(c==null||typeof c=="boolean"||typeof c=="number"||typeof c=="string"||c instanceof Boolean||c instanceof Number||c instanceof String||c instanceof Date||c instanceof RegExp||GC(c)||_u(c)||ArrayBuffer.isView(c)||c instanceof ImageData)return c;if(Array.isArray(c))return c.map(wh);if(typeof c=="object"){let s=c.$name||"Object";if(s==="Map"){let h=c.entries||[],g=new Map;for(let _=0;_c>=128&&c<=255,Arabic:c=>c>=1536&&c<=1791,"Arabic Supplement":c=>c>=1872&&c<=1919,"Arabic Extended-A":c=>c>=2208&&c<=2303,"Hangul Jamo":c=>c>=4352&&c<=4607,"Unified Canadian Aboriginal Syllabics":c=>c>=5120&&c<=5759,Khmer:c=>c>=6016&&c<=6143,"Unified Canadian Aboriginal Syllabics Extended":c=>c>=6320&&c<=6399,"General Punctuation":c=>c>=8192&&c<=8303,"Letterlike Symbols":c=>c>=8448&&c<=8527,"Number Forms":c=>c>=8528&&c<=8591,"Miscellaneous Technical":c=>c>=8960&&c<=9215,"Control Pictures":c=>c>=9216&&c<=9279,"Optical Character Recognition":c=>c>=9280&&c<=9311,"Enclosed Alphanumerics":c=>c>=9312&&c<=9471,"Geometric Shapes":c=>c>=9632&&c<=9727,"Miscellaneous Symbols":c=>c>=9728&&c<=9983,"Miscellaneous Symbols and Arrows":c=>c>=11008&&c<=11263,"CJK Radicals Supplement":c=>c>=11904&&c<=12031,"Kangxi Radicals":c=>c>=12032&&c<=12255,"Ideographic Description Characters":c=>c>=12272&&c<=12287,"CJK Symbols and Punctuation":c=>c>=12288&&c<=12351,Hiragana:c=>c>=12352&&c<=12447,Katakana:c=>c>=12448&&c<=12543,Bopomofo:c=>c>=12544&&c<=12591,"Hangul Compatibility Jamo":c=>c>=12592&&c<=12687,Kanbun:c=>c>=12688&&c<=12703,"Bopomofo Extended":c=>c>=12704&&c<=12735,"CJK Strokes":c=>c>=12736&&c<=12783,"Katakana Phonetic Extensions":c=>c>=12784&&c<=12799,"Enclosed CJK Letters and Months":c=>c>=12800&&c<=13055,"CJK Compatibility":c=>c>=13056&&c<=13311,"CJK Unified Ideographs Extension A":c=>c>=13312&&c<=19903,"Yijing Hexagram Symbols":c=>c>=19904&&c<=19967,"CJK Unified Ideographs":c=>c>=19968&&c<=40959,"Yi Syllables":c=>c>=40960&&c<=42127,"Yi Radicals":c=>c>=42128&&c<=42191,"Hangul Jamo Extended-A":c=>c>=43360&&c<=43391,"Hangul Syllables":c=>c>=44032&&c<=55215,"Hangul Jamo Extended-B":c=>c>=55216&&c<=55295,"Private Use Area":c=>c>=57344&&c<=63743,"CJK Compatibility Ideographs":c=>c>=63744&&c<=64255,"Arabic Presentation Forms-A":c=>c>=64336&&c<=65023,"Vertical Forms":c=>c>=65040&&c<=65055,"CJK Compatibility Forms":c=>c>=65072&&c<=65103,"Small Form Variants":c=>c>=65104&&c<=65135,"Arabic Presentation Forms-B":c=>c>=65136&&c<=65279,"Halfwidth and Fullwidth Forms":c=>c>=65280&&c<=65519,Osage:c=>c>=66736&&c<=66815,"CJK Unified Ideographs Extension B":c=>c>=131072&&c<=173791};function $C(c){for(let s of c)if(bb(s.charCodeAt(0)))return!0;return!1}function OD(c){for(let s of c)if(!vb(s.charCodeAt(0)))return!1;return!0}function vb(c){return!(Ii.Arabic(c)||Ii["Arabic Supplement"](c)||Ii["Arabic Extended-A"](c)||Ii["Arabic Presentation Forms-A"](c)||Ii["Arabic Presentation Forms-B"](c))}function bb(c){return!(c!==746&&c!==747&&(c<4352||!(Ii["Bopomofo Extended"](c)||Ii.Bopomofo(c)||Ii["CJK Compatibility Forms"](c)&&!(c>=65097&&c<=65103)||Ii["CJK Compatibility Ideographs"](c)||Ii["CJK Compatibility"](c)||Ii["CJK Radicals Supplement"](c)||Ii["CJK Strokes"](c)||!(!Ii["CJK Symbols and Punctuation"](c)||c>=12296&&c<=12305||c>=12308&&c<=12319||c===12336)||Ii["CJK Unified Ideographs Extension A"](c)||Ii["CJK Unified Ideographs"](c)||Ii["Enclosed CJK Letters and Months"](c)||Ii["Hangul Compatibility Jamo"](c)||Ii["Hangul Jamo Extended-A"](c)||Ii["Hangul Jamo Extended-B"](c)||Ii["Hangul Jamo"](c)||Ii["Hangul Syllables"](c)||Ii.Hiragana(c)||Ii["Ideographic Description Characters"](c)||Ii.Kanbun(c)||Ii["Kangxi Radicals"](c)||Ii["Katakana Phonetic Extensions"](c)||Ii.Katakana(c)&&c!==12540||!(!Ii["Halfwidth and Fullwidth Forms"](c)||c===65288||c===65289||c===65293||c>=65306&&c<=65310||c===65339||c===65341||c===65343||c>=65371&&c<=65503||c===65507||c>=65512&&c<=65519)||!(!Ii["Small Form Variants"](c)||c>=65112&&c<=65118||c>=65123&&c<=65126)||Ii["Unified Canadian Aboriginal Syllabics"](c)||Ii["Unified Canadian Aboriginal Syllabics Extended"](c)||Ii["Vertical Forms"](c)||Ii["Yijing Hexagram Symbols"](c)||Ii["Yi Syllables"](c)||Ii["Yi Radicals"](c))))}function xb(c){return!(bb(c)||(function(s){return!!(Ii["Latin-1 Supplement"](s)&&(s===167||s===169||s===174||s===177||s===188||s===189||s===190||s===215||s===247)||Ii["General Punctuation"](s)&&(s===8214||s===8224||s===8225||s===8240||s===8241||s===8251||s===8252||s===8258||s===8263||s===8264||s===8265||s===8273)||Ii["Letterlike Symbols"](s)||Ii["Number Forms"](s)||Ii["Miscellaneous Technical"](s)&&(s>=8960&&s<=8967||s>=8972&&s<=8991||s>=8996&&s<=9e3||s===9003||s>=9085&&s<=9114||s>=9150&&s<=9165||s===9167||s>=9169&&s<=9179||s>=9186&&s<=9215)||Ii["Control Pictures"](s)&&s!==9251||Ii["Optical Character Recognition"](s)||Ii["Enclosed Alphanumerics"](s)||Ii["Geometric Shapes"](s)||Ii["Miscellaneous Symbols"](s)&&!(s>=9754&&s<=9759)||Ii["Miscellaneous Symbols and Arrows"](s)&&(s>=11026&&s<=11055||s>=11088&&s<=11097||s>=11192&&s<=11243)||Ii["CJK Symbols and Punctuation"](s)||Ii.Katakana(s)||Ii["Private Use Area"](s)||Ii["CJK Compatibility Forms"](s)||Ii["Small Form Variants"](s)||Ii["Halfwidth and Fullwidth Forms"](s)||s===8734||s===8756||s===8757||s>=9984&&s<=10087||s>=10102&&s<=10131||s===65532||s===65533)})(c))}function LF(c){return Ii.Arabic(c)||Ii["Arabic Supplement"](c)||Ii["Arabic Extended-A"](c)||Ii["Arabic Presentation Forms-A"](c)||Ii["Arabic Presentation Forms-B"](c)}function PD(c){return c>=1424&&c<=2303||Ii["Arabic Presentation Forms-A"](c)||Ii["Arabic Presentation Forms-B"](c)}function FF(c,s){return!(!s&&PD(c)||c>=2304&&c<=3583||c>=3840&&c<=4255||Ii.Khmer(c))}function NF(c){for(let s of c)if(PD(s.charCodeAt(0)))return!0;return!1}let Cl={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"},qC=null,Za=Cl.unavailable,Ch=null,LD=function(c){c&&typeof c=="string"&&c.indexOf("NetworkError")>-1&&(Za=Cl.error),qC&&qC(c)};function WC(){KC.fire(new Wc("pluginStateChange",{pluginStatus:Za,pluginURL:Ch}))}let KC=new Pp,wb=function(){return Za},qp=function(){if(Za!==Cl.deferred||!Ch)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Za=Cl.loading,WC(),Ch&&gm({url:Ch},c=>{c?LD(c):(Za=Cl.loaded,WC())})},Fd={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Za===Cl.loaded||Fd.applyArabicShaping!=null,isLoading:()=>Za===Cl.loading,setState(c){Za=c.pluginStatus,Ch=c.pluginURL},isParsing:()=>Za===Cl.parsing,isParsed:()=>Za===Cl.parsed,getPluginURL:()=>Ch};class Nr{constructor(s,l){this.zoom=s,l?(this.now=l.now,this.fadeDuration=l.fadeDuration,this.transition=l.transition,this.pitch=l.pitch,this.brightness=l.brightness,this.worldview=l.worldview):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(s){return(function(l,u){for(let h of l)if(!FF(h.charCodeAt(0),u))return!1;return!0})(s,Fd.isLoaded())}}class Wp{constructor(s,l,u,h,g){this.property=s,this.value=l,this.expression=(function(_,b,C,T,A){if(pb(_))return new gb(_,b);if(jC(_)||Array.isArray(_)&&_.length>0){let D=HC(_,b,C,T,A);if(D.result==="error")throw new Error(D.value.map(M=>`${M.key}: ${M.message}`).join(", "));return D.value}{let D=_;return typeof _=="string"&&b.type==="color"&&(D=er.parse(_)),{kind:"constant",configDependencies:new Set,evaluate:()=>D}}})(l===void 0?s.specification.default:l,s.specification,u,h,g)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(s,l,u,h){return this.property.possiblyEvaluate(this,s,l,u,h)}}class YC{constructor(s,l,u,h){this.property=s,this.value=new Wp(s,void 0,l,u,h)}transitioned(s,l){return new yu(this.property,this.value,l,Object.assign({},s.transition,this.transition),s.now)}untransitioned(){return new yu(this.property,this.value,null,{},0)}}class FD{constructor(s,l,u,h){this._properties=s,this._values=Object.create(s.defaultTransitionablePropertyValues),this._scope=l,this._options=u,this._iconImageUseTheme=h,this.configDependencies=new Set}getValue(s){return hn(this._values[s].value.value)}setValue(s,l){this._values.hasOwnProperty(s)||(this._values[s]=new YC(this._values[s].property,this._scope,this._options,this._iconImageUseTheme)),this._values[s].value=new Wp(this._values[s].property,l===null?void 0:hn(l),this._scope,this._options,this._iconImageUseTheme),this._values[s].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[s].value.expression.configDependencies]))}setTransitionOrValue(s,l){l&&(this._options=l);let u=this._properties.properties;if(s)for(let h in s){let g=s[h];if(h.endsWith("-transition")){let _=h.slice(0,-11);u[_]&&this.setTransition(_,g)}else u.hasOwnProperty(h)&&this.setValue(h,g)}}getTransition(s){return hn(this._values[s].transition)}setTransition(s,l){this._values.hasOwnProperty(s)||(this._values[s]=new YC(this._values[s].property)),this._values[s].transition=hn(l)||void 0}serialize(){let s={};for(let l of Object.keys(this._values)){let u=this.getValue(l);u!==void 0&&(s[l]=u);let h=this.getTransition(l);h!==void 0&&(s[`${l}-transition`]=h)}return s}transitioned(s,l){let u=new ZC(this._properties);for(let h of Object.keys(this._values))u._values[h]=this._values[h].transitioned(s,l._values[h]);return u}untransitioned(){let s=new ZC(this._properties);for(let l of Object.keys(this._values))s._values[l]=this._values[l].untransitioned();return s}}class yu{constructor(s,l,u,h,g){let _=h.delay||0,b=h.duration||0;g=g||0,this.property=s,this.value=l,this.begin=g+_,this.end=this.begin+b,s.specification.transition&&(h.delay||h.duration)&&(this.prior=u)}possiblyEvaluate(s,l,u){let h=s.now||0,g=this.value.possiblyEvaluate(s,l,u),_=this.prior;if(_){if(h>this.end)return this.prior=null,g;if(this.value.isDataDriven())return this.prior=null,g;if(h":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":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"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":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function Cb(c){return c instanceof Number||c instanceof String||c instanceof Boolean?c.valueOf():c}function Qp(c){if(Array.isArray(c))return c.map(Qp);if(c instanceof Object&&!(c instanceof Number||c instanceof String||c instanceof Boolean)){let s={};for(let l in c)s[l]=Qp(c[l]);return s}return Cb(c)}function Ib(c){if(c===!0||c===!1)return!0;if(!Array.isArray(c)||c.length===0)return!1;switch(c[0]){case"has":return c.length>=2&&c[1]!=="$id"&&c[1]!=="$type";case"in":return c.length>=3&&(typeof c[1]!="string"||Array.isArray(c[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return c.length!==3||Array.isArray(c[1])||Array.isArray(c[2]);case"any":case"all":for(let s of c.slice(1))if(!Ib(s)&&typeof s!="boolean")return!1;return!0;default:return!0}}function iy(c,s="",l=null,u="fill"){if(c==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Ib(c)||(c=Tb(c));let h=c,g=!0;try{g=(function(A){if(!Fm(A))return A;let D=Qp(A);return Qc(D),D=ND(D),D})(h)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
and paste the contents of this message in the report.
Thank you!
Filter Expression:
${JSON.stringify(h,null,2)}
`)}let _=null,b=null;if(u!=="background"&&u!=="sky"&&u!=="slot"){b=Fe[`filter_${u}`];let A=Ld(g,b,s,l);if(A.result==="error")throw new Error(A.value.map(D=>`${D.key}: ${D.message}`).join(", "));_=(D,M,L)=>A.value.evaluate(D,M,{},L)}let C=null,T=null;if(g!==h){let A=Ld(h,b,s,l);if(A.result==="error")throw new Error(A.value.map(D=>`${D.key}: ${D.message}`).join(", "));C=(D,M,L,F,j)=>A.value.evaluate(D,M,{},L,void 0,void 0,F,j),T=!Am(A.value.expression)}return{filter:_,dynamicFilter:C||void 0,needGeometry:zD(g),needFeature:!!T}}function ND(c){if(!Array.isArray(c))return c;let s=(function(l){if(BD.has(l[0])){for(let u=1;uND(l))}function Qc(c){let s=!1,l=[];if(c[0]==="case"){for(let u=1;u",">=","<","<=","to-boolean"]);function BF(c,s){return cs?1:0}function zD(c){if(!Array.isArray(c))return!1;if(c[0]==="within"||c[0]==="distance")return!0;for(let s=1;s"||s==="<="||s===">="?QC(c[1],c[2],s):s==="any"?(l=c.slice(1),["any"].concat(l.map(Tb))):s==="all"?["all"].concat(c.slice(1).map(Tb)):s==="none"?["all"].concat(c.slice(1).map(Tb).map(Sb)):s==="in"?VD(c[1],c.slice(2)):s==="!in"?Sb(VD(c[1],c.slice(2))):s==="has"?UD(c[1]):s!=="!has"||Sb(UD(c[1]));var l}function QC(c,s,l){switch(c){case"$type":return[`filter-type-${l}`,s];case"$id":return[`filter-id-${l}`,s];default:return[`filter-${l}`,c,s]}}function VD(c,s){if(s.length===0)return!1;switch(c){case"$type":return["filter-type-in",["literal",s]];case"$id":return["filter-id-in",["literal",s]];default:return s.length>200&&!s.some(l=>typeof l!=typeof s[0])?["filter-in-large",c,["literal",s.sort(BF)]]:["filter-in-small",c,["literal",s]]}}function UD(c){switch(c){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",c]}}function Sb(c){return["!",c]}let ny="";function Nm(c,s){return s?`${c}${ny}${s}`:c}let XC,jD=()=>XC||(XC=new yo({"icon-size":new Ht(Fe.layout_symbol["icon-size"]),"icon-image":new Ht(Fe.layout_symbol["icon-image"]),"icon-rotate":new Ht(Fe.layout_symbol["icon-rotate"]),"icon-offset":new Ht(Fe.layout_symbol["icon-offset"])}));class zF{constructor(s,l,u,h,g,_){let b=Ld(s,Fe.appearance.condition);if(b.result==="success"&&(this.condition=b.value),this.name=l,u){this.properties=new Zp(jD()),this.unevaluatedLayout=new Kp(jD(),h,g,_);for(let C in u)this.unevaluatedLayout.setValue(C,u[C])}}isActive(s){return!(this.condition||!s.isHidden||this.name!=="hidden")||this.condition.evaluate(s.globals,s.feature,s.featureState,s.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(s){return this.properties.get(s)}getUnevaluatedProperties(){return this.unevaluatedLayout}serialize(){let s={};return s.condition=this.condition.expression.serialize(),this.name&&(s.name=this.name),this.properties&&(s.properties=this.properties),s}}let HD="-transition",GD=new Set(["fill","line","background","hillshade","raster"]);class Aa extends Pp{constructor(s,l,u,h,g,_){if(super(),this.id=s.id,this.fqid=Nm(this.id,u),this.type=s.type,this.scope=u,this.lut=h,this.options=g,this.iconImageUseTheme=_,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,s.type!=="custom"){if(this.metadata=s.metadata,this.minzoom=s.minzoom,this.maxzoom=s.maxzoom,s.type&&s.type!=="background"&&s.type!=="sky"&&s.type!=="slot"){this.source=s.source,this.sourceLayer=s["source-layer"],this.filter=s.filter;let b=Ld(this.filter,Fe[`filter_${s.type}`]);b.result!=="error"&&(this.configDependencies=new Set([...this.configDependencies,...b.value.configDependencies]))}if(s.slot&&(this.slot=s.slot),s.appearances&&s.appearances.forEach(b=>{this.appearances.push(new zF(b.condition,b.name,b.properties,this.scope,g,this.iconImageUseTheme))}),l.layout&&(this._unevaluatedLayout=new Kp(l.layout,this.scope,g,this.iconImageUseTheme),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),l.paint){this._transitionablePaint=new FD(l.paint,this.scope,g);for(let b in s.paint)this.setPaintProperty(b,s.paint[b]);for(let b in s.layout)this.setLayoutProperty(b,s.layout[b]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Zp(l.paint)}}}onAdd(s){}onRemove(s){}isDraped(s){return!this.is3D(!0)&&GD.has(this.type)}getLayoutProperty(s){return s==="visibility"?this.visibility:this._unevaluatedLayout.getValue(s)}setLayoutProperty(s,l){if(this.type==="custom"&&s==="visibility")return void(this.visibility=l);let u=this._unevaluatedLayout;u._properties.properties[s]&&(u.setValue(s,l),this.configDependencies=new Set([...this.configDependencies,...u.configDependencies]),s==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(s){return s.endsWith(HD)?this._transitionablePaint.getTransition(s.slice(0,-11)):this._transitionablePaint.getValue(s)}setPaintProperty(s,l){let u=this._transitionablePaint,h=u._properties.properties;if(s.endsWith(HD)){let D=s.slice(0,-11);return h[D]&&u.setTransition(D,l||void 0),!1}if(!h[s])return!1;let g=u._values[s],_=g.value.isDataDriven(),b=g.value;u.setValue(s,l),this.configDependencies=new Set([...this.configDependencies,...u.configDependencies]),this._handleSpecialPaintPropertyUpdate(s);let C=u._values[s].value,T=C.isDataDriven(),A=s.endsWith("pattern")||s==="line-dasharray";return T||_||A||this._handleOverridablePaintPropertyUpdate(s,b,C)}_handleSpecialPaintPropertyUpdate(s){}getProgramIds(){return null}getDefaultProgramParams(s,l,u){return null}_handleOverridablePaintPropertyUpdate(s,l,u){return!1}isHidden(s){return!!(this.minzoom&&s=this.maxzoom)||this.visibility==="none"}updateTransitions(s){this._transitioningPaint=this._transitionablePaint.transitioned(s,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(s,l){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(s,void 0,l,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(s,void 0,l)}serialize(){let s={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.appearances.length!==0&&(s.appearances=this.appearances.map(l=>l.serialize())),yn(s,(l,u)=>!(l===void 0||u==="layout"&&!Object.keys(l).length||u==="paint"&&!Object.keys(l).length))}is3D(s){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(let s in this.paint._values){let l=this.paint.get(s);if(l instanceof Yp&&ub(l.property.specification)&&(l.value.kind==="source"||l.value.kind==="composite")&&l.value.isStateDependent)return!0}return!1}compileFilter(s){this._filterCompiled||(this._featureFilter=iy(this.filter,this.scope,s),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(s){this._stats&&(s.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRadius(s){}queryIntersectsFeature(s,l,u,h,g,_,b,C,T){}}let Ih={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Bm{constructor(s,l){this._structArray=s,this._pos1=l*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Kr{constructor(){this.capacity=-1,this.resize(0)}static serialize(s,l){return s._trim(),l&&l.add(s.arrayBuffer),{length:s.length,arrayBuffer:s.arrayBuffer}}static deserialize(s){let l=Object.create(this.prototype);return l.arrayBuffer=s.arrayBuffer,l.length=s.length,l.capacity=s.arrayBuffer.byteLength/l.bytesPerElement,l._refreshViews(),l}_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(s){this.reserve(s),this.length=s}reserve(s){if(s>this.capacity){this.capacity=Math.max(s,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let l=this.uint8;this._refreshViews(),l&&this.uint8.set(l)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...s){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...s){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 xn(c,s=1){let l=0,u=0;return{members:c.map(h=>{let g=Ih[h.type].BYTES_PER_ELEMENT,_=l=$D(l,Math.max(s,g)),b=h.components||1;return u=Math.max(u,g),l+=g*b,{name:h.name,type:h.type,components:b,offset:_}}),size:$D(l,Math.max(u,s)),alignment:s}}function $D(c,s){return Math.ceil(c/s)*s}class Th extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l){let u=this.length;return this.resize(u+1),this.emplace(u,s,l)}emplace(s,l,u){let h=2*s;return this.int16[h+0]=l,this.int16[h+1]=u,s}}Th.prototype.bytesPerElement=4,Qt(Th,"StructArrayLayout2i4");class Xp extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,s,l,u)}emplace(s,l,u,h){let g=3*s;return this.int16[g+0]=l,this.int16[g+1]=u,this.int16[g+2]=h,s}}Xp.prototype.bytesPerElement=6,Qt(Xp,"StructArrayLayout3i6");class Jp extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,u,h){let g=this.length;return this.resize(g+1),this.emplace(g,s,l,u,h)}emplace(s,l,u,h,g){let _=4*s;return this.int16[_+0]=l,this.int16[_+1]=u,this.int16[_+2]=h,this.int16[_+3]=g,s}}Jp.prototype.bytesPerElement=8,Qt(Jp,"StructArrayLayout4i8");class Sh extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s){let l=this.length;return this.resize(l+1),this.emplace(l,s)}emplace(s,l){return this.float32[1*s+0]=l,s}}Sh.prototype.bytesPerElement=4,Qt(Sh,"StructArrayLayout1f4");class JC extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,s,l,u)}emplace(s,l,u,h){let g=4*s,_=2*s;return this.int16[g+0]=l,this.int16[g+1]=u,this.float32[_+1]=h,s}}JC.prototype.bytesPerElement=8,Qt(JC,"StructArrayLayout2i1f8");class Eb extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,s,l,u)}emplace(s,l,u,h){let g=4*s;return this.int16[g+0]=l,this.int16[g+1]=u,this.int16[g+2]=h,s}}Eb.prototype.bytesPerElement=8,Qt(Eb,"StructArrayLayout3i8");class eI extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g){let _=this.length;return this.resize(_+1),this.emplace(_,s,l,u,h,g)}emplace(s,l,u,h,g,_){let b=5*s;return this.int16[b+0]=l,this.int16[b+1]=u,this.int16[b+2]=h,this.int16[b+3]=g,this.int16[b+4]=_,s}}eI.prototype.bytesPerElement=10,Qt(eI,"StructArrayLayout5i10");class Ab extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g,_,b){let C=this.length;return this.resize(C+1),this.emplace(C,s,l,u,h,g,_,b)}emplace(s,l,u,h,g,_,b,C){let T=6*s,A=12*s,D=3*s;return this.int16[T+0]=l,this.int16[T+1]=u,this.uint8[A+4]=h,this.uint8[A+5]=g,this.uint8[A+6]=_,this.uint8[A+7]=b,this.float32[D+2]=C,s}}Ab.prototype.bytesPerElement=12,Qt(Ab,"StructArrayLayout2i4ub1f12");class ul extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,s,l,u)}emplace(s,l,u,h){let g=3*s;return this.float32[g+0]=l,this.float32[g+1]=u,this.float32[g+2]=h,s}}ul.prototype.bytesPerElement=12,Qt(ul,"StructArrayLayout3f12");class Eh extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g){let _=this.length;return this.resize(_+1),this.emplace(_,s,l,u,h,g)}emplace(s,l,u,h,g,_){let b=6*s,C=3*s;return this.uint16[b+0]=l,this.uint16[b+1]=u,this.uint16[b+2]=h,this.uint16[b+3]=g,this.float32[C+2]=_,s}}Eh.prototype.bytesPerElement=12,Qt(Eh,"StructArrayLayout4ui1f12");class zm extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,l,u,h){let g=this.length;return this.resize(g+1),this.emplace(g,s,l,u,h)}emplace(s,l,u,h,g){let _=4*s;return this.uint16[_+0]=l,this.uint16[_+1]=u,this.uint16[_+2]=h,this.uint16[_+3]=g,s}}zm.prototype.bytesPerElement=8,Qt(zm,"StructArrayLayout4ui8");class Db extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g,_){let b=this.length;return this.resize(b+1),this.emplace(b,s,l,u,h,g,_)}emplace(s,l,u,h,g,_,b){let C=6*s;return this.int16[C+0]=l,this.int16[C+1]=u,this.int16[C+2]=h,this.int16[C+3]=g,this.int16[C+4]=_,this.int16[C+5]=b,s}}Db.prototype.bytesPerElement=12,Qt(Db,"StructArrayLayout6i12");class tI extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g,_,b,C,T,A,D,M){let L=this.length;return this.resize(L+1),this.emplace(L,s,l,u,h,g,_,b,C,T,A,D,M)}emplace(s,l,u,h,g,_,b,C,T,A,D,M,L){let F=12*s;return this.int16[F+0]=l,this.int16[F+1]=u,this.int16[F+2]=h,this.int16[F+3]=g,this.uint16[F+4]=_,this.uint16[F+5]=b,this.uint16[F+6]=C,this.uint16[F+7]=T,this.int16[F+8]=A,this.int16[F+9]=D,this.int16[F+10]=M,this.int16[F+11]=L,s}}tI.prototype.bytesPerElement=24,Qt(tI,"StructArrayLayout4i4ui4i24");class iI extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g,_){let b=this.length;return this.resize(b+1),this.emplace(b,s,l,u,h,g,_)}emplace(s,l,u,h,g,_,b){let C=10*s,T=5*s;return this.int16[C+0]=l,this.int16[C+1]=u,this.int16[C+2]=h,this.float32[T+2]=g,this.float32[T+3]=_,this.float32[T+4]=b,s}}iI.prototype.bytesPerElement=20,Qt(iI,"StructArrayLayout3i3f20");class Xc extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u,h){let g=this.length;return this.resize(g+1),this.emplace(g,s,l,u,h)}emplace(s,l,u,h,g){let _=4*s;return this.float32[_+0]=l,this.float32[_+1]=u,this.float32[_+2]=h,this.float32[_+3]=g,s}}Xc.prototype.bytesPerElement=16,Qt(Xc,"StructArrayLayout4f16");class Vm extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(s){let l=this.length;return this.resize(l+1),this.emplace(l,s)}emplace(s,l){return this.uint32[1*s+0]=l,s}}Vm.prototype.bytesPerElement=4,Qt(Vm,"StructArrayLayout1ul4");class es extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,l){let u=this.length;return this.resize(u+1),this.emplace(u,s,l)}emplace(s,l,u){let h=2*s;return this.uint16[h+0]=l,this.uint16[h+1]=u,s}}es.prototype.bytesPerElement=4,Qt(es,"StructArrayLayout2ui4");class Um extends Kr{_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(s,l,u,h,g,_,b,C,T,A,D,M,L){let F=this.length;return this.resize(F+1),this.emplace(F,s,l,u,h,g,_,b,C,T,A,D,M,L)}emplace(s,l,u,h,g,_,b,C,T,A,D,M,L,F){let j=20*s,H=10*s;return this.int16[j+0]=l,this.int16[j+1]=u,this.int16[j+2]=h,this.int16[j+3]=g,this.int16[j+4]=_,this.float32[H+3]=b,this.float32[H+4]=C,this.float32[H+5]=T,this.float32[H+6]=A,this.int16[j+14]=D,this.uint32[H+8]=M,this.uint16[j+18]=L,this.uint16[j+19]=F,s}}Um.prototype.bytesPerElement=40,Qt(Um,"StructArrayLayout5i4f1i1ul2ui40");class kb extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g,_,b){let C=this.length;return this.resize(C+1),this.emplace(C,s,l,u,h,g,_,b)}emplace(s,l,u,h,g,_,b,C){let T=8*s;return this.int16[T+0]=l,this.int16[T+1]=u,this.int16[T+2]=h,this.int16[T+4]=g,this.int16[T+5]=_,this.int16[T+6]=b,this.int16[T+7]=C,s}}kb.prototype.bytesPerElement=16,Qt(kb,"StructArrayLayout3i2i2i16");class nI extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g){let _=this.length;return this.resize(_+1),this.emplace(_,s,l,u,h,g)}emplace(s,l,u,h,g,_){let b=4*s,C=8*s;return this.float32[b+0]=l,this.float32[b+1]=u,this.float32[b+2]=h,this.int16[C+6]=g,this.int16[C+7]=_,s}}nI.prototype.bytesPerElement=16,Qt(nI,"StructArrayLayout2f1f2i16");class rI extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g,_){let b=this.length;return this.resize(b+1),this.emplace(b,s,l,u,h,g,_)}emplace(s,l,u,h,g,_,b){let C=20*s,T=5*s;return this.uint8[C+0]=l,this.uint8[C+1]=u,this.float32[T+1]=h,this.float32[T+2]=g,this.float32[T+3]=_,this.float32[T+4]=b,s}}rI.prototype.bytesPerElement=20,Qt(rI,"StructArrayLayout2ub4f20");class ps extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,s,l,u)}emplace(s,l,u,h){let g=3*s;return this.uint16[g+0]=l,this.uint16[g+1]=u,this.uint16[g+2]=h,s}}ps.prototype.bytesPerElement=6,Qt(ps,"StructArrayLayout3ui6");class ry extends Kr{_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(s,l,u,h,g,_,b,C,T,A,D,M,L,F,j,H,G,ie,ne,se,_e){let ye=this.length;return this.resize(ye+1),this.emplace(ye,s,l,u,h,g,_,b,C,T,A,D,M,L,F,j,H,G,ie,ne,se,_e)}emplace(s,l,u,h,g,_,b,C,T,A,D,M,L,F,j,H,G,ie,ne,se,_e,ye){let Ce=30*s,De=15*s,Me=60*s;return this.int16[Ce+0]=l,this.int16[Ce+1]=u,this.int16[Ce+2]=h,this.float32[De+2]=g,this.float32[De+3]=_,this.uint16[Ce+8]=b,this.uint16[Ce+9]=C,this.uint32[De+5]=T,this.uint32[De+6]=A,this.uint32[De+7]=D,this.uint16[Ce+16]=M,this.uint16[Ce+17]=L,this.uint16[Ce+18]=F,this.float32[De+10]=j,this.float32[De+11]=H,this.uint8[Me+48]=G,this.uint8[Me+49]=ie,this.uint8[Me+50]=ne,this.uint32[De+13]=se,this.int16[Ce+28]=_e,this.uint8[Me+58]=ye,s}}ry.prototype.bytesPerElement=60,Qt(ry,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class oI extends Kr{_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(s,l,u,h,g,_,b,C,T,A,D,M,L,F,j,H,G,ie,ne,se,_e,ye,Ce,De,Me,lt,Ne,dt,vt,ut,ft,Ct,ot){let gt=this.length;return this.resize(gt+1),this.emplace(gt,s,l,u,h,g,_,b,C,T,A,D,M,L,F,j,H,G,ie,ne,se,_e,ye,Ce,De,Me,lt,Ne,dt,vt,ut,ft,Ct,ot)}emplace(s,l,u,h,g,_,b,C,T,A,D,M,L,F,j,H,G,ie,ne,se,_e,ye,Ce,De,Me,lt,Ne,dt,vt,ut,ft,Ct,ot,gt){let We=20*s,Ge=40*s,Tt=80*s;return this.float32[We+0]=l,this.float32[We+1]=u,this.int16[Ge+4]=h,this.int16[Ge+5]=g,this.int16[Ge+6]=_,this.int16[Ge+7]=b,this.int16[Ge+8]=C,this.int16[Ge+9]=T,this.int16[Ge+10]=A,this.int16[Ge+11]=D,this.int16[Ge+12]=M,this.uint16[Ge+13]=L,this.uint16[Ge+14]=F,this.uint16[Ge+15]=j,this.uint16[Ge+16]=H,this.uint16[Ge+17]=G,this.uint16[Ge+18]=ie,this.uint16[Ge+19]=ne,this.uint16[Ge+20]=se,this.uint16[Ge+21]=_e,this.uint16[Ge+22]=ye,this.uint16[Ge+23]=Ce,this.uint16[Ge+24]=De,this.uint16[Ge+25]=Me,this.uint16[Ge+26]=lt,this.uint16[Ge+27]=Ne,this.uint32[We+14]=dt,this.float32[We+15]=vt,this.float32[We+16]=ut,this.float32[We+17]=ft,this.float32[We+18]=Ct,this.uint8[Tt+76]=ot,this.uint16[Ge+39]=gt,s}}oI.prototype.bytesPerElement=80,Qt(oI,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class oy extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g,_){let b=this.length;return this.resize(b+1),this.emplace(b,s,l,u,h,g,_)}emplace(s,l,u,h,g,_,b){let C=6*s;return this.float32[C+0]=l,this.float32[C+1]=u,this.float32[C+2]=h,this.float32[C+3]=g,this.float32[C+4]=_,this.float32[C+5]=b,s}}oy.prototype.bytesPerElement=24,Qt(oy,"StructArrayLayout6f24");class ef extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g){let _=this.length;return this.resize(_+1),this.emplace(_,s,l,u,h,g)}emplace(s,l,u,h,g,_){let b=5*s;return this.float32[b+0]=l,this.float32[b+1]=u,this.float32[b+2]=h,this.float32[b+3]=g,this.float32[b+4]=_,s}}ef.prototype.bytesPerElement=20,Qt(ef,"StructArrayLayout5f20");class sI extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g,_,b){let C=this.length;return this.resize(C+1),this.emplace(C,s,l,u,h,g,_,b)}emplace(s,l,u,h,g,_,b,C){let T=7*s;return this.float32[T+0]=l,this.float32[T+1]=u,this.float32[T+2]=h,this.float32[T+3]=g,this.float32[T+4]=_,this.float32[T+5]=b,this.float32[T+6]=C,s}}sI.prototype.bytesPerElement=28,Qt(sI,"StructArrayLayout7f28");class Mb extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g,_,b,C,T,A,D){let M=this.length;return this.resize(M+1),this.emplace(M,s,l,u,h,g,_,b,C,T,A,D)}emplace(s,l,u,h,g,_,b,C,T,A,D,M){let L=11*s;return this.float32[L+0]=l,this.float32[L+1]=u,this.float32[L+2]=h,this.float32[L+3]=g,this.float32[L+4]=_,this.float32[L+5]=b,this.float32[L+6]=C,this.float32[L+7]=T,this.float32[L+8]=A,this.float32[L+9]=D,this.float32[L+10]=M,s}}Mb.prototype.bytesPerElement=44,Qt(Mb,"StructArrayLayout11f44");class sy extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g,_,b,C,T){let A=this.length;return this.resize(A+1),this.emplace(A,s,l,u,h,g,_,b,C,T)}emplace(s,l,u,h,g,_,b,C,T,A){let D=9*s;return this.float32[D+0]=l,this.float32[D+1]=u,this.float32[D+2]=h,this.float32[D+3]=g,this.float32[D+4]=_,this.float32[D+5]=b,this.float32[D+6]=C,this.float32[D+7]=T,this.float32[D+8]=A,s}}sy.prototype.bytesPerElement=36,Qt(sy,"StructArrayLayout9f36");class jm extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l){let u=this.length;return this.resize(u+1),this.emplace(u,s,l)}emplace(s,l,u){let h=2*s;return this.float32[h+0]=l,this.float32[h+1]=u,s}}jm.prototype.bytesPerElement=8,Qt(jm,"StructArrayLayout2f8");class Rb extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s,l,u,h){let g=this.length;return this.resize(g+1),this.emplace(g,s,l,u,h)}emplace(s,l,u,h,g){let _=6*s;return this.uint32[3*s+0]=l,this.uint16[_+2]=u,this.uint16[_+3]=h,this.uint16[_+4]=g,s}}Rb.prototype.bytesPerElement=12,Qt(Rb,"StructArrayLayout1ul3ui12");class Ob extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(s){let l=this.length;return this.resize(l+1),this.emplace(l,s)}emplace(s,l){return this.uint16[1*s+0]=l,s}}Ob.prototype.bytesPerElement=2,Qt(Ob,"StructArrayLayout1ui2");class aI extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g,_,b,C,T,A,D,M,L,F,j,H){let G=this.length;return this.resize(G+1),this.emplace(G,s,l,u,h,g,_,b,C,T,A,D,M,L,F,j,H)}emplace(s,l,u,h,g,_,b,C,T,A,D,M,L,F,j,H,G){let ie=16*s;return this.float32[ie+0]=l,this.float32[ie+1]=u,this.float32[ie+2]=h,this.float32[ie+3]=g,this.float32[ie+4]=_,this.float32[ie+5]=b,this.float32[ie+6]=C,this.float32[ie+7]=T,this.float32[ie+8]=A,this.float32[ie+9]=D,this.float32[ie+10]=M,this.float32[ie+11]=L,this.float32[ie+12]=F,this.float32[ie+13]=j,this.float32[ie+14]=H,this.float32[ie+15]=G,s}}aI.prototype.bytesPerElement=64,Qt(aI,"StructArrayLayout16f64");class Hm extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(s,l,u,h,g,_,b){let C=this.length;return this.resize(C+1),this.emplace(C,s,l,u,h,g,_,b)}emplace(s,l,u,h,g,_,b,C){let T=10*s,A=5*s;return this.uint16[T+0]=l,this.uint16[T+1]=u,this.uint16[T+2]=h,this.uint16[T+3]=g,this.float32[A+2]=_,this.float32[A+3]=b,this.float32[A+4]=C,s}}Hm.prototype.bytesPerElement=20,Qt(Hm,"StructArrayLayout4ui3f20");class Gm extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(s){let l=this.length;return this.resize(l+1),this.emplace(l,s)}emplace(s,l){return this.int16[1*s+0]=l,s}}Gm.prototype.bytesPerElement=2,Qt(Gm,"StructArrayLayout1i2");class Pb extends Kr{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(s){let l=this.length;return this.resize(l+1),this.emplace(l,s)}emplace(s,l){return this.uint8[1*s+0]=l,s}}Pb.prototype.bytesPerElement=1,Qt(Pb,"StructArrayLayout1ub1");class qD extends Bm{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]}}qD.prototype.size=40;class lI extends Um{get(s){return new qD(this,s)}}Qt(lI,"CollisionBoxArray");class WD extends Bm{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(s){this._structArray.uint8[this._pos1+49]=s}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(s){this._structArray.uint8[this._pos1+50]=s}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(s){this._structArray.uint32[this._pos4+13]=s}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(s){this._structArray.uint8[this._pos1+58]=s}}WD.prototype.size=60;class Lb extends ry{get(s){return new WD(this,s)}}Qt(Lb,"PlacedSymbolArray");class KD extends Bm{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(s){this._structArray.uint32[this._pos4+14]=s}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(s){this._structArray.float32[this._pos4+18]=s}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}KD.prototype.size=80;class YD extends oI{get(s){return new KD(this,s)}}Qt(YD,"SymbolInstanceArray");class ZD extends Sh{getoffsetX(s){return this.float32[1*s+0]}}Qt(ZD,"GlyphOffsetArray");class QD extends Th{getx(s){return this.int16[2*s+0]}gety(s){return this.int16[2*s+1]}}Qt(QD,"SymbolLineVertexArray");class cI extends Bm{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]}}cI.prototype.size=12;class XD extends Rb{get(s){return new cI(this,s)}}Qt(XD,"FeatureIndexArray");class JD extends es{geta_centroid_pos0(s){return this.uint16[2*s+0]}geta_centroid_pos1(s){return this.uint16[2*s+1]}}Qt(JD,"FillExtrusionCentroidArray");class ek extends Bm{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]}}ek.prototype.size=6;class tk extends Xp{get(s){return new ek(this,s)}}Qt(tk,"FillExtrusionWallArray");let VF=xn([{name:"a_pos",components:2,type:"Int16"}],4),UF=xn([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),jF=xn([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class co{constructor(s=[]){this.segments=s}_prepareSegment(s,l,u,h){let g=this.segments[this.segments.length-1];return s>co.MAX_VERTEX_ARRAY_LENGTH&&vn(`Max vertices per segment is ${co.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${s}`),(!g||g.vertexLength+s>co.MAX_VERTEX_ARRAY_LENGTH||g.sortKey!==h)&&(g={vertexOffset:l,primitiveOffset:u,vertexLength:0,primitiveLength:0},h!==void 0&&(g.sortKey=h),this.segments.push(g)),g}prepareSegment(s,l,u,h){return this._prepareSegment(s,l.length,u.length,h)}get(){return this.segments}destroy(){for(let s of this.segments)for(let l in s.vaos)s.vaos[l].destroy()}static simpleSegment(s,l,u,h){return new co([{vertexOffset:s,primitiveOffset:l,vertexLength:u,primitiveLength:h,vaos:{},sortKey:0}])}}function ay(c,s){return 256*(c=ve(Math.floor(c),0,255))+ve(Math.floor(s),0,255)}co.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Qt(co,"SegmentVector");let HF=xn([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),GF=xn([{name:"a_pattern_b",components:4,type:"Uint16"}]),Fb=xn([{name:"a_dash",components:4,type:"Uint16"}]);class ly{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(s,l,u,h){this.ids.push(dI(s)),this.positions.push(l,u,h)}eachPosition(s,l){let u=dI(s),h=0,g=this.ids.length-1;for(;h>1;this.ids[_]>=u?g=_:h=_+1}for(;this.ids[h]===u;)l(this.positions[3*h],this.positions[3*h+1],this.positions[3*h+2]),h++}static serialize(s,l){let u=new Float64Array(s.ids),h=new Uint32Array(s.positions);return uI(u,h,0,u.length-1),l&&(l.add(u.buffer),l.add(h.buffer)),{ids:u,positions:h}}static deserialize(s){let l=new ly,u;l.ids=s.ids,l.positions=s.positions;for(let h of l.ids)h!==u&&l.uniqueIds.push(h),u=h;return l.indexed=!0,l}}function dI(c){let s=+c;return Number.isSafeInteger(s)?s:Pv(String(c))}function uI(c,s,l,u){for(;l>1],g=l-1,_=u+1;for(;;){do g++;while(c[g]h);if(g>=_)break;cy(c,g,_),cy(s,3*g,3*_),cy(s,3*g+1,3*_+1),cy(s,3*g+2,3*_+2)}_-l`u_${g}`),this.type=u,this.context=h}setUniform(s,l,u,h,g){let _=h.constantOr(this.value);l.set(s,g,_ instanceof er?_.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):_)}getBinding(s,l){return this.type==="color"?new ik(s):new Lo(s)}}class tf{constructor(s,l){this.uniformNames=l.map(u=>`u_${u}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(s,l){this.pixelRatio=s.pixelRatio||1,this.pattern=s.tl.concat(s.br),this.patternTransition=l?l.tl.concat(l.br):this.pattern}setUniform(s,l,u,h,g){let _=null;g!=="u_pattern"&&g!=="u_dash"||(_=this.pattern),g==="u_pattern_b"&&(_=this.patternTransition),g==="u_pixel_ratio"&&(_=this.pixelRatio),_&&l.set(s,g,_)}getBinding(s,l){return l==="u_pattern"||l==="u_pattern_b"||l==="u_dash"?new hy(s):new Lo(s)}}class Ah{constructor(s,l,u,h){this.expression=s,this.type=u,this.maxValue=0,this.paintVertexAttributes=l.map(g=>({name:`a_${g}`,type:"Float32",components:u==="color"?2:1,offset:0})),this.paintVertexArray=new h}populatePaintArray(s,l,u,h,g,_,b,C){let T=this.paintVertexArray.length,A=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Nr(0,{brightness:_,worldview:C}),l,{},g,h,b):this.expression.kind==="constant"&&this.expression.value,D=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Nr(0,{brightness:_,worldview:C}),l,{},g,h,b):this.lutExpression.value)==="none";this.paintVertexArray.resize(s),this._setPaintValue(T,s,A,D?null:this.context.lut)}updatePaintArray(s,l,u,h,g,_,b,C){let T=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:b,worldview:C},u,h,void 0,g):this.expression.kind==="constant"&&this.expression.value,A=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Nr(0,{brightness:b,worldview:C}),u,h,void 0,g):this.lutExpression.value)==="none";this._setPaintValue(s,l,T,A?null:this.context.lut)}_setPaintValue(s,l,u,h){if(this.type==="color"){let g=fy(u.toPremultipliedRenderColor(h));for(let _=s;_`u_${b}_t`),this.type=u,this.useIntegerZoom=h,this.context=g,this.maxValue=0,this.paintVertexAttributes=l.map(b=>({name:`a_${b}`,type:"Float32",components:u==="color"?4:2,offset:0})),this.paintVertexArray=new _}populatePaintArray(s,l,u,h,g,_,b,C){let T=this.expression.evaluate(new Nr(this.context.zoom,{brightness:_,worldview:C}),l,{},g,h,b),A=this.expression.evaluate(new Nr(this.context.zoom+1,{brightness:_,worldview:C}),l,{},g,h,b),D=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Nr(0,{brightness:_,worldview:C}),l,{},g,h,b):this.lutExpression.value)==="none",M=this.paintVertexArray.length;this.paintVertexArray.resize(s),this._setPaintValue(M,s,T,A,D?null:this.context.lut)}updatePaintArray(s,l,u,h,g,_,b,C){let T=this.expression.evaluate({zoom:this.context.zoom,brightness:b,worldview:C},u,h,void 0,g),A=this.expression.evaluate({zoom:this.context.zoom+1,brightness:b,worldview:C},u,h,void 0,g),D=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Nr(0,{brightness:b,worldview:C}),u,h,void 0,g):this.lutExpression.value)==="none";this._setPaintValue(s,l,T,A,D?null:this.context.lut)}_setPaintValue(s,l,u,h,g){if(this.type==="color"){let _=fy(u.toPremultipliedRenderColor(g)),b=fy(u.toPremultipliedRenderColor(g));for(let C=s;C!0){this.binders={},this._buffers=[],this.context=l;let h=[];for(let g in s.paint._values){let _=s.paint.get(g);if(g.endsWith("-use-theme")||!u(g)||!(_ instanceof Yp&&ub(_.property.specification)))continue;let b=ij(g,s.type),C=_.value,T=_.property.specification.type,A=!!_.property.useIntegerZoom,D=g==="line-dasharray"||g.endsWith("pattern"),M=s.paint.get(`${g}-use-theme`),L=g==="line-dasharray"&&s.layout.get("line-cap").value.kind!=="constant"||M&&M.value.kind!=="constant";if(C.kind!=="constant"||L)if(C.kind==="source"||L||D){let F=d(g,T,"source");this.binders[g]=D?new bu(C,b,T,F,s.id):new Ah(C,b,T,F),h.push(`/a_${g}`)}else{let F=d(g,T,"composite");this.binders[g]=new vu(C,b,T,A,l,F),h.push(`/z_${g}`)}else this.binders[g]=D?new tf(C.value,b):new Ql(C.value,b,T,l),h.push(`/u_${g}`);M&&(this.binders[g].lutExpression=M.value)}this.cacheKey=h.sort().join("")}getMaxValue(s){let l=this.binders[s];return l instanceof Ah||l instanceof vu?l.maxValue:0}populatePaintArrays(s,l,u,h,g,_,b,C){for(let T in this.binders){let A=this.binders[T];A.context=this.context,(A instanceof Ah||A instanceof vu||A instanceof bu)&&A.populatePaintArray(s,l,u,h,g,_,b,C)}}setConstantPatternPositions(s,l){for(let u in this.binders){let h=this.binders[u];h instanceof tf&&h.setConstantPatternPositions(s,l)}}getPatternTransitionVertexBuffer(s){let l=this.binders[s];return l instanceof bu?l.paintTransitionVertexBuffer:null}updatePaintArrays(s,l,u,h,g,_,b,C,T,A){let D=!1,M=Object.keys(s),L=M.length!==0&&!C,F=L?M:l.uniqueIds;this.context.lut=g.lut;for(let j in this.binders){let H=this.binders[j];if(H.context=this.context,(H instanceof Ah||H instanceof vu||H instanceof bu)&&H.expression&&H.expression.kind&&H.expression.kind!=="constant"&&(H.expression.isStateDependent===!0||H.expression.isLightConstant===!1)){let G=g.paint.get(j);H.expression=G.value;for(let ie of F){let ne=s[ie.toString()];l.eachPosition(ie,(se,_e,ye)=>{let Ce=h.feature(se);H.updatePaintArray(_e,ye,Ce,ne,_,b,T,A)})}if(!L)for(let ie of u.uniqueIds){let ne=s[ie.toString()];u.eachPosition(ie,(se,_e,ye)=>{let Ce=h.feature(se);H.updatePaintArray(_e,ye,Ce,ne,_,b,T,A)})}D=!0}}return D}defines(){let s=[];for(let l in this.binders){let u=this.binders[l];(u instanceof Ql||u instanceof tf)&&s.push(...u.uniformNames.map(h=>`#define HAS_UNIFORM_${h}`))}return s}getPaintVertexBuffers(){return this._buffers}getUniforms(s){let l=[];for(let u in this.binders){let h=this.binders[u];if(h instanceof Ql||h instanceof tf||h instanceof vu)for(let g of h.uniformNames)l.push({name:g,property:u,binding:h.getBinding(s,g)})}return l}setUniforms(s,l,u,h,g){for(let{name:_,property:b,binding:C}of u)this.binders[b].setUniform(s,C,g,h.get(b),_)}updatePaintBuffers(){this._buffers=[];for(let s in this.binders){let l=this.binders[s];(l instanceof Ah||l instanceof vu||l instanceof bu)&&l.paintVertexBuffer&&this._buffers.push(l.paintVertexBuffer),l instanceof bu&&l.paintTransitionVertexBuffer&&this._buffers.push(l.paintTransitionVertexBuffer)}}upload(s){for(let l in this.binders){let u=this.binders[l];(u instanceof Ah||u instanceof vu||u instanceof bu)&&u.upload(s)}this.updatePaintBuffers()}destroy(){for(let s in this.binders){let l=this.binders[s];(l instanceof Ah||l instanceof vu||l instanceof bu)&&l.destroy()}}}class Jc{constructor(s,l,u=()=>!0){this.programConfigurations={};for(let h of s)this.programConfigurations[h.id]=new nf(h,l,u);this.needsUpload=!1,this._featureMap=new ly,this._featureMapWithoutIds=new ly,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(s,l,u,h,g,_,b,C,T){for(let A in this.programConfigurations)this.programConfigurations[A].populatePaintArrays(s,l,h,g,_,b,C,T);l.id!==void 0?this._featureMap.add(l.id,u,this._bufferOffset,s):(this._featureMapWithoutIds.add(this._idlessCounter,u,this._bufferOffset,s),this._idlessCounter+=1),this._bufferOffset=s,this.needsUpload=!0}updatePaintArrays(s,l,u,h,g,_,b,C){for(let T of u)this.needsUpload=this.programConfigurations[T.id].updatePaintArrays(s,this._featureMap,this._featureMapWithoutIds,l,T,h,g,_,b||0,C)||this.needsUpload}get(s){return this.programConfigurations[s]}upload(s){if(this.needsUpload){for(let l in this.programConfigurations)this.programConfigurations[l].upload(s);this.needsUpload=!1}}destroy(){for(let s in this.programConfigurations)this.programConfigurations[s].destroy()}}let nk={"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":["gapwidth"],"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 ij(c,s){return nk[c]||[c.replace(`${s}-`,"").replace(/-/g,"_")]}let m={"line-pattern":{source:Eh,composite:Eh},"fill-pattern":{source:Eh,composite:Eh},"fill-extrusion-pattern":{source:Eh,composite:Eh},"line-dasharray":{source:zm,composite:zm}},a={color:{source:jm,composite:Xc},number:{source:Sh,composite:jm}};function d(c,s,l){let u=m[c];return u&&u[l]||a[s][l]}Qt(Ql,"ConstantBinder"),Qt(tf,"PatternConstantBinder"),Qt(Ah,"SourceExpressionBinder"),Qt(bu,"PatternCompositeBinder"),Qt(vu,"CompositeExpressionBinder"),Qt(nf,"ProgramConfiguration",{omit:["_buffers"]}),Qt(Jc,"ProgramConfigurationSet");let f=Pt/Math.PI/2,y=5,v=6,w=16383,I=64,E=[I,32,16],k=-f,R=f;function N(c,s,l,u=f){return l=Le(l),[c*Math.sin(l)*u,-s*u,c*Math.cos(l)*u]}function P(c,s,l){return N(Math.cos(Le(c)),Math.sin(Le(c)),s,l)}let z=63710088e-1,V=2*Math.PI*z;class U{constructor(s,l){if(isNaN(s)||isNaN(l))throw new Error(`Invalid LngLat object: (${s}, ${l})`);if(this.lng=+s,this.lat=+l,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new U(Oe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(s){let l=Math.PI/180,u=this.lat*l,h=s.lat*l,g=Math.sin(u)*Math.sin(h)+Math.cos(u)*Math.cos(h)*Math.cos((s.lng-this.lng)*l);return z*Math.acos(Math.min(g,1))}toBounds(s=0){let l=360*s/40075017,u=l/Math.cos(Math.PI/180*this.lat);return new Q({lng:this.lng-u,lat:this.lat-l},{lng:this.lng+u,lat:this.lat+l})}toEcef(s){return P(this.lat,this.lng,f+s*f/z)}static convert(s){if(s instanceof U)return s;if(Array.isArray(s)&&(s.length===2||s.length===3))return new U(Number(s[0]),Number(s[1]));if(!Array.isArray(s)&&typeof s=="object"&&s!==null)return new U(Number("lng"in s?s.lng:s.lon),Number(s.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class Q{constructor(s,l){s&&(l?this.setSouthWest(s).setNorthEast(l):Array.isArray(s)&&s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1]))}setNorthEast(s){return this._ne=s instanceof U?new U(s.lng,s.lat):U.convert(s),this}setSouthWest(s){return this._sw=s instanceof U?new U(s.lng,s.lat):U.convert(s),this}extend(s){let l=this._sw,u=this._ne,h,g;if(s instanceof U)h=s,g=s;else{if(!(s instanceof Q))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(Q.convert(s)):this.extend(U.convert(s)):typeof s=="object"&&s!==null&&s.hasOwnProperty("lat")&&(s.hasOwnProperty("lon")||s.hasOwnProperty("lng"))?this.extend(U.convert(s)):this;if(h=s._sw,g=s._ne,!h||!g)return this}return l||u?(l.lng=Math.min(h.lng,l.lng),l.lat=Math.min(h.lat,l.lat),u.lng=Math.max(g.lng,u.lng),u.lat=Math.max(g.lat,u.lat)):(this._sw=new U(h.lng,h.lat),this._ne=new U(g.lng,g.lat)),this}getCenter(){return new U((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 U(this.getWest(),this.getNorth())}getSouthEast(){return new U(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(s){let{lng:l,lat:u}=U.convert(s),h=this._sw.lng<=l&&l<=this._ne.lng;return this._sw.lng>this._ne.lng&&(h=this._sw.lng>=l&&l>=this._ne.lng),this._sw.lat<=u&&u<=this._ne.lat&&h}static convert(s){if(s)return s instanceof Q?s:new Q(s)}}let $=0,X=25.5;function oe(c){return V*Math.cos(c*Math.PI/180)}function ae(c){return(180+c)/360}function fe(c){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c*Math.PI/360)))/360}function he(c,s){return c/oe(s)}function me(c){return 360*c-180}function pe(c){return 360/Math.PI*Math.atan(Math.exp((180-360*c)*Math.PI/180))-90}function ue(c,s){return c*oe(pe(s))}let ge=85.051129;function je(c){return Math.cos(Le(ve(c,-ge,ge)))}function Re(c,s){let l=ve(s,$,X),u=Math.pow(2,l);return je(c)*V/(512*u)}function Xe(c){return 1/Math.cos(c*Math.PI/180)}function Be(c,s=0){let l=Math.exp(Math.PI*(1-(c.y+s/Pt)/(1<=C?(At(c,s,l,T,A,g,D,b,C),At(c,T,A,u,h,D,_,b,C)):c.push(_)}function Ue(c,s,l){let u=c[0],h=u.x,g=u.y;s(u);let _=[u];for(let b=1;bc.x+1||uc.y+1)&&vn("Geometry exceeds allowed extent, reduce your vector tile buffer size"),c}function Gt(c,s,l){let u=c.loadGeometry(),h=c.extent,g=Pt/h;if(s&&l&&l.projection.isReprojectedInTileSpace){let _=1<{let L=me((s.x+M.x/h)/_),F=pe((s.y+M.y/h)/_),j=A.project(L,F);M.x=(j.x*b-C)*h,M.y=(j.y*b-T)*h};for(let M=0;M=h||F.y<0||F.y>=h||(D(F),L.push(F));u[M]=L}}for(let _ of u)for(let b of _)Et(b,g);return u}function wt(c,s){return{type:c.type,id:c.id,properties:c.properties,geometry:s?Gt(c):[]}}class _t{constructor(s,l,u,h,g){this.properties={},this.extent=u,this.type=0,this.id=void 0,this._pbf=s,this._geometry=-1,this._keys=h,this._values=g,s.readFields(hi,this,l)}loadGeometry(){let s=this._pbf;s.pos=this._geometry;let l=s.readVarint()+s.pos,u=[],h,g=1,_=0,b=0,C=0;for(;s.pos>3}if(_--,g===1||g===2)b+=s.readSVarint(),C+=s.readSVarint(),g===1&&(h&&u.push(h),h=[]),h&&h.push(new It(b,C));else{if(g!==7)throw new Error(`unknown command ${g}`);h&&h.push(h[0].clone())}}return h&&u.push(h),u}bbox(){let s=this._pbf;s.pos=this._geometry;let l=s.readVarint()+s.pos,u=1,h=0,g=0,_=0,b=1/0,C=-1/0,T=1/0,A=-1/0;for(;s.pos>3}if(h--,u===1||u===2)g+=s.readSVarint(),_+=s.readSVarint(),gC&&(C=g),_A&&(A=_);else if(u!==7)throw new Error(`unknown command ${u}`)}return[b,T,C,A]}toGeoJSON(s,l,u){let h=this.extent*Math.pow(2,u),g=this.extent*s,_=this.extent*l,b=this.loadGeometry();function C(M){return[360*(M.x+g)/h-180,360/Math.PI*Math.atan(Math.exp((1-2*(M.y+_)/h)*Math.PI))-90]}function T(M){return M.map(C)}let A;if(this.type===1){let M=[];for(let F of b)M.push(F[0]);let L=T(M);A=M.length===1?{type:"Point",coordinates:L[0]}:{type:"MultiPoint",coordinates:L}}else if(this.type===2){let M=b.map(T);A=M.length===1?{type:"LineString",coordinates:M[0]}:{type:"MultiLineString",coordinates:M}}else{if(this.type!==3)throw new Error("unknown feature type");{let M=(function(F){let j=F.length;if(j<=1)return[F];let H=[],G,ie;for(let ne=0;ne=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];let l=this._pbf.readVarint()+this._pbf.pos;return new _t(this._pbf,l,this.extent,this._keys,this._values)}}function si(c,s,l){c===15?s.version=l.readVarint():c===1?s.name=l.readString():c===5?s.extent=l.readVarint():c===2?s._features.push(l.pos):c===3?s._keys.push(l.readString()):c===4&&s._values.push((function(u){let h=null,g=u.readVarint()+u.pos;for(;u.pos>3;h=_===1?u.readString():_===2?u.readFloat():_===3?u.readDouble():_===4?u.readVarint64():_===5?u.readVarint():_===6?u.readSVarint():_===7?u.readBoolean():null}if(h==null)throw new Error("unknown feature value");return h})(l))}class Ni{constructor(s,l){this.layers=s.readFields(Qi,{},l)}}function Qi(c,s,l){if(c===3){let u=new di(l,l.readVarint()+l.pos);u.length&&(s[u.name]=u)}}let tn="3d_elevation_id",ir="level";class Gi{constructor(){this._valid=!1}reset(s){return this.feature=s,this._valid=!0,this._geometry=s.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(s,l){return this._valid&&s(l(this._geometry)),this}require(s,l,u){return this.get(s,!0,l,u)}optional(s,l,u){return this.get(s,!1,l,u)}success(){return this._valid}get(s,l,u,h){let g=this.feature.properties.hasOwnProperty(s)?+this.feature.properties[s]:void 0;return this._valid&&g!==void 0&&!Number.isNaN(g)?u(h?h(g):g):l&&(this._valid=!1),this}}class Fn{constructor(s,l){this.featureFunc=s,this.vertexFunc=l}parseFeature(s,l,u){return this.featureFunc(s,l,u)}parseVertex(s,l,u){return this.vertexFunc(s,l,u)}}let Xn=new Fn((c,s,l)=>c.reset(s).require(tn,u=>{l.id=u}).optional("fixed_height_relative",u=>{l.constantHeight=u},Xi.decodeRelativeHeight).geometry(u=>{l.bounds=u},Gv).success(),(c,s,l)=>c.reset(s).require(tn,u=>{l.id=u}).require("elevation_idx",u=>{l.idx=u}).require("extent",u=>{l.extent=u}).require("height_relative",u=>{l.height=u},Xi.decodeRelativeHeight).geometry(u=>{l.position=u},Xi.getPoint).success()),Yr=new Fn((c,s,l)=>c.reset(s).require(tn,u=>{l.id=u}).optional("fixed_height",u=>{l.constantHeight=u},Xi.decodeMetricHeight).geometry(u=>{l.bounds=u},Gv).success(),(c,s,l)=>c.reset(s).require(tn,u=>{l.id=u}).require("elevation_idx",u=>{l.idx=u}).require("extent",u=>{l.extent=u}).require("height",u=>{l.height=u},Xi.decodeMetricHeight).geometry(u=>{l.position=u},Xi.getPoint).success());class Xi{static getPoint(s){return Hc(s[0][0].x,s[0][0].y)}static decodeRelativeHeight(s){return 1e-4*s*5}static decodeMetricHeight(s){return 1e-4*s}static getVersionSchema(s){return s?s==="1.0.1"?Yr:void 0:Xn}static parse(s){let l=[],u=[],h=s.length,g=new Gi;for(let _=0;_=0);if(g===0)return 0;g!==s.length&&(l=!1)}return l?2:1}function ys(c,s){for(let l of c.projections){let u=eo(s,c.points[0],l.axis);if(l.projection[1]u[1])return 0}return 1}function to(c,s){let l=0,u=[0,0,0,0];for(let _=0;_=0&&l++;var h,g;return l}class nn{constructor(s,l){this.points=s||new Array(8).fill([0,0,0]),this.planes=l||new Array(6).fill([0,0,0,0]),this.bounds=ki.fromPoints(this.points),this.projections=[],this.frustumEdges=[Co([],this.points[2],this.points[3]),Co([],this.points[0],this.points[3]),Co([],this.points[4],this.points[0]),Co([],this.points[5],this.points[1]),Co([],this.points[6],this.points[2]),Co([],this.points[7],this.points[3])];for(let u of this.frustumEdges){let h=[0,-u[2],u[1]],g=[u[2],0,-u[0]];this.projections.push({axis:h,projection:eo(this.points,this.points[0],h)}),this.projections.push({axis:g,projection:eo(this.points,this.points[0],g)})}}static fromInvProjectionMatrix(s,l,u,h){let g=Math.pow(2,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(T=>{let A=$a([],T,s),D=1/A[3]/l*g;return(M=A)[0]=(L=A)[0]*(F=[D,D,h?1/A[3]:D,D])[0],M[1]=L[1]*F[1],M[2]=L[2]*F[2],M[3]=L[3]*F[3],M;var M,L,F}),b=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(T=>{let A=Fr([],Mo([],Co([],_[T[0]],_[T[1]]),Co([],_[T[2]],_[T[1]]))),D=-_o(A,_[T[1]]);return A.concat(D)}),C=[];for(let T=0;T<_.length;T++)C.push([_[T][0],_[T][1],_[T][2]]);return new nn(C,b)}intersectsPrecise(s,l,u){for(let h=0;hT[1]||T[0]>C[1])return 0}return 1}containsPoint(s){for(let l of this.planes){let u=l[3];if(_o([l[0],l[1],l[2]],s)+u<0)return!1}return!0}}class ki{static fromPoints(s){let l=[1/0,1/0,1/0],u=[-1/0,-1/0,-1/0];for(let h of s)bl(l,l,h),wa(u,u,h);return new ki(l,u)}static fromTileIdAndHeight(s,l,u){let h=1<s.max[l]||s.min[l]>this.max[l])return!1;return!0}intersectsAabbXY(s){return!(this.min[0]>s.max[0]||s.min[0]>this.max[0]||this.min[1]>s.max[1]||s.min[1]>this.max[1])}encapsulate(s){for(let l=0;l<3;l++)this.min[l]=Math.min(this.min[l],s.min[l]),this.max[l]=Math.max(this.max[l],s.max[l])}encapsulatePoint(s){for(let l=0;l<3;l++)this.min[l]=Math.min(this.min[l],s[l]),this.max[l]=Math.max(this.max[l],s[l])}closestPoint(s){return[Math.max(Math.min(this.max[0],s[0]),this.min[0]),Math.max(Math.min(this.max[1],s[1]),this.min[1]),Math.max(Math.min(this.max[2],s[2]),this.min[2])]}}Qt(ki,"Aabb");class nr{constructor(s,l){this.feature=s,this.metersToTile=l,this.index=0}get(){let s=this.feature.vertices[this.index],l=this.feature.vertexProps[this.index].dir,u=l[1],h=-l[0],g=(s.extent+1)*this.metersToTile;return[new It(Math.trunc(s.position[0]+u*g),Math.trunc(s.position[1]+h*g)),new It(Math.trunc(s.position[0]-u*g),Math.trunc(s.position[1]-h*g))]}next(){this.index++}valid(){return this.index{return b.a0?Rr(C,C,1/T):Lr(C,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(s){if(this.edges.length===0)return;let l=0,u=Number.POSITIVE_INFINITY,h=0,[g,_,b,C,T,A,D]=this._tmpVec2;E_(D,s.x,s.y);let M=new Vn(D,null);for(let L=0;L0?Fs(C,b)/se:0,ye=ve(_e,0,1),Ce=Math.abs((_e-ye)*this.edgeProps[L].len);Md(T,D,H),E_(A,j[1],-j[0]);let De=Ce+Math.abs(Fs(T,A));De=0;--_){let b=this.edges[_].a,C=this.edges[_].b,{position:T,height:A,extent:D}=this.vertices[b],{position:M,height:L,extent:F}=this.vertices[C],j=this.vertexProps[b].dir,H=this.vertexProps[C].dir;if(Lr(l,T[0]/s,T[1]/s,A),Lr(u,M[0]/s,M[1]/s,L),Lr(h,j[1],-j[0],0),Rr(h,h,D),Lr(g,H[1],-H[0],0),Rr(g,g,F),this.distSqLines($o(l[0]+.5*h[0],l[1]+.5*h[1],l[2]+.5*h[2]),$o(u[0]-.5*g[0],u[1]-.5*g[1],u[2]-.5*g[2]),$o(l[0]-.5*h[0],l[1]-.5*h[1],l[2]-.5*h[2]),$o(u[0]+.5*g[0],u[1]+.5*g[1],u[2]+.5*g[2]))<=.0025000000000000005)continue;let G=this.vertices.length,ie=lh(qs(),T,M);this.vertices.push({position:hu(ie,ie,.5),height:.5*(A+L),extent:.5*(D+F)});let ne=lh(qs(),j,H);this.vertexProps.push({dir:po(ne,ne)}),this.edges.splice(_,1),this.edgeProps.splice(_,1),this.edges.push({a:b,b:G}),this.edges.push({a:G,b:C});let se=Md(qs(),this.vertices[G].position,T),_e=kp(se),ye={vec:se,dir:hu(qs(),se,1/_e),len:_e};this.edgeProps.push(ye),this.edgeProps.push(ye)}}distSqLines(s,l,u,h){let g=$s(fn(),l,s),_=$s(fn(),h,u),b=$s(fn(),s,u),C=_o(g,g),T=_o(g,_),A=_o(g,b),D=_o(_,_),M=_o(_,b),L=C*D-T*T;if(L===0)return zc(Ca(g,u,h,_o(b,_)/_o(_,_)),s);let F=(C*M-T*A)/L;return zc(Ca(g,s,l,(T*M-A*D)/L),Ca(_,u,h,F))}}class so{static parseFrom(s,l){let u=Xi.parse(s);if(!u)return[];let{vertices:h,features:g}=u,_=1/Be(l);g.sort((A,D)=>A.id-D.id),h.sort((A,D)=>A.id-D.id||A.idx-D.idx),h=h.filter((A,D,M)=>D===M.findIndex(L=>L.id===A.id&&L.idx===A.idx));let b=new Array,C=0,T=h.length;for(let A of g){if(A.constantHeight){b.push(new vo(A.id,A.bounds,A.constantHeight));continue}for(;C!==T&&h[C].idh.id===u)}}class Uo{constructor(s,l){this.zScale=1,this.xOffset=0,this.yOffset=0,s.equals(l)||(this.zScale=Math.pow(2,l.z-s.z),this.xOffset=(s.x*this.zScale-l.x)*Pt,this.yOffset=(s.y*this.zScale-l.y)*Pt)}constantElevation(s,l){if(s.constantHeight!=null)return this.computeBiasedHeight(s.constantHeight,l)}pointElevation(s,l,u){let h=this.constantElevation(l,u);return h??(s.x=s.x*this.zScale+this.xOffset,s.y=s.y*this.zScale+this.yOffset,this.computeBiasedHeight(l.pointElevation(s),u))}computeBiasedHeight(s,l){return l<=0?s:s+l*Ke(0,l,s>=0?s:Math.abs(.5*s))}}Qt(vo,"ElevationFeature");class Ns{constructor(s){this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(l=>l.fqid),this.index=s.index,this.hasPattern=!1,this.projection=s.projection,this.layoutVertexArray=new Th,this.indexArray=new ps,this.segments=new co,this.programConfigurations=new Jc(s.layers,{zoom:s.zoom,lut:s.lut}),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new Sh),this.worldview=s.worldview}updateFootprints(s,l){}populate(s,l,u,h){let g=this.layers[0],_=[],b=null;g.type==="circle"&&(b=g.layout.get("circle-sort-key"));for(let{feature:T,id:A,index:D,sourceLayerIndex:M}of s){let L=this.layers[0]._featureFilter.needGeometry,F=wt(T,L);if(!this.layers[0]._featureFilter.filter(new Nr(this.zoom,{worldview:this.worldview}),F,u))continue;let j=b?b.evaluate(F,{},u):void 0,H={id:A,properties:T.properties,type:T.type,sourceLayerIndex:M,index:D,geometry:L?F.geometry:Gt(T,u,h),patterns:{},sortKey:j};_.push(H)}b&&_.sort((T,A)=>T.sortKey-A.sortKey);let C=null;h.projection.name==="globe"&&(this.globeExtVertexArray=new Db,C=h.projection);for(let T of _){let{geometry:A,index:D,sourceLayerIndex:M}=T,L=s[D].feature;this.addFeature(T,A,D,l.availableImages,u,C,l.brightness,l.elevationFeatures),l.featureIndex.insert(L,A,D,M,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(s,l,u,h,g,_,b){this.programConfigurations.updatePaintArrays(s,l,g,u,h,_,b,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,VF.members),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=s.createVertexBuffer(this.globeExtVertexArray,jF.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=s.createVertexBuffer(this.elevatedLayoutVertexArray,UF.members))),this.programConfigurations.upload(s),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(s,l,u,h,g,_,b,C){let T;this.elevationMode!=="none"&&(T=so.getElevationFeature(s,C));for(let A of l)for(let D of A){let M=D.x,L=D.y;if(M<0||M>=Pt||L<0||L>=Pt)continue;if(_){let H=_.projectTilePoint(M,L,g),G=_.upVector(g,M,L);this.addGlobeExtVertex(H,G),this.addGlobeExtVertex(H,G),this.addGlobeExtVertex(H,G),this.addGlobeExtVertex(H,G)}let F=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,s.sortKey),j=F.vertexLength;if(this.addCircleVertex(M,L,-1,-1),this.addCircleVertex(M,L,1,-1),this.addCircleVertex(M,L,1,1),this.addCircleVertex(M,L,-1,1),this.elevationMode!=="none"){let H=T?T.pointElevation(new It(M,L)):0;this.hasElevation=this.hasElevation||H!==0;for(let G=0;G<4;G++)this.elevatedLayoutVertexArray.emplaceBack(H)}this.indexArray.emplaceBack(j,j+1,j+2),this.indexArray.emplaceBack(j,j+2,j+3),F.vertexLength+=4,F.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,u,{},h,g,b,void 0,this.worldview)}addCircleVertex(s,l,u,h){this.layoutVertexArray.emplaceBack(2*s+(u+1)/2,2*l+(h+1)/2)}addGlobeExtVertex(s,l){this.globeExtVertexArray.emplaceBack(s.x,s.y,s.z,l[0]*16384,l[1]*16384,l[2]*16384)}}function Xl(c,s){for(let l=0;l1){if(Qa(c,s))return!0;for(let u=0;u1?l:l.sub(s)._mult(h)._add(s))}function ts(c,s){let l,u,h,g=!1;for(let _=0;_s.y!=h.y>s.y&&s.x<(h.x-u.x)*(s.y-u.y)/(h.y-u.y)+u.x&&(g=!g)}return g}function vs(c,s){let l=!1;for(let u=0,h=c.length-1;us.y!=_.y>s.y&&s.x<(_.x-g.x)*(s.y-g.y)/(_.y-g.y)+g.x&&(l=!l)}return l}function Fo(c,s,l,u,h){for(let _ of c)if(s<=_.x&&l<=_.y&&u>=_.x&&h>=_.y)return!0;let g=[new It(s,l),new It(s,h),new It(u,h),new It(u,l)];if(c.length>2){for(let _ of g)if(vs(c,_))return!0}for(let _=0;_h.x&&s.x>h.x||c.yh.y&&s.y>h.y)return!1;let g=Eo(c,s,l[0]);return g!==Eo(c,s,l[1])||g!==Eo(c,s,l[2])||g!==Eo(c,s,l[3])}function zd(c,s,l,u,h,g){let _=s.y-c.y,b=c.x-s.x;if(g=g||0){let C=_*_+b*b;if(C===0)return!0;let T=Math.sqrt(C);_/=T,b/=T}return!((l.x-c.x)*_+(l.y-c.y)*b-g<0||(u.x-c.x)*_+(u.y-c.y)*b-g<0||(h.x-c.x)*_+(h.y-c.y)*b-g<0)}function xu(c,s,l,u,h,g,_){return!(zd(c,s,u,h,g,_)||zd(s,l,u,h,g,_)||zd(l,c,u,h,g,_)||zd(u,h,c,s,l,_)||zd(h,g,c,s,l,_)||zd(g,u,c,s,l,_))}function td(c,s,l){let u=s.paint.get(c).value;return u.kind==="constant"?u.value:l.programConfigurations.get(s.id).getMaxValue(c)}function Dh(c){return Math.sqrt(c[0]*c[0]+c[1]*c[1])}function kh(c,s,l,u,h){if(!s[0]&&!s[1])return c;let g=It.convert(s)._mult(h);l==="viewport"&&g._rotate(-u);let _=[];for(let b=0;b>l&&s.y===this.y>>l}url(s,l){let u=(function(g,_,b){var C=Ud(256*g,256*(_=Math.pow(2,b)-_-1),b),T=Ud(256*(g+1),256*(_+1),b);return C[0]+","+C[1]+","+T[0]+","+T[1]})(this.x,this.y,this.z),h=(function(g,_,b){let C,T="";for(let A=g;A>0;A--)C=1<this.canonical.z?new Xa(s,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Xa(s,this.wrap,s,this.canonical.x>>l,this.canonical.y>>l)}calculateScaledKey(s,l=!0){if(this.overscaledZ===s&&l)return this.key;if(s>this.canonical.z)return zb(this.wrap*+l,s,this.canonical.z,this.canonical.x,this.canonical.y);{let u=this.canonical.z-s;return zb(this.wrap*+l,s,s,this.canonical.x>>u,this.canonical.y>>u)}}isChildOf(s){if(s.wrap!==this.wrap)return!1;let l=this.canonical.z-s.canonical.z;return s.overscaledZ===0||s.overscaledZ>l&&s.canonical.y===this.canonical.y>>l}children(s){if(this.overscaledZ>=s)return[new Xa(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let l=this.canonical.z+1,u=2*this.canonical.x,h=2*this.canonical.y;return[new Xa(l,this.wrap,l,u,h),new Xa(l,this.wrap,l,u+1,h),new Xa(l,this.wrap,l,u,h+1),new Xa(l,this.wrap,l,u+1,h+1)]}isLessThan(s){return this.wraps.wrap)&&(this.overscaledZs.overscaledZ)&&(this.canonical.xs.canonical.x)&&this.canonical.y{let s=c.canonical.x-1,l=c.wrap;return s<0&&(s=(1<{let s=c.canonical.x+1,l=c.wrap;return s===1<new Xa(c.overscaledZ,c.wrap,c.canonical.z,c.canonical.x,(c.canonical.y===0?1<new Xa(c.overscaledZ,c.wrap,c.canonical.z,c.canonical.x,c.canonical.y===(1<1?null:(function(u,h,g,_){let b=Math.sin(g);return u*(Math.sin((1-_)*g)/b)+h*(Math.sin(_*g)/b)})(c.a[s],c.b[s],c.angle,ve(l,0,1))+c.center[s]}function Mh(c){if(c.z<=1)return yoe[c.z+2*c.y+c.x];let s=YF(sk(c));return ki.fromPoints(s)}function rf(c,s,l){return Rr(c,c,1-l),Ss(c,c,s,l)}function oj(c,s,l){for(let u of c)wo(u,u,s),Rr(u,u,l)}function sj(c,s,l,u){let h=s/c.worldSize,g=c.globeMatrix;if(l.z<=1){let Me=Mh(l).getCorners();return oj(Me,g,h),ki.fromPoints(Me)}let _=sk(l,u),b=YF(_,f+ok(c._tileCoverLift));oj(b,g,h);let C=Number.MAX_VALUE,T=[-C,-C,-C],A=[C,C,C];if(_.contains(c.center)){for(let Ne of b)bl(A,A,Ne),wa(T,T,Ne);T[2]=0;let Me=c.point,lt=[Me.x*h,Me.y*h,0];return bl(A,A,lt),wa(T,T,lt),new ki(A,T)}if(c._tileCoverLift>0){for(let Me of b)bl(A,A,Me),wa(T,T,Me);return new ki(A,T)}let D=[g[12]*h,g[13]*h,g[14]*h],M=_.getCenter(),L=ve(c.center.lat,-ge,ge),F=ve(M.lat,-ge,ge),j=ae(c.center.lng),H=fe(L),G=j-ae(M.lng),ie=H-fe(F);G>.5?G-=1:G<-.5&&(G+=1);let ne=0;Math.abs(G)>Math.abs(ie)?ne=G>=0?1:3:(ne=ie>=0?0:2,Ss(D,D,[g[4]*h,g[5]*h,g[6]*h],-Math.sin(Le(ie>=0?_.getSouth():_.getNorth()))*f));let se=b[ne],_e=b[(ne+1)%4],ye=new voe(se,_e,D),Ce=[KF(ye,0)||se[0],KF(ye,1)||se[1],KF(ye,2)||se[2]],De=qm(c.zoom);if(De>0){let Me=(function({x:Ne,y:dt,z:vt},ut,ft,Ct,ot){let gt=1/(1<.5?mi=-1:Kt<-.5&&(mi=1),We=((We+mi)*ut-(Ct*=ut))*ft+Ct,Ge=((Ge+mi)*ut-Ct)*ft+Ct,Tt=(Tt*ut-(ot*=ut))*ft+ot,xt=(xt*ut-ot)*ft+ot,[[We,xt,0],[Ge,xt,0],[Ge,Tt,0],[We,Tt,0]]})(l,s,c._pixelsPerMercatorPixel,j,H);for(let Ne=0;NeMath.PI/2*1.01}let uj=Le(85),boe=Math.cos(uj),xoe=Math.sin(uj),woe=re(),hj=c=>{let s=[];return c.paint.get("circle-pitch-alignment")==="map"&&s.push("PITCH_WITH_MAP"),c.paint.get("circle-pitch-scale")==="map"&&s.push("SCALE_WITH_MAP"),s};function pj(c,s,l,u,h,g,_,b,C){if(g&&c.queryGeometry.isAboveHorizon)return!1;g&&(C*=c.pixelToTileUnitsFactor);let T=c.tileID.canonical,A=l.projection.upVectorScale(T,l.center.lat,l.worldSize).metersToTile;for(let D of s)for(let M of D){let L=M.add(b),F=h&&l.elevation?l.elevation.exaggeration()*h.getElevationAt(L.x,L.y,!0):0,j=l.projection.projectTilePoint(L.x,L.y,T);if(F>0){let ne=l.projection.upVector(T,L.x,L.y);j.x+=ne[0]*A*F,j.y+=ne[1]*A*F,j.z+=ne[2]*A*F}let H=g?L:Coe(j.x,j.y,j.z,u),G=g?c.tilespaceRays.map(ne=>Toe(ne,F)):c.queryGeometry.screenGeometry,ie=$a([],[j.x,j.y,j.z,1],u);if(!_&&g?C*=ie[3]/l.cameraToCenterDistance:_&&!g&&(C*=l.cameraToCenterDistance/ie[3]),g){let ne=pe((M.y/Pt+T.y)/(1<c.width||h.height>c.height||l.x>c.width-h.width||l.y>c.height-h.height)throw new RangeError("out of range source coordinates for image copy");if(h.width>s.width||h.height>s.height||u.x>s.width-h.width||u.y>s.height-h.height)throw new RangeError("out of range destination coordinates for image copy");let C=c.data,T=s.data,A=g===4&&b;for(let D=0;D{s[c.evaluationKey]=C;let T=c.expression.evaluate(s),A=T?T.toNonPremultipliedRenderColor(null):null;A&&(h.data[_+b+0]=Math.floor(255*A.r),h.data[_+b+1]=Math.floor(255*A.g),h.data[_+b+2]=Math.floor(255*A.b),h.data[_+b+3]=Math.floor(255*A.a))};if(c.clips)for(let _=0,b=0;_80*l){b=c[0],C=c[1];let A=b,D=C;for(let M=l;MA&&(A=L),F>D&&(D=F)}T=Math.max(A-b,D-C),T=T!==0?32767/T:0}return fI(g,_,l,b,C,T,0),_}function Cj(c,s,l,u,h){let g;if(h===(function(_,b,C,T){let A=0;for(let D=b,M=C-T;D0)for(let _=s;_=s;_-=u)g=Ej(_/u|0,c[_],c[_+1],g);return g&&Ub(g,g.next)&&(_I(g),g=g.next),g}function my(c,s){if(!c)return c;s||(s=c);let l,u=c;do if(l=!1,u.steiner||!Ub(u,u.next)&&Es(u.prev,u,u.next)!==0)u=u.next;else{if(_I(u),u=s=u.prev,u===u.next)break;l=!0}while(l||u!==s);return s}function fI(c,s,l,u,h,g,_){if(!c)return;!_&&g&&(function(C,T,A,D){let M=C;do M.z===0&&(M.z=eN(M.x,M.y,T,A,D)),M.prevZ=M.prev,M.nextZ=M.next,M=M.next;while(M!==C);M.prevZ.nextZ=null,M.prevZ=null,(function(L){let F,j=1;do{let H,G=L;L=null;let ie=null;for(F=0;G;){F++;let ne=G,se=0;for(let ye=0;ye0||_e>0&≠)se!==0&&(_e===0||!ne||G.z<=ne.z)?(H=G,G=G.nextZ,se--):(H=ne,ne=ne.nextZ,_e--),ie?ie.nextZ=H:L=H,H.prevZ=ie,ie=H;G=ne}ie.nextZ=null,j*=2}while(F>1)})(M)})(c,u,h,g);let b=c;for(;c.prev!==c.next;){let C=c.prev,T=c.next;if(g?Moe(c,u,h,g):koe(c))s.push(C.i,c.i,T.i),_I(c),c=T.next,b=T.next;else if((c=T)===b){_?_===1?fI(c=Roe(my(c),s),s,l,u,h,g,2):_===2&&Ooe(c,s,l,u,h,g):fI(my(c),s,l,u,h,g,1);break}}}function koe(c){let s=c.prev,l=c,u=c.next;if(Es(s,l,u)>=0)return!1;let h=s.x,g=l.x,_=u.x,b=s.y,C=l.y,T=u.y,A=Math.min(h,g,_),D=Math.min(b,C,T),M=Math.max(h,g,_),L=Math.max(b,C,T),F=u.next;for(;F!==s;){if(F.x>=A&&F.x<=M&&F.y>=D&&F.y<=L&&mI(h,b,g,C,_,T,F.x,F.y)&&Es(F.prev,F,F.next)>=0)return!1;F=F.next}return!0}function Moe(c,s,l,u){let h=c.prev,g=c,_=c.next;if(Es(h,g,_)>=0)return!1;let b=h.x,C=g.x,T=_.x,A=h.y,D=g.y,M=_.y,L=Math.min(b,C,T),F=Math.min(A,D,M),j=Math.max(b,C,T),H=Math.max(A,D,M),G=eN(L,F,s,l,u),ie=eN(j,H,s,l,u),ne=c.prevZ,se=c.nextZ;for(;ne&&ne.z>=G&&se&&se.z<=ie;){if(ne.x>=L&&ne.x<=j&&ne.y>=F&&ne.y<=H&&ne!==h&&ne!==_&&mI(b,A,C,D,T,M,ne.x,ne.y)&&Es(ne.prev,ne,ne.next)>=0||(ne=ne.prevZ,se.x>=L&&se.x<=j&&se.y>=F&&se.y<=H&&se!==h&&se!==_&&mI(b,A,C,D,T,M,se.x,se.y)&&Es(se.prev,se,se.next)>=0))return!1;se=se.nextZ}for(;ne&&ne.z>=G;){if(ne.x>=L&&ne.x<=j&&ne.y>=F&&ne.y<=H&&ne!==h&&ne!==_&&mI(b,A,C,D,T,M,ne.x,ne.y)&&Es(ne.prev,ne,ne.next)>=0)return!1;ne=ne.prevZ}for(;se&&se.z<=ie;){if(se.x>=L&&se.x<=j&&se.y>=F&&se.y<=H&&se!==h&&se!==_&&mI(b,A,C,D,T,M,se.x,se.y)&&Es(se.prev,se,se.next)>=0)return!1;se=se.nextZ}return!0}function Roe(c,s){let l=c;do{let u=l.prev,h=l.next.next;!Ub(u,h)&&Tj(u,l,l.next,h)&&gI(u,h)&&gI(h,u)&&(s.push(u.i,l.i,h.i),_I(l),_I(l.next),l=c=h),l=l.next}while(l!==c);return my(l)}function Ooe(c,s,l,u,h,g){let _=c;do{let b=_.next.next;for(;b!==_.prev;){if(_.i!==b.i&&Boe(_,b)){let C=Sj(_,b);return _=my(_,_.next),C=my(C,C.next),fI(_,s,l,u,h,g,0),void fI(C,s,l,u,h,g,0)}b=b.next}_=_.next}while(_!==c)}function Poe(c,s){let l=c.x-s.x;return l===0&&(l=c.y-s.y,l===0)&&(l=(c.next.y-c.y)/(c.next.x-c.x)-(s.next.y-s.y)/(s.next.x-s.x)),l}function Loe(c,s){let l=(function(h,g){let _=g,b=h.x,C=h.y,T,A=-1/0;if(Ub(h,_))return _;do{if(Ub(h,_.next))return _.next;if(C<=_.y&&C>=_.next.y&&_.next.y!==_.y){let j=_.x+(C-_.y)*(_.next.x-_.x)/(_.next.y-_.y);if(j<=b&&j>A&&(A=j,T=_.x<_.next.x?_:_.next,j===b))return T}_=_.next}while(_!==g);if(!T)return null;let D=T,M=T.x,L=T.y,F=1/0;_=T;do{if(b>=_.x&&_.x>=M&&b!==_.x&&Ij(CT.x||_.x===T.x&&Foe(T,_)))&&(T=_,F=j)}_=_.next}while(_!==D);return T})(c,s);if(!l)return s;let u=Sj(l,c);return my(u,u.next),my(l,l.next)}function Foe(c,s){return Es(c.prev,c,s.prev)<0&&Es(s.next,c,c.next)<0}function eN(c,s,l,u,h){return(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-l)*h|0)|c<<8))|c<<4))|c<<2))|c<<1))|(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-u)*h|0)|s<<8))|s<<4))|s<<2))|s<<1))<<1}function Noe(c){let s=c,l=c;do(s.x=(c-_)*(g-b)&&(c-_)*(u-b)>=(l-_)*(s-b)&&(l-_)*(g-b)>=(h-_)*(u-b)}function mI(c,s,l,u,h,g,_,b){return!(c===_&&s===b)&&Ij(c,s,l,u,h,g,_,b)}function Boe(c,s){return c.next.i!==s.i&&c.prev.i!==s.i&&!(function(l,u){let h=l;do{if(h.i!==l.i&&h.next.i!==l.i&&h.i!==u.i&&h.next.i!==u.i&&Tj(h,h.next,l,u))return!0;h=h.next}while(h!==l);return!1})(c,s)&&(gI(c,s)&&gI(s,c)&&(function(l,u){let h=l,g=!1,_=(l.x+u.x)/2,b=(l.y+u.y)/2;do h.y>b!=h.next.y>b&&h.next.y!==h.y&&_<(h.next.x-h.x)*(b-h.y)/(h.next.y-h.y)+h.x&&(g=!g),h=h.next;while(h!==l);return g})(c,s)&&(Es(c.prev,c,s.prev)||Es(c,s.prev,s))||Ub(c,s)&&Es(c.prev,c,c.next)>0&&Es(s.prev,s,s.next)>0)}function Es(c,s,l){return(s.y-c.y)*(l.x-s.x)-(s.x-c.x)*(l.y-s.y)}function Ub(c,s){return c.x===s.x&&c.y===s.y}function Tj(c,s,l,u){let h=dk(Es(c,s,l)),g=dk(Es(c,s,u)),_=dk(Es(l,u,c)),b=dk(Es(l,u,s));return h!==g&&_!==b||!(h!==0||!ck(c,l,s))||!(g!==0||!ck(c,u,s))||!(_!==0||!ck(l,c,u))||!(b!==0||!ck(l,s,u))}function ck(c,s,l){return s.x<=Math.max(c.x,l.x)&&s.x>=Math.min(c.x,l.x)&&s.y<=Math.max(c.y,l.y)&&s.y>=Math.min(c.y,l.y)}function dk(c){return c>0?1:c<0?-1:0}function gI(c,s){return Es(c.prev,c,c.next)<0?Es(c,s,c.next)>=0&&Es(c,c.prev,s)>=0:Es(c,s,c.prev)<0||Es(c,c.next,s)<0}function Sj(c,s){let l=tN(c.i,c.x,c.y),u=tN(s.i,s.x,s.y),h=c.next,g=s.prev;return c.next=s,s.prev=c,l.next=h,h.prev=l,u.next=l,l.prev=u,g.next=u,u.prev=g,u}function Ej(c,s,l,u){let h=tN(c,s,l);return u?(h.next=u.next,h.prev=u,u.next.prev=h,u.next=h):(h.prev=h,h.next=h),h}function _I(c){c.next.prev=c.prev,c.prev.next=c.next,c.prevZ&&(c.prevZ.nextZ=c.nextZ),c.nextZ&&(c.nextZ.prevZ=c.prevZ)}function tN(c,s,l){return{i:c,x:s,y:l,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function yI(c,s){let l=c.length;if(l<=1)return[c];let u=[],h,g;for(let _=0;_1)for(let _=0;_=Pt&&l>=Pt}static evaluate(s){if(s.length===0)return new of;let l=[];for(let C of s)l.push(...C.portals);if(l.length===0)return new of;for(let C of l){let T=C.va,A=C.vb;(of.isOnBorder(T.x,A.x)||of.isOnBorder(T.y,A.y))&&(C.type="border")}let u=l.filter(C=>C.type!=="unevaluated"),h=l.filter(C=>C.type==="unevaluated");if(h.length===0)return new of;h.sort((C,T)=>C.hash===T.hash?C.isTunnel===T.isTunnel?0:C.isTunnel?-1:1:C.hashC.hashg!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Jc(l,{zoom:u,lut:h},g=>g!=="fill-bridge-guard-rail-color")}addVertices(s,l){let u=this.unevalVertices.length;for(let h=0;h=g.min.x&&D.x<=g.max.x&&D.y>=g.min.y&&D.y<=g.max.y||M.x>=g.min.x&&M.x<=g.max.x&&M.y>=g.min.y&&M.y<=g.max.y||la(D,M,b))||this.isOnBorder(D.x,M.x)||this.isOnBorder(D.y,M.y))continue;let L=ec.computeEdgeHash(this.unevalVertices[T],this.unevalVertices[A]),F,j=this.vertexHashLookup.get(ec.computePosHash(D));j!=null?F=j.next:(j=this.vertexHashLookup.get(ec.computePosHash(M)),F=j!=null?j.prev:L),this.unevalEdges.push({polygonIdx:s,a:T,b:A,hash:L,portalHash:F,isTunnel:h,type:"unevaluated",featureInfo:_})}}addPortalCandidates(s,l,u,h,g){if(l.length===0)return;this.portalPolygons.add(s,{geometry:l,zLevel:g});let _=l[0];this.vertexHashLookup.clear();let b=ec.computeEdgeHash(_[_.length-2],_[_.length-1]);for(let C=0;C<_.length-1;C++){let T=_[C+0],A=_[C+1],D=Hc(A.x-T.x,A.y-T.y),M=kp(D);if(M===0)continue;let L="unevaluated",F=h.pointElevation(T),j=h.pointElevation(A);Math.abs(F)<.01&&Math.abs(j)<.01?L="entrance":(this.isOnBorder(T.x,A.x)||this.isOnBorder(T.y,A.y))&&(L="border");let H=ec.computeEdgeHash(T,A);this.unevaluatedPortals.portals.push({connection:{a:s,b:void 0},va:T,vb:A,vab:D,length:M,hash:H,isTunnel:u,type:L});let G=ec.computePosHash(T);this.vertexHashLookup.set(G,{prev:b,next:H}),b=H}}construct(s){if(this.unevalVertices.length===0)return;let l=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),u=M=>{M.primitiveLength=this.indexArray.length-M.primitiveOffset},h=new Voe(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(s.portals,this.unevalEdges);let g=l(),_=l(),b=l(),C=(M,L)=>{M.sort((j,H)=>j.type===L&&H.type!==L?-1:j.type!==L&&H.type===L?1:0);let F=M.findIndex(j=>j.type!==L);return F>=0?F:M.length},T=0;this.unevalEdges.length>0&&(T=C(this.unevalEdges,"none"),this.constructBridgeStructures(h,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:T},this.tileToMeters)),u(b);let A=l(),D=l();if(this.unevalEdges.length>0){let M=this.unevalEdges.splice(T),L=C(M,"tunnel")+T;this.unevalEdges.push(...M),this.constructTunnelStructures(h,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:T},{min:T,max:L})}u(A),h.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),u(D),h.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),u(_),h.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),u(g),this.maskSegments=co.simpleSegment(0,D.primitiveOffset,0,D.primitiveLength),this.depthSegments=co.simpleSegment(0,_.primitiveOffset,0,_.primitiveLength),this.renderableBridgeSegments=co.simpleSegment(0,b.primitiveOffset,0,b.primitiveLength),this.renderableTunnelSegments=co.simpleSegment(0,A.primitiveOffset,0,A.primitiveLength),this.shadowCasterSegments=co.simpleSegment(0,g.primitiveOffset,0,g.primitiveLength)}update(s,l,u,h,g,_,b,C){this.bridgeProgramConfigurations.updatePaintArrays(s,l,g,u,h,_,b,C),this.tunnelProgramConfigurations.updatePaintArrays(s,l,g,u,h,_,b,C)}upload(s){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=s.createVertexBuffer(this.vertexPositions,Aoe.members),this.vertexBufferNormal=s.createVertexBuffer(this.vertexNormals,Doe.members),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(s),this.tunnelProgramConfigurations.upload(s))}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(s,l,u,h,g){let _=(b,C)=>{for(let T=0;TLr(ft,l[Ct].x,l[Ct].y,u[Ct]*C),D=fn(),M=fn(),L=fn(),F=fn(),j=fn(),H=(ft,Ct)=>{let ot=b.get(ec.computePosHash(l[Ct])),gt=ot.from,We=ot.to;if(!gt||!We)return;A(D,gt),A(M,Ct),A(L,We),Ep(F),xl(D,M)||(Co(j,M,D),Fr(F,j)),xl(L,M)||(Co(j,L,M),Mr(F,F,Fr(j,j)));let Ge=Dd(F);return Ge>0?Rr(ft,F,1/Ge):void 0},G=Number.POSITIVE_INFINITY;this.sortSubarray(h,g.min,g.max,(ft,Ct)=>ft.featureInfo.featureIndex-Ct.featureInfo.featureIndex);let ie=fn(),ne=fn(),se=fn(),_e=fn(),ye=fn(),Ce=fn(),De=fn(),Me=fn(),lt=fn(),Ne=[fn(),fn(),fn(),fn()],dt=[fn(),fn(),fn(),fn()],vt=[{coord:new It(0,0),height:0},{coord:new It(0,0),height:0}],ut=(ft,Ct)=>ft>Ct;for(let ft=g.min;ftG.featureInfo.featureIndex-ie.featureInfo.featureIndex;this.sortSubarray(h,g.min,g.max,C),this.sortSubarray(h,_.min,_.max,C);let T=G=>Fr(G,G),A=[{coord:new It(0,0),height:0},{coord:new It(0,0),height:0}],D=(G,ie)=>Gb.hash===C.hash?C.polygonIdx-b.polygonIdx:C.hash>b.hash?1:-1);let u=0,h=0,g=0,_=l[u].polygonIdx;do h++,(h===l.length||l[u].hash!==l[h].hash)&&((h-u==1||l[h-1].polygonIdx!==_)&&(gT.portalHashA.hash?b++:A.hash>T.portalHash?C++:(T.type=A.type,b++)}}}isOnBorder(s,l){return s<=0&&l<=0||s>=Pt&&l>=Pt}addFeatureSection(s,l,u,h){return s!==l&&(l=s,u.push({featureIndex:s,vertexStart:h.getVertexCount()}),h.clearVertexLookup()),l}sortSubarray(s,l,u,h){let g=s.slice(l,u);g.sort(h),s.splice(l,g.length,...g)}static computeEdgeHash(s,l){return(s.y===l.y&&s.x>l.x||s.y>l.y)&&([s,l]=[l,s]),BigInt(ec.computePosHash(s))<<32n|BigInt(ec.computePosHash(l))}static computePosHash(s){return((65535&s.x)<<16|65535&s.y)>>>0}}var kj,Mj={exports:{}},Rj=(kj||(kj=1,(function(c,s){(function(l){function u(le,ce){return le>ce?1:le0){var Xt=at+Math.floor(zt/2),vi={key:ce[Xt],data:qe[Xt],parent:le};return vi.left=_(vi,ce,qe,at,Xt),vi.right=_(vi,ce,qe,Xt+1,Vt),vi}return null}function b(le,ce,qe,at,Vt){if(!(qe>=at)){for(var zt=le[qe+at>>1],Xt=qe-1,vi=at+1;;){do Xt++;while(Vt(le[Xt],zt)<0);do vi--;while(Vt(le[vi],zt)>0);if(Xt>=vi)break;var cn=le[Xt];le[Xt]=le[vi],le[vi]=cn,cn=ce[Xt],ce[Xt]=ce[vi],ce[vi]=cn}b(le,ce,qe,vi,Vt),b(le,ce,vi+1,at,Vt)}}h.prototype.rotateLeft=function(le){var ce=le.right;ce&&(le.right=ce.left,ce.left&&(ce.left.parent=le),ce.parent=le.parent),le.parent?le===le.parent.left?le.parent.left=ce:le.parent.right=ce:this._root=ce,ce&&(ce.left=le),le.parent=ce},h.prototype.rotateRight=function(le){var ce=le.left;ce&&(le.left=ce.right,ce.right&&(ce.right.parent=le),ce.parent=le.parent),le.parent?le===le.parent.left?le.parent.left=ce:le.parent.right=ce:this._root=ce,ce&&(ce.right=le),le.parent=ce},h.prototype._splay=function(le){for(;le.parent;){var ce=le.parent;ce.parent?ce.left===le&&ce.parent.left===ce?(this.rotateRight(ce.parent),this.rotateRight(ce)):ce.right===le&&ce.parent.right===ce?(this.rotateLeft(ce.parent),this.rotateLeft(ce)):ce.left===le&&ce.parent.right===ce?(this.rotateRight(ce),this.rotateLeft(ce)):(this.rotateLeft(ce),this.rotateRight(ce)):ce.left===le?this.rotateRight(ce):this.rotateLeft(ce)}},h.prototype.splay=function(le){for(var ce,qe,at,Vt,zt;le.parent;)(qe=(ce=le.parent).parent)&&qe.parent?((at=qe.parent).left===qe?at.left=le:at.right=le,le.parent=at):(le.parent=null,this._root=le),Vt=le.left,zt=le.right,le===ce.left?(qe&&(qe.left===ce?(ce.right?(qe.left=ce.right,qe.left.parent=qe):qe.left=null,ce.right=qe,qe.parent=ce):(Vt?(qe.right=Vt,Vt.parent=qe):qe.right=null,le.left=qe,qe.parent=le)),zt?(ce.left=zt,zt.parent=ce):ce.left=null,le.right=ce,ce.parent=le):(qe&&(qe.right===ce?(ce.left?(qe.right=ce.left,qe.right.parent=qe):qe.right=null,ce.left=qe,qe.parent=ce):(zt?(qe.left=zt,zt.parent=qe):qe.left=null,le.right=qe,qe.parent=le)),Vt?(ce.right=Vt,Vt.parent=ce):ce.right=null,le.left=ce,ce.parent=le)},h.prototype.replace=function(le,ce){le.parent?le===le.parent.left?le.parent.left=ce:le.parent.right=ce:this._root=ce,ce&&(ce.parent=le.parent)},h.prototype.minNode=function(le){if(le===void 0&&(le=this._root),le)for(;le.left;)le=le.left;return le},h.prototype.maxNode=function(le){if(le===void 0&&(le=this._root),le)for(;le.right;)le=le.right;return le},h.prototype.insert=function(le,ce){var qe=this._root,at=null,Vt=this._compare;if(this._noDuplicates)for(;qe;){if(at=qe,Vt(qe.key,le)===0)return;qe=Vt(qe.key,le)<0?qe.right:qe.left}else for(;qe;)at=qe,qe=Vt(qe.key,le)<0?qe.right:qe.left;return qe={key:le,data:ce,left:null,right:null,parent:at},at?Vt(at.key,qe.key)<0?at.right=qe:at.left=qe:this._root=qe,this.splay(qe),this._size++,qe},h.prototype.find=function(le){for(var ce=this._root,qe=this._compare;ce;){var at=qe(ce.key,le);if(at<0)ce=ce.right;else{if(!(at>0))return ce;ce=ce.left}}return null},h.prototype.contains=function(le){for(var ce=this._root,qe=this._compare;ce;){var at=qe(le,ce.key);if(at===0)return!0;ce=at<0?ce.left:ce.right}return!1},h.prototype.remove=function(le){var ce=this.find(le);if(!ce)return!1;if(this.splay(ce),ce.left)if(ce.right){var qe=this.minNode(ce.right);qe.parent!==ce&&(this.replace(qe,qe.right),qe.right=ce.right,qe.right.parent=qe),this.replace(ce,qe),qe.left=ce.left,qe.left.parent=qe}else this.replace(ce,ce.left);else this.replace(ce,ce.right);return this._size--,!0},h.prototype.removeNode=function(le){if(!le)return!1;if(this.splay(le),le.left)if(le.right){var ce=this.minNode(le.right);ce.parent!==le&&(this.replace(ce,ce.right),ce.right=le.right,ce.right.parent=ce),this.replace(le,ce),ce.left=le.left,ce.left.parent=ce}else this.replace(le,le.left);else this.replace(le,le.right);return this._size--,!0},h.prototype.erase=function(le){var ce=this.find(le);if(ce){this.splay(ce);var qe=ce.left,at=ce.right,Vt=null;qe&&(qe.parent=null,Vt=this.maxNode(qe),this.splay(Vt),this._root=Vt),at&&(qe?Vt.right=at:this._root=at,at.parent=Vt),this._size--}},h.prototype.pop=function(){var le=this._root,ce=null;if(le){for(;le.left;)le=le.left;ce={key:le.key,data:le.data},this.remove(le.key)}return ce},h.prototype.next=function(le){var ce=le;if(ce)if(ce.right)for(ce=ce.right;ce&&ce.left;)ce=ce.left;else for(ce=le.parent;ce&&ce.right===le;)le=ce,ce=ce.parent;return ce},h.prototype.prev=function(le){var ce=le;if(ce)if(ce.left)for(ce=ce.left;ce&&ce.right;)ce=ce.right;else for(ce=le.parent;ce&&ce.left===le;)le=ce,ce=ce.parent;return ce},h.prototype.forEach=function(le){for(var ce=this._root,qe=[],at=!1,Vt=0;!at;)ce?(qe.push(ce),ce=ce.left):qe.length>0?(le(ce=qe.pop(),Vt++),ce=ce.right):at=!0;return this},h.prototype.range=function(le,ce,qe,at){for(var Vt=[],zt=this._compare,Xt=this._root;Vt.length!==0||Xt;)if(Xt)Vt.push(Xt),Xt=Xt.left;else{if(zt((Xt=Vt.pop()).key,ce)>0)break;if(zt(Xt.key,le)>=0&&qe.call(at,Xt))return this;Xt=Xt.right}return this},h.prototype.keys=function(){for(var le=this._root,ce=[],qe=[],at=!1;!at;)le?(ce.push(le),le=le.left):ce.length>0?(le=ce.pop(),qe.push(le.key),le=le.right):at=!0;return qe},h.prototype.values=function(){for(var le=this._root,ce=[],qe=[],at=!1;!at;)le?(ce.push(le),le=le.left):ce.length>0?(le=ce.pop(),qe.push(le.data),le=le.right):at=!0;return qe},h.prototype.at=function(le){for(var ce=this._root,qe=[],at=!1,Vt=0;!at;)if(ce)qe.push(ce),ce=ce.left;else if(qe.length>0){if(ce=qe.pop(),Vt===le)return ce;Vt++,ce=ce.right}else at=!0;return null},h.prototype.load=function(le,ce,qe){if(le===void 0&&(le=[]),ce===void 0&&(ce=[]),qe===void 0&&(qe=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var at=le.length;return qe&&b(le,ce,0,at-1,this._compare),this._root=_(null,le,ce,0,at),this._size=at,this},h.prototype.min=function(){var le=this.minNode(this._root);return le?le.key:null},h.prototype.max=function(){var le=this.maxNode(this._root);return le?le.key:null},h.prototype.isEmpty=function(){return this._root===null},g.size.get=function(){return this._size},h.createTree=function(le,ce,qe,at,Vt){return new h(qe,Vt).load(le,ce,at)},Object.defineProperties(h.prototype,g);var C=0,T=1,A=2,D=3,M=0,L=1,F=2,j=3;function H(le,ce,qe){ce===null?(le.inOut=!1,le.otherInOut=!0):(le.isSubject===ce.isSubject?(le.inOut=!ce.inOut,le.otherInOut=ce.otherInOut):(le.inOut=!ce.otherInOut,le.otherInOut=ce.isVertical()?!ce.inOut:ce.inOut),ce&&(le.prevInResult=!G(ce,qe)||ce.isVertical()?ce.prevInResult:ce));var at=G(le,qe);le.resultTransition=at?(function(Vt,zt){var Xt,vi=!Vt.inOut,cn=!Vt.otherInOut;switch(zt){case M:Xt=vi&&cn;break;case L:Xt=vi||cn;break;case j:Xt=vi^cn;break;case F:Xt=Vt.isSubject?vi&&!cn:cn&&!vi}return Xt?1:-1})(le,qe):0}function G(le,ce){switch(le.type){case C:switch(ce){case M:return!le.otherInOut;case L:return le.otherInOut;case F:return le.isSubject&&le.otherInOut||!le.isSubject&&!le.otherInOut;case j:return!0}break;case A:return ce===M||ce===L;case D:return ce===F;case T:return!1}return!1}var ie=function(le,ce,qe,at,Vt){this.left=ce,this.point=le,this.otherEvent=qe,this.isSubject=at,this.type=Vt||C,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},ne={inResult:{configurable:!0}};function se(le,ce){return le[0]===ce[0]&&le[1]===ce[1]}ie.prototype.isBelow=function(le){var ce=this.point,qe=this.otherEvent.point;return this.left?(ce[0]-le[0])*(qe[1]-le[1])-(qe[0]-le[0])*(ce[1]-le[1])>0:(qe[0]-le[0])*(ce[1]-le[1])-(ce[0]-le[0])*(qe[1]-le[1])>0},ie.prototype.isAbove=function(le){return!this.isBelow(le)},ie.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},ne.inResult.get=function(){return this.resultTransition!==0},ie.prototype.clone=function(){var le=new ie(this.point,this.left,this.otherEvent,this.isSubject,this.type);return le.contourId=this.contourId,le.resultTransition=this.resultTransition,le.prevInResult=this.prevInResult,le.isExteriorRing=this.isExteriorRing,le.inOut=this.inOut,le.otherInOut=this.otherInOut,le},Object.defineProperties(ie.prototype,ne);var _e=11102230246251565e-32,ye=134217729,Ce=(3+8*_e)*_e;function De(le,ce,qe,at,Vt){var zt,Xt,vi,cn,dn=ce[0],on=at[0],rr=0,io=0;on>dn==on>-dn?(zt=dn,dn=ce[++rr]):(zt=on,on=at[++io]);var rn=0;if(rrdn==on>-dn?(vi=zt-((Xt=dn+zt)-dn),dn=ce[++rr]):(vi=zt-((Xt=on+zt)-on),on=at[++io]),zt=Xt,vi!==0&&(Vt[rn++]=vi);rrdn==on>-dn?(vi=zt-((Xt=zt+dn)-(cn=Xt-zt))+(dn-cn),dn=ce[++rr]):(vi=zt-((Xt=zt+on)-(cn=Xt-zt))+(on-cn),on=at[++io]),zt=Xt,vi!==0&&(Vt[rn++]=vi);for(;rr0!=rr>0)return io;var rn=Math.abs(on+rr);return Math.abs(io)>=lt*rn?io:-(function(Br,pr,Bn,jr,Hr,Pr,zr){var fr,un,_r,uo,Mi,Pn,Gr,bo,Zr,is,wr,qo,Sl,da,Ys,El,Ph,ns,bs=Br-Hr,ua=Bn-Hr,Ja=pr-Pr,Da=jr-Pr;vt[0]=(Ys=(bo=bs-(Gr=(Pn=ye*bs)-(Pn-bs)))*(is=Da-(Zr=(Pn=ye*Da)-(Pn-Da)))-((da=bs*Da)-Gr*Zr-bo*Zr-Gr*is))-((wr=Ys-(Ph=(bo=Ja-(Gr=(Pn=ye*Ja)-(Pn-Ja)))*(is=ua-(Zr=(Pn=ye*ua)-(Pn-ua)))-((El=Ja*ua)-Gr*Zr-bo*Zr-Gr*is)))+(Mi=Ys-wr))+(Mi-Ph),vt[1]=(Sl=da-((qo=da+wr)-(Mi=qo-da))+(wr-Mi))-((wr=Sl-El)+(Mi=Sl-wr))+(Mi-El),vt[2]=qo-((ns=qo+wr)-(Mi=ns-qo))+(wr-Mi),vt[3]=ns;var eg=(function(_Fe,q7){for(var W7=q7[0],c3=1;c3<4;c3++)W7+=q7[c3];return W7})(0,vt),YI=Ne*zr;if(eg>=YI||-eg>=YI||(fr=Br-(bs+(Mi=Br-bs))+(Mi-Hr),_r=Bn-(ua+(Mi=Bn-ua))+(Mi-Hr),un=pr-(Ja+(Mi=pr-Ja))+(Mi-Pr),uo=jr-(Da+(Mi=jr-Da))+(Mi-Pr),fr===0&&un===0&&_r===0&&uo===0)||(YI=dt*zr+Ce*Math.abs(eg),(eg+=bs*uo+Da*fr-(Ja*_r+ua*un))>=YI||-eg>=YI))return eg;ot[0]=(Ys=(bo=fr-(Gr=(Pn=ye*fr)-(Pn-fr)))*(is=Da-(Zr=(Pn=ye*Da)-(Pn-Da)))-((da=fr*Da)-Gr*Zr-bo*Zr-Gr*is))-((wr=Ys-(Ph=(bo=un-(Gr=(Pn=ye*un)-(Pn-un)))*(is=ua-(Zr=(Pn=ye*ua)-(Pn-ua)))-((El=un*ua)-Gr*Zr-bo*Zr-Gr*is)))+(Mi=Ys-wr))+(Mi-Ph),ot[1]=(Sl=da-((qo=da+wr)-(Mi=qo-da))+(wr-Mi))-((wr=Sl-El)+(Mi=Sl-wr))+(Mi-El),ot[2]=qo-((ns=qo+wr)-(Mi=ns-qo))+(wr-Mi),ot[3]=ns;var Gle=De(4,vt,4,ot,ut);ot[0]=(Ys=(bo=bs-(Gr=(Pn=ye*bs)-(Pn-bs)))*(is=uo-(Zr=(Pn=ye*uo)-(Pn-uo)))-((da=bs*uo)-Gr*Zr-bo*Zr-Gr*is))-((wr=Ys-(Ph=(bo=Ja-(Gr=(Pn=ye*Ja)-(Pn-Ja)))*(is=_r-(Zr=(Pn=ye*_r)-(Pn-_r)))-((El=Ja*_r)-Gr*Zr-bo*Zr-Gr*is)))+(Mi=Ys-wr))+(Mi-Ph),ot[1]=(Sl=da-((qo=da+wr)-(Mi=qo-da))+(wr-Mi))-((wr=Sl-El)+(Mi=Sl-wr))+(Mi-El),ot[2]=qo-((ns=qo+wr)-(Mi=ns-qo))+(wr-Mi),ot[3]=ns;var $le=De(Gle,ut,4,ot,ft);ot[0]=(Ys=(bo=fr-(Gr=(Pn=ye*fr)-(Pn-fr)))*(is=uo-(Zr=(Pn=ye*uo)-(Pn-uo)))-((da=fr*uo)-Gr*Zr-bo*Zr-Gr*is))-((wr=Ys-(Ph=(bo=un-(Gr=(Pn=ye*un)-(Pn-un)))*(is=_r-(Zr=(Pn=ye*_r)-(Pn-_r)))-((El=un*_r)-Gr*Zr-bo*Zr-Gr*is)))+(Mi=Ys-wr))+(Mi-Ph),ot[1]=(Sl=da-((qo=da+wr)-(Mi=qo-da))+(wr-Mi))-((wr=Sl-El)+(Mi=Sl-wr))+(Mi-El),ot[2]=qo-((ns=qo+wr)-(Mi=ns-qo))+(wr-Mi),ot[3]=ns;var qle=De($le,ft,4,ot,Ct);return Ct[qle-1]})(Vt,zt,Xt,vi,cn,dn,rn)})(le[0],le[1],ce[0],ce[1],qe[0],qe[1]);return at>0?-1:at<0?1:0}function We(le,ce){var qe=le.point,at=ce.point;return qe[0]>at[0]?1:qe[0]at[1]?1:-1:(function(Vt,zt,Xt,vi){return Vt.left!==zt.left?Vt.left?1:-1:gt(Xt,Vt.otherEvent.point,zt.otherEvent.point)!==0?Vt.isBelow(zt.otherEvent.point)?-1:1:!Vt.isSubject&&zt.isSubject?1:-1})(le,ce,qe)}function Ge(le,ce,qe){var at=new ie(ce,!1,le,le.isSubject),Vt=new ie(ce,!0,le.otherEvent,le.isSubject);return se(le.point,le.otherEvent.point)&&console.warn("what is that, a collapsed segment?",le),at.contourId=Vt.contourId=le.contourId,We(Vt,le.otherEvent)>0&&(le.otherEvent.left=!0,Vt.left=!1),le.otherEvent.otherEvent=Vt,le.otherEvent=at,qe.push(Vt),qe.push(at),qe}function Tt(le,ce){return le[0]*ce[1]-le[1]*ce[0]}function xt(le,ce){return le[0]*ce[0]+le[1]*ce[1]}function mi(le,ce,qe){var at=(function(cn,dn,on,rr,io){var rn=[dn[0]-cn[0],dn[1]-cn[1]],Br=[rr[0]-on[0],rr[1]-on[1]];function pr(Pn,Gr,bo){return[Pn[0]+Gr*bo[0],Pn[1]+Gr*bo[1]]}var Bn=[on[0]-cn[0],on[1]-cn[1]],jr=Tt(rn,Br),Hr=jr*jr,Pr=xt(rn,rn);if(Hr>0){var zr=Tt(Bn,Br)/jr;if(zr<0||zr>1)return null;var fr=Tt(Bn,rn)/jr;return fr<0||fr>1?null:zr===0||zr===1?[pr(cn,zr,rn)]:fr===0||fr===1?[pr(on,fr,Br)]:[pr(cn,zr,rn)]}if((Hr=(jr=Tt(Bn,rn))*jr)>0)return null;var un=xt(rn,Bn)/Pr,_r=un+xt(rn,Br)/Pr,uo=Math.min(un,_r),Mi=Math.max(un,_r);return uo<=1&&Mi>=0?uo===1?[pr(cn,uo>0?uo:0,rn)]:Mi===0?[pr(cn,Mi<1?Mi:1,rn)]:[pr(cn,uo>0?uo:0,rn),pr(cn,Mi<1?Mi:1,rn)]:null})(le.point,le.otherEvent.point,ce.point,ce.otherEvent.point),Vt=at?at.length:0;if(Vt===0||Vt===1&&(se(le.point,ce.point)||se(le.otherEvent.point,ce.otherEvent.point))||Vt===2&&le.isSubject===ce.isSubject)return 0;if(Vt===1)return se(le.point,at[0])||se(le.otherEvent.point,at[0])||Ge(le,at[0],qe),se(ce.point,at[0])||se(ce.otherEvent.point,at[0])||Ge(ce,at[0],qe),1;var zt=[],Xt=!1,vi=!1;return se(le.point,ce.point)?Xt=!0:We(le,ce)===1?zt.push(ce,le):zt.push(le,ce),se(le.otherEvent.point,ce.otherEvent.point)?vi=!0:We(le.otherEvent,ce.otherEvent)===1?zt.push(ce.otherEvent,le.otherEvent):zt.push(le.otherEvent,ce.otherEvent),Xt&&vi||Xt?(ce.type=T,le.type=ce.inOut===le.inOut?A:D,Xt&&!vi&&Ge(zt[1].otherEvent,zt[0].point,qe),2):vi?(Ge(zt[0],zt[1].point,qe),3):zt[0]!==zt[3].otherEvent?(Ge(zt[0],zt[1].point,qe),Ge(zt[1],zt[2].point,qe),3):(Ge(zt[0],zt[1].point,qe),Ge(zt[3].otherEvent,zt[2].point,qe),3)}function Kt(le,ce){if(le===ce)return 0;if(gt(le.point,le.otherEvent.point,ce.point)!==0||gt(le.point,le.otherEvent.point,ce.otherEvent.point)!==0)return se(le.point,ce.point)?le.isBelow(ce.otherEvent.point)?-1:1:le.point[0]===ce.point[0]?le.point[1]ce.contourId?1:-1:We(le,ce)===1?1:-1}var ni=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function Ot(le,ce,qe,at){var Vt,zt=le+1,Xt=ce[le].point,vi=ce.length;for(ztat;)zt--;return zt}ni.prototype.isExterior=function(){return this.holeOf==null};var pi=Ut,Bi=Ut;function Ut(le,ce){if(!(this instanceof Ut))return new Ut(le,ce);if(this.data=le||[],this.length=this.data.length,this.compare=ce||li,this.length>0)for(var qe=(this.length>>1)-1;qe>=0;qe--)this._down(qe)}function li(le,ce){return lece?1:0}Ut.prototype={push:function(le){this.data.push(le),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var le=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),le}},peek:function(){return this.data[0]},_up:function(le){for(var ce=this.data,qe=this.compare,at=ce[le];le>0;){var Vt=le-1>>1,zt=ce[Vt];if(qe(at,zt)>=0)break;ce[le]=zt,le=Vt}ce[le]=at},_down:function(le){for(var ce=this.data,qe=this.compare,at=this.length>>1,Vt=ce[le];le=0)break;ce[le]=vi,le=zt}ce[le]=Vt}},pi.default=Bi;var Ai=Math.max,$i=Math.min,ln=0;function Wi(le,ce,qe,at,Vt,zt){var Xt,vi,cn,dn,on,rr;for(Xt=0,vi=le.length-1;Xt0?rr.left=!0:on.left=!0;var io=cn[0],rn=cn[1];Vt[0]=$i(Vt[0],io),Vt[1]=$i(Vt[1],rn),Vt[2]=Ai(Vt[2],io),Vt[3]=Ai(Vt[3],rn),at.push(on),at.push(rr)}}var ii=[];function qi(le,ce,qe){typeof le[0][0][0]=="number"&&(le=[le]),typeof ce[0][0][0]=="number"&&(ce=[ce]);var at=(function(rn,Br,pr){var Bn=null;return rn.length*Br.length==0&&(pr===M?Bn=ii:pr===F?Bn=rn:pr!==L&&pr!==j||(Bn=rn.length===0?Br:rn)),Bn})(le,ce,qe);if(at)return at===ii?null:at;var Vt=[1/0,1/0,-1/0,-1/0],zt=[1/0,1/0,-1/0,-1/0],Xt=(function(rn,Br,pr,Bn,jr){var Hr,Pr,zr,fr,un,_r,uo=new pi(null,We);for(zr=0,fr=rn.length;zrBn[2]||Bn[0]>pr[2]||pr[1]>Bn[3]||Bn[1]>pr[3])&&(jr===M?Hr=ii:jr===F?Hr=rn:jr!==L&&jr!==j||(Hr=rn.concat(Br))),Hr})(le,ce,Vt,zt,qe))return at===ii?null:at;for(var vi=(function(rn){var Br,pr,Bn=(function(zr){var fr,un,_r,uo,Mi=[];for(un=0,_r=zr.length;un<_r;un++)((fr=zr[un]).left&&fr.inResult||!fr.left&&fr.otherEvent.inResult)&&Mi.push(fr);for(var Pn=!1;!Pn;)for(Pn=!0,un=0,_r=Mi.length;un<_r;un++)un+1<_r&&We(Mi[un],Mi[un+1])===1&&(uo=Mi[un],Mi[un]=Mi[un+1],Mi[un+1]=uo,Pn=!1);for(un=0,_r=Mi.length;un<_r;un++)(fr=Mi[un]).otherPos=un;for(un=0,_r=Mi.length;un<_r;un++)(fr=Mi[un]).left||(uo=fr.otherPos,fr.otherPos=fr.otherEvent.otherPos,fr.otherEvent.otherPos=uo);return Mi})(rn),jr={},Hr=[],Pr=function(){if(!jr[Br]){var zr=Hr.length,fr=(function(Mi,Pn,Gr){var bo=new ni;if(Mi.prevInResult!=null){var Zr=Mi.prevInResult,is=Zr.outputContourId;if(Zr.resultTransition>0){var wr=Pn[is];if(wr.holeOf!=null){var qo=wr.holeOf;Pn[qo].holeIds.push(Gr),bo.holeOf=qo,bo.depth=Pn[is].depth}else Pn[is].holeIds.push(Gr),bo.holeOf=is,bo.depth=Pn[is].depth+1}else bo.holeOf=null,bo.depth=Pn[is].depth}else bo.holeOf=null,bo.depth=0;return bo})(Bn[Br],Hr,zr),un=function(Mi){jr[Mi]=!0,Mi=Bn.length)&&Bn[_r];);Hr.push(fr)}};for(Br=0,pr=Bn.length;Bruo||Hr===F&&Mi.point[0]>Bn[2])break;if(Mi.left){zr=Pr=un.insert(Mi),Pr=Pr!==(fr=un.minNode())?un.prev(Pr):null,zr=un.next(zr);var Pn=Pr?Pr.key:null;if(H(Mi,Pn,Hr),zr&&mi(Mi,zr.key,rn)===2&&(H(Mi,Pn,Hr),H(zr.key,Mi,Hr)),Pr&&mi(Pr.key,Mi,rn)===2){var Gr=Pr;H(Pn,(Gr=Gr!==fr?un.prev(Gr):null)?Gr.key:null,Hr),H(Mi,Pn,Hr)}}else zr=Pr=un.find(Mi=Mi.otherEvent),Pr&&zr&&(Pr=Pr!==fr?un.prev(Pr):null,zr=un.next(zr),un.remove(Mi),zr&&Pr&&mi(Pr.key,zr.key,rn))}return _r})(Xt,0,0,Vt,zt,qe)),cn=[],dn=0;dn{_.push(new It(D,C+(D-b)/(T-b)*(A-C)))}:(_,b,C,T,A,D)=>{_.push(new It(b+(D-C)/(A-C)*(T-b),D))};for(let _ of c){let b=[];for(let C of _){if(C.length<=2)continue;let T=[];for(let M=0;Ms&&g(T,L,F,j,H,s):G>l?ie=s&&g(T,L,F,j,H,s),ie>l&&G<=l&&g(T,L,F,j,H,l)}let A=C[C.length-1],D=u===0?A.x:A.y;D>=s&&D<=l&&T.push(A),T.length&&(A=T[T.length-1],T[0].x===A.x&&T[0].y===A.y||T.push(T[0]),b.push(T))}b.length&&h.push(b)}return h}function Uoe(c,s){let l=rN(c),u=rN([s]),h=Rj.intersection(l,u);return h==null?[]:Oj(h)}function joe(c,s){let u=rN(c,65536),h=[];for(;s.valid();s.next()){let[g,_]=s.get(),b=g.x*65536,C=g.y*65536,T=_.x*65536,A=_.y*65536,D=T-b,M=A-C,L=Math.hypot(D,M);if(L===0)continue;let F=Math.trunc(M/L*3),j=-Math.trunc(D/L*3);h.push([[[b,C],[T,A],[T+F,A+j],[b+F,C+j],[b,C]]])}return h.length>0&&(u=Rj.diff(u,h)),Oj(u,1/65536)}function rN(c,s=1){return[c.map(l=>l.map(u=>[u.x*s,u.y*s]))]}function Oj(c,s=1){return c.map(l=>l.map((u,h)=>{let g=u.map(_=>new It(_[0]*s,_[1]*s).round());return h>0&&g.reverse(),g}))}class oN{constructor(s,l){this.layoutVertexArray=new Th,this.indexArray=new ps,this.lineIndexArray=new es,this.triangleSegments=new co,this.lineSegments=new co,this.programConfigurations=new Jc(s.layers,{zoom:s.zoom,lut:s.lut}),this.uploaded=!1,l&&(this.elevatedLayoutVertexArray=new Sh)}update(s,l,u,h,g,_,b,C){this.programConfigurations.updatePaintArrays(s,l,g,u,h,_,b,C)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,Soe.members),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.lineIndexBuffer=s.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=s.createVertexBuffer(this.elevatedLayoutVertexArray,Eoe.members))),this.programConfigurations.upload(s),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(s,l,u,h,g,_,b){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,l,u,h,g,_,void 0,b)}}class sN{constructor(s){this.zoom=s.zoom,this.pixelRatio=s.pixelRatio,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(l=>l.fqid),this.index=s.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=s.lut,this.bufferData=new oN(s,!1),this.elevationBufferData=new oN(s,!0),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.projection=s.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=s.sourceLayerIndex,this.worldview=s.worldview}updateFootprints(s,l){}populate(s,l,u,h){this.hasPattern=iN("fill",this.layers,this.pixelRatio,l);let g=this.layers[0].layout.get("fill-sort-key"),_=[];for(let{feature:b,id:C,index:T,sourceLayerIndex:A}of s){let D=this.layers[0]._featureFilter.needGeometry,M=wt(b,D);if(!this.layers[0]._featureFilter.filter(new Nr(this.zoom,{worldview:this.worldview}),M,u))continue;let L=g?g.evaluate(M,{},u,l.availableImages):void 0,F={id:C,properties:b.properties,type:b.type,sourceLayerIndex:A,index:T,geometry:D?M.geometry:Gt(b,u,h),patterns:{},sortKey:L};_.push(F)}g&&_.sort((b,C)=>b.sortKey-C.sortKey);for(let b of _){let{geometry:C,index:T,sourceLayerIndex:A}=b;if(this.hasPattern){let D=nN("fill",this.layers,b,this.zoom,this.pixelRatio,l);this.patternFeatures.push(D)}else this.addFeature(b,C,T,u,{},l.availableImages,l.brightness,l.elevationFeatures);l.featureIndex.insert(s[T].feature,C,T,A,this.index)}}update(s,l,u,h,g,_,b){this.bufferData.update(s,l,u,h,g,_,b,this.worldview),this.elevationBufferData.update(s,l,u,h,g,_,b,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(s,l,u,h,g,_,b,this.worldview)}addFeatures(s,l,u,h,g,_){for(let b of this.patternFeatures)this.addFeature(b,b.geometry,b.index,l,u,h,_,s.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(s){this.bufferData.upload(s),this.elevationBufferData.upload(s),this.elevatedStructures&&this.elevatedStructures.upload(s)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(s,l,u,h,g,_=[],b,C){let T=yI(l,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(s,T,h,u,C):this.addGeometry(T,this.bufferData),this.bufferData.populatePaintArrays(s,u,g,_,h,b,this.worldview),this.elevationBufferData.populatePaintArrays(s,u,g,_,h,b,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(s,l,u,h,g){this.elevatedStructures&&(this.elevatedStructures.construct(s),this.elevatedStructures.populatePaintArrays(l,u,h,g,this.worldview))}addElevatedRoadFeature(s,l,u,h,g){let _=new Array,b=so.getElevationFeature(s,g);if(!b)return void this.addGeometry(l,this.bufferData);{let T=this.clipPolygonsToTile(l,1);T.length>0&&_.push({polygons:T,elevationFeature:b,elevationTileID:u})}let C={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(s,{},u),featureIndex:h};for(let T of _)if(T.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new ec(T.elevationTileID,this.layers,this.zoom,this.lut));let D=T.elevationFeature.isTunnel(),M=0;s.properties.hasOwnProperty(ir)&&(M=+s.properties[ir]);for(let L of T.polygons)this.elevatedStructures.addPortalCandidates(T.elevationFeature.id,L,D,T.elevationFeature,M)}T.elevationFeature.constantHeight==null&&(T.polygons=this.prepareElevatedPolygons(T.polygons,T.elevationFeature,T.elevationTileID));let A=new Uo(u,T.elevationTileID);this.addElevatedGeometry(T.polygons,A,T.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,h,C)}}addElevatedGeometry(s,l,u,h,g,_){let b={elevation:u,elevationSampler:l,bias:h,index:g,featureInfo:_},[C,T]=this.addGeometry(s,this.elevationBufferData,b);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:C,max:T}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,C),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,T))}addGeometry(s,l,u){let h=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,_=null;u&&(_=u.elevationSampler.constantElevation(u.elevation,u.bias),_!=null&&(h=_,g=_));let b=(C,T,A)=>{if(u!=null)if(T.push(C),_!=null)l.elevatedLayoutVertexArray.emplaceBack(_),A.push(_);else{let D=u.elevationSampler.pointElevation(C,u.elevation,u.bias);l.elevatedLayoutVertexArray.emplaceBack(D),A.push(D),h=Math.min(h,D),g=Math.max(g,D)}};for(let C of s){let T=0;for(let ne of C)T+=ne.length;let A=l.triangleSegments.prepareSegment(T,l.layoutVertexArray,l.indexArray),D=A.vertexLength,M=[],L=[],F=[],j=[],H=[],G=l.layoutVertexArray.length;for(let ne of C){if(ne.length===0)continue;ne!==C[0]&&L.push(M.length/2);let se=l.lineSegments.prepareSegment(ne.length,l.layoutVertexArray,l.lineIndexArray),_e=se.vertexLength;u&&H.push(l.layoutVertexArray.length-G),b(ne[0],F,j),l.layoutVertexArray.emplaceBack(ne[0].x,ne[0].y),l.lineIndexArray.emplaceBack(_e+ne.length-1,_e),M.push(ne[0].x),M.push(ne[0].y);for(let ye=1;ye0&&u&&this.elevationMode==="hd-road-base"){let ne=u.elevation.isTunnel(),se=u.elevation.safeArea,_e=this.elevatedStructures.addVertices(F,j);this.elevatedStructures.addTriangles(ie,_e,ne);let ye=H.length;if(ye>0){for(let Ce=0;Ce=u&&L.max.x<=g&&L.min.y>=h&&L.max.y<=_?C:T).push(M)}if(C.length===s.length)return s;let A=[new It(u,h),new It(g,h),new It(g,_),new It(u,_),new It(u,h)],D=C;for(let M of T)D.push(...Uoe(M,A));return D}}let Pj,Lj,Fj,Nj;Qt(sN,"FillBucket",{omit:["layers","patternFeatures"]}),Qt(oN,"FillBufferData"),Qt(ec,"ElevatedStructures");class hk{constructor(s,l,u,h){if(this.triangleCount=l.length/3,this.min=new It(0,0),this.max=new It(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||s.length===0)return;let[g,_]=[s[0].clone(),s[0].clone()];for(let D=1;DD.cellIdx-M.cellIdx||D.triIdx-M.triIdx);let A=0;for(;Athis.max.x||this.min.x>s.x||s.y>this.max.y||this.min.y>s.y)return;let u=Rh(s.x-this.min.x,this.xScale,this.cellsX),h=Rh(s.y-this.min.y,this.yScale,this.cellsY),g=this.cells[h*this.cellsX+u];if(g){this._lazyInitLookup();for(let _=0;_this.max.x||this.min.x>l.x||s.y>this.max.y||this.min.y>l.y)return;this._lazyInitLookup();let h=Rh(s.x-this.min.x,this.xScale,this.cellsX),g=Rh(l.x-this.min.x,this.xScale,this.cellsX),_=Rh(s.y-this.min.y,this.yScale,this.cellsY),b=Rh(l.y-this.min.y,this.yScale,this.cellsY);for(let C=_;C<=b;C++)for(let T=h;T<=g;T++){let A=this.cells[C*this.cellsX+T];if(A)for(let D=0;Dl.fqid),this.index=s.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.footprints=[],this.worldview=s.worldview}updateFootprints(s,l){for(let u of this.footprints)l.push({footprint:u,id:s})}populate(s,l,u,h){let g=[];for(let{feature:_,id:b,index:C,sourceLayerIndex:T}of s){let A=this.layers[0]._featureFilter.needGeometry,D=wt(_,A);if(!this.layers[0]._featureFilter.filter(new Nr(this.zoom,{worldview:this.worldview}),D,u))continue;let M={id:b,properties:_.properties,type:_.type,sourceLayerIndex:T,index:C,geometry:A?D.geometry:Gt(_,u,h),patterns:{}};g.push(M)}for(let _ of g){let{geometry:b,index:C,sourceLayerIndex:T}=_;this.addFeature(_,b,C,u,{},l.availableImages,l.brightness),l.featureIndex.insert(s[C].feature,b,C,T,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(s){}update(s,l,u,h,g,_,b){}destroy(){}addFeature(s,l,u,h,g,_=[],b){for(let C of yI(l,2)){let T=[],A=[],D=[],M=new It(1/0,1/0),L=new It(-1/0,-1/0);for(let H of C)if(H.length!==0){H!==C[0]&&D.push(A.length/2);for(let G=0;G_===h)===void 0})(u,c.clipScope)}function pk(c,s){return c.x-s.x||c.y-s.y}function Uj(c,s){return pk(c.min,s.min)===0&&pk(c.max,s.max)===0}function aN(c,s){return!(c.min.x>s.max.x||c.max.xs.max.y||c.max.ynew It((C.x+g.x*Pt)*b-_.x*Pt,(C.y+g.y*Pt)*b-_.y*Pt))}return lN(l,h,c.indices,0,c.indices.length,0,0)}function Gj(c,s,l,u){let h=Math.pow(2,u.z-l.z);return new It((c+l.x*Pt)*h-u.x*Pt,(s+l.y*Pt)*h-u.y*Pt)}function cN(c,s){let l=[];s.grid.queryPoint(c,l);let u=s.indices,h=s.vertices;for(let g=0;g0&&(u.length>1&&l.push(u),u=[])}return u.length>1&&l.push(u),l}let uN=_t.types,Qoe=["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"],Xoe=["fill-extrusion-flood-light-ground-radius"],Joe=Math.pow(2,13),ese=Math.pow(2,15)-1,qj=new It(0,1),Km=2147483648;function bI(c,s,l,u,h,g,_,b){c.emplaceBack((s<<1)+_,(l<<1)+g,(Math.floor(u*Joe)<<1)+h,Math.round(b))}function xI(c,s,l){c.emplaceBack(s.x*Pt,s.y*Pt,l?1:0)}function mk(c,s,l,u,h,g){c.emplaceBack(s.x,s.y,(l.x<<1)+u,(l.y<<1)+h,g)}function wI(c,s,l){c.emplaceBack(s.x,s.y,s.z,l[0]*16384,l[1]*16384,l[2]*16384)}class Wj{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Kj{constructor(){this.centroidXY=new It(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 It(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new It(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new It(this.max.x-this.min.x,this.max.y-this.min.y)}}class Yj{constructor(){this.acc=new It(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(s,l){s.min.x===Number.MAX_VALUE&&(s.min.x=s.max.x=l.x,s.min.y=s.max.y=l.y)}appendEdge(s,l,u){this.accCount++,this.acc._add(l);let h=!!this.borders;l.xs.max.x&&(s.max.x=l.x,h=!0),l.ys.max.y&&(s.max.y=l.y,h=!0),((l.x===0||l.x===Pt)&&l.x===u.x)!=((l.y===0||l.y===Pt)&&l.y===u.y)&&this.processBorderOverlap(l,u),h&&this.checkBorderIntersection(l,u)}checkBorderIntersection(s,l){l.x<0!=s.x<0&&this.addBorderIntersection(0,Ti(l.y,s.y,(0-l.x)/(s.x-l.x))),l.x>Pt!=s.x>Pt&&this.addBorderIntersection(1,Ti(l.y,s.y,(Pt-l.x)/(s.x-l.x))),l.y<0!=s.y<0&&this.addBorderIntersection(2,Ti(l.x,s.x,(0-l.y)/(s.y-l.y))),l.y>Pt!=s.y>Pt&&this.addBorderIntersection(3,Ti(l.x,s.x,(Pt-l.y)/(s.y-l.y)))}addBorderIntersection(s,l){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);let u=this.borders[s];lu[1]&&(u[1]=l)}processBorderOverlap(s,l){if(s.x===l.x){if(s.y===l.y)return;let u=s.x===0?0:1;this.addBorderIntersection(u,l.y),this.addBorderIntersection(u,s.y)}else{let u=s.y===0?2:3;this.addBorderIntersection(u,l.x),this.addBorderIntersection(u,s.x)}}centroid(){return this.accCount===0?new It(0,0):new It(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((s,l)=>s+ +(l[0]!==Number.MAX_VALUE),0):0}}function Zj(c,s){let l=c.add(s)._unit(),u=ve(c.x*l.x+c.y*l.y,-1,1);var h,g,_;return h=Math.acos(u),Math.min(4,Math.max(-4,Math.tan(h)))/4*ese*((g=c).x*(_=s).y-g.y*_.x<0?-1:1)}let tse=[c=>c.x<0,c=>c.x>Pt,c=>c.y<0,c=>c.y>Pt];function ise(c,s,l,u){let h=[4];if(u===0)return h;l._mult(u);let g=c.sub(l),_=s.sub(l),b=[c,s,g,_];for(let C=0;C<4;C++)for(let T of b)if(tse[C](T)){h.push(C);break}return h}class hN{constructor(s){this.vertexArray=new eI,this.indexArray=new ps,this.programConfigurations=new Jc(s.layers,{zoom:s.zoom,lut:s.lut},l=>Xoe.includes(l)),this._segments=new co,this.hiddenByLandmarkVertexArray=new Pb,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new co}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(s,l,u,h=!1){let g=s.length;if(g>2){let _=Math.max(0,this._segments.get().length-1),b=this._segments._prepareSegment(4*g,this.vertexArray.length,2*this._segmentToGroundQuads[_].length),C;_!==this._segments.get().length-1&&(_++,this._segmentToGroundQuads[_]=[],this._segmentToRegionTriCounts[_]=[0,0,0,0,0]);{let T=s[0],A=s[1];C=Zj(T.sub(s[g-1])._perp()._unit(),A.sub(T)._perp()._unit())}for(let T=0;Th.region-g.region);for(let u=0;uC+T,0);let b=0;for(let C=0;C<=4;C++){let T=_[C];if(T!==0){let A=this.regionSegments[C];A||(A=this.regionSegments[C]=new co);let D={vertexOffset:g.vertexOffset,primitiveOffset:g.primitiveOffset+b,vertexLength:g.vertexLength,primitiveLength:T};A.get().push(D)}b+=T}for(let C=0;C0?this.hiddenByLandmarkVertexBuffer=s.createVertexBuffer(this.hiddenByLandmarkVertexArray,Woe.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 s=0;s<=4;s++){let l=this.regionSegments[s];l&&l.destroy()}}}}class gk{constructor(s){this.zoom=s.zoom,this.canonical=s.canonical,this.overscaling=s.overscaling,this.layers=s.layers,this.pixelRatio=s.pixelRatio,this.layerIds=this.layers.map(l=>l.fqid),this.index=s.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=s.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new ps,this.footprintVertices=new Th,this.footprintSegments=[],this.layoutVertexArray=new Jp,this.centroidVertexArray=new JD,this.wallVertexArray=new tk,this.indexArray=new ps,this.programConfigurations=new Jc(s.layers,{zoom:s.zoom,lut:s.lut},l=>Qoe.includes(l)),this.segments=new co,this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.groundEffect=new hN(s),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=s.worldview}updateFootprints(s,l){}populate(s,l,u,h){this.features=[],this.hasPattern=iN("fill-extrusion",this.layers,this.pixelRatio,l),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=Be(u),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(let{feature:g,id:_,index:b,sourceLayerIndex:C}of s){let T=this.layers[0]._featureFilter.needGeometry,A=wt(g,T);if(!this.layers[0]._featureFilter.filter(new Nr(this.zoom,{worldview:this.worldview}),A,u))continue;let D={id:_,sourceLayerIndex:C,index:b,geometry:T?A.geometry:Gt(g,u,h),properties:g.properties,type:g.type,patterns:{}},M=this.layoutVertexArray.length,L=uN[D.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:g.id,feature:nN("fill-extrusion",this.layers,D,this.zoom,this.pixelRatio,l)});else if(this.wallMode)for(let F of D.geometry)for(let j of $j(F,L))this.addFeature(g.id,D,[j],b,u,{},l.availableImages,h,l.brightness);else this.addFeature(g.id,D,D.geometry,b,u,{},l.availableImages,h,l.brightness);l.featureIndex.insert(g,D.geometry,b,C,this.index,M)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(s,l,u,h,g,_){for(let{featureId:b,feature:C}of this.features){let T=uN[C.type]==="Polygon",{geometry:A}=C;if(this.wallMode)for(let D of A)for(let M of $j(D,T))this.addFeature(b,C,[M],C.index,l,u,h,g,_);else this.addFeature(b,C,A,C.index,l,u,h,g,_)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(s,l,u,h,g,_,b){this.programConfigurations.updatePaintArrays(s,l,g,u,h,_,b,this.worldview),this.groundEffect.update(s,l,g,u,h,_,b,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,Yoe),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.wallVertexBuffer=s.createVertexBuffer(this.wallVertexArray,qoe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=s.createVertexBuffer(this.layoutVertexExtArray,Koe.members,!0)),this.groundEffect.upload(s)),this.groundEffect.uploadPaintProperties(s),this.programConfigurations.upload(s),this.uploaded=!0}uploadCentroid(s){this.groundEffect.uploadHiddenByLandmark(s),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=s.createVertexBuffer(this.centroidVertexArray,$oe.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(s,l,u,h,g,_,b,C,T){let A=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(l,{})/this.tileToMeter,D=[new It(0,0),new It(Pt,Pt)],M=C.projection,L=M.name==="globe",F=this.wallMode||uN[l.type]==="Polygon",j=new Yj;j.centroidDataIndex=this.centroidData.length;let H=new Kj;H.buildingId=s,l.properties&&l.properties.hasOwnProperty("building_id")&&(H.buildingId=l.properties.building_id);let G=this.layers[0].paint.get("fill-extrusion-base").evaluate(l,{},g)<=0,ie=this.layers[0].paint.get("fill-extrusion-height").evaluate(l,{},g),ne;if(H.height=ie,H.vertexArrayOffset=this.layoutVertexArray.length,H.groundVertexArrayOffset=this.groundEffect.vertexArray.length,L&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Db),this.wallMode){if(L)return void vn("Non zero fill-extrusion-line-width is not yet supported on globe.");if(u.length!==1)return;ne=(function(Ne){let dt=Ne[0].x===Ne[Ne.length-1].x&&Ne[0].y===Ne[Ne.length-1].y;(function(Ot){let pi=0,Bi=Ot.length;for(let Ut=0;Ut=0})(Ne)||(Ne=Ne.reverse());let ut={geometry:[],joinNormals:[],indices:[]},ft=[],Ct=[],ot=[],gt=Ne.length;for(;gt>=2&&Ne[gt-1].equals(Ne[gt-2]);)gt--;if(gt<(dt?3:2))return ut;let We,Ge,Tt,xt,mi,Kt=0;for(;Kt0,Ai="miter",$i=2;Ai==="miter"&&Ut>$i&&(Ai="bevel"),Ai==="bevel"&&(Ut>100&&(Ai="flipbevel"),Ut<$i&&(Ai="miter"));let ln=(Wi,ii,qi,An)=>{let le=new It(Wi.x,Wi.y),ce=new It(Wi.x,Wi.y);le.x+=ii.x*An,le.y+=ii.y*An,ce.x-=ii.x*Math.max(qi,1),ce.y-=ii.y*Math.max(qi,1),ot.push(ii),ft.push(le),Ct.push(ce)};if(Ai==="miter")pi._mult(Ut),ln(We,pi,0,0);else if(Ai==="flipbevel")pi=mi.mult(-1),ln(We,pi,0,0),ln(We,pi.mult(-1),0,0);else{let Wi=-Math.sqrt(Ut*Ut-1),ii=li?Wi:0,qi=li?0:Wi;Ge&&ln(We,xt,ii,qi),Tt&&ln(We,mi,ii,qi)}}ut.geometry=[...ft,...Ct.reverse(),ft[0]],ut.joinNormals=[...ot,...ot.reverse(),ot[ot.length-1]];let ni=ut.geometry.length-1;for(let Ot=0;OtNe<(dt.length-1)/2||Ne===dt.length-1,_e=this.wallMode?[u]:yI(u,500);for(let Ne=_e.length-1;Ne>=0;Ne--){let dt=_e[Ne];(dt.length===0||(ye=dt[0]).every(vt=>vt.x<=0)||ye.every(vt=>vt.x>=Pt)||ye.every(vt=>vt.y<=0)||ye.every(vt=>vt.y>=Pt))&&_e.splice(Ne,1)}var ye;let Ce;if(L)Ce=nH(_e,D,g);else{Ce=[];for(let Ne of _e)Ce.push({polygon:Ne,bounds:D})}let De=F?this.edgeRadius:0,Me=De>0&&this.zoom<17,lt=(Ne,dt)=>{if(Ne.length===0)return!1;let vt=Ne[Ne.length-1];return dt.x===vt.x&&dt.y===vt.y};for(let{polygon:Ne,bounds:dt}of Ce){let vt=0,ut=0;for(let gt of Ne)F&&!gt[0].equals(gt[gt.length-1])&>.push(gt[0]),ut+=F?gt.length-1:gt.length;let ft=this.segments.prepareSegment((F?5:4)*ut,this.layoutVertexArray,this.indexArray);H.footprintSegIdx<0&&(H.footprintSegIdx=this.footprintSegments.length),H.polygonSegIdx<0&&(H.polygonSegIdx=this.polygonSegments.length);let Ct={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},ot=new Wj;if(ot.vertexOffset=this.footprintVertices.length,ot.indexOffset=3*this.footprintIndices.length,ot.ringIndices=[],F){let gt=[],We=[];vt=ft.vertexLength;for(let Tt=0;Tt4&&eH(We[We.length-2],We[0],We[1]),Tt=De?nse(We[We.length-2],We[0],We[1],De):0,xt=[],mi,Kt,ni;Kt=We[1].sub(We[0])._perp()._unit();let Ot=!0;for(let pi=1,Bi=0;pi0?1:0,ii=Ut.dist(li);if(Bi+ii>32768&&(Bi=0),De){ni=Ai.sub(li)._perp()._unit();let ce=Xj(Ut,li,Ai,Qj(Kt,ni),De);isNaN(ce)&&(ce=0);let qe=li.sub(Ut)._unit();Ut=Ut.add(qe.mult(Tt))._round(),li=li.add(qe.mult(-ce))._round(),Tt=ce,Kt=ni,G&&this.zoom>=17&&(lt(xt,Ut)||xt.push(Ut),lt(xt,li)||xt.push(li))}let qi=ft.vertexLength,An=We.length>4&&eH(Ut,li,Ai),le=tH(Bi,Ge,Ot);if(bI(this.layoutVertexArray,Ut.x,Ut.y,ln,Wi,0,0,le),bI(this.layoutVertexArray,Ut.x,Ut.y,ln,Wi,0,1,le),this.wallMode){let ce=se(pi-1,We),qe=ne.joinNormals[pi-1];xI(this.wallVertexArray,qe,ce),xI(this.wallVertexArray,qe,ce)}if(Bi+=ii,le=tH(Bi,An,!Ot),Ge=An,bI(this.layoutVertexArray,li.x,li.y,ln,Wi,0,0,le),bI(this.layoutVertexArray,li.x,li.y,ln,Wi,0,1,le),this.wallMode){let ce=se(pi,We),qe=ne.joinNormals[pi];xI(this.wallVertexArray,qe,ce),xI(this.wallVertexArray,qe,ce)}if(ft.vertexLength+=4,this.indexArray.emplaceBack(qi+0,qi+1,qi+2),this.indexArray.emplaceBack(qi+1,qi+3,qi+2),ft.primitiveLength+=2,De){let ce=vt+(pi===1?We.length-2:pi-2),qe=pi===1?vt:ce+1;if(this.indexArray.emplaceBack(qi+1,ce,qi+3),this.indexArray.emplaceBack(ce,qe,qi+3),ft.primitiveLength+=2,mi===void 0&&(mi=qi),!pN(Ai,We[pi],dt)){let at=pi===We.length-1?mi:ft.vertexLength;this.indexArray.emplaceBack(qi+2,qi+3,at),this.indexArray.emplaceBack(qi+3,at+1,at),this.indexArray.emplaceBack(qi+3,qe,at+1),ft.primitiveLength+=3}Ot=!Ot}if(L){let ce=this.layoutVertexExtArray,qe=M.projectTilePoint(Ut.x,Ut.y,g),at=M.projectTilePoint(li.x,li.y,g),Vt=M.upVector(g,Ut.x,Ut.y),zt=M.upVector(g,li.x,li.y);wI(ce,qe,Vt),wI(ce,qe,Vt),wI(ce,at,zt),wI(ce,at,zt)}}F&&(vt+=We.length-1),G&&De&&this.zoom>=17&&(xt.length!==0&<(xt,xt[0])&&xt.pop(),this.groundEffect.addData(xt,dt,A,De>0))}this.footprintSegments.push(ot),Ct.triangleCount=this.indexArray.length-Ct.triangleArrayOffset,this.polygonSegments.push(Ct),++H.footprintSegLen,++H.polygonSegLen}if(H.vertexCount=this.layoutVertexArray.length-H.vertexArrayOffset,H.groundVertexCount=this.groundEffect.vertexArray.length-H.groundVertexArrayOffset,H.vertexCount!==0){if(H.centroidXY=j.borders?qj:this.encodeCentroid(j,H),this.centroidData.push(H),j.borders){this.featuresOnBorder.push(j);let Ne=this.featuresOnBorder.length-1;for(let dt=0;dtthis.featuresOnBorder[l].borders[s][0]-this.featuresOnBorder[u].borders[s][0])}splitToSubtiles(){let s=[];for(let b=0;bPt),A=2*T+(+(C.min.x+C.max.x>Pt)^T);for(let D=0;Db.triangleSegmentIdx===C.triangleSegmentIdx?b.subtile-C.subtile:b.triangleSegmentIdx-C.triangleSegmentIdx);let u=0,h=0,g=0;for(let b of s){if(b.triangleSegmentIdx!==u)break;g++}let _=s.length;for(;h!==s.length;){u=s[h].triangleSegmentIdx;let b=0,C=h,T=h;for(let A=C;A0&&this.triangleSubSegments.push({segment:L,min:D,max:M}),C=T;for(let F=C;F[j[0]*(1-G[0])+H[0]*G[0],j[1]*(1-G[1])+H[1]*G[1]],L=[],F=[];for(let j of this.triangleSubSegments){L[0]=j.min.x/Pt,L[1]=j.min.y/Pt,F[0]=j.max.x/Pt,F[1]=j.max.y/Pt;let H=M(A,D,L),G=M(A,D,F);if(new ki([H[0],H[1],g],[G[0],G[1],_]).intersectsPrecise(u)===0){T&&(h.segments.push(T),T=void 0);continue}let ie=j.segment;T&&T.vertexOffset!==ie.vertexOffset&&(h.segments.push(T),T=void 0),T?(T.vertexLength+=ie.vertexLength,T.primitiveLength+=ie.primitiveLength):T={vertexOffset:ie.vertexOffset,primitiveLength:ie.primitiveLength,vertexLength:ie.vertexLength,primitiveOffset:ie.primitiveOffset,sortKey:void 0,vaos:{}}}return T&&h.segments.push(T),h}encodeCentroid(s,l){let u=s.centroid(),h=l.span(),g=Math.min(7,Math.round(h.x*this.tileToMeter/10)),_=Math.min(7,Math.round(h.y*this.tileToMeter/10));return new It(ve(u.x,1,Pt-1)<<3|g,ve(u.y,1,Pt-1)<<3|_)}encodeBorderCentroid(s){if(!s.borders)return new It(0,0);let l=s.borders,u=Number.MAX_VALUE;if(l[0][0]!==u||l[1][0]!==u){let h=l[0][0]!==u?0:1;return new It(6|(l[0][0]!==u?0:65528),(l[h][0]+l[h][1])/2<<3|6)}{let h=l[2][0]!==u?2:3;return new It((l[h][0]+l[h][1])/2<<3|6,6|(l[2][0]!==u?0:65528))}}showCentroid(s){let l=this.centroidData[s.centroidDataIndex];l.flags&=2147483647,l.centroidXY.x=0,l.centroidXY.y=0,this.writeCentroidToBuffer(l)}writeCentroidToBuffer(s){this.groundEffect.updateHiddenByLandmark(s);let l=s.vertexArrayOffset,u=s.vertexCount+s.vertexArrayOffset,h=s.flags&Km?qj:s.centroidXY,g=this.centroidVertexArray.geta_centroid_pos0(l);if(this.centroidVertexArray.geta_centroid_pos1(l)!==h.y||g!==h.x){for(let _=l;_C.max.x||C.min.x>_.max.x||_.min.y>C.max.y||C.min.y>_.max.y))for(let T=0;Tl!=L>l&&s<(this.footprintVertices.int16[2*(A+_.vertexOffset)+0]-D)*(l-M)/(L-M)+D&&(h=!h)}b=C}}return h}getHeightAtTileCoord(s,l){let u=Number.NEGATIVE_INFINITY,h=!0,g=4*(s+Pt)*Pt+(l+Pt);if(this.partLookup.hasOwnProperty(g)){let _=this.partLookup[g];return _?{height:_.height,hidden:!!(_.flags&Km)}:void 0}for(let _ of this.centroidData)s>_.max.x||_.min.x>s||l>_.max.y||_.min.y>l||_.height<=u||this.footprintContainsPoint(s,l,_)&&(u=_.height,this.partLookup[g]=_,h=!!(_.flags&Km));if(u!==Number.NEGATIVE_INFINITY)return{height:u,hidden:h};this.partLookup[g]=void 0}}function Qj(c,s){let l=c.add(s)._unit();return c.x*l.x+c.y*l.y}function nse(c,s,l,u){let h=s.sub(c)._perp()._unit(),g=l.sub(s)._perp()._unit();return Xj(c,s,l,Qj(h,g),u)}function Xj(c,s,l,u,h){let g=Math.sqrt(1-u*u);return Math.min(c.dist(s)/3,s.dist(l)/3,h*g/u)}function pN(c,s,l){return c.xl[1].x&&s.x>l[1].x||c.yl[1].y&&s.y>l[1].y}function Jj(c,s){return c.xs[1].x||c.ys[1].y}function eH(c,s,l){if(c.x<0||c.x>=Pt||s.x<0||s.x>=Pt||l.x<0||l.x>=Pt)return!1;let u=l.sub(s),h=u.perp(),g=c.sub(s);return(u.x*g.x+u.y*g.y)/Math.sqrt((u.x*u.x+u.y*u.y)*(g.x*g.x+g.y*g.y))>-.866&&h.x*g.x+h.y*g.y<0}function tH(c,s,l){let u=s?2|c:-3&c;return l?1|u:-2&u}function iH(){let c=Math.PI/32,s=Math.tan(c),l=z;return l*Math.sqrt(1+2*s*s)-l}function nH(c,s,l){let u=1<{for(let De of ye)F.push({polygon:De,bounds:Ce})},H=Math.ceil(Math.log2(A)),G=Math.ceil(Math.log2(D)),ie=H-G,ne=[];for(let ye=0;ye0?0:1);for(let ye=0;yeCe+1?_e.push({polygons:ut,bounds:Ct,depth:Ce+1}):j(ut,Ct)}if(ft.length){let Ct=[new It(De===0?vt:Me.x,De===1?vt:Me.y),lt];ne.length>Ce+1?_e.push({polygons:ft,bounds:Ct,depth:Ce+1}):j(ft,Ct)}}return F})(c,s,Math.ceil((g-h)/11.25),Math.ceil((_-b)/11.25),1,(C,T,A)=>{if(C===0)return .5*(T+A);{let D=pe((l.y+T/Pt)/u);return(fe(.5*(pe((l.y+A/Pt)/u)+D))*u-l.y)*Pt}})}function rse(c,s,l,u,h,g){let _=Math.pow(2,u.z-h.z);for(let b=0;b=C[_]&&(b=s,C=c),b[_]h&&aH(b,C,_,h),b[_]g&&aH(C,b,_,g)}}function _k(c,s,l,u,h,g){let _=[];for(let b=0;b=u&&F.x>=u||(L.x>=u?L=new It(u,L.y+(u-L.x)/(F.x-L.x)*(F.y-L.y))._round():F.x>=u&&(F=new It(u,L.y+(u-L.x)/(F.x-L.x)*(F.y-L.y))._round()),L.y>=h&&F.y>=h||(L.y>=h?L=new It(L.x+(h-L.y)/(F.y-L.y)*(F.x-L.x),h)._round():F.y>=h&&(F=new It(L.x+(h-L.y)/(F.y-L.y)*(F.x-L.x),h)._round()),T&&L.equals(T[T.length-1])||(T=[L],_.push(T),g&&g.push({progress:{min:H+cH(G,ie,L)*j,max:1},parentIndex:b,prevPoint:G,nextPoint:ie})),T.push(F),g&&(g[g.length-1].progress.max=H+cH(G,ie,F)*j,g[g.length-1].nextPoint=ie)))))}if(g&&D>0)for(let M=A;M<_.length;M++)g[M].progress.min/=D,g[M].progress.max/=D}return _}function ose(c,s,l,u,h){if(c.length<2)return void u.push(c);let g=[];for(;s.valid();){let[T,A]=s.get();for(let D=0;DT.t-A.t);let _=0,b=0,C=[];for(u.push(C);_!==c.length;){if(b===g.length){for(;_!==c.length;)C.length!==0&&C[C.length-1].equals(c[_])||C.push(c[_]),_++;break}g[b].t<=_?(C.length!==0&&C[C.length-1].equals(g[b].point)||C.push(g[b].point),Math.trunc(g[b].t),b++):(C.length!==0&&C[C.length-1].equals(c[_])||C.push(c[_]),_++)}}function cH(c,s,l){return c.x!==s.x?(l.x-c.x)/(s.x-c.x):c.y!==s.y?(l.y-c.y)/(s.y-c.y):0}function CI(c,s){return c.x*s.x+c.y*s.y}function dH(c,s){if(c.length===1){let l=0,u=s[l++],h;for(;!h||u.equals(h);)if(h=s[l++],!h)return 1/0;for(;l{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 ase{constructor(){this.tasks={},this.taskQueue=[],Ri(["process"],this),this.invoker=new sse(this.process),this.nextId=0}add(s,l){let u=this.nextId++,h=(function({type:g,isSymbolTile:_,zoom:b}){return b=b||0,g==="message"?0:g!=="maybePrepare"||_?g!=="parseTile"||_?g==="parseTile"&&_?300-b:g==="maybePrepare"&&_?400-b:500:200-b:100-b})(l);if(h===0){try{s()}finally{}return null}return this.tasks[u]={fn:s,metadata:l,priority:h,id:u},this.taskQueue.push(u),this.invoker.trigger(),{cancel:()=>{delete this.tasks[u]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(u=>!!this.tasks[u]),!this.taskQueue.length)return;let s=this.pick();if(s===null)return;let l=this.tasks[s];if(delete this.tasks[s],this.taskQueue.length&&this.invoker.trigger(),!l)return;l.fn()}finally{}}pick(){let s=null,l=1/0;for(let h=0;h{u&&delete this.callbacks[b],this.target.postMessage({id:b,type:"",targetMapId:h,sourceMapId:this.mapId})}}}receive(s){let l=s.data;if(!l)return;let u=l.id;if(u&&(!l.targetMapId||this.mapId===l.targetMapId))if(l.type===""){let h=this.cancelCallbacks[u];delete this.cancelCallbacks[u],h&&h.cancel()}else if(l.mustQueue||Er(self)){let h=this.callbacks[u],g=this.scheduler.add(()=>this.processTask(u,l),h&&h.metadata||{type:"message"});g&&(this.cancelCallbacks[u]=g)}else this.processTask(u,l)}processTask(s,l){if(delete this.cancelCallbacks[s],l.type===""){let u=this.callbacks[s];delete this.callbacks[s],u&&(l.error?u(wh(l.error)):u(null,wh(l.data)))}else{let u=new Set,h=l.hasCallback?(_,b)=>{this.target.postMessage({id:s,type:"",sourceMapId:this.mapId,error:_?xh(_):null,data:xh(b,u)},u)}:()=>{},g=wh(l.data);if(this.parent[l.type])this.parent[l.type](l.sourceMapId,g,h);else if(this.parent.getWorkerSource){let _=l.type.split("."),{source:b,scope:C}=g;this.parent.getWorkerSource(l.sourceMapId,_[0],b,C)[_[1]](g,h)}else h(new Error(`Could not find function ${l.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var II={workerUrl:"",workerClass:null,workerParams:void 0};let fN="mapboxgl_preloaded_worker_pool",yk=(()=>{class c{constructor(){this.active={}}acquire(l,u=c.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[fN]}numActive(){return Object.keys(this.active).length}}return c.workerCount=2,c})();class jb{constructor(s,l,u="Worker",h=yk.workerCount){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=mt();let g=this.workerPool.acquire(this.id,h);for(let _=0;_{this.ready=!0})}broadcast(s,l,u){Ye(this.actors,(h,g)=>{h.send(s,l,g)},u=u||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(s=>{s.remove()}),this.actors=[],this.workerPool.release(this.id)}}let TI,mN;function vk(){return TI||(TI=new yk),TI}jb.Actor=hH;class lse{constructor(s){this.module=s}createIntArray(s){let l=new Int32Array(s),u=this.module.malloc(l.length*l.BYTES_PER_ELEMENT);return this.module.heap32.set(l,u/l.BYTES_PER_ELEMENT),u}createFloatArray(s){let l=new Float32Array(s),u=this.module.malloc(l.length*l.BYTES_PER_ELEMENT);return this.module.heapF32.set(l,u/l.BYTES_PER_ELEMENT),u}createStringBuffer(s){let l=this.module.malloc(s.length+1);for(let u=0;uh.arrayBuffer()).then(h=>{s.buffers[l]=h})}function bH(c,s){let l=c.json.bufferViews[s];return new Uint8Array(c.buffers[l.buffer],l.byteOffset||0,l.byteLength)}function fse(c,s,l,u){if(c.uri){let h=vH(c.uri,u);return fetch(h).then(g=>g.blob()).then(g=>createImageBitmap(g)).then(g=>{s.images[l]=g})}if(c.bufferView!==void 0){let h=bH(s,c.bufferView),g=new Blob([h],{type:c.mimeType});return createImageBitmap(g).then(_=>{s.images[l]=_})}}function xH(c,s=0,l){let u={json:null,images:[],buffers:[]};if(new Uint32Array(c,s,1)[0]===_H){let A=new Uint32Array(c,s),D=2,M=(A[D++]>>2)-3,L=A[D++]>>2;if(D++,u.json=JSON.parse(yH.decode(A.subarray(D,D+L))),D+=L,D{let A=[],D=b&&b.includes(yN),M=b&&b.includes(wk);if(D&&A.push((function(){if(!Iu)return SI??(SI=(function(L){let F,j=null;function H(){F=new Uint8Array(j.buffer)}function G(){throw new Error("Unexpected Draco error.")}let ie={a:{a:G,d:function(ne,se,_e){return F.copyWithin(ne,se,se+_e)},c:function(ne){let se=F.length,_e=Math.max(ne>>>0,Math.ceil(1.2*se)),ye=Math.ceil((_e-se)/65536);try{return j.grow(ye),H(),!0}catch{return!1}},b:G}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(L,ie):L.then(ne=>ne.arrayBuffer()).then(ne=>WebAssembly.instantiate(ne,ie))).then(ne=>{let{Rb:se,Qb:_e,P:ye,T:Ce,X:De,Ja:Me,La:lt,Qa:Ne,Va:dt,Wa:vt,eb:ut,jb:ft,f:Ct,e:ot,yb:gt,zb:We,Ab:Ge,Bb:Tt,Db:xt,Gb:mi}=ne.instance.exports;j=ot;let Kt=(()=>{let ni=0,Ot=0,pi=0,Bi=0;return Ut=>{pi&&(se(Bi),se(ni),Ot+=pi,pi=ni=0),ni||(Ot+=128,ni=_e(Ot));let li=Ut.length+7&-8,Ai=ni;li>=Ot&&(pi=li,Ai=Bi=_e(li));for(let $i=0;$i{Iu=L,SI=void 0}))})()),M&&A.push((function(){if(_N)return;let L=(function(F){let j,H=WebAssembly.instantiateStreaming(F,{}).then(ne=>{j=ne.instance,j.exports.__wasm_call_ctors()}),G={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},ie={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:H,supported:!0,decodeGltfBuffer(ne,se,_e,ye,Ce,De){(function(Me,lt,Ne,dt,vt,ut,ft){let Ct=Me.exports.sbrk,ot=dt+3&-4,gt=Ct(ot*vt),We=Ct(ut.length),Ge=new Uint8Array(Me.exports.memory.buffer);Ge.set(ut,We);let Tt=lt(gt,dt,vt,We,ut.length);if(Tt===0&&ft&&ft(gt,ot,vt),Ne.set(Ge.subarray(gt,gt+dt*vt)),Ct(gt-Ct(0)),Tt!==0)throw new Error(`Malformed buffer data: ${Tt}`)})(j,j.exports[ie[Ce]],ne,se,_e,ye,j.exports[G[De]])}}})(fetch(mH()));return L.ready.then(()=>{_N=L})})()),g)for(let L=0;L{if(D&&_)for(let{primitives:L}of _)for(let F of L)use(F,u);if(M&&_&&C)for(let L of C)hse(L,u);return u})})}function vN(c){switch(c){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 bN(c){switch(c){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 xN{constructor(s,l,u,h){this.context=s,this.format=u,this.useMipmap=h&&h.useMipmap,this.texture=s.gl.createTexture(),this.update(l,{premultiply:h&&h.premultiply})}update(s,l){let u=s&&s instanceof HTMLVideoElement&&s.width===0?s.videoWidth:s.width,h=s&&s instanceof HTMLVideoElement&&s.height===0?s.videoHeight:s.height,{context:g}=this,{gl:_}=g,{x:b,y:C}=l&&l.position?l.position:{x:0,y:0},T=b+u,A=C+h;!this.size||this.size[0]===T&&this.size[1]===A||(_.bindTexture(_.TEXTURE_2D,null),_.deleteTexture(this.texture),this.texture=_.createTexture(),this.size=null),_.bindTexture(_.TEXTURE_2D,this.texture),g.pixelStoreUnpackFlipY.set(!1),g.pixelStoreUnpack.set(1),g.pixelStoreUnpackPremultiplyAlpha.set(this.format===_.RGBA8&&(!l||l.premultiply!==!1));let D=s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||ImageBitmap&&s instanceof ImageBitmap;if(!this.size&&T>0&&A>0){let M=this.useMipmap?Math.floor(Math.log2(Math.max(T,A)))+1:1;_.texStorage2D(_.TEXTURE_2D,M,this.format,T,A),this.size=[T,A]}this.size&&(D?_.texSubImage2D(_.TEXTURE_2D,0,b,C,vN(this.format),bN(this.format),s):"data"in s&&s.data&&_.texSubImage2D(_.TEXTURE_2D,0,b,C,u,h,vN(this.format),bN(this.format),s.data)),this.useMipmap&&_.generateMipmap(_.TEXTURE_2D)}bind(s,l,u=!1){let{context:h}=this,{gl:g}=h;g.bindTexture(g.TEXTURE_2D,this.texture),s!==this.minFilter&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,s),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,this.useMipmap&&!u?s===g.NEAREST?g.NEAREST_MIPMAP_NEAREST:g.LINEAR_MIPMAP_LINEAR:s),this.minFilter=s),l!==this.wrapS&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,l),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,l),this.wrapS=l)}bindExtraParam(s,l,u,h,g){let{context:_}=this,{gl:b}=_;b.bindTexture(b.TEXTURE_2D,this.texture),l!==this.magFilter&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,l),this.magFilter=l),s!==this.minFilter&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,this.useMipmap?s===b.NEAREST?b.NEAREST_MIPMAP_NEAREST:b.LINEAR_MIPMAP_LINEAR:s),this.minFilter=s),u!==this.wrapS&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,u),this.wrapS=u),h!==this.wrapT&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,h),this.wrapT=h),g!==this.compareMode&&(g?(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_COMPARE_MODE,b.COMPARE_REF_TO_TEXTURE),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_COMPARE_FUNC,g)):b.texParameteri(b.TEXTURE_2D,b.TEXTURE_COMPARE_MODE,b.NONE),this.compareMode=g)}destroy(){let{gl:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}class AI{constructor(s,l){this.context=s,this.texture=l}bind(s,l){let{context:u}=this,{gl:h}=u;h.bindTexture(h.TEXTURE_2D,this.texture),s!==this.minFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,s),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,s),this.minFilter=s),l!==this.wrapS&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,l),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,l),this.wrapS=l)}}let mse=xn([{name:"a_pos_3f",components:3,type:"Float32"}]),gse=xn([{name:"a_color_3f",components:3,type:"Float32"}]),_se=xn([{name:"a_color_4f",components:4,type:"Float32"}]),yse=xn([{name:"a_uv_2f",components:2,type:"Float32"}]),vse=xn([{name:"a_normal_3f",components:3,type:"Float32"}]),bse=xn([{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"}]),xse=xn([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function wH(c,s){let l=Ck(c.projection,c.zoom,c.width,c.height),u=(function(g,_,b,C,T){let A=new U(b.lng-180*Ym,b.lat),D=new U(b.lng+180*Ym,b.lat),M=g.project(A.lng,A.lat),L=g.project(D.lng,D.lat),F=-Math.atan2(L.y-M.y,L.x-M.x),j=Ze.fromLngLat(b);j.y=ve(j.y,-1+Ym,1-Ym);let H=j.toLngLat(),G=g.project(H.lng,H.lat),ie=Ze.fromLngLat(H);ie.x+=Ym;let ne=ie.toLngLat(),se=g.project(ne.lng,ne.lat),_e=IH(se.x-G.x,se.y-G.y,F),ye=Ze.fromLngLat(H);ye.y+=Ym;let Ce=ye.toLngLat(),De=g.project(Ce.lng,Ce.lat),Me=IH(De.x-G.x,De.y-G.y,F),lt=Math.abs(_e.x)/Math.abs(Me.y),Ne=te([]);Rn(Ne,Ne,-F*(1-(T?0:C)));let dt=te([]);return bt(dt,dt,[1,1-(1-lt)*C,1]),dt[4]=-Me.x/Me.y*C,Rn(dt,dt,F),Pe(dt,Ne,dt),dt})(c.projection,0,c.center,l,s),h=CH(c);return bt(u,u,[h,h,1]),u}function CH(c){let s=c.projection,l=Ck(c.projection,c.zoom,c.width,c.height),u=wN(s,c.center),h=wN(s,U.convert(s.center));return Math.pow(2,u*l+(1-l)*h)}function Ck(c,s,l,u,h=1/0){let g=c.range;if(!g)return 0;let _=Math.min(h,Math.max(l,u)),b=Math.log2(_/1024);return Ke(g[0]+b,g[1]+b,s)}let Ym=1/4e4;function wN(c,s){let l=ve(s.lat,-ge,ge),u=new U(s.lng-180*Ym,l),h=new U(s.lng+180*Ym,l),g=c.project(u.lng,l),_=c.project(h.lng,l),b=Ze.fromLngLat(u),C=Ze.fromLngLat(h),T=_.x-g.x,A=_.y-g.y,D=C.x-b.x,M=C.y-b.y,L=Math.sqrt((D*D+M*M)/(T*T+A*A));return Math.log2(L)}function IH(c,s,l){let u=Math.cos(l),h=Math.sin(l);return{x:c*u-s*h,y:c*h+s*u}}function TH(c,s,l){te(c),Rn(c,c,Le(s[2])),ci(c,c,Le(s[0])),Oi(c,c,Le(s[1])),bt(c,c,l),Pe(c,c,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function Ik(c,s,l,u,h,g,_,b){let C=[l[0]-s[0],l[1]-s[1],0],T=[u[0]-s[0],u[1]-s[1],0];if(hs(C)<1e-12||hs(T)<1e-12)return jc(c);let A=Mo([],C,T);Fr(A,A),$s(T,u,s),C[2]=(g-h)*b,T[2]=(_-h)*b;let D=C;return Mo(D,C,T),Fr(D,D),dm(c,A,D)}function CN(c,s,l=!1){let u=qm(s.zoom),h=(function(g,_,b){let C=_.worldSize,T=[g[12],g[13],g[14]],A=pe(T[1]/C),D=me(T[0]/C),M=te([]),L=he(1,A)*C,F=he(1,0)*C*Re(A,_.zoom),j=1/QF(C),H=F*j;if(b){let se=Ck(_.projection,_.zoom,_.width,_.height,1024);H=j*_.projection.pixelSpaceConversion(_.center.lat,C,se)}let G=P(A,D);Mr(G,G,Rr([],Fr([],G),L*H*T[2]));let ie=(function(se){let _e=[se[0],se[1],se[2]],ye=[0,1,0],Ce=Mo([],ye,_e);return Mo(ye,_e,Ce),lu(ye)===0&&(ye=[0,1,0],Mo(Ce,_e,ye)),Fr(Ce,Ce),Fr(ye,ye),Fr(_e,_e),[Ce[0],Ce[1],Ce[2],0,ye[0],ye[1],ye[2],0,_e[0],_e[1],_e[2],0,se[0],se[1],se[2],1]})(G);bt(M,M,[H,H,H*L]),ct(M,M,[-T[0],-T[1],-T[2]]);let ne=Pe([],_.globeMatrix,ie);return Pe(ne,ne,M),Pe(ne,ne,g),ne})(c,s,l);if(u>0){let g=(function(_,b){let C=b.worldSize,T=he(1,0)*C*Re(b.center.lat,b.zoom)/QF(C),A=he(1,b.center.lat)*C,D=te([]);Oi(D,D,Le(b.center.lng)),ci(D,D,Le(b.center.lat)),ct(D,D,[0,0,f]),bt(D,D,[T,T,T*A]);let M=b.point;return ct(D,D,[-M.x,-M.y,0]),Pe(D,D,_),Pe(D,b.globeMatrix,D)})(c,s);return(function(_,b,C){let T=(F,j,H)=>{let G=hs(F),ie=hs(j),ne=rf(F,j,H);return Rr(ne,ne,1/hs(ne)*Ti(G,ie,H))},A=T([_[0],_[1],_[2]],[b[0],b[1],b[2]],C),D=T([_[4],_[5],_[6]],[b[4],b[5],b[6]],C),M=T([_[8],_[9],_[10]],[b[8],b[9],b[10]],C),L=rf([_[12],_[13],_[14]],[b[12],b[13],b[14]],C);return[A[0],A[1],A[2],0,D[0],D[1],D[2],0,M[0],M[1],M[2],0,L[0],L[1],L[2],1]})(h,g,u)}return h}function SH(c,s,l,u){let h=ki.projectAabbCorners(u,l),g=Number.MAX_VALUE,_=-1;for(let T=0;Tnew It(h[T][0],h[T][1]),C;switch(_){case 0:case 6:C=[b(1),b(5),b(4),b(7),b(3),b(2),b(1)];break;case 1:case 7:C=[b(0),b(4),b(5),b(6),b(2),b(3),b(0)];break;case 3:case 5:C=[b(1),b(0),b(4),b(7),b(6),b(2),b(1)];break;default:C=[b(1),b(5),b(6),b(7),b(3),b(0),b(1)]}if(Xl(c,C))return g}let _y=64,qb={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function EH(c,s,l,u,h,g,_,b,C,T=!1){let A=l.zoom,D=l.project(u),M=Re(u.lat,A),L=1/M;te(c),ct(c,c,[D.x+_[0]*L,D.y+_[1]*L,_[2]]);let F=1,j=1,H=l.worldSize;if(T){if(l.projection.name==="mercator"){let se=0;l.elevation&&(se=l.elevation.getAtPointOrZero(new Ze(D.x/H,D.y/H),0));let _e=$a([],[D.x,D.y,se,1],l.projMatrix)[3]/l.cameraToCenterDistance;F=_e,j=_e*Re(l.center.lat,A)}else if(l.projection.name==="globe"){let se=CN(c,l),_e=[0,0,0,1];$a(_e,_e,Pe([],l.projMatrix,se));let ye=_e[3]/l.cameraToCenterDistance,Ce=qm(A),De=l.projection.pixelsPerMeter(u.lat,H)*Re(u.lat,A),Me=l.projection.pixelsPerMeter(l.center.lat,H)*Re(l.center.lat,A);F=ye/Ti(De,je(l.center.lat),Ce),j=ye*M/De,F*=Me,j*=Me}}else F=L;bt(c,c,[F,F,j]);let G=[...c],ie=s.orientation,ne=[];if(TH(ne,[ie[0]+h[0],ie[1]+h[1],ie[2]+h[2]],g),Pe(c,G,ne),b&&l.elevation){let se=0,_e=[];if(C&&l.elevation){se=(function(Ce,De,Me,lt,Ne){let dt=De.elevation;if(!dt)return 0;let vt=ki.projectAabbCorners(Me,lt),ut=he(1,Ne.lat)*De.worldSize,ft=(function(Ot,pi){let Bi=[0,0,1],Ut=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(let li of Ut){let Ai=Ot[li.corners[0]],$i=Ot[li.corners[1]],ln=Ot[li.corners[2]],Wi=[$i[0]-Ai[0],$i[1]-Ai[1],pi*($i[2]-Ai[2])],ii=Mo(Wi,Wi,[ln[0]-Ai[0],ln[1]-Ai[1],pi*(ln[2]-Ai[2])]);Fr(ii,ii),li.dotProductWithUp=_o(ii,Bi)}return Ut.sort((li,Ai)=>li.dotProductWithUp-Ai.dotProductWithUp),Ut[0].corners})(vt,ut),Ct=vt[ft[0]],ot=vt[ft[1]],gt=vt[ft[2]],We=vt[ft[3]],Ge=dt.getAtPointOrZero(new Ze(Ct[0]/De.worldSize,Ct[1]/De.worldSize),0),Tt=dt.getAtPointOrZero(new Ze(ot[0]/De.worldSize,ot[1]/De.worldSize),0),xt=dt.getAtPointOrZero(new Ze(gt[0]/De.worldSize,gt[1]/De.worldSize),0),mi=dt.getAtPointOrZero(new Ze(We[0]/De.worldSize,We[1]/De.worldSize),0),Kt=(Ge+mi)/2,ni=(Tt+xt)/2;return Kt>ni?Tt=s.gl.NEAREST_MIPMAP_NEAREST}),c.uploaded=!0,c.image=null)}function wse(c,s,l){c.indexBuffer=s.createIndexBuffer(c.indexArray,!1,!0),c.vertexBuffer=s.createVertexBuffer(c.vertexArray,mse.members,!1,!0),c.normalArray&&(c.normalBuffer=s.createVertexBuffer(c.normalArray,vse.members,!1,!0)),c.texcoordArray&&(c.texcoordBuffer=s.createVertexBuffer(c.texcoordArray,yse.members,!1,!0)),c.colorArray&&(c.colorBuffer=s.createVertexBuffer(c.colorArray,(c.colorArray.bytesPerElement===12?gse:_se).members,!1,!0)),c.featureArray&&(c.pbrBuffer=s.createVertexBuffer(c.featureArray,xse.members,!0)),c.segments=co.simpleSegment(0,0,c.vertexArray.length,c.indexArray.length);let u=c.material;u.pbrMetallicRoughness.baseColorTexture&&DI(u.pbrMetallicRoughness.baseColorTexture,s),u.pbrMetallicRoughness.metallicRoughnessTexture&&DI(u.pbrMetallicRoughness.metallicRoughnessTexture,s),u.normalTexture&&DI(u.normalTexture,s),u.occlusionTexture&&DI(u.occlusionTexture,s,l),u.emissionTexture&&DI(u.emissionTexture,s)}function IN(c,s,l){if(c.meshes)for(let u of c.meshes)wse(u,s,l);if(c.children)for(let u of c.children)IN(u,s,l)}function Tk(c){if(c.meshes)for(let s of c.meshes)s.indexArray.destroy(),s.vertexArray.destroy(),s.colorArray&&s.colorArray.destroy(),s.normalArray&&s.normalArray.destroy(),s.texcoordArray&&s.texcoordArray.destroy(),s.featureArray&&s.featureArray.destroy();if(c.children)for(let s of c.children)Tk(s)}function TN(c){if(c.meshes)for(let l of c.meshes)l.vertexBuffer&&(l.vertexBuffer.destroy(),l.indexBuffer.destroy(),l.normalBuffer&&l.normalBuffer.destroy(),l.texcoordBuffer&&l.texcoordBuffer.destroy(),l.colorBuffer&&l.colorBuffer.destroy(),l.pbrBuffer&&l.pbrBuffer.destroy(),l.segments.destroy(),l.material&&((s=l.material).pbrMetallicRoughness.baseColorTexture&&s.pbrMetallicRoughness.baseColorTexture.gfxTexture&&s.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),s.pbrMetallicRoughness.metallicRoughnessTexture&&s.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&s.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),s.normalTexture&&s.normalTexture.gfxTexture&&s.normalTexture.gfxTexture.destroy(),s.emissionTexture&&s.emissionTexture.gfxTexture&&s.emissionTexture.gfxTexture.destroy(),s.occlusionTexture&&s.occlusionTexture.gfxTexture&&s.occlusionTexture.gfxTexture.destroy()));var s;if(c.children)for(let l of c.children)TN(l)}function yy(c,s){let l=c.json.bufferViews[s.bufferView],u=xk[s.componentType];return new u(c.buffers[l.buffer],(s.byteOffset||0)+(l.byteOffset||0),s.count*(l.byteStride&&l.byteStride!==EI[s.type]*u.BYTES_PER_ELEMENT?l.byteStride/u.BYTES_PER_ELEMENT:EI[s.type]))}function SN(c,s,l,u){let h=xk[s.componentType],g=(function(A){switch(A){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}})(h),_=c.json.bufferViews[s.bufferView],b=_.byteStride?_.byteStride/h.BYTES_PER_ELEMENT:EI[s.type],C=l.float32,T=C.length/l.capacity;for(let A=0,D=0;A0){for(let H=0;H0){g.texcoordArray=new jm;let M=s.json.accessors[h.TEXCOORD_0];g.texcoordArray.resize(M.count);let L=yy(s,M);SN(s,M,g.texcoordArray,L)}if(h._FEATURE_ID_RGBA4444!==void 0){let M=s.json.accessors[h._FEATURE_ID_RGBA4444];s.json.extensionsUsed&&s.json.extensionsUsed.includes("EXT_meshopt_compression")&&(g.featureData=yy(s,M))}h._FEATURE_RGBA4444!==void 0&&(g.featureData=new Uint32Array(yy(s,s.json.accessors[h._FEATURE_RGBA4444]).buffer));let D=c.material;return g.material=(function(M,L){let{emissiveFactor:F=[0,0,0],alphaMode:j="OPAQUE",alphaCutoff:H=.5,normalTexture:G,occlusionTexture:ie,emissiveTexture:ne,doubleSided:se}=M,{baseColorFactor:_e=[1,1,1,1],metallicFactor:ye=1,roughnessFactor:Ce=1,baseColorTexture:De,metallicRoughnessTexture:Me}=M.pbrMetallicRoughness||{},lt=ie?L[ie.index]:void 0;if(ie&&ie.extensions&&ie.extensions.KHR_texture_transform&<){let Ne=ie.extensions.KHR_texture_transform;lt.offsetScale=[Ne.offset[0],Ne.offset[1],Ne.scale[0],Ne.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new er(..._e),metallicFactor:ye,roughnessFactor:Ce,baseColorTexture:De?L[De.index]:void 0,metallicRoughnessTexture:Me?L[Me.index]:void 0},doubleSided:se,emissiveFactor:new er(...F),alphaMode:j,alphaCutoff:H,normalTexture:G?L[G.index]:void 0,occlusionTexture:lt,emissionTexture:ne?L[ne.index]:void 0,defined:M.defined===void 0}})(D!==void 0?s.json.materials[D]:{defined:!1},l),g}function AH(c,s,l){let{matrix:u,rotation:h,translation:g,scale:_,mesh:b,extras:C,children:T}=c,A={};if(A.matrix=u||(function(D,M,L,F){var j=M[0],H=M[1],G=M[2],ie=M[3],ne=j+j,se=H+H,_e=G+G,ye=j*ne,Ce=j*se,De=j*_e,Me=H*se,lt=H*_e,Ne=G*_e,dt=ie*ne,vt=ie*se,ut=ie*_e,ft=F[0],Ct=F[1],ot=F[2];return D[0]=(1-(Me+Ne))*ft,D[1]=(Ce+ut)*ft,D[2]=(De-vt)*ft,D[3]=0,D[4]=(Ce-ut)*Ct,D[5]=(1-(ye+Ne))*Ct,D[6]=(lt+dt)*Ct,D[7]=0,D[8]=(De+vt)*ot,D[9]=(lt-dt)*ot,D[10]=(1-(ye+Me))*ot,D[11]=0,D[12]=L[0],D[13]=L[1],D[14]=L[2],D[15]=1,D})([],h||[0,0,0,1],g||[0,0,0],_||[1,1,1]),b!==void 0){A.meshes=l[b];let D=A.anchor=[0,0];for(let M of A.meshes){let{min:L,max:F}=M.aabb;D[0]+=L[0]+F[0],D[1]+=L[1]+F[1]}D[0]=Math.floor(D[0]/A.meshes.length/2),D[1]=Math.floor(D[1]/A.meshes.length/2)}if(C&&(C.id&&(A.id=C.id),C.lights&&(A.lights=(function(D){if(!D.length)return[];let M=(function(G){let ie=atob(G),ne=new Uint8Array(ie.length);for(let se=0;se1&&u[u.length-1].equals(u[0])&&u.pop();let h=0;for(let _=0;_0&&u.reverse();let g=Vb(u.flatMap(_=>[_.x,_.y]),[]);return g.length===0?null:{vertices:u,indices:g}}function Sse(c,s){let l=[],u=[],h=0,g=[];for(let _ of c){h=l.length;let b=_.vertexArray.float32,C=_.indexArray.uint16;for(let T=0;T<_.vertexArray.length;T++)g[0]=b[3*T+0],g[1]=b[3*T+1],g[2]=b[3*T+2],wo(g,g,s),l.push(new It(g[0],g[1]));for(let T=0;T<3*_.indexArray.length;T++)u.push(C[T]+h)}if(u.length%3!=0)return null;for(let _=0;_0&&([u[_+1],u[_+2]]=[u[_+2],u[_+1]])}return{vertices:l,indices:u}}function DH(c){let s=(function(C,T){let A=[],D=WebGL2RenderingContext;if(C.json.textures)for(let M of C.json.textures){let L={magFilter:D.LINEAR,minFilter:D.NEAREST,wrapS:D.REPEAT,wrapT:D.REPEAT};M.sampler!==void 0&&Object.assign(L,C.json.samplers[M.sampler]),A.push({image:T[M.source],sampler:L,uploaded:!1})}return A})(c,c.images),l=(function(C,T){let A=[];for(let D of C.json.meshes){let M=[];for(let L of D.primitives)M.push(Cse(L,C,T));A.push(M)}return A})(c,s),{scenes:u,scene:h,nodes:g}=c.json,_=u?u[h||0].nodes:[...g.keys()],b=[];for(let C of _)b.push(AH(g[C],c,l));return(function(C,T,A){let D={},M=new Set;for(let L=0;L0){let L=Array.from(M.values()).sort((F,j)=>F-j);for(let F=L.length-1;F>=0;F--)C.splice(L[F],1)}})(b,_,c.json.nodes),b}function Ese(c){c.heightmap=new Float32Array(4096),c.heightmap.fill(-1);let s=c.vertexArray.float32,l=c.aabb.min[0]-1,u=c.aabb.min[1]-1,h=_y/(c.aabb.max[0]-l+2),g=_y/(c.aabb.max[1]-u+2);for(let _=0;_c.heightmap[T*_y+C]&&(c.heightmap[T*_y+C]=b)}}function kH(c,s,l,u,h){l.reserve(l.length+4*c.length),u.reserve(u.length+10*c.length),h.reserve(h.length+10*c.length);let g=u.length;for(let _ of c){let b=Math.min(10,Math.max(4,1.3*_.height))*s,C=[-_.normal[1],_.normal[0],0],T=Math.min(.29,.1*_.width/_.depth),A=_.width-2*_.depth*s*(T+.01),D=Ss([],_.pos,C,A/2),M=Ss([],_.pos,C,-A/2),L=[D[0],D[1],D[2]+_.height],F=[M[0],M[1],M[2]+_.height],j=Ss([],_.normal,C,T);Rr(j,j,b);let H=Ss([],_.normal,C,-T);Rr(H,H,b),Mr(j,D,j),Mr(H,M,H),D[2]+=.1,M[2]+=.1,u.emplaceBack(j[0],j[1],j[2]),u.emplaceBack(H[0],H[1],H[2]),u.emplaceBack(D[0],D[1],D[2]),u.emplaceBack(M[0],M[1],M[2]),u.emplaceBack(L[0],L[1],L[2]),u.emplaceBack(F[0],F[1],F[2]),u.emplaceBack(D[0],D[1],D[2]),u.emplaceBack(M[0],M[1],M[2]),u.emplaceBack(j[0],j[1],j[2]),u.emplaceBack(H[0],H[1],H[2]);let G=A/b/2;h.emplaceBack(-G-T,-1,G,.8),h.emplaceBack(G+T,-1,G,.8),h.emplaceBack(-G,0,G,1.3),h.emplaceBack(G,0,G,1.3),h.emplaceBack(G+T,-.8,G,.7),h.emplaceBack(G+T,-.8,G,.7),h.emplaceBack(0,0,G,1.3),h.emplaceBack(0,0,G,1.3),h.emplaceBack(G+T,-1.2,G,.8),h.emplaceBack(G+T,-1.2,G,.8),l.emplaceBack(6+g,4+g,8+g),l.emplaceBack(7+g,9+g,5+g),l.emplaceBack(0+g,1+g,2+g),l.emplaceBack(1+g,3+g,2+g),g+=10}}function Ase(c,s){let l={};l.indexArray=new ps,l.vertexArray=new ul,l.colorArray=new Xc,kH(c,s,l.indexArray,l.vertexArray,l.colorArray);let u={defined:!0};u.emissiveFactor=er.black;let h={};return h.baseColorFactor=er.white,u.pbrMetallicRoughness=h,l.material=u,l.aabb=new ki([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),l}let MH=xn([{name:"a_pos_3f",components:3,type:"Float32"}]),Dse=xn([{name:"a_normal_3",components:3,type:"Int16"}]),kse=xn([{name:"a_centroid_3",components:3,type:"Int16"}]),RH=xn([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),Mse=xn([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),Rse=xn([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),Ose=xn([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),Pse=xn([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),OH=_t.types,EN=32767;function Lse(c,s){let l=Pt+s;for(let u of c)for(let h of u)if(h.x<-s||h.x>l||h.y<-s||h.y>l)return!1;return!0}class PH{constructor(){this.layoutVertexArray=new ul,this.layoutAttenuationArray=new Xc,this.layoutColorArray=new es,this.indexArray=new ps,this.indexArrayForConflation=new ps,this.segmentsBucket=new co}}class AN{constructor(){this.layoutVertexArray=new ul,this.layoutNormalArray=new Xp,this.layoutCentroidArray=new Xp,this.layoutColorArray=new es,this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.layoutAOArray=[],this.indexArray=new ps,this.indexArrayForConflation=new ps,this.segmentsBucket=new co,this.entranceBloom=new PH}}class LH{constructor(s){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.featuresOnBorder=[],this.buildingFeatures=[],this.buildingWithoutFacade=new AN,this.buildingWithFacade=new AN,this.indexArrayForConflationUploaded=!1,this.footprintLookup={},this.zoom=s.zoom,this.canonical=s.canonical,this.layers=s.layers,this.layerIds=this.layers.map(l=>l.fqid),this.index=s.index,this.hasPattern=!1,this.worldview=s.worldview,this.lut=s.lut,this.buildingWithFacade.layoutFacadePaintArray=new es,this.buildingWithFacade.layoutFacadeDataArray=new zm,this.buildingWithFacade.layoutFacadeVerticalRangeArray=new es,this.programConfigurations=new Jc(s.layers,{zoom:s.zoom,lut:s.lut}),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.projection=s.projection,this.groundEffect=new hN(s)}updateFootprints(s,l){for(let u of this.footprints)l.push({footprint:u,id:s})}prepare(){return(function(){if(bk!=null||pH!=null)return null;if($b!=null)return $b;let s=fetch(Sa.BUILDING_GEN_URL);return $b=(function(l){let u,h,g,_;function b(){u=new Uint8Array(_.buffer),h=new Int32Array(_.buffer),g=new Float32Array(_.buffer)}function C(){throw new Error("Unexpected BuildingGen error.")}let T=()=>{},A={a:{a:C,f:function(D){let M=u.length,L=Math.max(D>>>0,Math.ceil(1.2*M)),F=Math.ceil((L-M)/65536);try{return _.grow(F),b(),!0}catch{return!1}},g:C,b:T,c:T,d:T,e:T}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(l,A):l.then(D=>D.arrayBuffer()).then(D=>WebAssembly.instantiate(D,A))).then(D=>{let M=D.instance.exports;return(0,M.g)(),_=M.f,b(),new lse({setStyle:M.h,setAOOptions:M.i,setMetricOptions:M.j,setStructuralOptions:M.k,setFacadeOptions:M.l,setFauxFacadeOptions:M.m,setFacadeClassifierOptions:M.n,addFeature:M.o,addFacade:M.p,generateMesh:M.q,getLastError:M.r,getOuterRingLength:M.s,getMeshCount:M.t,getPositionsPtr:M.u,getPositionsLength:M.v,getNormalsPtr:M.w,getNormalsLength:M.x,getColorsPtr:M.y,getColorsLength:M.z,getAOPtr:M.A,getAOLength:M.B,getUVPtr:M.C,getUVLength:M.D,getFauxFacadePtr:M.E,getFauxFacadeLength:M.F,getIndicesPtr:M.G,getIndicesLength:M.H,getBuildingPart:M.I,getRingCount:M.J,getRingPtr:M.K,getRingLength:M.L,free:M.M,malloc:M.N,heapU8:u,heap32:h,heapF32:g})})})(s).then(l=>($b=null,bk=l,bk)).catch(l=>{vn("Could not load building-gen"),$b=null,pH=l}),$b})()}populate(s,l,u,h){let g=cse();if(!g)return;let _=Be(u);this.tileToMeter=_,this.brightness=l.brightness,g.setStyle({convertToMeters:!1,entranceColorRgb:[1,1,1],facadeGlazingColorRgb:[.5607843137254902,.6745098039215687,.7215686274509804],normalScale:[1,-1,_],ridgeHeight:3,roofColorRgb:[.886274516,.784313738,.713725507],tileToMeters:_,tileZoom:16,wallColorRgb:[.988235294,.933333337,.811764717]}),g.setAOOptions(!1,.3),g.setMetricOptions(!1,16),g.setStructuralOptions(!0),g.setFacadeClassifierOptions(3);let b=new Map;for(let{feature:C}of s){if(OH[C.type]!=="LineString")continue;let T=this.layers[0]._featureFilter.needGeometry,A=wt(C,T);if(!this.layers[0]._featureFilter.filter(new Nr(this.zoom),A,u))continue;let D=T?A.geometry:Gt(C,u,h),M=[];for(let H of D)for(let G of H)M.push({x:G.x,y:G.y});let L={coordinates:M,crossPerc:C.properties.cross_perc,distanceToRoad:C.properties.distance_to_road,entrances:C.properties.entrances,sourceId:0},F=C.properties.source_id,j=b.get(F);j||(j=[],b.set(F,j)),j.push(L)}this.maxHeight=0;for(let{feature:C,index:T}of s){if(OH[C.type]==="LineString")continue;let A=this.layers[0]._featureFilter.needGeometry,D=wt(C,A);if(!this.layers[0]._featureFilter.filter(new Nr(this.zoom),D,u))continue;let M=A?D.geometry:Gt(C,u,h),L=yI(M,500);if(!Lse(M,163))continue;let F=this.layers[0],j=F.layout.get("building-base").evaluate(C,{},u),H=F.layout.get("building-height").evaluate(C,{},u),G=F.layout.get("building-roof-shape").evaluate(C,{},u),ie=F.paint.get("building-ambient-occlusion-intensity"),ne=F.paint.get("building-ambient-occlusion-ground-radius")/this.tileToMeter;if(G==="flat")continue;let se=F.layout.get("building-facade").evaluate(C,{},u);g.setFacadeOptions(4,!0),g.setFauxFacadeOptions(se,!1,1);let _e=C.properties.source_id,ye;ye=b.has(_e)?b.get(_e):[];let Ce=0,De=0,Me=0,lt=0,Ne=0,dt=0;if(se){let ii=Math.round(F.layout.get("building-facade-floors").evaluate(C,{},u));if(j===0){ii=Math.max(1,ii-(ye.length>0?1:0));let An=4;if(H>100){let le=[10,13,15];An=le[C.id?C.id%le.length:0],g.setFacadeOptions(An,!0)}Ne=1.6803*An/_}else Ne=j/_;dt=H/_,Ne=Math.min(Ne,dt),Me=F.layout.get("building-facade-unit-width").evaluate(C,{},u)/_,lt=(dt-Ne)/ii,g.setFauxFacadeOptions(!0,!0,Me);let qi=F.layout.get("building-facade-window").evaluate(C,{},u);Ce=qi[0],De=qi[1]}let vt=[],ut=new It(1/0,1/0),ft=new It(-1/0,-1/0),Ct=new It(0,0),ot=0;for(let ii of L)if(ii.length>0){let qi=[];for(let An of ii){let le=[];for(let ce=An.length-1;ce>=0;ce--){let qe=An[ce];le.push({x:qe.x,y:qe.y}),ut.x=Math.min(ut.x,qe.x),ut.y=Math.min(ut.y,qe.y),ft.x=Math.max(ft.x,qe.x),ft.y=Math.max(ft.y,qe.y),Ct.x+=qe.x,Ct.y+=qe.y,ot++}qi.push(le)}vt.push({id:C.id?C.id:0,height:H,minHeight:j,sourceId:0,roofType:G,coordinates:qi})}Ct.x/=ot||1,Ct.y/=ot||1;let gt=g.generateMesh(vt,ye);if(typeof gt=="string"){vn(`Unable to generate building ${C.id}: ${gt}`);continue}if(gt.meshes.length===0||gt.modifiedPolygonRings.length===0)continue;let We=0;for(let ii of gt.meshes)We+=ii.positions.length/3;let Ge=se?this.buildingWithFacade:this.buildingWithoutFacade,Tt=Ge.segmentsBucket.prepareSegment(We,Ge.layoutVertexArray,Ge.indexArray),xt=[],mi=null,Kt=0,ni=-1,Ot=Ge.indexArray.length,pi=0;for(let ii of gt.meshes){let qi=Ge.layoutVertexArray.length;if(ii.buildingPart==="entrance"){let at=new Array;for(let vi=0;viPt||ut.y<0||ft.y>Pt)&&this.featuresOnBorder.push({featureId:C.id,footprintIndex:this.footprints.length});{let ii=Vb(Ut,null,2),qi=new hk(li,ii,8,256),An=C.id;C.properties&&C.properties.hasOwnProperty("building_id")&&(An=C.properties.building_id),this.footprints.push({vertices:li,indices:ii,grid:qi,min:Ai,max:$i,buildingId:An,hiddenFlags:0,indicesOffset:Ot,indicesLength:Bi,bloomIndicesOffset:Kt,bloomIndicesLength:ni,groundEffectVertexOffset:ln,groundEffectVertexLength:Wi,hasFauxFacade:se,segment:Tt,height:pi})}this.programConfigurations.populatePaintArrays(Ge.layoutVertexArray.length,C,T,{},l.availableImages,u,l.brightness),this.groundEffect.addPaintPropertiesData(C,T,{},l.availableImages,u,l.brightness)}this.groundEffect.prepareBorderSegments(),this.evaluate(this.layers[0],{})}update(s,l,u,h,g,_,b){this.programConfigurations.updatePaintArrays(s,l,g,u,h,_,b),this.groundEffect.update(s,l,g,u,h,_,b),this.evaluate(this.layers[0],s),this.colorBufferUploaded=!1}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(s){let l=u=>{u.layoutVertexBuffer=s.createVertexBuffer(u.layoutVertexArray,MH.members),u.layoutNormalBuffer=s.createVertexBuffer(u.layoutNormalArray,Dse.members),u.layoutCentroidBuffer=s.createVertexBuffer(u.layoutCentroidArray,kse.members),u.layoutFacadeDataArray&&u.layoutFacadeDataArray.length&&(u.layoutFacadeDataBuffer=s.createVertexBuffer(u.layoutFacadeDataArray,Rse.members)),u.layoutFacadeVerticalRangeArray&&u.layoutFacadeVerticalRangeArray.length&&(u.layoutFacadeVerticalRangeBuffer=s.createVertexBuffer(u.layoutFacadeVerticalRangeArray,Ose.members)),u.entranceBloom.layoutVertexArray.length&&(u.entranceBloom.layoutVertexBuffer=s.createVertexBuffer(u.entranceBloom.layoutVertexArray,MH.members),u.entranceBloom.layoutAttenuationBuffer=s.createVertexBuffer(u.entranceBloom.layoutAttenuationArray,Pse.members)),this.uploadUpdatedColorBuffer(s),this.uploadUpdatedIndexBuffer(s)};this.uploaded||(l(this.buildingWithoutFacade),l(this.buildingWithFacade),this.groundEffect.upload(s)),this.groundEffect.uploadPaintProperties(s),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){let s=l=>{l.layoutVertexBuffer&&(l.layoutVertexBuffer.destroy(),l.layoutNormalBuffer.destroy(),l.layoutColorBuffer.destroy(),l.segmentsBucket.destroy(),l.indexBuffer&&l.indexBuffer.destroy(),l.entranceBloom.layoutVertexBuffer&&(l.entranceBloom.layoutVertexBuffer.destroy(),l.entranceBloom.layoutColorBuffer.destroy(),l.entranceBloom.layoutAttenuationBuffer.destroy(),l.entranceBloom.indexBuffer.destroy(),l.entranceBloom.segmentsBucket.destroy()))};s(this.buildingWithoutFacade),s(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(s,l,u=!0){let h=!1,g=u?l:0,_=0|(u?-1:~l);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(let b of s){let C=this.footprints[b],T=C.hiddenFlags&_|g;C.hiddenFlags!==T&&(C.hiddenFlags=T,h=!0,this.groundEffect.updateHiddenByLandmarkRange(C.groundEffectVertexOffset,C.groundEffectVertexLength,C.hiddenFlags!==0))}return h&&(this.indexArrayForConflationUploaded=!1),h}uploadUpdatedIndexBuffer(s){if(this.groundEffect.uploadHiddenByLandmark(s),this.indexArrayForConflationUploaded)return;let l=h=>{h.indexArray.length!==0&&(h.indexArrayForConflation.resize(h.indexArray.length),h.indexArrayForConflation.uint16.set(h.indexArray.uint16),h.entranceBloom.indexArrayForConflation.resize(h.entranceBloom.indexArray.length),h.entranceBloom.indexArrayForConflation.uint16.set(h.entranceBloom.indexArray.uint16))};l(this.buildingWithoutFacade),l(this.buildingWithFacade);for(let h of this.footprints){let g=h.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,_=h.indicesOffset+h.indicesLength;if(h.hiddenFlags!==0){for(let C=h.indicesOffset;C<_;C++)g.indexArrayForConflation.uint16[3*C+0]=0,g.indexArrayForConflation.uint16[3*C+1]=0,g.indexArrayForConflation.uint16[3*C+2]=0;let b=h.bloomIndicesOffset+h.bloomIndicesLength;for(let C=h.bloomIndicesOffset;C{h.indexArray.length!==0&&(h.indexBuffer?h.indexBuffer.updateData(h.indexArrayForConflation):h.indexBuffer=s.createIndexBuffer(h.indexArrayForConflation,!0),h.entranceBloom.indexBuffer?h.entranceBloom.indexBuffer.updateData(h.entranceBloom.indexArrayForConflation):h.entranceBloom.indexBuffer=s.createIndexBuffer(h.entranceBloom.indexArrayForConflation,!0))};u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(s){let l=u=>{u.layoutColorBuffer?u.layoutColorBuffer.updateData(u.layoutColorArray):u.layoutColorBuffer=s.createVertexBuffer(u.layoutColorArray,RH.members,!0),u.layoutFacadePaintArray&&(u.layoutFacadePaintBuffer?u.layoutFacadePaintBuffer.updateData(u.layoutFacadePaintArray):u.layoutFacadePaintBuffer=s.createVertexBuffer(u.layoutFacadePaintArray,Mse.members,!0)),u.entranceBloom.layoutColorBuffer?u.entranceBloom.layoutColorBuffer.updateData(u.entranceBloom.layoutColorArray):u.entranceBloom.layoutColorBuffer=s.createVertexBuffer(u.entranceBloom.layoutColorArray,RH.members,!0)};l(this.buildingWithoutFacade),l(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(s,l){let u=s.paint.get("building-ambient-occlusion-intensity");for(let h of this.buildingFeatures){let g=l[h.feature.id],_=h.feature;_.properties["building-part"]="roof";let b=s.paint.get("building-color").evaluate(_,g,this.canonical).toPremultipliedRenderColor(this.lut),C=s.paint.get("building-emissive-strength").evaluate(_,g,this.canonical);_.properties["building-part"]="wall";let T=s.paint.get("building-color").evaluate(_,g,this.canonical).toPremultipliedRenderColor(this.lut),A=s.paint.get("building-emissive-strength").evaluate(_,g,this.canonical);_.properties["building-part"]="window";let D=s.paint.get("building-color").evaluate(_,g,this.canonical).toPremultipliedRenderColor(this.lut),M=s.paint.get("building-emissive-strength").evaluate(_,g,this.canonical);_.properties["building-part"]="door";let L=s.paint.get("building-color").evaluate(_,g,this.canonical).toPremultipliedRenderColor(this.lut),F=s.paint.get("building-emissive-strength").evaluate(_,g,this.canonical),j=h.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(let G of h.parts){let ie,ne=b;G.part==="roof"?(ne=b,ie=C):G.part==="wall"?(ne=T,ie=A):G.part==="facade_glazing"?(ne=D,ie=M):G.part==="entrance"&&(ne=L,ie=F),ie=ve(ie,0,1);for(let se=0;se_.max.x||C.max.x<_.min.x||C.min.y>_.max.y||C.max.y<_.min.y||(g.length=0,Fse(C.vertices,0,C.vertices.length,_.footprintTileId.canonical,s.canonical,g),lN(_.footprint,g,C.indices,0,C.indices.length,0,-b)&&(C.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(let _ of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(_.groundEffectVertexOffset,_.groundEffectVertexLength,_.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getHeightAtTileCoord(s,l){let u=Number.NEGATIVE_INFINITY,h=!0,g=4*(s+Pt)*Pt+(l+Pt);if(this.footprintLookup.hasOwnProperty(g)){let b=this.footprintLookup[g];return b?{height:b.height,hidden:b.hiddenFlags!==0}:void 0}let _=new It(s,l);for(let b of this.footprints)s>b.max.x||b.min.x>s||l>b.max.y||b.min.y>l||b.height<=u||cN(_,b)&&(u=b.height,this.footprintLookup[g]=b,h=b.hiddenFlags!==0);if(u!==Number.NEGATIVE_INFINITY)return{height:u,hidden:h};this.footprintLookup[g]=void 0}}function Fse(c,s,l,u,h,g){let _=Math.pow(2,u.z-h.z);for(let b=0;b1&&(C=s[++b]);let A=Math.abs(T-C.left),D=Math.abs(T-C.right),M=Math.min(A,D),L,F=g/u*(h+1);if(C.isDash){let j=h-Math.abs(F);L=Math.sqrt(M*M+j*j)}else L=h-Math.sqrt(M*M+F*F);this.image.data[_+T]=Math.max(0,Math.min(255,L+128))}}}addRegularDash(s,l){for(let C=s.length-1;C>=0;--C){let T=s[C],A=s[C+1];T.zeroLength?s.splice(C,1):A&&A.isDash===T.isDash&&(A.left=T.left,s.splice(C,1))}let u=s[0],h=s[s.length-1];u.isDash===h.isDash&&(u.left=h.left-this.width,h.right=u.right+this.width);let g=this.width*this.nextRow,_=0,b=s[_];for(let C=0;C1&&(b=s[++_]);let T=Math.abs(C-b.left),A=Math.abs(C-b.right),D=Math.min(T,A);this.image.data[g+C]=Math.max(0,Math.min(255,(b.isDash?D:-D)+l+128))}}addDash(s,l){let u=this.getKey(s,l);if(this.positions[u])return this.positions[u];let h=l==="round",g=h?7:0,_=2*g+1;if(this.nextRow+_>this.height)return vn("LineAtlas out of space"),null;s.length===0&&s.push(1);let b=0;for(let A=0;Al.fqid),this.index=s.index,this.projection=s.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(l=>{this.gradients[l.id]={}}),this.layoutVertexArray=new Ab,this.layoutVertexArray2=new ul,this.patternVertexArray=new ul,this.indexArray=new ps,this.programConfigurations=new Jc(s.layers,{zoom:s.zoom,lut:s.lut}),this.segments=new co,this.maxLineLength=0,this.zOffsetVertexArray=new ul,this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.tessellationStep=s.tessellationStep?s.tessellationStep:Pt/64,this.worldview=s.worldview}updateFootprints(s,l){}populate(s,l,u,h){this.hasPattern=iN("line",this.layers,this.pixelRatio,l);let g=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Be(u);let _=this.layers[0].layout.get("line-elevation-reference");if(_==="hd-road-markup")this.elevationType="road";else{let M=this.layers[0].layout.get("line-z-offset"),L=M.isConstant()&&!M.constantOr(0);this.elevationType=_!=="sea"&&_!=="ground"&&L?"none":"offset",this.elevationType==="offset"&&_==="none"&&vn(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}let b=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&b!==void 0;let C=[];for(let{feature:M,id:L,index:F,sourceLayerIndex:j}of s){let H=this.layers[0]._featureFilter.needGeometry,G=wt(M,H);if(!this.layers[0]._featureFilter.filter(new Nr(this.zoom,{worldview:this.worldview}),G,u))continue;let ie=g?g.evaluate(G,{},u):void 0,ne={id:L,properties:M.properties,type:M.type,sourceLayerIndex:j,index:F,geometry:H?G.geometry:Gt(M,u,h),patterns:{},sortKey:ie};C.push(ne)}g&&C.sort((M,L)=>M.sortKey-L.sortKey);let{lineAtlas:T,featureIndex:A}=l,D=this.addConstantDashes(T);for(let M of C){let{geometry:L,index:F,sourceLayerIndex:j}=M;if(D&&this.addFeatureDashes(M,T),this.hasPattern){let H=nN("line",this.layers,M,this.zoom,this.pixelRatio,l);this.patternFeatures.push(H)}else this.addFeature(M,L,F,u,T.positions,l.availableImages,l.brightness,l.elevationFeatures);A.insert(s[F].feature,L,F,j,this.index)}}addConstantDashes(s){let l=!1;for(let u of this.layers){let h=u.paint.get("line-dasharray").value,g=u.layout.get("line-cap").value;if(h.kind!=="constant"||g.kind!=="constant")l=!0;else{let _=g.value,b=h.value;if(!b)continue;s.addDash(b,_)}}return l}addFeatureDashes(s,l){let u=this.zoom;for(let h of this.layers){let g=h.paint.get("line-dasharray").value,_=h.layout.get("line-cap").value;if(g.kind==="constant"&&_.kind==="constant")continue;let b,C;if(g.kind==="constant"){if(b=g.value,!b)continue}else b=g.evaluate({zoom:u},s);C=_.kind==="constant"?_.value:_.evaluate({zoom:u},s),l.addDash(b,C),s.patterns[h.id]=[l.getKey(b,C)]}}update(s,l,u,h,g,_,b,C){this.programConfigurations.updatePaintArrays(s,l,g,u,h,_,b,C)}addFeatures(s,l,u,h,g,_){for(let b of this.patternFeatures)this.addFeature(b,b.geometry,b.index,l,u,h,_)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(s){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=s.createVertexBuffer(this.layoutVertexArray2,Use)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=s.createVertexBuffer(this.patternVertexArray,Hse)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=s.createVertexBuffer(this.zOffsetVertexArray,Bse.members,!0)),this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,zse),this.indexBuffer=s.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(s),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(s,l){let u,h;if(l&&l>0?(u=`mapbox_clip_start_${l}`,h=`mapbox_clip_end_${l}`):(u="mapbox_clip_start",h="mapbox_clip_end"),s.properties&&s.properties.hasOwnProperty(u)&&s.properties.hasOwnProperty(h))return{start:+s.properties[u],end:+s.properties[h]}}addFeature(s,l,u,h,g,_,b,C){let T=this.layers[0].layout,A=T.get("line-join").evaluate(s,{}),D=T.get("line-cap").evaluate(s,{}),M=T.get("line-miter-limit"),L=T.get("line-round-limit");this.lineClips=this.lineFeatureClips(s),this.lineFeature=s;let F=!(!s.properties||!s.properties.hasOwnProperty("mapbox_line_metrics"))&&s.properties.mapbox_line_metrics;this.zOffsetValue=T.get("line-z-offset").value;let j=this.layers[0].paint.get("line-width").value;if(j.kind!=="constant"&&j.isLineProgressConstant===!1&&(this.variableWidthValue=j),this.elevationType==="road"){let H=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(s,l,h,C,A,D,M,L)){let[G,ie]=this.clipRuntimeLinesToTile(l,1);for(let ne=0;ne0?_e.parentIndex:null)}this.fillNonElevatedRoadSegment(H)}}else for(let H=0;H0?H:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,s,u,g,_,h,b,void 0,this.worldview)}computeSegNextDir(s,l){return s.nextPoint.sub(l.at(-2)).unit()}computeSegPrevDir(s,l){return l[1].sub(s.prevPoint).unit()}clipLinesToTile(s,l){return _k(s,-l,-l,Pt+l,Pt+l)}clipRuntimeLinesToTile(s,l){let u=[];return[_k(s,-l,-l,Pt+l,Pt+l,u),u]}addElevatedRoadFeature(s,l,u,h,g,_,b,C){let T=[],A=so.getElevationFeature(s,h);if(A){let D=this.clipLinesToTile(l,1),M=this.prepareElevatedLines(D,A,u);for(let L of M)T.push({geometry:L,elevation:A,elevationTileID:u,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(T.length===0)return!1;for(let D of T){let M=this.layoutVertexArray.length;this.addLine(D.geometry,s,u,g,_,b,C);let L=new Uo(u,D.elevationTileID);if(D.elevation)for(let F=M;F>1,this.layoutVertexArray.int16[6*F+1]>>1),H=L.pointElevation(j,D.elevation,.05);this.updateHeightRange(H),this.zOffsetVertexArray.emplaceBack(H,0,0)}else this.fillNonElevatedRoadSegment(M)}return!0}prepareElevatedLines(s,l,u){if(l.constantHeight!=null)return s;let h=[],g=1/Be(u);for(let _ of s)ose(_,new nr(l,g),0,h);return h}fillNonElevatedRoadSegment(s){for(let l=s;l0,M=C&&C.progress.max<1;if(this.lineClips){let Me={min:this.lineClips.start,max:this.lineClips.end},lt=1;if(C){let vt=this.lineClips.end-this.lineClips.start;Me=(function(ut,ft,Ct){return{min:fu(ut.min,ft,Ct),max:fu(ut.max,ft,Ct)}})(C.progress,{min:0,max:1},Me),vt>0&&(lt=(Me.max-Me.min)/vt)}let Ne=+l.properties.mapbox_clip_feature_len,dt=+l.properties.mapbox_clip_seg_len;if(Number.isNaN(Ne)||Number.isNaN(dt)){for(let ut=0;ut=2&&s[F-1].equals(s[F-2]);)F--;let j=0;for(;j0,We=this.overscaling<=16?15*Pt/(512*this.overscaling):0;if(lt&&Ne==="round"){if(ft_&&(Ne="bevel"),Ne==="bevel"&&(ft>2&&(Ne="flipbevel"),ft<_&&(Ne="miter")),ie&&!(Ne==="miter"&&ot)&&this.updateDistance(ie,G),Ne==="miter")if(ot){let Ge=G.dist(ie);if(Ge>2*We){let xt=G.sub(G.sub(ie)._mult(We/Ge)._round());this.updateDistance(ie,xt),this.addCurrentVertex(xt,se,0,0,H,De),ie=xt}this.updateDistance(ie,G),vt._mult(ft),this.addCurrentVertex(G,vt,0,0,H,De);let Tt=G.dist(ne);if(Tt>2*We){let xt=G.add(ne.sub(G)._mult(We/Tt)._round());this.updateDistance(G,xt),this.addCurrentVertex(xt,_e,0,0,H,De),G=xt}}else vt._mult(ft),this.addCurrentVertex(G,vt,0,0,H,De);else if(Ne==="flipbevel"){if(ft>100)vt=_e.mult(-1);else{let Ge=ft*se.add(_e).mag()/se.sub(_e).mag();vt._perp()._mult(Ge*(gt?-1:1))}this.addCurrentVertex(G,vt,0,0,H,De),this.addCurrentVertex(G,vt.mult(-1),0,0,H,De)}else if(Ne==="bevel"||Ne==="fakeround"){De!=null&&ie&&this.addCurrentVertex(G,Ce||se,-1,-1,H,De);let Ge=G.dist(ie)<=2*We&&Ne!=="bevel",Tt=vt.mult(gt?1:-1);Tt._mult(ft);let xt=_e.mult(gt?-1:1),mi=se.mult(gt?-1:1),Kt=this.evaluateLineProgressFeatures(this.distance);if(De==null&&(this.addHalfVertex(G,Tt.x,Tt.y,!1,!gt,0,H,Kt),Ge||this.addHalfVertex(G,Tt.x+2*mi.x,Tt.y+2*mi.y,!1,gt,0,H,Kt)),Ne==="fakeround"){let ni=Math.round(180*Ct/Math.PI/20);this.addHalfVertex(G,mi.x,mi.y,!1,gt,0,H,Kt);for(let Ot=0;Ot1){this.lineSoFar=s.w;let j=(l.x-s.x)/D,H=(l.y-s.y)/D,G=(l.z-s.z)/D,ie=(l.w-s.w)/D;for(let ne=1;ne=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,A),C.primitiveLength++),_?this.e2=A:this.e1=A,T!=null&&this.zOffsetVertexArray.emplaceBack(T.zOffset,T.variableWidth,T.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(s,l){this.prevDistance=this.distance,this.distance+=s.dist(l),this.updateScaledDistance()}}function kN(c,s,l){return c.xl||c.yl}let zH,VH;function UH(c,s,l){return s*(Pt/(c.tileSize*Math.pow(2,l-c.tileID.overscaledZ)))}Qt(DN,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});let jH=(c,s,l)=>(1-l)*c+l*s;function HH(c,s){return 1/UH(c,1,s.tileZoom)}function GH(c,s,l,u){return c.translatePosMatrix(u||s.tileID.projMatrix,s,l.paint.get("line-translate"),l.paint.get("line-translate-anchor"))}let $H=c=>{let s=[];qH(c)&&s.push("RENDER_LINE_DASH"),c.paint.get("line-gradient")&&s.push("RENDER_LINE_GRADIENT");let l=c.paint.get("line-trim-offset");l[0]===0&&l[1]===0||s.push("RENDER_LINE_TRIM_OFFSET"),c.paint.get("line-border-width").constantOr(1)!==0&&s.push("RENDER_LINE_BORDER");let u=c.layout.get("line-join").constantOr("miter")==="none",h=!!c.paint.get("line-pattern").constantOr(1);return u&&h&&s.push("LINE_JOIN_NONE"),s};function qH(c){let s=c.paint.get("line-dasharray").value;return s.kind!=="constant"||s.value}let MN,WH=()=>MN||(MN={layout:zH||(zH=new yo({"line-cap":new Ht(Fe.layout_line["line-cap"]),"line-join":new Ht(Fe.layout_line["line-join"]),"line-miter-limit":new St(Fe.layout_line["line-miter-limit"]),"line-round-limit":new St(Fe.layout_line["line-round-limit"]),"line-sort-key":new Ht(Fe.layout_line["line-sort-key"]),"line-z-offset":new Ht(Fe.layout_line["line-z-offset"]),"line-elevation-reference":new St(Fe.layout_line["line-elevation-reference"]),"line-cross-slope":new St(Fe.layout_line["line-cross-slope"]),visibility:new St(Fe.layout_line.visibility),"line-width-unit":new St(Fe.layout_line["line-width-unit"])})),paint:VH||(VH=new yo({"line-opacity":new Ht(Fe.paint_line["line-opacity"]),"line-color":new Ht(Fe.paint_line["line-color"]),"line-translate":new St(Fe.paint_line["line-translate"]),"line-translate-anchor":new St(Fe.paint_line["line-translate-anchor"]),"line-width":new Ht(Fe.paint_line["line-width"]),"line-gap-width":new Ht(Fe.paint_line["line-gap-width"]),"line-offset":new Ht(Fe.paint_line["line-offset"]),"line-blur":new Ht(Fe.paint_line["line-blur"]),"line-dasharray":new Ht(Fe.paint_line["line-dasharray"]),"line-pattern":new Ht(Fe.paint_line["line-pattern"]),"line-pattern-cross-fade":new St(Fe.paint_line["line-pattern-cross-fade"]),"line-gradient":new Lm(Fe.paint_line["line-gradient"]),"line-trim-offset":new St(Fe.paint_line["line-trim-offset"]),"line-trim-fade-range":new St(Fe.paint_line["line-trim-fade-range"]),"line-trim-color":new St(Fe.paint_line["line-trim-color"]),"line-emissive-strength":new St(Fe.paint_line["line-emissive-strength"]),"line-border-width":new Ht(Fe.paint_line["line-border-width"]),"line-border-color":new Ht(Fe.paint_line["line-border-color"]),"line-occlusion-opacity":new St(Fe.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Ht({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Ht({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Ht({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Ht({type:"string",default:"default","property-type":"data-driven"})}))},MN);class Wse extends Ht{possiblyEvaluate(s,l){return l=new Nr(Math.floor(l.zoom),{now:l.now,fadeDuration:l.fadeDuration,transition:l.transition,worldview:l.worldview}),super.possiblyEvaluate(s,l)}evaluate(s,l,u,h){return l=Object.assign({},l,{zoom:Math.floor(l.zoom)}),super.evaluate(s,l,u,h)}}let kI;function KH(c,s){return s>0?s+2*c:c}let Kse=xn([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Yse=xn([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Zse=xn([{name:"a_projected_pos",components:4,type:"Float32"}],4);xn([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let Qse=xn([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),Xse=xn([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),Jse=xn([{name:"a_texb",components:2,type:"Uint16"}]),eae=xn([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),tae=xn([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);xn([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);let YH=xn([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),iae=xn([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);xn([{name:"triangle",components:3,type:"Uint16"}]),xn([{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"}]),xn([{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"}]),xn([{type:"Float32",name:"offsetX"}]),xn([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var Bs=24;function nae(c,s,l){return c.sections.forEach(u=>{u.text=(function(h,g,_){let b=g.layout.get("text-transform").evaluate(_,{});return b==="uppercase"?h=h.toLocaleUpperCase():b==="lowercase"&&(h=h.toLocaleLowerCase()),Fd.applyArabicShaping&&(h=Fd.applyArabicShaping(h)),h})(u.text,s,l)}),c}let MI={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42","\u2190":"\u2191","\u2192":"\u2193"};function rae(c){return c==="\uFE36"||c==="\uFE48"||c==="\uFE38"||c==="\uFE44"||c==="\uFE42"||c==="\uFE3E"||c==="\uFE3C"||c==="\uFE3A"||c==="\uFE18"||c==="\uFE40"||c==="\uFE10"||c==="\uFE13"||c==="\uFE14"||c==="\uFF40"||c==="\uFFE3"||c==="\uFE11"||c==="\uFE12"}function oae(c){return c==="\uFE35"||c==="\uFE47"||c==="\uFE37"||c==="\uFE43"||c==="\uFE41"||c==="\uFE3D"||c==="\uFE3B"||c==="\uFE39"||c==="\uFE17"||c==="\uFE3F"}let RN=4294967296,ZH=1/RN,QH=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),Sk=class{constructor(c=new Uint8Array(16)){this.buf=ArrayBuffer.isView(c)?c:new Uint8Array(c),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(c,s,l=this.length){for(;this.pos>3,g=this.pos;this.type=7&u,c(h,s,this),this.pos===g&&this.skip(u)}return s}readMessage(c,s){return this.readFields(c,s,this.readVarint()+this.pos)}readFixed32(){let c=this.dataView.getUint32(this.pos,!0);return this.pos+=4,c}readSFixed32(){let c=this.dataView.getInt32(this.pos,!0);return this.pos+=4,c}readFixed64(){let c=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*RN;return this.pos+=8,c}readSFixed64(){let c=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*RN;return this.pos+=8,c}readFloat(){let c=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,c}readDouble(){let c=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,c}readVarint(c){let s=this.buf,l,u;return u=s[this.pos++],l=127&u,u<128?l:(u=s[this.pos++],l|=(127&u)<<7,u<128?l:(u=s[this.pos++],l|=(127&u)<<14,u<128?l:(u=s[this.pos++],l|=(127&u)<<21,u<128?l:(u=s[this.pos],l|=(15&u)<<28,(function(h,g,_){let b=_.buf,C,T;if(T=b[_.pos++],C=(112&T)>>4,T<128||(T=b[_.pos++],C|=(127&T)<<3,T<128)||(T=b[_.pos++],C|=(127&T)<<10,T<128)||(T=b[_.pos++],C|=(127&T)<<17,T<128)||(T=b[_.pos++],C|=(127&T)<<24,T<128)||(T=b[_.pos++],C|=(1&T)<<31,T<128))return Wb(h,C,g);throw new Error("Expected varint not more than 10 bytes")})(l,c,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let c=this.readVarint();return c%2==1?(c+1)/-2:c/2}readBoolean(){return!!this.readVarint()}readString(){let c=this.readVarint()+this.pos,s=this.pos;return this.pos=c,c-s>=12&&QH?QH.decode(this.buf.subarray(s,c)):(function(l,u,h){let g="",_=u;for(;_239?4:b>223?3:b>191?2:1;if(_+M>h)break;M===1?b<128&&(D=b):M===2?(C=l[_+1],(192&C)==128&&(D=(31&b)<<6|63&C,D<=127&&(D=null))):M===3?(C=l[_+1],T=l[_+2],(192&C)==128&&(192&T)==128&&(D=(15&b)<<12|(63&C)<<6|63&T,(D<=2047||D>=55296&&D<=57343)&&(D=null))):M===4&&(C=l[_+1],T=l[_+2],A=l[_+3],(192&C)==128&&(192&T)==128&&(192&A)==128&&(D=(15&b)<<18|(63&C)<<12|(63&T)<<6|63&A,(D<=65535||D>=1114112)&&(D=null))),D===null?(D=65533,M=1):D>65535&&(D-=65536,g+=String.fromCharCode(D>>>10&1023|55296),D=56320|1023&D),g+=String.fromCharCode(D),_+=M}return g})(this.buf,s,c)}readBytes(){let c=this.readVarint()+this.pos,s=this.buf.subarray(this.pos,c);return this.pos=c,s}readPackedVarint(c=[],s){let l=this.readPackedEnd();for(;this.pos127;);else if(s===2)this.pos=this.readVarint()+this.pos;else if(s===5)this.pos+=4;else{if(s!==1)throw new Error(`Unimplemented type: ${s}`);this.pos+=8}}writeTag(c,s){this.writeVarint(c<<3|s)}realloc(c){let s=this.length||16;for(;s268435455||c<0?(function(s,l){let u,h;if(s>=0?(u=s%4294967296|0,h=s/4294967296|0):(u=~(-s%4294967296),h=~(-s/4294967296),4294967295^u?u=u+1|0:(u=0,h=h+1|0)),s>=18446744073709552e3||s<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");l.realloc(10),(function(g,_,b){b.buf[b.pos++]=127&g|128,g>>>=7,b.buf[b.pos++]=127&g|128,g>>>=7,b.buf[b.pos++]=127&g|128,g>>>=7,b.buf[b.pos++]=127&g|128,b.buf[b.pos]=127&(g>>>=7)})(u,0,l),(function(g,_){let b=(7&g)<<4;_.buf[_.pos++]|=b|((g>>>=3)?128:0),g&&(_.buf[_.pos++]=127&g|((g>>>=7)?128:0),g&&(_.buf[_.pos++]=127&g|((g>>>=7)?128:0),g&&(_.buf[_.pos++]=127&g|((g>>>=7)?128:0),g&&(_.buf[_.pos++]=127&g|((g>>>=7)?128:0),g&&(_.buf[_.pos++]=127&g)))))})(h,l)})(c,this):(this.realloc(4),this.buf[this.pos++]=127&c|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=c>>>7&127))))}writeSVarint(c){this.writeVarint(c<0?2*-c-1:2*c)}writeBoolean(c){this.writeVarint(+c)}writeString(c){c=String(c),this.realloc(4*c.length),this.pos++;let s=this.pos;this.pos=(function(u,h,g){for(let _,b,C=0;C55295&&_<57344){if(!b){_>56319||C+1===h.length?(u[g++]=239,u[g++]=191,u[g++]=189):b=_;continue}if(_<56320){u[g++]=239,u[g++]=191,u[g++]=189,b=_;continue}_=b-55296<<10|_-56320|65536,b=null}else b&&(u[g++]=239,u[g++]=191,u[g++]=189,b=null);_<128?u[g++]=_:(_<2048?u[g++]=_>>6|192:(_<65536?u[g++]=_>>12|224:(u[g++]=_>>18|240,u[g++]=_>>12&63|128),u[g++]=_>>6&63|128),u[g++]=63&_|128)}return g})(this.buf,c,this.pos);let l=this.pos-s;l>=128&&XH(s,l,this),this.pos=s-1,this.writeVarint(l),this.pos+=l}writeFloat(c){this.realloc(4),this.dataView.setFloat32(this.pos,c,!0),this.pos+=4}writeDouble(c){this.realloc(8),this.dataView.setFloat64(this.pos,c,!0),this.pos+=8}writeBytes(c){let s=c.length;this.writeVarint(s),this.realloc(s);for(let l=0;l=128&&XH(l,u,this),this.pos=l-1,this.writeVarint(u),this.pos+=u}writeMessage(c,s,l){this.writeTag(c,2),this.writeRawMessage(s,l)}writePackedVarint(c,s){s.length&&this.writeMessage(c,sae,s)}writePackedSVarint(c,s){s.length&&this.writeMessage(c,aae,s)}writePackedBoolean(c,s){s.length&&this.writeMessage(c,dae,s)}writePackedFloat(c,s){s.length&&this.writeMessage(c,lae,s)}writePackedDouble(c,s){s.length&&this.writeMessage(c,cae,s)}writePackedFixed32(c,s){s.length&&this.writeMessage(c,uae,s)}writePackedSFixed32(c,s){s.length&&this.writeMessage(c,hae,s)}writePackedFixed64(c,s){s.length&&this.writeMessage(c,pae,s)}writePackedSFixed64(c,s){s.length&&this.writeMessage(c,fae,s)}writeBytesField(c,s){this.writeTag(c,2),this.writeBytes(s)}writeFixed32Field(c,s){this.writeTag(c,5),this.writeFixed32(s)}writeSFixed32Field(c,s){this.writeTag(c,5),this.writeSFixed32(s)}writeFixed64Field(c,s){this.writeTag(c,1),this.writeFixed64(s)}writeSFixed64Field(c,s){this.writeTag(c,1),this.writeSFixed64(s)}writeVarintField(c,s){this.writeTag(c,0),this.writeVarint(s)}writeSVarintField(c,s){this.writeTag(c,0),this.writeSVarint(s)}writeStringField(c,s){this.writeTag(c,2),this.writeString(s)}writeFloatField(c,s){this.writeTag(c,5),this.writeFloat(s)}writeDoubleField(c,s){this.writeTag(c,1),this.writeDouble(s)}writeBooleanField(c,s){this.writeVarintField(c,+s)}};function Wb(c,s,l){return l?4294967296*s+(c>>>0):4294967296*(s>>>0)+(c>>>0)}function XH(c,s,l){let u=s<=16383?1:s<=2097151?2:s<=268435455?3:Math.floor(Math.log(s)/(7*Math.LN2));l.realloc(u);for(let h=l.pos-1;h>=c;h--)l.buf[h+u]=l.buf[h]}function sae(c,s){for(let l=0;l=0&&u>=s&&Ek[this.text.charCodeAt(u)];u--)l--;this.text=this.text.substring(s,l),this.sectionIndex=this.sectionIndex.slice(s,l)}substring(s,l){let u=new Kb;return u.text=this.text.substring(s,l),u.sectionIndex=this.sectionIndex.slice(s,l),u.sections=this.sections,u}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((s,l)=>Math.max(s,this.sections[l].scale),0)}addTextSection(s,l){this.text+=s.text,this.sections.push(RI.forText(s.scale,s.fontStack||l));let u=this.sections.length-1;for(let h=0;h=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function PN(c,s,l,u,h,g,_,b,C,T,A,D,M,L,F,j=1){let H=Kb.fromFeature(c,h,j);D===tc.vertical&&H.verticalizePunctuation(M);let G=[],ie=(function(Ce,De,Me,lt,Ne,dt){if(!Ce)return[];let vt=[],ut=(function(gt,We,Ge,Tt,xt,mi){let Kt=0;for(let ni=0;ni=0,Ct=0;for(let gt=0;gt0&&Br>Wi&&(Wi=Br)}else{let io=Me[ce.fontStack];if(!io)continue;io[at]&&(Xt=io[at]);let rn=De[ce.fontStack];if(!rn)continue;let Br=rn.glyphs[at];if(!Br)continue;if(zt=Br.metrics,cn=at!==8203?Bs:0,mi){let pr=rn.ascender!==void 0?Math.abs(rn.ascender):0,Bn=rn.descender!==void 0?Math.abs(rn.descender):0,jr=(pr+Bn)*Vt;ii-l/2;){if(_--,_<0)return!1;b-=c[_].dist(g),g=c[_]}b+=c[_].dist(c[_+1]),_++;let C=[],T=0;for(;bu;)T-=C.shift().angleDelta;if(T>h)return!1;_++,b+=A.dist(D)}return!0}function h9(c){let s=0;for(let l=0;lT){let F=(T-C)/L,j=Ti(D.x,M.x,F),H=Ti(D.y,M.y,F),G=new sf(j,H,0,M.angleTo(D),A);return!_||u9(c,G,b,_,s)?G:void 0}C+=L}}function wae(c,s,l,u,h,g,_,b,C){let T=p9(u,g,_),A=f9(u,h),D=A*_,M=c[0].x===0||c[0].x===C||c[0].y===0||c[0].y===C;return s-D=0&&se=0&&_e=0&&M+T<=A){let ye=new sf(se,_e,0,ie,F);u&&!u9(c,ye,g,u,h)||L.push(ye)}}D+=G}return b||L.length||_||(L=m9(c,D/2,l,u,h,g,_,!0,C)),L}function g9(c){let s=0,l=0;for(let _ of c)s+=_.w*_.h,l=Math.max(l,_.w);c.sort((_,b)=>b.h-_.h);let u=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(s/.95)),l),h:1/0}],h=0,g=0;for(let _ of c)for(let b=u.length-1;b>=0;b--){let C=u[b];if(!(_.w>C.w||_.h>C.h)){if(_.x=C.x,_.y=C.y,g=Math.max(g,_.y+_.h),h=Math.max(h,_.x+_.w),_.w===C.w&&_.h===C.h){let T=u.pop();T&&b1?F-1:F,ca.copy(D.data,T,{x:0,y:0},{x:j,y:H},D.data,u),ca.copy(D.data,T,{x:0,y:ie-F},{x:j,y:H-F},{width:G,height:F},u),ca.copy(D.data,T,{x:0,y:0},{x:j,y:H+ie},{width:G,height:F},u),ca.copy(D.data,T,{x:G-F,y:0},{x:j-F,y:H},{width:F,height:ie},u),ca.copy(D.data,T,{x:0,y:0},{x:j+G,y:H},{width:F,height:ie},u),ca.copy(D.data,T,{x:G-F,y:ie-F},{x:j-F,y:H-F},{width:F,height:F},u),ca.copy(D.data,T,{x:0,y:ie-F},{x:j+G,y:H-F},{width:F,height:F},u),ca.copy(D.data,T,{x:0,y:0},{x:j+G,y:H+ie},{width:F,height:F},u),ca.copy(D.data,T,{x:G-F,y:0},{x:j-F,y:H+ie},{width:F,height:F},u)}this.lut=u,this.image=T,this.iconPositions=h,this.patternPositions=g}addImages(s,l,u,h){for(let[g,_]of s.entries()){let{bin:b,imagePosition:C,imageVariant:T}=NN(g,_,u);l.set(g,C),h.push(b),_.hasRenderCallback&&this.haveRenderCallbacks.push(T.id)}}patchUpdatedImages(s,l,u){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(h=>s.hasImage(h,u)),s.dispatchRenderCallbacks(this.haveRenderCallbacks,u);for(let h of s.getUpdatedImages(u)){for(let g of this.iconPositions.keys()){let _=Yc.parse(g);if(Wl.isEqual(_.id,h)){let b=s.getImage(h,u);this.patchUpdatedImage(this.iconPositions.get(g),b,l,null)}}for(let g of this.patternPositions.keys()){let _=Yc.parse(g);if(Wl.isEqual(_.id,h)){let b=s.getImage(h,u);this.patchUpdatedImage(this.patternPositions.get(g),b,l,this.lut)}}}}patchUpdatedImage(s,l,u,h=null){if(!s||!l||s.version===l.version)return;s.version=l.version;let[g,_]=s.tl,b=s.sdf;if(this.lut||b){let C={width:l.data.width,height:l.data.height},T=new ca(C);ca.copy(l.data,T,{x:0,y:0},{x:0,y:0},C,h,b),u.update(T,{position:{x:g,y:_}})}else u.update(l.data,{position:{x:g,y:_}})}}Qt(PI,"ImagePosition"),Qt(_9,"ImageAtlas");let LI=1e20;function y9(c,s,l,u,h,g,_,b,C){for(let T=s;T-1);C++,g[C]=b,_[C]=T,_[C+1]=LI}for(let b=0,C=0;b{let C=this.entries[g];C||(C=this.entries[g]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let T=C.glyphs[_];if(T!==void 0)return void b(null,{stack:g,id:_,glyph:T});if(T=this._tinySDF(C,g,_),T)return C.glyphs[_]=T,void b(null,{stack:g,id:_,glyph:T});let A=Math.floor(_/256);if(256*A>65535)return vn("glyphs > 65535 not supported"),void b(null,{stack:g,id:_,glyph:T});if(C.ranges[A])return void b(null,{stack:g,id:_,glyph:T});let D=C.requests[A];D||(D=C.requests[A]=[],Yb.loadGlyphRange(g,A,h,this.requestManager,(M,L)=>{if(L){C.ascender=L.ascender,C.descender=L.descender;for(let F in L.glyphs)this._doesCharSupportLocalGlyph(+F)||(C.glyphs[+F]=L.glyphs[+F]);C.ranges[A]=!0}for(let F of D)F(M,L);delete C.requests[A]})),D.push((M,L)=>{M?b(M):L&&b(null,{stack:g,id:_,glyph:L.glyphs[_]||null})})},(g,_)=>{if(g)l(g);else if(_){let b={};for(let{stack:C,id:T,glyph:A}of _)b[C]===void 0&&(b[C]={}),b[C].glyphs===void 0&&(b[C].glyphs={}),b[C].glyphs[T]=A&&{id:A.id,bitmap:A.bitmap.clone(),metrics:A.metrics},b[C].ascender=this.entries[C].ascender,b[C].descender=this.entries[C].descender;l(null,b)}})}_doesCharSupportLocalGlyph(s){return this.localGlyphMode!==BN.none&&(this.localGlyphMode===BN.all?!!this.localFontFamily:!!this.localFontFamily&&(Ii["CJK Unified Ideographs"](s)||Ii["Hangul Syllables"](s)||Ii.Hiragana(s)||Ii.Katakana(s)||Ii["CJK Symbols and Punctuation"](s)||Ii["CJK Unified Ideographs Extension A"](s)||Ii["CJK Unified Ideographs Extension B"](s)||Ii.Osage(s)))}_tinySDF(s,l,u){let h=this.localFontFamily;if(!h||!this._doesCharSupportLocalGlyph(u))return;let g=s.tinySDF;if(!g){let j="400";/bold/i.test(l)?j="900":/medium/i.test(l)?j="500":/light/i.test(l)&&(j="200"),g=s.tinySDF=new Yb.TinySDF({fontFamily:h,fontWeight:j,fontSize:24*Tu,buffer:3*Tu,radius:8*Tu}),g.fontWeight=j}if(this.localGlyphs[g.fontWeight][u])return this.localGlyphs[g.fontWeight][u];let _=String.fromCodePoint(u),{data:b,width:C,height:T,glyphWidth:A,glyphHeight:D,glyphLeft:M,glyphTop:L,glyphAdvance:F}=g.draw(_);return this.localGlyphs[g.fontWeight][u]={id:u,bitmap:new Wm({width:C,height:T},b),metrics:{width:A/Tu,height:D/Tu,left:M/Tu,top:L/Tu-27,advance:F/Tu,localGlyph:!0}}}}Yb.loadGlyphRange=function(c,s,l,u,h){let g=256*s,_=g+255,b=u.transformRequest(u.normalizeGlyphsURL(l).replace("{fontstack}",c).replace("{range}",`${g}-${_}`),kv.Glyphs);gm(b,(C,T)=>{if(C)h(C);else if(T){let A={},D=(function(M){return new Sk(M).readFields(mae,{})})(T);for(let M of D.glyphs)A[M.id]=M;h(null,{glyphs:A,ascender:D.ascender,descender:D.descender})}})},Yb.TinySDF=class{constructor({fontSize:c=24,buffer:s=3,radius:l=8,cutoff:u=.25,fontFamily:h="sans-serif",fontWeight:g="normal",fontStyle:_="normal",lang:b=null}={}){this.buffer=s,this.cutoff=u,this.radius=l,this.lang=b;let C=this.size=c+4*s,T=this._createCanvas(C),A=this.ctx=T.getContext("2d",{willReadFrequently:!0});A.font=`${_} ${g} ${c}px ${h}`,A.textBaseline="alphabetic",A.textAlign="left",A.fillStyle="black",this.gridOuter=new Float64Array(C*C),this.gridInner=new Float64Array(C*C),this.f=new Float64Array(C),this.z=new Float64Array(C+1),this.v=new Uint16Array(C)}_createCanvas(c){let s=document.createElement("canvas");return s.width=s.height=c,s}draw(c){let{width:s,actualBoundingBoxAscent:l,actualBoundingBoxDescent:u,actualBoundingBoxLeft:h,actualBoundingBoxRight:g}=this.ctx.measureText(c),_=Math.ceil(l),b=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(g-h))),C=Math.min(this.size-this.buffer,_+Math.ceil(u)),T=b+2*this.buffer,A=C+2*this.buffer,D=Math.max(T*A,0),M=new Uint8ClampedArray(D),L={data:M,width:T,height:A,glyphWidth:b,glyphHeight:C,glyphTop:_,glyphLeft:0,glyphAdvance:s};if(b===0||C===0)return L;let{ctx:F,buffer:j,gridInner:H,gridOuter:G}=this;this.lang&&(F.lang=this.lang),F.clearRect(j,j,b,C),F.fillText(c,j,j+_);let ie=F.getImageData(j,j,b,C);G.fill(LI,0,D),H.fill(0,0,D);for(let ne=0;ne0?Ce*Ce:0,H[ye]=Ce<0?Ce*Ce:0}}y9(G,0,0,T,A,T,this.f,this.v,this.z),y9(H,j,j,b,C,T,this.f,this.v,this.z);for(let ne=0;ne{let ft=Dk(Ne.stretch-ie,ne,A,c.left*h),Ct=kk(Ne.fixed-ye,Ce,Ne.stretch,F),ot=Dk(dt.stretch-se,_e,D,c.top*h),gt=kk(dt.fixed-De,Me,dt.stretch,j),We=Dk(vt.stretch-ie,ne,A,c.left*h),Ge=kk(vt.fixed-ye,Ce,vt.stretch,F),Tt=Dk(ut.stretch-se,_e,D,c.top*h),xt=kk(ut.fixed-De,Me,ut.stretch,j),mi=new It(ft,ot),Kt=new It(We,ot),ni=new It(We,Tt),Ot=new It(ft,Tt),pi=new It(Ct/b,gt/b),Bi=new It(Ge/b,xt/b),Ut=s*Math.PI/180;if(Ut){let ii=Math.sin(Ut),qi=Math.cos(Ut),An=[qi,-ii,ii,qi];mi._matMult(An),Kt._matMult(An),Ot._matMult(An),ni._matMult(An)}let li=Ne.stretch+Ne.fixed,Ai=vt.stretch+vt.fixed,$i=dt.stretch+dt.fixed,ln=ut.stretch+ut.fixed,Wi=c.imageSecondary;return{tl:mi,tr:Kt,bl:Ot,br:ni,texPrimary:{x:_.paddedRect.x+Zm+li,y:_.paddedRect.y+Zm+$i,w:Ai-li,h:ln-$i},texSecondary:Wi?{x:Wi.paddedRect.x+Zm+li,y:Wi.paddedRect.y+Zm+$i,w:Ai-li,h:ln-$i}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:pi,pixelOffsetBR:Bi,minFontScaleX:Ce/b/A,minFontScaleY:Me/b/D,isSDF:l}};if(u&&(_.stretchX||_.stretchY)){let Ne=w9(M,H,F),dt=w9(L,G,j);for(let vt=0;vtg)&&(g=F.x),(!L||F.y>_)&&(_=F.y)}let C=Math.min(g-u,_-h),T=C/2,A=new Kv([],Tae);if(C===0)return new It(u,h);for(let L=u;LD.d||!D.d)&&(D=L,l&&console.log("found best %d after %d probes",Math.round(1e4*L.d)/1e4,M)),L.max-D.d<=s||(T=L.h/2,A.push(new Zb(L.p.x-T,L.p.y-T,T,c)),A.push(new Zb(L.p.x+T,L.p.y-T,T,c)),A.push(new Zb(L.p.x-T,L.p.y+T,T,c)),A.push(new Zb(L.p.x+T,L.p.y+T,T,c)),M+=4)}return l&&(console.log(`num probes: ${M}`),console.log(`best distance: ${D.d}`)),D.p}function Tae(c,s){return s.max-c.max}class Zb{constructor(s,l,u,h){this.p=new It(s,l),this.h=u,this.d=(function(g,_){let b=!1,C=1/0;for(let T=0;T<_.length;T++){let A=_[T];for(let D=0,M=A.length,L=M-1;Dg.y!=j.y>g.y&&g.x<(j.x-F.x)*(g.y-F.y)/(j.y-F.y)+F.x&&(b=!b),C=Math.min(C,ao(g,F,j))}}return(b?1:-1)*Math.sqrt(C)})(this.p,h),this.max=this.d+this.h*Math.SQRT2}}let Sae=Object.keys,zN=Number.POSITIVE_INFINITY,Eae=Math.sqrt(2);function C9(c,[s,l]){let u=0,h=0;if(l===zN){s<0&&(s=0);let g=s/Eae;switch(c){case"top-right":case"top-left":h=g-7;break;case"bottom-right":case"bottom-left":h=7-g;break;case"bottom":h=7-s;break;case"top":h=s-7}switch(c){case"top-right":case"bottom-right":u=-g;break;case"top-left":case"bottom-left":u=g;break;case"left":u=s;break;case"right":u=-s}}else{switch(s=Math.abs(s),l=Math.abs(l),c){case"top-right":case"top-left":case"top":h=l-7;break;case"bottom-right":case"bottom-left":case"bottom":h=7-l}switch(c){case"top-right":case"bottom-right":case"right":u=-s;break;case"top-left":case"bottom-left":case"left":u=s}}return[u,h]}function Mk(c,s,l,u,h,g,_,b,C){if(!s||!s.usvg)return;let T=c9(u),A=c9(h),D=g!=="both"&&g!=="width"||!a9(u)?1:A.width/T.width,M=g!=="both"&&g!=="height"||!l9(u)?1:A.height/T.height;l.scaleSelf(D,M);let L=l.toString();_.set(L,l),b.set(L,s);let{imagePosition:F}=NN(L,s,vy);C.set(L,F)}function I9(c,s,l,u,h,g,_,b,C){if(!c)return;let T=(function(A,D,M,L,F,j){if(A.kind==="camera")return A.maxSize;if(A.kind==="composite"){let H=D.possiblyEvaluate(new Nr(A.maxZoom,{worldview:j}),M).evaluate(F,{},M),G=D.possiblyEvaluate(new Nr(A.minZoom,{worldview:j}),M).evaluate(F,{},M);return Math.max(H,G)}return D.possiblyEvaluate(new Nr(L,{worldview:j})).evaluate(F,{},M)})(s,l,u,h,g,C);return c.scaleSelf(T*b*_)}function T9(c,s,l,u,h,g,_,b,C){return{iconPrimary:I9(c.getPrimary(),s,l,u,h,g,_,b,C),iconSecondary:I9(c.getSecondary(),s,l,u,h,g,_,b,C)}}function Aae(c,s,l){if(!s)return;let u=l.get(c.toString()),h=l.get(s.toString());u&&h&&(u.paddedRect.w===h.paddedRect.w&&u.paddedRect.h===h.paddedRect.h||vn(`Mismatch in icon variant sizes: ${c.toString()} and ${s.toString()}`),u.usvg!==h.usvg&&vn(`Mismatch in icon variant image types: ${c.id} and ${s.id}`))}function S9(c,s,l,u){if(!c)return;let h=s.get(l.toString());if(c.imagePrimary=h,u){let g=s.get(u.toString());c.imageSecondary=g}}function Dae(c,s){for(let l in c.horizontal)E9(c.horizontal[l],s);E9(c.vertical,s)}function E9(c,s){if(c){for(let l of c.positionedLines)for(let u of l.positionedGlyphs)if(u.image!==null){let h=u.image.toString();u.rect=s.get(h).paddedRect}}}function VN(c){switch(c){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function kae(c,s,l,u,h,g,_,b,C){let T=UN(g.horizontal)||g.vertical,A=l.get("icon-text-fit-padding").evaluate(u,{},h),D,M=s;return s&&C!=="none"&&(c.allowVerticalPlacement&&g.vertical&&(D=s9(s,g.vertical,C,A,b,_)),T&&(M=s9(s,T,C,A,b,_))),{defaultShapedIcon:M,verticallyShapedIcon:D}}function Mae(c,s,l,u,h,g,_,b,C,T,A,D,M,L,F,j,H,G,ie,ne){let se=_.textMaxSize.evaluate(s,{},M);se===void 0?se=b*_.textScaleFactor:se*=_.textScaleFactor;let _e=c.layers[0].layout,ye=UN(l.horizontal)||l.vertical,Ce=L.name==="globe",De=Bs,Me=c.tilePixelRatio*se/De,lt=(Ct=c.overscaling,c.zoom>18&&Ct>2&&(Ct>>=1),Math.max(Pt/(512*Ct),1)*_e.get("symbol-spacing")),Ne=_e.get("text-padding")*c.tilePixelRatio,dt=_e.get("icon-padding")*c.tilePixelRatio,vt=Le(_e.get("text-max-angle")),ut=_e.get("icon-rotation-alignment")==="map"&&ne!=="point",ft=lt/2;var Ct;c.hasAnyIconTextFit===!1&&H!=="none"&&(c.hasAnyIconTextFit=!0);let ot=s.properties?+s.properties[tn]:null,gt=ot&&c.elevationFeatureIdToIndex?c.elevationFeatureIdToIndex.get(ot):65535,We=(Ge,Tt,xt)=>{if(Tt.x<0||Tt.x>=Pt||Tt.y<0||Tt.y>=Pt)return;let mi=null;if(Ce){let{x:Kt,y:ni,z:Ot}=L.projectTilePoint(Tt.x,Tt.y,xt);mi={anchor:new sf(Kt,ni,Ot,0,void 0),up:L.upVector(xt,Tt.x,Tt.y)}}(function(Kt,ni,Ot,pi,Bi,Ut,li,Ai,$i,ln,Wi,ii,qi,An,le,ce,qe,at,Vt,zt,Xt,vi,cn,dn,on,rr,io,rn,Br){let pr=Kt.addToLineVertexArray(ni,pi),Bn,jr,Hr,Pr,zr,fr,un,_r=0,uo=0,Mi=0,Pn=0,Gr=-1,bo=-1,Zr={},is=Pv(""),wr=Ot?Ot.anchor:ni,qo=rn!=="none",Sl=0,da=0;if($i._unevaluatedLayout.getValue("text-radial-offset")===void 0){let ns=$i.layout.get("text-offset").evaluate(Xt,{},on);Sl=ns[0]*Bs,da=ns[1]*Bs}else Sl=$i.layout.get("text-radial-offset").evaluate(Xt,{},on)*Bs,da=zN;if(Kt.allowVerticalPlacement&&Bi.vertical){let ns=Bi.vertical;if(le)fr=jN(ns),Ai&&(un=jN(Ai));else{let bs=$i.layout.get("text-rotate").evaluate(Xt,{},on)+90;Hr=Rk(ln,wr,ni,Wi,ii,qi,ns,An,bs,ce),Ai&&(Pr=Rk(ln,wr,ni,Wi,ii,qi,Ai,at,bs))}}if(Ut){let ns=Kt.iconSizeData,bs=$i.layout.get("icon-rotate").evaluate(Xt,{},on),ua=x9(Ut,bs,cn,qo,vi.iconScaleFactor),Ja=Ai?x9(Ai,bs,cn,qo,vi.iconScaleFactor):void 0;jr=Rk(ln,wr,ni,Wi,ii,qi,Ut,at,bs,null),_r=4*ua.length;let Da=null;ns.kind==="source"?(Da=[Oh*$i.layout.get("icon-size").evaluate(Xt,{},on)*vi.iconScaleFactor],Da[0]>Qm&&vn(`${Kt.layerIds[0]}: Value for "icon-size" is >= ${FI}. Reduce your "icon-size".`)):ns.kind==="composite"&&(Da=[Oh*vi.compositeIconSizes[0].evaluate(Xt,{},on)*vi.iconScaleFactor,Oh*vi.compositeIconSizes[1].evaluate(Xt,{},on)*vi.iconScaleFactor],(Da[0]>Qm||Da[1]>Qm)&&vn(`${Kt.layerIds[0]}: Value for "icon-size" is >= ${FI}. Reduce your "icon-size".`)),Kt.addSymbols(Kt.icon,ua,Da,zt,Vt,Xt,void 0,Ot,ni,pr.lineStartIndex,pr.lineLength,-1,dn,on,rr,io),Gr=Kt.icon.placedSymbolArray.length-1,Ja&&(uo=4*Ja.length,Kt.addSymbols(Kt.icon,Ja,Da,zt,Vt,Xt,tc.vertical,Ot,ni,pr.lineStartIndex,pr.lineLength,-1,dn,on,rr,io),bo=Kt.icon.placedSymbolArray.length-1)}for(let ns in Bi.horizontal){let bs=ns,ua=Bi.horizontal[bs];Bn||(is=Pv(ua.text),le?zr=jN(ua):Bn=Rk(ln,wr,ni,Wi,ii,qi,ua,An,$i.layout.get("text-rotate").evaluate(Xt,{},on),ce));let Ja=ua.positionedLines.length===1;if(Mi+=A9(Kt,Ot,ni,ua,li,$i,le,Xt,ce,pr,Bi.vertical?tc.horizontal:tc.horizontalOnly,Ja?Sae(Bi.horizontal):[bs],Zr,Gr,vi,dn,on,rr),Ja)break}Bi.vertical&&(Pn+=A9(Kt,Ot,ni,Bi.vertical,li,$i,le,Xt,ce,pr,tc.vertical,["vertical"],Zr,bo,vi,dn,on,rr));let Ys=-1,El=(ns,bs)=>ns?Math.max(ns,bs):bs;Ys=El(zr,Ys),Ys=El(fr,Ys),Ys=El(un,Ys);let Ph=Ys>-1?1:0;Kt.glyphOffsetArray.length>=65535&&vn("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Xt.sortKey!==void 0&&Kt.addToSortKeyRanges(Kt.symbolInstances.length,Xt.sortKey),Kt.symbolInstances.emplaceBack(ni.x,ni.y,wr.x,wr.y,wr.z,Zr.right>=0?Zr.right:-1,Zr.center>=0?Zr.center:-1,Zr.left>=0?Zr.left:-1,Zr.vertical>=0?Zr.vertical:-1,Gr,bo,is,Bn!==void 0?Bn:Kt.collisionBoxArray.length,Bn!==void 0?Bn+1:Kt.collisionBoxArray.length,Hr!==void 0?Hr:Kt.collisionBoxArray.length,Hr!==void 0?Hr+1:Kt.collisionBoxArray.length,jr!==void 0?jr:Kt.collisionBoxArray.length,jr!==void 0?jr+1:Kt.collisionBoxArray.length,Pr||Kt.collisionBoxArray.length,Pr?Pr+1:Kt.collisionBoxArray.length,Wi,Mi,Pn,_r,uo,Ph,0,Sl,da,Ys,0,qo?1:0,Br)})(c,Tt,mi,Ge,l,u,g,h,c.layers[0],c.collisionBoxArray,s.index,s.sourceLayerIndex,c.index,Ne,ie,T,0,dt,ut,G,s,_,A,D,M,F,j,H,gt)};if(ne==="line")for(let Ge of _k(s.geometry,0,0,Pt,Pt)){let Tt=wae(Ge,lt,vt,l.vertical||ye,u,De,Me,c.overscaling,Pt);for(let xt of Tt)ye&&Rae(c,ye.text,ft,xt)||We(Ge,xt,M)}else if(ne==="line-center"){for(let Ge of s.geometry)if(Ge.length>1){let Tt=xae(Ge,vt,l.vertical||ye,u,De,Me);Tt&&We(Ge,Tt,M)}}else if(s.type==="Polygon")for(let Ge of yI(s.geometry,0)){let Tt=Iae(Ge,16);We(Ge[0],new sf(Tt.x,Tt.y,0,0,void 0),M)}else if(s.type==="LineString")for(let Ge of s.geometry)We(Ge,new sf(Ge[0].x,Ge[0].y,0,0,void 0),M);else if(s.type==="Point")for(let Ge of s.geometry)for(let Tt of Ge)We([Tt],new sf(Tt.x,Tt.y,0,0,void 0),M)}let FI=255,Qm=FI*Oh;function A9(c,s,l,u,h,g,_,b,C,T,A,D,M,L,F,j,H,G){let ie=(function(_e,ye,Ce,De,Me,lt,Ne,dt){let vt=[];if(ye.positionedLines.length===0)return vt;let ut=De.layout.get("text-rotate").evaluate(lt,{})*Math.PI/180,ft=(function(Ge){let Tt=Ge[0],xt=Ge[1],mi=Tt*xt;return mi>0?[Tt,-xt]:mi<0?[-Tt,xt]:Tt===0?[xt,Tt]:[xt,-Tt]})(Ce),Ct=Math.abs(ye.top-ye.bottom);for(let Ge of ye.positionedLines)Ct-=Ge.lineOffset;let ot=ye.positionedLines.length,gt=Ct/ot,We=ye.top-Ce[1];for(let Ge=0;GeQm&&vn(`${c.layerIds[0]}: Value for "text-size" is >= ${FI}. Reduce your "text-size".`)):ne.kind==="composite"&&(se=[Oh*F.compositeTextSizes[0].evaluate(b,{},H)*F.textScaleFactor,Oh*F.compositeTextSizes[1].evaluate(b,{},H)*F.textScaleFactor],(se[0]>Qm||se[1]>Qm)&&vn(`${c.layerIds[0]}: Value for "text-size" is >= ${FI}. Reduce your "text-size".`)),c.addSymbols(c.text,ie,se,C,_,b,A,s,l,T.lineStartIndex,T.lineLength,L,j,H,G,!1);for(let _e of D)M[_e]=c.text.placedSymbolArray.length-1;return 4*ie.length}function UN(c){for(let s in c)return c[s];return null}function Rk(c,s,l,u,h,g,_,b,C,T){let A=_.top,D=_.bottom,M=_.left,L=_.right;if(o9(_)&&_.collisionPadding){let F=_.collisionPadding;M-=F[0],A-=F[1],L+=F[2],D+=F[3]}if(C){let F=new It(M,A),j=new It(L,A),H=new It(M,D),G=new It(L,D),ie=Le(C),ne=new It(0,0);T&&(ne=new It(T[0],T[1])),F._rotateAround(ie,ne),j._rotateAround(ie,ne),H._rotateAround(ie,ne),G._rotateAround(ie,ne),M=Math.min(F.x,j.x,H.x,G.x),L=Math.max(F.x,j.x,H.x,G.x),A=Math.min(F.y,j.y,H.y,G.y),D=Math.max(F.y,j.y,H.y,G.y)}return c.emplaceBack(s.x,s.y,s.z,l.x,l.y,M,A,L,D,b,u,h,g),c.length-1}function jN(c){o9(c)&&c.collisionPadding&&(c.top-=c.collisionPadding[1],c.bottom+=c.collisionPadding[3]);let s=c.bottom-c.top;return s>0?Math.max(10,s):null}function Rae(c,s,l,u){let h=c.compareText;if(s in h){let g=h[s];for(let _=g.length-1;_>=0;_--)if(u.dist(g[_])ne&&(se(ye,ut,De,Me,dt,vt),se(ut,Ce,dt,vt,lt,Ne))}se(D,M,u,g,h,g),se(M,L,h,g,h,_),se(L,F,h,_,u,_),se(F,D,u,_,u,g),j-=ne,H-=ne,G+=ne,ie+=ne;let _e=1/Math.max(G-j,ie-H);return{scale:_e,x:j*_e,y:H*_e,x2:G*_e,y2:ie*_e,projection:s}}function k9(c,{x:s,y:l},u=0){return new It(((s-u)*c.scale-c.x)*Pt,(l*c.scale-c.y)*Pt)}let Oae=te(new Float32Array(16));class Xm{constructor(s){this.spec=s,this.name=s.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(s,l){return{x:0,y:0,z:0}}unproject(s,l){return new U(0,0)}projectTilePoint(s,l,u){return{x:s,y:l,z:0}}locationPoint(s,l,u,h=!0){return s._coordinatePoint(s.locationCoordinate(l,u),h)}pixelsPerMeter(s,l){return he(1,s)*l}pixelSpaceConversion(s,l,u){return 1}farthestPixelDistance(s){return D9(s,s.pixelsPerMeter)}pointCoordinate(s,l,u,h){let g=s.horizonLineFromTop(!1),_=new It(l,Math.max(g,u));return s.rayIntersectionCoordinate(s.pointRayIntersection(_,h))}pointCoordinate3D(s,l,u){let h=new It(l,u);if(s.elevation)return s.elevation.pointCoordinate(h);{let g=this.pointCoordinate(s,h.x,h.y,0);return[g.x,g.y,g.z]}}isPointAboveHorizon(s,l){if(s.elevation&&s.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(s,l.x,l.y);let u=s.horizonLineFromTop();return l.y0?l<-Qb+u&&(l=-Qb+u):l>Qb-u&&(l=Qb-u);let _=g/Math.pow(Pk(l),h),b=_*Math.sin(h*s),C=g-_*Math.cos(h*s);return b=.5*(b/Math.PI+.5),C=.5*(C/Math.PI+.5),{x:b,y:this.southernCenter?C:1-C,z:0}}unproject(s,l){s=(2*s-.5)*Math.PI,this.southernCenter&&(l=1-l),l=(2*(1-l)-.5)*Math.PI;let{n:u,f:h}=this,g=h-l,_=Math.sign(g),b=Math.sign(u)*Math.sqrt(s*s+g*g),C=Math.atan2(s,Math.abs(g))*_;g*u<0&&(C-=Math.PI*Math.sign(s)*_);let T=ve(q(C/u)+this.center[0],-180,180),A=ve(q(2*Math.atan(Math.pow(h/b,1/u))-Qb),-ge,ge);return new U(T,this.southernCenter?-A:A)}}class M9 extends Xm{constructor(s){super(s),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(s,l){return{x:ae(s),y:fe(l),z:0}}unproject(s,l){let u=me(s),h=pe(l);return new U(u,h)}}let R9=Le(ge);class Bae extends Xm{project(s,l){let u=(l=Le(l))*l,h=u*u;return{x:.5*((s=Le(s))*(.8707-.131979*u+h*(h*(.003971*u-.001529*h)-.013791))/Math.PI+.5),y:1-.5*(l*(1.007226+u*(.015085+h*(.028874*u-.044475-.005916*h)))/Math.PI+1),z:0}}unproject(s,l){s=(2*s-.5)*Math.PI;let u=l=(2*(1-l)-1)*Math.PI,h=25,g=0,_=u*u;do{_=u*u;let T=_*_;g=(u*(1.007226+_*(.015085+T*(.028874*_-.044475-.005916*T)))-l)/(1.007226+_*(.045255+T*(.259866*_-.311325-.005916*11*T))),u=ve(u-g,-R9,R9)}while(Math.abs(g)>1e-6&&--h>0);_=u*u;let b=ve(q(s/(.8707+_*(_*(_*_*_*(.003971-.001529*_)-.013791)-.131979))),-180,180),C=q(u);return new U(b,C)}}let O9=Le(ge);class zae extends Xm{project(s,l){l=Le(l),s=Le(s);let u=Math.cos(l),h=2/Math.PI,g=Math.acos(u*Math.cos(s/2)),_=Math.sin(g)/g,b=.5*(s*h+2*u*Math.sin(s/2)/_)||0,C=.5*(l+Math.sin(l)/_)||0;return{x:.5*(b/Math.PI+.5),y:1-.5*(C/Math.PI+1),z:0}}unproject(s,l){let u=s=(2*s-.5)*Math.PI,h=l=(2*(1-l)-1)*Math.PI,g=25,_=1e-6,b=0,C=0;do{let T=Math.cos(h),A=Math.sin(h),D=2*A*T,M=A*A,L=T*T,F=Math.cos(u/2),j=Math.sin(u/2),H=2*F*j,G=j*j,ie=1-L*F*F,ne=ie?1/ie:0,se=ie?Math.acos(T*F)*Math.sqrt(1/ie):0,_e=.5*(2*se*T*j+2*u/Math.PI)-s,ye=.5*(se*A+h)-l,Ce=.5*ne*(L*G+se*T*F*M)+1/Math.PI,De=ne*(H*D/4-se*A*j),Me=.125*ne*(D*j-se*A*L*H),lt=.5*ne*(M*F+se*G*T)+.5,Ne=De*Me-lt*Ce;b=(ye*De-_e*lt)/Ne,C=(_e*Me-ye*Ce)/Ne,u=ve(u-b,-Math.PI,Math.PI),h=ve(h-C,-O9,O9)}while((Math.abs(b)>_||Math.abs(C)>_)&&--g>0);return new U(q(u),q(h))}}class P9 extends Xm{constructor(s){super(s),this.center=s.center||[0,0],this.parallels=s.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Le(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(s,l){let{scale:u,cosPhi:h}=this;return{x:Le(s)*h*u+.5,y:-Math.sin(Le(l))/h*u+.5,z:0}}unproject(s,l){let{scale:u,cosPhi:h}=this,g=-(l-.5)/u,_=ve(q((s-.5)/u)/h,-180,180),b=Math.asin(ve(g*h,-1,1)),C=ve(q(b),-ge,ge);return new U(_,C)}}class Vae extends M9{constructor(s){super(s),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(s,l,u){let h=hI(s,l,u);return wo(h,h,lk(Mh(u))),{x:h[0],y:h[1],z:h[2]}}locationPoint(s,l,u){let h=P(l.lat,l.lng),g=Fr([],h),_=u?s._centerAltitude+u:s.elevation?s.elevation.getAtPointOrZero(s.locationCoordinate(l),s._centerAltitude):s._centerAltitude;Ss(h,h,g,he(1,0)*Pt*_);let b=te(new Float64Array(16));return Pe(b,s.pixelMatrix,s.globeMatrix),wo(h,h,b),new It(h[0],h[1])}pixelsPerMeter(s,l){return he(1,0)*l}pixelSpaceConversion(s,l,u){let h=he(1,s)*l,g=Ti(he(1,45)*l,h,u);return this.pixelsPerMeter(s,l)/g}createTileMatrix(s,l,u){let h=ZF(Mh(u.canonical));return Pe(new Float64Array(16),s.globeMatrix,h)}createInversionMatrix(s,l){let{center:u}=s,h=lk(Mh(l));return Oi(h,h,Le(u.lng)),ci(h,h,Le(u.lat)),bt(h,h,[s._pixelsPerMercatorPixel,s._pixelsPerMercatorPixel,1]),Float32Array.from(h)}pointCoordinate(s,l,u,h){return rj(s,l,u,!0)||new Ze(0,0)}pointCoordinate3D(s,l,u){let h=this.pointCoordinate(s,l,u,0);return[h.x,h.y,h.z]}isPointAboveHorizon(s,l){return!rj(s,l.x,l.y,!1)}farthestPixelDistance(s){let l=(function(h,g){let _=h.cameraToCenterDistance,b=h._centerAltitude*g,C=h._camera,T=h._camera.forward(),A=Mr([],Rr([],T,-_),[0,0,b]),D=h.worldSize/(2*Math.PI),M=[0,0,-D],L=h.width/h.height,F=Math.tan(h.fovAboveCenter),j=Rr([],C.up(),F),H=Rr([],C.right(),F*L),G=Fr([],Mr([],Mr([],T,j),H)),ie=[],ne;if(new Nn(A,G).closestPointOnSphere(M,D,ie)){let se=Mr([],ie,M),_e=Co([],se,A);ne=Math.cos(h.fovAboveCenter)*hs(_e)}else{let se=Co([],A,M),_e=Co([],M,A);Fr(_e,_e);let ye=hs(se)-D;ne=Math.sqrt(ye*(ye+2*D));let Ce=Math.acos(ne/(D+ye))-Math.acos(_o(T,_e));ne*=Math.cos(Ce)}return 1.01*ne})(s,this.pixelsPerMeter(s.center.lat,s.worldSize)),u=qm(s.zoom);if(u>0){let h=D9(s,he(1,s.center.lat)*s.worldSize),g=s.worldSize/(2*Math.PI),_=Math.max(s.width,s.height)/s.worldSize*Math.PI;return Ti(l,h+g*(1-Math.cos(_)),Math.pow(u,10))}return l}upVector(s,l,u){return hI(l,u,s,1)}upVectorScale(s){return{metersToTile:ok(ak(Mh(s)))}}}function L9(c){let s=c.parallels,l=!!s&&Math.abs(s[0]+s[1])<.01;switch(c.name){case"mercator":return new M9(c);case"equirectangular":return new Fae(c);case"naturalEarth":return new Bae(c);case"equalEarth":return new Lae(c);case"winkelTripel":return new zae(c);case"albers":return l?new P9(c):new Pae(c);case"lambertConformalConic":return l?new P9(c):new Nae(c);case"globe":return new Vae(c)}throw new Error(`Invalid projection name: ${c.name}`)}let Uae=_t.types,jae=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Lk(c,s,l,u,h,g,_,b,C,T,A,D,M){let L=b?Math.min(Qm,Math.round(b[0])):0,F=b?Math.min(Qm,Math.round(b[1])):0;c.emplaceBack(s,l,Math.round(32*u),Math.round(32*h),g,_,(L<<1)+(C?1:0),F,16*T,16*A,256*D,256*M)}function Fk(c,s,l){c.emplaceBack(s,l)}function Nk(c,s,l,u,h,g,_){c.emplaceBack(s,l,u,h,g,_)}let Bk=(c,s,l,u)=>{for(let h=0;h0&&(this.iconTransitioningVertexBuffer=s.createVertexBuffer(this.iconTransitioningVertexArray,Jse.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=s.createVertexBuffer(this.globeExtVertexArray,Yse.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||g)&&(this.zOffsetVertexBuffer=s.createVertexBuffer(this.zOffsetVertexArray,Qse.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=s.createVertexBuffer(this.orientationVertexArray,Xse.members,!0)),this.opacityVertexBuffer.itemSize=1),(u||h)&&this.programConfigurations.upload(s))}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())}}Qt(HN,"SymbolBuffers");class GN{constructor(s,l,u){this.layoutVertexArray=new s,this.layoutAttributes=l,this.indexArray=new u,this.segments=new co,this.collisionVertexArray=new rI,this.collisionVertexArrayExt=new Xc}upload(s){this.layoutVertexBuffer=s.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=s.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=s.createVertexBuffer(this.collisionVertexArray,eae.members,!0),this.collisionVertexBufferExt=s.createVertexBuffer(this.collisionVertexArrayExt,tae.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Qt(GN,"CollisionBuffers");class Vk{constructor(s){this.collisionBoxArray=s.collisionBoxArray,this.zoom=s.zoom,this.overscaling=s.overscaling,this.layers=s.layers,this.layerIds=this.layers.map(_=>_.fqid),this.index=s.index,this.pixelRatio=s.pixelRatio,this.sourceLayerIndex=s.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=te([]),this.placementViewportMatrix=te([]);let l=this.layers[0]._unevaluatedLayout._values;this.worldview=s.worldview,this.textSizeData=d9(this.zoom,l["text-size"],this.worldview),this.iconSizeData=d9(this.zoom,l["icon-size"],this.worldview);let u=this.layers[0].layout,h=u.get("symbol-sort-key"),g=u.get("symbol-z-order");this.lut=s.lut,this.canOverlap=u.get("text-allow-overlap")||u.get("icon-allow-overlap")||u.get("text-ignore-placement")||u.get("icon-ignore-placement"),this.sortFeaturesByKey=g!=="viewport-y"&&h.constantOr(1)!==void 0,this.sortFeaturesByY=(g==="viewport-y"||g==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=u.get("text-writing-mode").map(_=>tc[_]),this.stateDependentLayerIds=this.layers.filter(_=>_.isStateDependent()).map(_=>_.id),this.sourceID=s.sourceID,this.projection=s.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 HN(new Jc(this.layers,{zoom:this.zoom,lut:this.lut},s=>s.startsWith("text")||s.startsWith("symbol"))),this.icon=new HN(new Jc(this.layers,{zoom:this.zoom,lut:this.lut},s=>s.startsWith("icon")||s.startsWith("symbol"))),this.glyphOffsetArray=new ZD,this.lineVertexArray=new QD,this.symbolInstances=new YD}calculateGlyphDependencies(s,l,u,h,g){for(let _ of s){let b=_.codePointAt(0);if(b===void 0)break;if(l[b]=!0,h&&g&&b<=65535){let C=MI[_];C&&(l[C.charCodeAt(0)]=!0)}}}updateFootprints(s,l){}updateReplacement(s,l){if(l.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=l.updateTime;let u=l.getReplacementRegionsForTile(s.toUnwrapped(),!0);return!fk(this.activeReplacements,u)&&(this.activeReplacements=u,!0)}populate(s,l,u,h){let g=this.layers[0],_=g.layout,b=this.projection.name==="globe",C=_.get("text-font"),T=_.get("text-field"),A=_.get("icon-image"),[D,M]=_.get("icon-size-scale-range"),L=ve(l.scaleFactor||1,D,M),F=(T.value.kind!=="constant"||T.value.value instanceof Ka&&!T.value.value.isEmpty()||T.value.value.toString().length>0)&&(C.value.kind!=="constant"||C.value.value.length>0),j=A.value.kind!=="constant"||!!A.value.value||Object.keys(A.parameters).length>0,H=_.get("symbol-sort-key");if(this.features=[],!F&&!j)return;let G=l.iconDependencies,ie=l.glyphDependencies,ne=l.availableImages,se=new Nr(this.zoom,{worldview:this.worldview});for(let{feature:_e,id:ye,index:Ce,sourceLayerIndex:De}of s){let Me=g._featureFilter.needGeometry,lt=wt(_e,Me);if(!g._featureFilter.filter(se,lt,u))continue;if(Me||(lt.geometry=Gt(_e,u,h)),b&&_e.type!==1&&u.z<=5){let ft=lt.geometry,Ct=.98078528056,ot=(gt,We)=>_o(hI(gt.x,gt.y,u,1),hI(We.x,We.y,u,1))=0;for(let ot of Ne.sections)if(ot.image){let gt=ot.image.getPrimary().scaleSelf(this.pixelRatio),We=gt.id.toString(),Ge=G.get(We)||[];Ge.push(gt),G.set(We,Ge)}else{let gt=$C(Ne.toString()),We=ot.fontStack||ft,Ge=ie[We]=ie[We]||{};this.calculateGlyphDependencies(ot.text,Ge,Ct,this.allowVerticalPlacement,gt)}}}if(_.get("symbol-placement")==="line"&&(this.features=(function(_e){let ye={},Ce={},De=[],Me=0;function lt(ut){De.push(_e[ut]),Me++}function Ne(ut,ft,Ct){let ot=Ce[ut];return delete Ce[ut],Ce[ft]=ot,De[ot].geometry[0].pop(),De[ot].geometry[0]=De[ot].geometry[0].concat(Ct[0]),ot}function dt(ut,ft,Ct){let ot=ye[ft];return delete ye[ft],ye[ut]=ot,De[ot].geometry[0].shift(),De[ot].geometry[0]=Ct[0].concat(De[ot].geometry[0]),ot}function vt(ut,ft,Ct){let ot=Ct?ft[0][ft[0].length-1]:ft[0][0];return`${ut}:${ot.x}:${ot.y}`}for(let ut=0;ut<_e.length;ut++){let ft=_e[ut],Ct=ft.geometry,ot=ft.text?ft.text.toString():null;if(!ot){lt(ut);continue}let gt=vt(ot,Ct),We=vt(ot,Ct,!0);if(gt in Ce&&We in ye&&Ce[gt]!==ye[We]){let Ge=dt(gt,We,Ct),Tt=Ne(gt,We,De[Ge].geometry);delete ye[gt],delete Ce[We],Ce[vt(ot,De[Tt].geometry,!0)]=Tt,De[Ge].geometry=null}else gt in Ce?Ne(gt,We,Ct):We in ye?dt(gt,We,Ct):(lt(ut),ye[gt]=Me-1,Ce[We]=Me-1)}return De.filter(ut=>ut.geometry)})(this.features)),_.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",l.elevationFeatures){!this.elevationFeatures&&l.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(let _e of l.elevationFeatures)this.elevationFeatureIdToIndex.set(_e.id,this.elevationFeatures.length),this.elevationFeatures.push(_e)}}else _.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((_e,ye)=>_e.sortKey-ye.sortKey)}update(s,l,u,h,g,_,b){this.text.programConfigurations.updatePaintArrays(s,l,g,u,h,_,b,this.worldview),this.icon.programConfigurations.updatePaintArrays(s,l,g,u,h,_,b,this.worldview)}updateRoadElevation(s){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let l=!1,u=Be(s),h=1/u,g=!1,_=!1;for(let b=0;b0||M>0,H=L>0,G=this.elevationFeatures[C.elevationFeatureIndex];if(G){let ie=new It(C.tileAnchorX,C.tileAnchorY),ne=.075+G.pointElevation(ie);C.zOffset!==ne&&(l=!0,C.zOffset=ne);let se=G.computeSlopeNormal(ie,h),_e=dm(Uc(),$o(0,0,1),se);Ad(T,T,_e),Ad(A,A,_e),T[2]*=u,A[2]*=u,T[0]===1&&T[1]===0&&T[2]===0&&A[0]===0&&A[1]===1&&A[2]===0||(g=g||j,_=_||H)}if(j&&(Bk(this.text.orientationVertexArray,D,T,A),Bk(this.text.orientationVertexArray,M,T,A)),H){let{placedIconSymbolIndex:ie,verticalPlacedIconSymbolIndex:ne}=C;ie>=0&&Bk(this.icon.orientationVertexArray,L,T,A),ne>=0&&Bk(this.icon.orientationVertexArray,F,T,A)}}g||(this.text.orientationVertexArray=void 0),_||(this.icon.orientationVertexArray=void 0),l&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){let s=(g,_,b)=>{u+=_,u>g.length&&g.resize(u);for(let C=-_;C<0;C++)g.emplace(C+u,b)},l=(g,_,b)=>{h+=_,h>g.length&&g.resize(h);for(let C=-_;C<0;C++)g.emplace(C+h,b)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let u=0,h=0;for(let g=0;g0;if((b>0||C>0)&&(s(this.text.zOffsetVertexArray,b,A),s(this.text.zOffsetVertexArray,C,A)),D){let{placedIconSymbolIndex:M,verticalPlacedIconSymbolIndex:L}=_;M>=0&&l(this.icon.zOffsetVertexArray,T,A),L>=0&&l(this.icon.zOffsetVertexArray,_.numVerticalIconVertices,A)}}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(s){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(s),this.iconCollisionBox.upload(s)),this.text.upload(s,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(s,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=L9(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(s,l){let u=this.lineVertexArray.length;if(s.segment!==void 0)for(let{x:h,y:g}of l)this.lineVertexArray.emplaceBack(h,g);return{lineStartIndex:u,lineLength:this.lineVertexArray.length-u}}addSymbols(s,l,u,h,g,_,b,C,T,A,D,M,L,F,j,H){let G=s.indexArray,ie=s.layoutVertexArray,ne=s.globeExtVertexArray,se=s.segments.prepareSegment(4*l.length,ie,G,this.canOverlap?_.sortKey:void 0),_e=this.glyphOffsetArray.length,ye=se.vertexLength,Ce=this.allowVerticalPlacement&&b===tc.vertical?Math.PI/2:0,De=_.text&&_.text.sections;for(let lt=0;lt=0?l.rightJustifiedTextSymbolIndex:l.centerJustifiedTextSymbolIndex>=0?l.centerJustifiedTextSymbolIndex:l.leftJustifiedTextSymbolIndex>=0?l.leftJustifiedTextSymbolIndex:l.verticalPlacedTextSymbolIndex>=0?l.verticalPlacedTextSymbolIndex:h),_=FN(this.textSizeData,s,g)/Bs;return this.tilePixelRatio*_}getSymbolInstanceIconSize(s,l,u){let h=this.icon.placedSymbolArray.get(u),g=FN(this.iconSizeData,s,h);return this.tilePixelRatio*g}_commitDebugCollisionVertexUpdate(s,l,u,h){s.emplaceBack(l,-u,-u,h),s.emplaceBack(l,u,-u,h),s.emplaceBack(l,u,u,h),s.emplaceBack(l,-u,u,h)}_updateTextDebugCollisionBoxes(s,l,u,h,g,_,b){for(let C=h;C0}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(s,l){let u=s.placedSymbolArray.get(l),h=u.vertexStartIndex+4*u.numGlyphs;for(let g=u.vertexStartIndex;g