=l[2]||p[1]<=l[1]||p[3]>=l[3])}function jb(p,l,u){let f=p[0]-l[0],g=p[1]-l[1],C=p[0]-u[0],w=p[1]-u[1];return f*w-C*g==0&&f*C<=0&&g*w<=0}function Ww(p,l,u=!1){let f=!1;for(let D=0,P=l.length;D(g=p)[1]!=(w=re)[1]>g[1]&&g[0]<(w[0]-C[0])*(g[1]-C[1])/(w[1]-C[1])+C[0]&&(f=!f)}}var g,C,w;return f}function EV(p,l,u,f){let g=f[0]-u[0],C=f[1]-u[1],w=(p[0]-u[0])*C-g*(p[1]-u[1]),D=(l[0]-u[0])*C-g*(l[1]-u[1]);return w>0&&D<0||w<0&&D>0}function f2(p,l,u,f){return(g=[f[0]-u[0],f[1]-u[1]])[0]*(C=[l[0]-p[0],l[1]-p[1]])[1]-g[1]*C[0]!=0&&!(!EV(p,l,u,f)||!EV(u,f,p,l));var g,C}function sF(p){let l=new Ti(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),u=new Ti(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(let f of p[0])l.x>f.x&&(l.x=f.x),l.y>f.y&&(l.y=f.y),u.xu[2]){let g=.5*f,C=p[0]-u[0]>g?-f:u[0]-p[0]>g?f:0;C===0&&(C=p[0]-u[2]>g?-f:u[2]-p[0]>g?f:0),p[0]+=C}tg(l,p)}function cd(p,l,u,f){let g=Math.pow(2,f.z)*qb,C=[f.x*qb,f.y*qb],w=[];if(!p)return w;for(let D of p)for(let P of D){let B=[P.x+C[0],P.y+C[1]];tp(B,l,u,g),w.push(B)}return w}function Qw(p,l,u,f){let g=Math.pow(2,f.z)*qb,C=[f.x*qb,f.y*qb],w=[];if(!p)return w;for(let P of p){let B=[];for(let q of P){let $=[q.x+C[0],q.y+C[1]];tg(l,$),B.push($)}w.push(B)}if(l[2]-l[0]<=g/2){(D=l)[0]=D[1]=1/0,D[2]=D[3]=-1/0;for(let P of w)for(let B of P)tp(B,l,u,g)}var D;return w}class Kb{constructor(l,u){this.type=La,this.geojson=l,this.geometries=u}static parse(l,u){if(l.length!==2)return u.error(`'within' expression requires exactly one argument, but found ${l.length-1} instead.`);if(Wo(l[1])){let f=l[1];if(f.type==="FeatureCollection")for(let g=0;gu)return Tc(C,w,(u-(f-D))/D)}return l[l.length-1]}pointToSegmentDistance(l,u,f){let[g,C]=u,w=ig(f[0]-g)*this.kx,D=(f[1]-C)*this.ky;if(w!==0||D!==0){let P=(ig(l[0]-g)*this.kx*w+(l[1]-C)*this.ky*D)/(w*w+D*D);P>1?(g=f[0],C=f[1]):P>0&&(g+=w/this.kx*P,C+=D/this.ky*P)}return w=ig(l[0]-g)*this.kx,D=(l[1]-C)*this.ky,Math.sqrt(w*w+D*D)}pointOnLine(l,u){let f=1/0,g=l[0][0],C=l[0][1],w=0,D=0;for(let P=0;P1?(B=l[P+1][0],q=l[P+1][1]):ne>0&&(B+=$/this.kx*ne,q+=K/this.ky*ne)),$=ig(u[0]-B)*this.kx,K=(u[1]-q)*this.ky;let re=$*$+K*K;reC.index||g.index===C.index&&g.t>C.t){let B=g;g=C,C=B}let w=[g.point],D=g.index+1,P=C.index;!Zw(f[D],w[0])&&D<=P&&w.push(f[D]);for(let B=D+1;B<=P;B++)w.push(f[B]);return Zw(f[P],C.point)||w.push(C.point),w}lineSliceAlong(l,u,f){let g=0,C=[];for(let w=0;wl&&C.length===0&&C.push(Tc(D,P,(l-(g-B))/B)),g>=u)return C.push(Tc(D,P,(u-(g-B))/B)),C;g>l&&C.push(P)}return C}bufferPoint(l,u){let f=u/this.ky,g=u/this.kx;return[l[0]-g,l[1]-f,l[0]+g,l[1]+f]}bufferBBox(l,u){let f=u/this.ky,g=u/this.kx;return[l[0]-g,l[1]-f,l[2]+g,l[3]+f]}insideBBox(l,u){return ig(l[0]-u[0])>=0&&ig(l[0]-u[2])<=0&&l[1]>=u[1]&&l[1]<=u[3]}}function Zw(p,l){return p[0]===l[0]&&p[1]===l[1]}function Tc(p,l,u){let f=ig(l[0]-p[0]);return[p[0]+f*u,p[1]+(l[1]-p[1])*u]}function ig(p){for(;p<-180;)p+=360;for(;p>180;)p-=360;return p}class WT{constructor(l=[],u=(f,g)=>fg?1:0){if(this.data=l,this.length=this.data.length,this.compare=u,this.length>0)for(let f=(this.length>>1)-1;f>=0;f--)this._down(f)}push(l){this.data.push(l),this._up(this.length++)}pop(){if(this.length===0)return;let l=this.data[0],u=this.data.pop();return--this.length>0&&(this.data[0]=u,this._down(0)),l}peek(){return this.data[0]}_up(l){let{data:u,compare:f}=this,g=u[l];for(;l>0;){let C=l-1>>1,w=u[C];if(f(g,w)>=0)break;u[l]=w,l=C}u[l]=g}_down(l){let{data:u,compare:f}=this,g=this.length>>1,C=u[l];for(;l=0)break;u[l]=u[w],l=w}u[l]=C}}var wn=8192;function cF(p,l){return l.dist-p.dist}let g2=100,_2=50;function Yb(p){let l=[1/0,1/0,-1/0,-1/0];if(l.length!==p.length)return!1;for(let u=0;u=p[0]&&p[1]p[1])return[null,null];let u=vf(p);if(l){if(u===2)return[p,null];let f=Math.floor(u/2);return[[p[0],p[0]+f],[p[0]+f,p[1]]]}{if(u===1)return[p,null];let f=Math.floor(u/2)-1;return[[p[0],p[0]+f],[p[0]+f+1,p[1]]]}}function Z_(p,l){let u=[1/0,1/0,-1/0,-1/0];if(!kh(l,p.length))return u;for(let f=l[0];f<=l[1];++f)tg(u,p[f]);return u}function Xw(p){let l=[1/0,1/0,-1/0,-1/0];for(let u=0;ul[2]&&(f=p[0]-l[2]),p[1]>l[3]&&(g=p[1]-l[3]),p[3]=f)return f;if(Um(g,C)){if(kV(p,l))return 0}else if(kV(l,p))return 0;let w=f;for(let D of p)for(let P=0,B=D.length,q=B-1;P=C)continue;let q=B.range1;if(vf(q)<=D){if(!kh(q,p.length))return NaN;if(l){let $=dF(p,q,u,f);if((C=Math.min(C,$))===0)return C}else for(let $=q[0];$<=q[1];++$){let K=v2(p[$],u,f);if((C=Math.min(C,K))===0)return C}}else{let $=QT(q,l);if($[0]!==null){let K=Qg(Z_(p,$[0]),P,f);K=w)continue;let $=q.range1,K=q.range2;if(vf($)<=P&&vf(K)<=B){if(!kh($,p.length)||!kh(K,u.length))return NaN;if(l&&f?w=Math.min(w,g7(p,$,u,K,g)):l||f?l&&!f?w=Math.min(w,DV(u,K,p,$,g)):!l&&f&&(w=Math.min(w,DV(p,$,u,K,g))):w=Math.min(w,y2(p,$,u,K,g)),w===0)return w}else{let ne=QT($,l),re=QT(K,f);b2(D,w,g,p,u,ne[0],re[0]),b2(D,w,g,p,u,ne[0],re[1]),b2(D,w,g,p,u,ne[1],re[0]),b2(D,w,g,p,u,ne[1],re[1])}}return w}function Fp(p,l,u,f,g=1/0){let C=g,w=Z_(p,[0,p.length-1]);for(let D of u)if(!(C!==1/0&&Qg(w,Z_(D,[0,D.length-1]),f)>=C)&&(C=Math.min(C,ip(p,l,D,!0,f,C)),C===0))return C;return C}function C2(p,l,u,f,g=1/0){let C=g,w=Z_(p,[0,p.length-1]);for(let D of u){if(C!==1/0&&Qg(w,Xw(D),f)>=C)continue;let P=_7(p,l,D,f,C);if(isNaN(P))return P;if((C=Math.min(C,P))===0)return C}return C}function uF(p){return p==="Point"||p==="MultiPoint"||p==="LineString"||p==="MultiLineString"||p==="Polygon"||p==="MultiPolygon"}class Wb{constructor(l,u){this.type=xr,this.geojson=l,this.geometries=u}static parse(l,u){if(l.length!==2)return u.error(`'distance' expression requires either one argument, but found ' ${l.length-1} instead.`);if(Wo(l[1])){let f=l[1];if(f.type==="FeatureCollection"){for(let g=0;g{l&&!eS(u)&&(l=!1)}),l}function tS(p){if(p instanceof _u&&p.name==="feature-state")return!1;let l=!0;return p.eachChild(u=>{l&&!tS(u)&&(l=!1)}),l}function Qb(p){if(p instanceof gv)return new Set([p.key]);let l=new Set;return p.eachChild(u=>{l=new Set([...l,...Qb(u)])}),l}function Zb(p,l){if(p instanceof _u&&l.indexOf(p.name)>=0)return!1;let u=!0;return p.eachChild(f=>{u&&!Zb(f,l)&&(u=!1)}),u}function Vx(p,l,u){return[p,l,u].filter(Boolean).join("")}function zx(p,l){switch(p){case"string":return yf(l);case"number":return+l;case"boolean":return!!l;case"color":return Ds.parse(l);case"formatted":return Vm.fromString(yf(l));case"resolvedImage":return rm.build(yf(l))}return l}function iS(p,l,u,f){return f!==void 0&&(p=f*Math.round(p/f)),l!==void 0&&pu&&(p=u),p}class gv{constructor(l,u,f,g=!1){this.type=l,this.key=u,this.scope=f,this.featureConstant=g}static parse(l,u){let f=u.expectedType;if(f==null&&(f=Cs),l.length<2||l.length>3)return u.error("Invalid number of arguments for 'config' expression.");let g=u.parse(l[1],1);if(!(g instanceof Xr))return u.error("Key name of 'config' expression must be a string literal.");let C,w=!0,D=yf(g.value);if(l.length>=3){let P=u.parse(l[2],2);if(!(P instanceof Xr))return u.error("Scope of 'config' expression must be a string literal.");C=yf(P.value)}if(u.options){let P=Vx(D,C,u._scope),B=u.options.get(P);B&&(w=eS(B.value||B.default))}return new gv(f,D,C,w)}evaluate(l){let u=Vx(this.key,this.scope,l.scope),f=l.getConfig(u);if(!f)return null;let{type:g,value:C,values:w,minValue:D,maxValue:P,stepValue:B}=f,q=f.default.evaluate(l),$=q;if(C){let K=l.scope;l.scope=(K||"").split("").slice(1).join(""),$=C.evaluate(l),l.scope=K}return g&&($=zx(g,$)),$===void 0||D===void 0&&P===void 0&&B===void 0||(typeof $=="number"?$=iS($,D,P,B):Array.isArray($)&&($=$.map(K=>typeof K=="number"?iS(K,D,P,B):K))),C!==void 0&&$!==void 0&&w&&!w.includes($)&&($=q,g&&($=zx(g,$))),(g&&g!==this.type||$!==void 0&&!qw(Mn($),this.type))&&($=zx(this.type.kind,$)),$}eachChild(){}outputDefined(){return!1}serialize(){let l=["config",this.key];return this.scope&&l.concat(this.scope),l}}class _v{constructor(l,u){this.type=u.type,this.name=l,this.boundExpression=u}static parse(l,u){if(l.length!==2||typeof l[1]!="string")return u.error("'var' expression requires exactly one string literal argument.");let f=l[1];return u.scope.has(f)?new _v(f,u.scope.get(f)):u.error(`Unknown variable "${f}". Make sure "${f}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(l){return this.boundExpression.evaluate(l)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class x2{constructor(l,u=[],f,g=new ey,C=[],w,D){this.registry=l,this.path=u,this.key=u.map(P=>typeof P=="string"?`['${P}']`:`[${P}]`).join(""),this.scope=g,this.errors=C,this.expectedType=f,this._scope=w,this.options=D}parse(l,u,f,g,C={}){return u||f?this.concat(u,null,f,g)._parse(l,C):this._parse(l,C)}parseObjectValue(l,u,f,g,C,w={}){return this.concat(u,f,g,C)._parse(l,w)}_parse(l,u){function f(g,C,w){return w==="assert"?new Kr(C,[g]):w==="coerce"?new om(C,[g]):g}if(l!==null&&typeof l!="string"&&typeof l!="boolean"&&typeof l!="number"||(l=["literal",l]),Array.isArray(l)){if(l.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let g=typeof l[0]=="string"?this.registry[l[0]]:void 0;if(g){let C=g.parse(l,this);if(!C)return null;if(this.expectedType){let w=this.expectedType,D=C.type;if(w.kind!=="string"&&w.kind!=="number"&&w.kind!=="boolean"&&w.kind!=="object"&&w.kind!=="array"||D.kind!=="value")if(w.kind!=="color"&&w.kind!=="formatted"&&w.kind!=="resolvedImage"||D.kind!=="value"&&D.kind!=="string"){if(this.checkSubtype(w,D))return null}else C=f(C,w,u.typeAnnotation||"coerce");else C=f(C,w,u.typeAnnotation||"assert")}if(!(C instanceof Xr)&&C.type.kind!=="resolvedImage"&&pF(C)){let w=new KT(this._scope,this.options);try{C=new Xr(C.type,C.evaluate(w))}catch(D){return this.error(D.message),null}}return C}return om.parse(["to-array",l],this)}return this.error(l===void 0?"'undefined' value invalid. Use null instead.":typeof l=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof l} instead.`)}concat(l,u,f,g){let C=typeof l=="number"?this.path.concat(l):this.path;C=typeof u=="string"?C.concat(u):C;let w=g?this.scope.concat(g):this.scope;return new x2(this.registry,C,f||null,w,this.errors,this._scope,this.options)}error(l,...u){let f=`${this.key}${u.map(g=>`[${g}]`).join("")}`;this.errors.push(new _f(f,l))}checkSubtype(l,u){let f=Gw(l,u);return f&&this.error(f),f}}function pF(p){if(p instanceof _v)return pF(p.boundExpression);if(p instanceof _u&&p.name==="error"||p instanceof am||p instanceof Kb||p instanceof Wb||p instanceof gv)return!1;let l=p instanceof om||p instanceof Kr,u=!0;return p.eachChild(f=>{u=l?u&&pF(f):u&&f instanceof Xr}),!!u&&eS(p)&&Zb(p,["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 w2(p,l){let u=p.length-1,f,g,C=0,w=u,D=0;for(;C<=w;)if(D=Math.floor((C+w)/2),f=p[D],g=p[D+1],f<=l){if(D===u||ll))throw new Ad("Input is not a number.");w=D-1}return 0}class ZT{constructor(l,u,f){this.type=l,this.input=u,this.labels=[],this.outputs=[];for(let[g,C]of f)this.labels.push(g),this.outputs.push(C)}static parse(l,u){if(l.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if((l.length-1)%2!=0)return u.error("Expected an even number of arguments.");let f=u.parse(l[1],1,xr);if(!f)return null;let g=[],C=null;u.expectedType&&u.expectedType.kind!=="value"&&(C=u.expectedType);for(let w=1;w=D)return u.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',B);let $=u.parse(P,q,C);if(!$)return null;C=C||$.type,g.push([D,$])}return new ZT(C,f,g)}evaluate(l){let u=this.labels,f=this.outputs;if(u.length===1)return f[0].evaluate(l);let g=this.input.evaluate(l);if(g<=u[0])return f[0].evaluate(l);let C=u.length;return g>=u[C-1]?f[C-1].evaluate(l):f[w2(u,g)].evaluate(l)}eachChild(l){l(this.input);for(let u of this.outputs)l(u)}outputDefined(){return this.outputs.every(l=>l.outputDefined())}serialize(){let l=["step",this.input.serialize()];for(let u=0;u0&&l.push(this.labels[u]),l.push(this.outputs[u].serialize());return l}}let RV=.95047,XT=1.08883,nS=4/29,Ux=6/29,gt=3*Ux*Ux,Xb=Ux*Ux*Ux,S2=Math.PI/180,ng=180/Math.PI;function kl(p){return p>Xb?Math.pow(p,1/3):p/gt+nS}function mF(p){return p>Ux?p*p*p:gt*(p-nS)}function hF(p){return 255*(p<=.0031308?12.92*p:1.055*Math.pow(p,1/2.4)-.055)}function I2(p){return(p/=255)<=.04045?p/12.92:Math.pow((p+.055)/1.055,2.4)}function yv(p){let l=I2(p.r),u=I2(p.g),f=I2(p.b),g=kl((.4124564*l+.3575761*u+.1804375*f)/RV),C=kl((.2126729*l+.7151522*u+.072175*f)/1);return{l:116*C-16,a:500*(g-C),b:200*(C-kl((.0193339*l+.119192*u+.9503041*f)/XT)),alpha:p.a}}function Hx(p){let l=(p.l+16)/116,u=isNaN(p.a)?l:l+p.a/500,f=isNaN(p.b)?l:l-p.b/200;return l=1*mF(l),u=RV*mF(u),f=XT*mF(f),new Ds(hF(3.2404542*u-1.5371385*l-.4985314*f),hF(-.969266*u+1.8760108*l+.041556*f),hF(.0556434*u-.2040259*l+1.0572252*f),p.alpha)}function OV(p,l,u){let f=l-p;return p+u*(f>180||f<-180?f-360*Math.round(f/360):f)}let rS={forward:yv,reverse:Hx,interpolate:function(p,l,u){return{l:Cr(p.l,l.l,u),a:Cr(p.a,l.a,u),b:Cr(p.b,l.b,u),alpha:Cr(p.alpha,l.alpha,u)}}},JT={forward:function(p){let{l,a:u,b:f}=yv(p),g=Math.atan2(f,u)*ng;return{h:g<0?g+360:g,c:Math.sqrt(u*u+f*f),l,alpha:p.a}},reverse:function(p){let l=p.h*S2,u=p.c;return Hx({l:p.l,a:Math.cos(l)*u,b:Math.sin(l)*u,alpha:p.alpha})},interpolate:function(p,l,u){return{h:OV(p.h,l.h,u),c:Cr(p.c,l.c,u),l:Cr(p.l,l.l,u),alpha:Cr(p.alpha,l.alpha,u)}}};var T2=Object.freeze({__proto__:null,hcl:JT,lab:rS});class ou{constructor(l,u,f,g,C){this.type=l,this.operator=u,this.interpolation=f,this.input=g,this.labels=[],this.outputs=[];for(let[w,D]of C)this.labels.push(w),this.outputs.push(D)}static interpolationFactor(l,u,f,g){let C=0;if(l.name==="exponential")C=fF(u,l.base,f,g);else if(l.name==="linear")C=fF(u,1,f,g);else if(l.name==="cubic-bezier"){let w=l.controlPoints;C=new Uo(w[0],w[1],w[2],w[3]).solve(fF(u,1,f,g))}return C}static parse(l,u){let[f,g,C,...w]=l;if(!Array.isArray(g)||g.length===0)return u.error("Expected an interpolation type expression.",1);if(g[0]==="linear")g={name:"linear"};else if(g[0]==="exponential"){let B=g[1];if(typeof B!="number")return u.error("Exponential interpolation requires a numeric base.",1,1);g={name:"exponential",base:B}}else{if(g[0]!=="cubic-bezier")return u.error(`Unknown interpolation type ${String(g[0])}`,1,0);{let B=g.slice(1);if(B.length!==4||B.some(q=>typeof q!="number"||q<0||q>1))return u.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);g={name:"cubic-bezier",controlPoints:B}}}if(l.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if(l.length-1>3&&(l.length-1)%2!=0)return u.error("Expected an even number of arguments.");if(C=u.parse(C,2,xr),!C)return null;let D=[],P=null;f==="interpolate-hcl"||f==="interpolate-lab"?P=Bm:u.expectedType&&u.expectedType.kind!=="value"&&(P=u.expectedType);for(let B=0;B=q)return u.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',K);let re=u.parse($,ne,P);if(!re)return null;P=P||re.type,D.push([q,re])}return P.kind==="number"||P.kind==="color"||P.kind==="array"&&P.itemType.kind==="number"&&typeof P.N=="number"?new ou(P,f,g,C,D):u.error(`Type ${_d(P)} is not interpolatable.`)}evaluate(l){let u=this.labels,f=this.outputs;if(u.length===1)return f[0].evaluate(l);let g=this.input.evaluate(l);if(g<=u[0])return f[0].evaluate(l);let C=u.length;if(g>=u[C-1])return f[C-1].evaluate(l);let w=w2(u,g),D=ou.interpolationFactor(this.interpolation,g,u[w],u[w+1]),P=f[w].evaluate(l),B=f[w+1].evaluate(l);return this.operator==="interpolate"?Lm[this.type.kind.toLowerCase()](P,B,D):this.operator==="interpolate-hcl"?JT.reverse(JT.interpolate(JT.forward(P),JT.forward(B),D)):rS.reverse(rS.interpolate(rS.forward(P),rS.forward(B),D))}eachChild(l){l(this.input);for(let u of this.outputs)l(u)}outputDefined(){return this.outputs.every(l=>l.outputDefined())}serialize(){let l;l=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];let u=[this.operator,l,this.input.serialize()];for(let f=0;fGw(g,D.type));return new E2(w?Cs:f,C)}evaluate(l){let u,f=null,g=0;for(let C of this.args){if(g++,f=C.evaluate(l),f&&f instanceof rm&&!f.available&&(u||(u=f),f=null,g===this.args.length))return u;if(f!==null)break}return f}eachChild(l){this.args.forEach(l)}outputDefined(){return this.args.every(l=>l.outputDefined())}serialize(){let l=["coalesce"];return this.eachChild(u=>{l.push(u.serialize())}),l}}class eE{constructor(l,u){this.type=u.type,this.bindings=[].concat(l),this.result=u}evaluate(l){return this.result.evaluate(l)}eachChild(l){for(let u of this.bindings)l(u[1]);l(this.result)}static parse(l,u){if(l.length<4)return u.error(`Expected at least 3 arguments, but found ${l.length-1} instead.`);let f=[];for(let C=1;C=f.length)throw new Ad(`Array index out of bounds: ${u} > ${f.length-1}.`);if(u!==Math.floor(u))throw new Ad(`Array index must be an integer, but found ${u} instead. Use at-interpolated to retrieve interpolated result with a fractional index.`);return f[u]}eachChild(l){l(this.index),l(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class gF{constructor(l,u,f){this.type=l,this.index=u,this.input=f}static parse(l,u){if(l.length!==3)return u.error(`Expected 2 arguments, but found ${l.length-1} instead.`);let f=u.parse(l[1],1,xr),g=u.parse(l[2],2,Op(u.expectedType||Cs));return f&&g?new gF(g.type.itemType,f,g):null}evaluate(l){let u=this.index.evaluate(l),f=this.input.evaluate(l);if(u<0)throw new Ad(`Array index out of bounds: ${u} < 0.`);if(u>f.length-1)throw new Ad(`Array index out of bounds: ${u} > ${f.length-1}.`);if(u===Math.floor(u))return f[u];let g=Math.floor(u),C=Math.ceil(u),w=f[g],D=f[C];if(typeof w!="number"||typeof D!="number")throw new Ad(`Cannot interpolate between non-number values at index ${u}.`);let P=u-g;return w*(1-P)+D*P}eachChild(l){l(this.index),l(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class X_{constructor(l,u){this.type=La,this.needle=l,this.haystack=u}static parse(l,u){if(l.length!==3)return u.error(`Expected 2 arguments, but found ${l.length-1} instead.`);let f=u.parse(l[1],1,Cs),g=u.parse(l[2],2,Cs);return f&&g?hv(f.type,[La,Lo,xr,pv,Cs])?new X_(f,g):u.error(`Expected first argument to be of type boolean, string, number or null, but found ${_d(f.type)} instead`):null}evaluate(l){let u=this.needle.evaluate(l),f=this.haystack.evaluate(l);if(f==null)return!1;if(!jw(u,["boolean","string","number","null"]))throw new Ad(`Expected first argument to be of type boolean, string, number or null, but found ${_d(Mn(u))} instead.`);if(!jw(f,["string","array"]))throw new Ad(`Expected second argument to be of type array or string, but found ${_d(Mn(f))} instead.`);return f.indexOf(u)>=0}eachChild(l){l(this.needle),l(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class D2{constructor(l,u,f){this.type=xr,this.needle=l,this.haystack=u,this.fromIndex=f}static parse(l,u){if(l.length<=2||l.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${l.length-1} instead.`);let f=u.parse(l[1],1,Cs),g=u.parse(l[2],2,Cs);if(!f||!g)return null;if(!hv(f.type,[La,Lo,xr,pv,Cs]))return u.error(`Expected first argument to be of type boolean, string, number or null, but found ${_d(f.type)} instead`);if(l.length===4){let C=u.parse(l[3],3,xr);return C?new D2(f,g,C):null}return new D2(f,g)}evaluate(l){let u=this.needle.evaluate(l),f=this.haystack.evaluate(l);if(!jw(u,["boolean","string","number","null"]))throw new Ad(`Expected first argument to be of type boolean, string, number or null, but found ${_d(Mn(u))} instead.`);if(!jw(f,["string","array"]))throw new Ad(`Expected second argument to be of type array or string, but found ${_d(Mn(f))} instead.`);if(this.fromIndex){let g=this.fromIndex.evaluate(l);return f.indexOf(u,g)}return f.indexOf(u)}eachChild(l){l(this.needle),l(this.haystack),this.fromIndex&&l(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){let l=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),l]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class k2{constructor(l,u,f,g,C,w){this.inputType=l,this.type=u,this.input=f,this.cases=g,this.outputs=C,this.otherwise=w}static parse(l,u){if(l.length<5)return u.error(`Expected at least 4 arguments, but found only ${l.length-1}.`);if(l.length%2!=1)return u.error("Expected an even number of arguments.");let f,g;u.expectedType&&u.expectedType.kind!=="value"&&(g=u.expectedType);let C={},w=[];for(let B=2;BNumber.MAX_SAFE_INTEGER)return K.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof re=="number"&&Math.floor(re)!==re)return K.error("Numeric branch labels must be integer values.");if(f){if(K.checkSubtype(f,Mn(re)))return null}else f=Mn(re);if(C[String(re)]!==void 0)return K.error("Branch labels must be unique.");C[String(re)]=w.length}let ne=u.parse($,B,g);if(!ne)return null;g=g||ne.type,w.push(ne)}let D=u.parse(l[1],1,Cs);if(!D)return null;let P=u.parse(l[l.length-1],l.length-1,g);return P?D.type.kind!=="value"&&u.concat(1).checkSubtype(f,D.type)?null:new k2(f,g,D,C,w,P):null}evaluate(l){let u=this.input.evaluate(l);return(qw(Mn(u),this.inputType)&&this.outputs[this.cases[u]]||this.otherwise).evaluate(l)}eachChild(l){l(this.input),this.outputs.forEach(l),l(this.otherwise)}outputDefined(){return this.outputs.every(l=>l.outputDefined())&&this.otherwise.outputDefined()}serialize(){let l=["match",this.input.serialize()],u=Object.keys(this.cases).sort(),f=[],g={};for(let w of u){let D=g[this.cases[w]];D===void 0?(g[this.cases[w]]=f.length,f.push([this.cases[w],[w]])):f[D][1].push(w)}let C=w=>this.inputType.kind==="number"?Number(w):w;for(let[w,D]of f)l.push(D.length===1?C(D[0]):D.map(C)),l.push(this.outputs[w].serialize());return l.push(this.otherwise.serialize()),l}}class M2{constructor(l,u,f){this.type=l,this.branches=u,this.otherwise=f}static parse(l,u){if(l.length<4)return u.error(`Expected at least 3 arguments, but found only ${l.length-1}.`);if(l.length%2!=0)return u.error("Expected an odd number of arguments.");let f;u.expectedType&&u.expectedType.kind!=="value"&&(f=u.expectedType);let g=[];for(let w=1;wu.outputDefined())&&this.otherwise.outputDefined()}serialize(){let l=["case"];return this.eachChild(u=>{l.push(u.serialize())}),l}}class Gx{constructor(l,u,f,g){this.type=l,this.input=u,this.beginIndex=f,this.endIndex=g}static parse(l,u){if(l.length<=2||l.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${l.length-1} instead.`);let f=u.parse(l[1],1,Cs),g=u.parse(l[2],2,xr);if(!f||!g)return null;if(!hv(f.type,[Op(Cs),Lo,Cs]))return u.error(`Expected first argument to be of type array or string, but found ${_d(f.type)} instead`);if(l.length===4){let C=u.parse(l[3],3,xr);return C?new Gx(f.type,f,g,C):null}return new Gx(f.type,f,g)}evaluate(l){let u=this.input.evaluate(l),f=this.beginIndex.evaluate(l);if(!jw(u,["string","array"]))throw new Ad(`Expected first argument to be of type array or string, but found ${_d(Mn(u))} instead.`);if(this.endIndex){let g=this.endIndex.evaluate(l);return u.slice(f,g)}return u.slice(f)}eachChild(l){l(this.input),l(this.beginIndex),this.endIndex&&l(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){let l=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),l]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class _F{constructor(l,u){this.type=Op(Lo),this.str=l,this.delimiter=u}static parse(l,u){if(l.length!==3)return u.error(`Expected 2 arguments, but found ${l.length-1} instead.`);let f=u.parse(l[1],1,Lo),g=u.parse(l[2],2,Lo);return f&&g?new _F(f,g):void 0}evaluate(l){let u=this.str.evaluate(l),f=this.delimiter.evaluate(l);return u.split(f)}eachChild(l){l(this.str),l(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function vv(p,l){return p==="=="||p==="!="?l.kind==="boolean"||l.kind==="string"||l.kind==="number"||l.kind==="null"||l.kind==="value":l.kind==="string"||l.kind==="number"||l.kind==="value"}function FV(p,l,u,f){return f.compare(l,u)===0}function oS(p,l,u){let f=p!=="=="&&p!=="!=";return class wQe{constructor(C,w,D){this.type=La,this.lhs=C,this.rhs=w,this.collator=D,this.hasUntypedArgument=C.type.kind==="value"||w.type.kind==="value"}static parse(C,w){if(C.length!==3&&C.length!==4)return w.error("Expected two or three arguments.");let D=C[0],P=w.parse(C[1],1,Cs);if(!P)return null;if(!vv(D,P.type))return w.concat(1).error(`"${D}" comparisons are not supported for type '${_d(P.type)}'.`);let B=w.parse(C[2],2,Cs);if(!B)return null;if(!vv(D,B.type))return w.concat(2).error(`"${D}" comparisons are not supported for type '${_d(B.type)}'.`);if(P.type.kind!==B.type.kind&&P.type.kind!=="value"&&B.type.kind!=="value")return w.error(`Cannot compare types '${_d(P.type)}' and '${_d(B.type)}'.`);f&&(P.type.kind==="value"&&B.type.kind!=="value"?P=new Kr(B.type,[P]):P.type.kind!=="value"&&B.type.kind==="value"&&(B=new Kr(P.type,[B])));let q=null;if(C.length===4){if(P.type.kind!=="string"&&B.type.kind!=="string"&&P.type.kind!=="value"&&B.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(q=w.parse(C[3],3,m2),!q)return null}return new wQe(P,B,q)}evaluate(C){let w=this.lhs.evaluate(C),D=this.rhs.evaluate(C);if(f&&this.hasUntypedArgument){let P=Mn(w),B=Mn(D);if(P.kind!==B.kind||P.kind!=="string"&&P.kind!=="number")throw new Ad(`Expected arguments for "${p}" to be (string, string) or (number, number), but found (${P.kind}, ${B.kind}) instead.`)}if(this.collator&&!f&&this.hasUntypedArgument){let P=Mn(w),B=Mn(D);if(P.kind!=="string"||B.kind!=="string")return l(C,w,D)}return this.collator?u(C,w,D,this.collator.evaluate(C)):l(C,w,D)}eachChild(C){C(this.lhs),C(this.rhs),this.collator&&C(this.collator)}outputDefined(){return!0}serialize(){let C=[p];return this.eachChild(w=>{C.push(w.serialize())}),C}}}let Zg=oS("==",function(p,l,u){return l===u},FV),PV=oS("!=",function(p,l,u){return l!==u},function(p,l,u,f){return!FV(0,l,u,f)}),y7=oS("<",function(p,l,u){return l",function(p,l,u){return l>u},function(p,l,u,f){return f.compare(l,u)>0}),b7=oS("<=",function(p,l,u){return l<=u},function(p,l,u,f){return f.compare(l,u)<=0}),R2=oS(">=",function(p,l,u){return l>=u},function(p,l,u,f){return f.compare(l,u)>=0});class O2{constructor(l,u,f,g,C,w){this.type=Lo,this.number=l,this.locale=u,this.currency=f,this.unit=g,this.minFractionDigits=C,this.maxFractionDigits=w}static parse(l,u){if(l.length!==3)return u.error("Expected two arguments.");let f=u.parse(l[1],1,xr);if(!f)return null;let g=l[2];if(typeof g!="object"||Array.isArray(g))return u.error("NumberFormat options argument must be an object.");let C=null;if(g.locale&&(C=u.parseObjectValue(g.locale,2,"locale",Lo),!C))return null;let w=null;if(g.currency&&(w=u.parseObjectValue(g.currency,2,"currency",Lo),!w))return null;let D=null;if(g.unit&&(D=u.parseObjectValue(g.unit,2,"unit",Lo),!D))return null;let P=null;if(g["min-fraction-digits"]&&(P=u.parseObjectValue(g["min-fraction-digits"],2,"min-fraction-digits",xr),!P))return null;let B=null;return g["max-fraction-digits"]&&(B=u.parseObjectValue(g["max-fraction-digits"],2,"max-fraction-digits",xr),!B)?null:new O2(f,C,w,D,P,B)}evaluate(l){return new Intl.NumberFormat(this.locale?this.locale.evaluate(l):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(l):void 0,unit:this.unit?this.unit.evaluate(l):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(l):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(l):void 0}).format(this.number.evaluate(l))}eachChild(l){l(this.number),this.locale&&l(this.locale),this.currency&&l(this.currency),this.unit&&l(this.unit),this.minFractionDigits&&l(this.minFractionDigits),this.maxFractionDigits&&l(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let l={};return this.locale&&(l.locale=this.locale.serialize()),this.currency&&(l.currency=this.currency.serialize()),this.unit&&(l.unit=this.unit.serialize()),this.minFractionDigits&&(l["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(l["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),l]}}class F2{constructor(l){this.type=xr,this.input=l}static parse(l,u){if(l.length!==2)return u.error(`Expected 1 argument, but found ${l.length-1} instead.`);let f=u.parse(l[1],1);return f?f.type.kind!=="array"&&f.type.kind!=="string"&&f.type.kind!=="value"?u.error(`Expected argument of type string or array, but found ${_d(f.type)} instead.`):new F2(f):null}evaluate(l){let u=this.input.evaluate(l);if(typeof u=="string"||Array.isArray(u))return u.length;throw new Ad(`Expected value to be of type string or array, but found ${_d(Mn(u))} instead.`)}eachChild(l){l(this.input)}outputDefined(){return!1}serialize(){let l=["length"];return this.eachChild(u=>{l.push(u.serialize())}),l}}function NV(p){return function(){p=1831565813+(p|=0)|0;let l=Math.imul(p^p>>>15,1|p);return l=l+Math.imul(l^l>>>7,61|l)^l,((l^l>>>14)>>>0)/4294967296}}let aS={"==":Zg,"!=":PV,">":v7,"<":y7,">=":R2,"<=":b7,array:Kr,at:A2,"at-interpolated":gF,boolean:Kr,case:M2,coalesce:E2,collator:am,format:Kw,image:Yw,in:X_,"index-of":D2,interpolate:ou,"interpolate-hcl":ou,"interpolate-lab":ou,length:F2,let:eE,literal:Xr,match:k2,number:Kr,"number-format":O2,object:Kr,slice:Gx,step:ZT,string:Kr,"to-boolean":om,"to-color":om,"to-number":om,"to-string":om,var:_v,within:Kb,distance:Wb,config:gv,split:_F};function tE(p,[l,u,f,g]){l=l.evaluate(p),u=u.evaluate(p),f=f.evaluate(p);let C=g?g.evaluate(p):1,w=Nx(l,u,f,C);if(w)throw new Ad(w);return new Ds(l/255,u/255,f/255,C)}function sS(p,[l,u,f,g]){l=l.evaluate(p),u=u.evaluate(p),f=f.evaluate(p);let C=g?g.evaluate(p):1,w=(function(B,q,$,K){return typeof B=="number"&&B>=0&&B<=360?typeof q=="number"&&q>=0&&q<=100&&typeof $=="number"&&$>=0&&$<=100?K===void 0||typeof K=="number"&&K>=0&&K<=1?null:`Invalid hsla value [${[B,q,$,K].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof K=="number"?[B,q,$,K]:[B,q,$]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof K=="number"?[B,q,$,K]:[B,q,$]).join(", ")}]: 'h' must be between 0 and 360.`})(l,u,f,C);if(w)throw new Ad(w);let D=`hsla(${l}, ${u}%, ${f}%, ${C})`,P=Ds.parse(D);if(!P)throw new Ad(`Failed to parse HSLA color: ${D}`);return P}function iE(p,l){return p in l}function P2(p,l){let u=l[p];return u===void 0?null:u}function bv(p){return{type:p}}function yF(p){return{result:"success",value:p}}function Gm(p){return{result:"error",value:p}}function ty(p,l){return!!p&&!!p.parameters&&p.parameters.indexOf(l)>-1}function iy(p){return p["property-type"]==="data-driven"}function rg(p){return ty(p.expression,"measure-light")}function LV(p){return ty(p.expression,"zoom")}function nE(p){return!!p.expression&&p.expression.interpolated}function rE(p){return typeof p=="object"&&p!==null&&!Array.isArray(p)}function lS(p){return p}function ny(p,l){let u=l.type==="color",f=p.stops&&typeof p.stops[0][0]=="object",g=f||!(f||p.property!==void 0),C=p.type||(nE(l)?"exponential":"interval");if(u&&((p=Fx({},p)).stops&&(p.stops=p.stops.map(B=>[B[0],Ds.parse(B[1])])),p.default=Ds.parse(p.default?p.default:l.default)),p.colorSpace&&p.colorSpace!=="rgb"&&!T2[p.colorSpace])throw new Error(`Unknown color space: ${p.colorSpace}`);let w,D,P;if(C==="exponential")w=BV;else if(C==="interval")w=oE;else if(C==="categorical"){w=vF,D=Object.create(null);for(let B of p.stops)D[B[0]]=B[1];P=typeof p.stops[0][0]}else{if(C!=="identity")throw new Error(`Unknown function type "${C}"`);w=bF}if(f){let B={},q=[];for(let ne=0;nene[0]),evaluate:({zoom:ne},re)=>BV({stops:$,base:p.base},l,ne).evaluate(ne,re)}}if(g){let B=C==="exponential"?{name:"exponential",base:p.base!==void 0?p.base:1}:null;return{kind:"camera",interpolationType:B,interpolationFactor:ou.interpolationFactor.bind(void 0,B),zoomStops:p.stops.map(q=>q[0]),evaluate:({zoom:q})=>w(p,l,q,D,P)}}return{kind:"source",evaluate(B,q){let $=q&&q.properties?q.properties[p.property]:void 0;return $===void 0?Jb(p.default,l.default):w(p,l,$,D,P)}}}function Jb(p,l,u){return p!==void 0?p:l!==void 0?l:u!==void 0?u:void 0}function vF(p,l,u,f,g){return Jb(typeof u===g?f[u]:void 0,p.default,l.default)}function oE(p,l,u){if(Gb(u)!=="number")return Jb(p.default,l.default);let f=p.stops.length;if(f===1||u<=p.stops[0][0])return p.stops[0][1];if(u>=p.stops[f-1][0])return p.stops[f-1][1];let g=w2(p.stops.map(C=>C[0]),u);return p.stops[g][1]}function BV(p,l,u){let f=p.base!==void 0?p.base:1;if(Gb(u)!=="number")return Jb(p.default,l.default);let g=p.stops.length;if(g===1||u<=p.stops[0][0])return p.stops[0][1];if(u>=p.stops[g-1][0])return p.stops[g-1][1];let C=w2(p.stops.map(q=>q[0]),u),w=(function(q,$,K,ne){let re=ne-K,ge=q-K;return re===0?0:$===1?ge/re:(Math.pow($,ge)-1)/(Math.pow($,re)-1)})(u,f,p.stops[C][0],p.stops[C+1][0]),D=p.stops[C][1],P=p.stops[C+1][1],B=Lm[l.type]||lS;if(p.colorSpace&&p.colorSpace!=="rgb"){let q=T2[p.colorSpace];B=($,K)=>q.reverse(q.interpolate(q.forward($),q.forward(K),w))}return typeof D.evaluate=="function"?{evaluate(...q){let $=D.evaluate.apply(void 0,q),K=P.evaluate.apply(void 0,q);if($!==void 0&&K!==void 0)return B($,K,w)}}:B(D,P,w)}function bF(p,l,u){return l.type==="color"?u=Ds.parse(u):l.type==="formatted"?u=Vm.fromString(u.toString()):l.type==="resolvedImage"?u=rm.build(u.toString()):Gb(u)===l.type||l.type==="enum"&&l.values[u]||(u=void 0),Jb(u,p.default,l.default)}_u.register(aS,{error:[{kind:"error"},[Lo],(p,[l])=>{throw new Ad(l.evaluate(p))}],typeof:[Lo,[Cs],(p,[l])=>_d(Mn(l.evaluate(p)))],"to-rgba":[Op(xr,4),[Bm],(p,[l])=>l.evaluate(p).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Op(xr,4),[Bm],(p,[l])=>l.evaluate(p).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Bm,[xr,xr,xr],tE],rgba:[Bm,[xr,xr,xr,xr],tE],hsl:[Bm,[xr,xr,xr],sS],hsla:[Bm,[xr,xr,xr,xr],sS],has:{type:La,overloads:[[[Lo],(p,[l])=>iE(l.evaluate(p),p.properties())],[[Lo,mv],(p,[l,u])=>iE(l.evaluate(p),u.evaluate(p))]]},get:{type:Cs,overloads:[[[Lo],(p,[l])=>P2(l.evaluate(p),p.properties())],[[Lo,mv],(p,[l,u])=>P2(l.evaluate(p),u.evaluate(p))]]},"feature-state":[Cs,[Lo],(p,[l])=>P2(l.evaluate(p),p.featureState||{})],properties:[mv,[],p=>p.properties()],"geometry-type":[Lo,[],p=>p.geometryType()],worldview:[Lo,[],p=>p.globals.worldview||""],id:[Cs,[],p=>p.id()],zoom:[xr,[],p=>p.globals.zoom],pitch:[xr,[],p=>p.globals.pitch||0],"distance-from-center":[xr,[],p=>p.distanceFromCenter()],"measure-light":[xr,[Lo],(p,[l])=>p.measureLight(l.evaluate(p))],"heatmap-density":[xr,[],p=>p.globals.heatmapDensity||0],"line-progress":[xr,[],p=>p.globals.lineProgress||0],"raster-value":[xr,[],p=>p.globals.rasterValue||0],"raster-particle-speed":[xr,[],p=>p.globals.rasterParticleSpeed||0],"sky-radial-progress":[xr,[],p=>p.globals.skyRadialProgress||0],accumulated:[Cs,[],p=>p.globals.accumulated===void 0?null:p.globals.accumulated],"+":[xr,bv(xr),(p,l)=>{let u=0;for(let f of l)u+=f.evaluate(p);return u}],"*":[xr,bv(xr),(p,l)=>{let u=1;for(let f of l)u*=f.evaluate(p);return u}],"-":{type:xr,overloads:[[[xr,xr],(p,[l,u])=>l.evaluate(p)-u.evaluate(p)],[[xr],(p,[l])=>-l.evaluate(p)]]},"/":[xr,[xr,xr],(p,[l,u])=>l.evaluate(p)/u.evaluate(p)],"%":[xr,[xr,xr],(p,[l,u])=>l.evaluate(p)%u.evaluate(p)],ln2:[xr,[],()=>Math.LN2],pi:[xr,[],()=>Math.PI],e:[xr,[],()=>Math.E],"^":[xr,[xr,xr],(p,[l,u])=>Math.pow(l.evaluate(p),u.evaluate(p))],sqrt:[xr,[xr],(p,[l])=>Math.sqrt(l.evaluate(p))],log10:[xr,[xr],(p,[l])=>Math.log(l.evaluate(p))/Math.LN10],ln:[xr,[xr],(p,[l])=>Math.log(l.evaluate(p))],log2:[xr,[xr],(p,[l])=>Math.log(l.evaluate(p))/Math.LN2],sin:[xr,[xr],(p,[l])=>Math.sin(l.evaluate(p))],cos:[xr,[xr],(p,[l])=>Math.cos(l.evaluate(p))],tan:[xr,[xr],(p,[l])=>Math.tan(l.evaluate(p))],asin:[xr,[xr],(p,[l])=>Math.asin(l.evaluate(p))],acos:[xr,[xr],(p,[l])=>Math.acos(l.evaluate(p))],atan:[xr,[xr],(p,[l])=>Math.atan(l.evaluate(p))],min:[xr,bv(xr),(p,l)=>Math.min(...l.map(u=>u.evaluate(p)))],max:[xr,bv(xr),(p,l)=>Math.max(...l.map(u=>u.evaluate(p)))],abs:[xr,[xr],(p,[l])=>Math.abs(l.evaluate(p))],round:[xr,[xr],(p,[l])=>{let u=l.evaluate(p);return u<0?-Math.round(-u):Math.round(u)}],floor:[xr,[xr],(p,[l])=>Math.floor(l.evaluate(p))],ceil:[xr,[xr],(p,[l])=>Math.ceil(l.evaluate(p))],"filter-==":[La,[Lo,Cs],(p,[l,u])=>p.properties()[l.value]===u.value],"filter-id-==":[La,[Cs],(p,[l])=>p.id()===l.value],"filter-type-==":[La,[Lo],(p,[l])=>p.geometryType()===l.value],"filter-<":[La,[Lo,Cs],(p,[l,u])=>{let f=p.properties()[l.value],g=u.value;return typeof f==typeof g&&f{let u=p.id(),f=l.value;return typeof u==typeof f&&u":[La,[Lo,Cs],(p,[l,u])=>{let f=p.properties()[l.value],g=u.value;return typeof f==typeof g&&f>g}],"filter-id->":[La,[Cs],(p,[l])=>{let u=p.id(),f=l.value;return typeof u==typeof f&&u>f}],"filter-<=":[La,[Lo,Cs],(p,[l,u])=>{let f=p.properties()[l.value],g=u.value;return typeof f==typeof g&&f<=g}],"filter-id-<=":[La,[Cs],(p,[l])=>{let u=p.id(),f=l.value;return typeof u==typeof f&&u<=f}],"filter->=":[La,[Lo,Cs],(p,[l,u])=>{let f=p.properties()[l.value],g=u.value;return typeof f==typeof g&&f>=g}],"filter-id->=":[La,[Cs],(p,[l])=>{let u=p.id(),f=l.value;return typeof u==typeof f&&u>=f}],"filter-has":[La,[Cs],(p,[l])=>l.value in p.properties()],"filter-has-id":[La,[],p=>p.id()!==null&&p.id()!==void 0],"filter-type-in":[La,[Op(Lo)],(p,[l])=>l.value.indexOf(p.geometryType())>=0],"filter-id-in":[La,[Op(Cs)],(p,[l])=>l.value.indexOf(p.id())>=0],"filter-in-small":[La,[Lo,Op(Cs)],(p,[l,u])=>u.value.indexOf(p.properties()[l.value])>=0],"filter-in-large":[La,[Lo,Op(Cs)],(p,[l,u])=>(function(f,g,C,w){for(;C<=w;){let D=C+w>>1;if(g[D]===f)return!0;g[D]>f?w=D-1:C=D+1}return!1})(p.properties()[l.value],u.value,0,u.value.length-1)],all:{type:La,overloads:[[[La,La],(p,[l,u])=>l.evaluate(p)&&u.evaluate(p)],[bv(La),(p,l)=>{for(let u of l)if(!u.evaluate(p))return!1;return!0}]]},any:{type:La,overloads:[[[La,La],(p,[l,u])=>l.evaluate(p)||u.evaluate(p)],[bv(La),(p,l)=>{for(let u of l)if(u.evaluate(p))return!0;return!1}]]},"!":[La,[La],(p,[l])=>!l.evaluate(p)],"is-supported-script":[La,[Lo],(p,[l])=>{let u=p.globals&&p.globals.isSupportedScript;return!u||u(l.evaluate(p))}],upcase:[Lo,[Lo],(p,[l])=>l.evaluate(p).toUpperCase()],downcase:[Lo,[Lo],(p,[l])=>l.evaluate(p).toLowerCase()],concat:[Lo,bv(Cs),(p,l)=>l.map(u=>yf(u.evaluate(p))).join("")],"resolved-locale":[Lo,[m2],(p,[l])=>l.evaluate(p).resolvedLocale()],random:[xr,[xr,xr,Cs],(p,l)=>{let[u,f,g]=l.map(w=>w.evaluate(p));if(u>f||u===f)return u;let C;if(typeof g=="string")C=(function(w){let D=0;if(w.length===0)return D;for(let P=0;PJSON.stringify(q)).join(", ")}, but found ${JSON.stringify(B)} instead.`);return B}catch(B){return this._warningHistory[B.message]||(this._warningHistory[B.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${B.message}`)),this._defaultValue}}}function aE(p){return Array.isArray(p)&&p.length>0&&typeof p[0]=="string"&&p[0]in aS}function eC(p,l,u,f){let g=new x2(aS,[],l?(function(w){let D={color:Bm,string:Lo,number:xr,enum:Lo,boolean:La,formatted:jT,resolvedImage:qT};return w.type==="array"?Op(D[w.value]||Cs,w.length):D[w.type]})(l):void 0,void 0,void 0,u,f),C=g.parse(p,void 0,void 0,void 0,l&&l.type==="string"?{typeAnnotation:"coerce"}:void 0);return C?yF(new _p(C,l,u,f)):Gm(g.errors)}class og{constructor(l,u,f,g){this.kind=l,this._styleExpression=u,this.isLightConstant=f,this.isLineProgressConstant=g,this.isStateDependent=l!=="constant"&&!tS(u.expression),this.configDependencies=Qb(u.expression)}evaluateWithoutErrorHandling(l,u,f,g,C,w){return this._styleExpression.evaluateWithoutErrorHandling(l,u,f,g,C,w)}evaluate(l,u,f,g,C,w){return this._styleExpression.evaluate(l,u,f,g,C,w)}}class ry{constructor(l,u,f,g,C,w){this.kind=l,this.zoomStops=f,this._styleExpression=u,this.isStateDependent=l!=="camera"&&!tS(u.expression),this.isLightConstant=C,this.isLineProgressConstant=w,this.configDependencies=Qb(u.expression),this.interpolationType=g}evaluateWithoutErrorHandling(l,u,f,g,C,w){return this._styleExpression.evaluateWithoutErrorHandling(l,u,f,g,C,w)}evaluate(l,u,f,g,C,w){return this._styleExpression.evaluate(l,u,f,g,C,w)}interpolationFactor(l,u,f){return this.interpolationType?ou.interpolationFactor(this.interpolationType,l,u,f):0}}function cS(p,l,u,f){if((p=eC(p,l,u,f)).result==="error")return p;let g=p.value.expression,C=eS(g);if(!C&&!iy(l))return Gm([new _f("","data expressions not supported")]);let w=Zb(g,["zoom","pitch","distance-from-center"]);if(!w&&!LV(l))return Gm([new _f("","zoom expressions not supported")]);let D=Zb(g,["measure-light"]);if(!D&&!rg(l))return Gm([new _f("","measure-light expression not supported")]);let P=Zb(g,["line-progress"]);if(!P&&!(function($){return ty($.expression,"line-progress")})(l))return Gm([new _f("","line-progress expression not supported")]);let B=l.expression&&l.expression.relaxZoomRestriction,q=dS(g);return q||w||B?q instanceof _f?Gm([q]):q instanceof ou&&!nE(l)?Gm([new _f("",'"interpolate" expressions cannot be used with this property')]):yF(q?new ry(C&&P?"camera":"composite",p.value,q.labels,q instanceof ou?q.interpolation:void 0,D,P):new og(C&&P?"constant":"source",p.value,D,P)):Gm([new _f("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class ag{constructor(l,u){this._parameters=l,this._specification=u,Fx(this,ny(this._parameters,this._specification))}static deserialize(l){return new ag(l._parameters,l._specification)}static serialize(l){return{_parameters:l._parameters,_specification:l._specification}}}function dS(p){let l=null;if(p instanceof eE)l=dS(p.result);else if(p instanceof E2){for(let u of p.args)if(l=dS(u),l)break}else(p instanceof ZT||p instanceof ou)&&p.input instanceof _u&&p.input.name==="zoom"&&(l=p);return l instanceof _f||p.eachChild(u=>{let f=dS(u);f instanceof _f?l=f:l&&f&&l!==f&&(l=new _f("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),l}var sm,N2,CF=(function(){if(N2)return sm;N2=1,sm=l;var p=3;function l(u,f,g){var C=this.cells=[];if(u instanceof ArrayBuffer){this.arrayBuffer=u;var w=new Int32Array(this.arrayBuffer);u=w[0],this.d=(f=w[1])+2*(g=w[2]);for(var D=0;D=K[ge+0]&&C>=K[ge+1])?(P[re]=!0,D.push($[re])):P[re]=!1}}},l.prototype._forEachCell=function(u,f,g,C,w,D,P,B){for(var q=this._convertToCellCoord(u),$=this._convertToCellCoord(f),K=this._convertToCellCoord(g),ne=this._convertToCellCoord(C),re=q;re<=K;re++)for(var ge=$;ge<=ne;ge++){var ve=this.d*ge+re;if((!B||B(this._convertFromCellCoord(re),this._convertFromCellCoord(ge),this._convertFromCellCoord(re+1),this._convertFromCellCoord(ge+1)))&&w.call(this,u,f,g,C,ve,D,P,B))return}},l.prototype._convertFromCellCoord=function(u){return(u-this.padding)/this.scale},l.prototype._convertToCellCoord=function(u){return Math.max(0,Math.min(this.d-1,Math.floor(u*this.scale)+this.padding))},l.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var u=this.cells,f=p+this.cells.length+1+1,g=0,C=0;C=0||(g[C]=oy(p[C],l)));p instanceof Error&&(g.message=p.message)}if(g.$name)throw new Error("$name property is reserved for worker serialization logic.");return f!=="Object"&&(g.$name=f),g}throw new Error("can't serialize object of type "+typeof p)}function Mh(p){if(p==null||typeof p=="boolean"||typeof p=="number"||typeof p=="string"||p instanceof Boolean||p instanceof Number||p instanceof String||p instanceof Date||p instanceof RegExp||L2(p)||Cv(p)||ArrayBuffer.isView(p)||p instanceof ImageData)return p;if(Array.isArray(p))return p.map(Mh);if(typeof p=="object"){let l=p.$name||"Object";if(l==="Map"){let g=p.entries||[],C=new Map;for(let w=0;wp>=128&&p<=255,Arabic:p=>p>=1536&&p<=1791,"Arabic Supplement":p=>p>=1872&&p<=1919,"Arabic Extended-A":p=>p>=2208&&p<=2303,"Hangul Jamo":p=>p>=4352&&p<=4607,"Unified Canadian Aboriginal Syllabics":p=>p>=5120&&p<=5759,Khmer:p=>p>=6016&&p<=6143,"Unified Canadian Aboriginal Syllabics Extended":p=>p>=6320&&p<=6399,"General Punctuation":p=>p>=8192&&p<=8303,"Letterlike Symbols":p=>p>=8448&&p<=8527,"Number Forms":p=>p>=8528&&p<=8591,"Miscellaneous Technical":p=>p>=8960&&p<=9215,"Control Pictures":p=>p>=9216&&p<=9279,"Optical Character Recognition":p=>p>=9280&&p<=9311,"Enclosed Alphanumerics":p=>p>=9312&&p<=9471,"Geometric Shapes":p=>p>=9632&&p<=9727,"Miscellaneous Symbols":p=>p>=9728&&p<=9983,"Miscellaneous Symbols and Arrows":p=>p>=11008&&p<=11263,"CJK Radicals Supplement":p=>p>=11904&&p<=12031,"Kangxi Radicals":p=>p>=12032&&p<=12255,"Ideographic Description Characters":p=>p>=12272&&p<=12287,"CJK Symbols and Punctuation":p=>p>=12288&&p<=12351,Hiragana:p=>p>=12352&&p<=12447,Katakana:p=>p>=12448&&p<=12543,Bopomofo:p=>p>=12544&&p<=12591,"Hangul Compatibility Jamo":p=>p>=12592&&p<=12687,Kanbun:p=>p>=12688&&p<=12703,"Bopomofo Extended":p=>p>=12704&&p<=12735,"CJK Strokes":p=>p>=12736&&p<=12783,"Katakana Phonetic Extensions":p=>p>=12784&&p<=12799,"Enclosed CJK Letters and Months":p=>p>=12800&&p<=13055,"CJK Compatibility":p=>p>=13056&&p<=13311,"CJK Unified Ideographs Extension A":p=>p>=13312&&p<=19903,"Yijing Hexagram Symbols":p=>p>=19904&&p<=19967,"CJK Unified Ideographs":p=>p>=19968&&p<=40959,"Yi Syllables":p=>p>=40960&&p<=42127,"Yi Radicals":p=>p>=42128&&p<=42191,"Hangul Jamo Extended-A":p=>p>=43360&&p<=43391,"Hangul Syllables":p=>p>=44032&&p<=55215,"Hangul Jamo Extended-B":p=>p>=55216&&p<=55295,"Private Use Area":p=>p>=57344&&p<=63743,"CJK Compatibility Ideographs":p=>p>=63744&&p<=64255,"Arabic Presentation Forms-A":p=>p>=64336&&p<=65023,"Vertical Forms":p=>p>=65040&&p<=65055,"CJK Compatibility Forms":p=>p>=65072&&p<=65103,"Small Form Variants":p=>p>=65104&&p<=65135,"Arabic Presentation Forms-B":p=>p>=65136&&p<=65279,"Halfwidth and Fullwidth Forms":p=>p>=65280&&p<=65519,Osage:p=>p>=66736&&p<=66815,"CJK Unified Ideographs Extension B":p=>p>=131072&&p<=173791};function jx(p){for(let l of p)if(uS(l.charCodeAt(0)))return!0;return!1}function C7(p){for(let l of p)if(!x7(l.charCodeAt(0)))return!1;return!0}function x7(p){return!(Qr.Arabic(p)||Qr["Arabic Supplement"](p)||Qr["Arabic Extended-A"](p)||Qr["Arabic Presentation Forms-A"](p)||Qr["Arabic Presentation Forms-B"](p))}function uS(p){return!(p!==746&&p!==747&&(p<4352||!(Qr["Bopomofo Extended"](p)||Qr.Bopomofo(p)||Qr["CJK Compatibility Forms"](p)&&!(p>=65097&&p<=65103)||Qr["CJK Compatibility Ideographs"](p)||Qr["CJK Compatibility"](p)||Qr["CJK Radicals Supplement"](p)||Qr["CJK Strokes"](p)||!(!Qr["CJK Symbols and Punctuation"](p)||p>=12296&&p<=12305||p>=12308&&p<=12319||p===12336)||Qr["CJK Unified Ideographs Extension A"](p)||Qr["CJK Unified Ideographs"](p)||Qr["Enclosed CJK Letters and Months"](p)||Qr["Hangul Compatibility Jamo"](p)||Qr["Hangul Jamo Extended-A"](p)||Qr["Hangul Jamo Extended-B"](p)||Qr["Hangul Jamo"](p)||Qr["Hangul Syllables"](p)||Qr.Hiragana(p)||Qr["Ideographic Description Characters"](p)||Qr.Kanbun(p)||Qr["Kangxi Radicals"](p)||Qr["Katakana Phonetic Extensions"](p)||Qr.Katakana(p)&&p!==12540||!(!Qr["Halfwidth and Fullwidth Forms"](p)||p===65288||p===65289||p===65293||p>=65306&&p<=65310||p===65339||p===65341||p===65343||p>=65371&&p<=65503||p===65507||p>=65512&&p<=65519)||!(!Qr["Small Form Variants"](p)||p>=65112&&p<=65118||p>=65123&&p<=65126)||Qr["Unified Canadian Aboriginal Syllabics"](p)||Qr["Unified Canadian Aboriginal Syllabics Extended"](p)||Qr["Vertical Forms"](p)||Qr["Yijing Hexagram Symbols"](p)||Qr["Yi Syllables"](p)||Qr["Yi Radicals"](p))))}function lE(p){return!(uS(p)||(function(l){return!!(Qr["Latin-1 Supplement"](l)&&(l===167||l===169||l===174||l===177||l===188||l===189||l===190||l===215||l===247)||Qr["General Punctuation"](l)&&(l===8214||l===8224||l===8225||l===8240||l===8241||l===8251||l===8252||l===8258||l===8263||l===8264||l===8265||l===8273)||Qr["Letterlike Symbols"](l)||Qr["Number Forms"](l)||Qr["Miscellaneous Technical"](l)&&(l>=8960&&l<=8967||l>=8972&&l<=8991||l>=8996&&l<=9e3||l===9003||l>=9085&&l<=9114||l>=9150&&l<=9165||l===9167||l>=9169&&l<=9179||l>=9186&&l<=9215)||Qr["Control Pictures"](l)&&l!==9251||Qr["Optical Character Recognition"](l)||Qr["Enclosed Alphanumerics"](l)||Qr["Geometric Shapes"](l)||Qr["Miscellaneous Symbols"](l)&&!(l>=9754&&l<=9759)||Qr["Miscellaneous Symbols and Arrows"](l)&&(l>=11026&&l<=11055||l>=11088&&l<=11097||l>=11192&&l<=11243)||Qr["CJK Symbols and Punctuation"](l)||Qr.Katakana(l)||Qr["Private Use Area"](l)||Qr["CJK Compatibility Forms"](l)||Qr["Small Form Variants"](l)||Qr["Halfwidth and Fullwidth Forms"](l)||l===8734||l===8756||l===8757||l>=9984&&l<=10087||l>=10102&&l<=10131||l===65532||l===65533)})(p))}function VV(p){return Qr.Arabic(p)||Qr["Arabic Supplement"](p)||Qr["Arabic Extended-A"](p)||Qr["Arabic Presentation Forms-A"](p)||Qr["Arabic Presentation Forms-B"](p)}function B2(p){return p>=1424&&p<=2303||Qr["Arabic Presentation Forms-A"](p)||Qr["Arabic Presentation Forms-B"](p)}function w7(p,l){return!(!l&&B2(p)||p>=2304&&p<=3583||p>=3840&&p<=4255||Qr.Khmer(p))}function zV(p){for(let l of p)if(B2(l.charCodeAt(0)))return!0;return!1}let jm={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"},xF=null,Pp=jm.unavailable,xv=null,wF=function(p){p&&typeof p=="string"&&p.indexOf("NetworkError")>-1&&(Pp=jm.error),xF&&xF(p)};function V2(){pS.fire(new dv("pluginStateChange",{pluginStatus:Pp,pluginURL:xv}))}let pS=new Hb,SF=function(){return Pp},IF=function(){if(Pp!==jm.deferred||!xv)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Pp=jm.loading,V2(),xv&&VT({url:xv},p=>{p?wF(p):(Pp=jm.loaded,V2())})},J_={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Pp===jm.loaded||J_.applyArabicShaping!=null,isLoading:()=>Pp===jm.loading,setState(p){Pp=p.pluginStatus,xv=p.pluginURL},isParsing:()=>Pp===jm.parsing,isParsed:()=>Pp===jm.parsed,getPluginURL:()=>xv};class Ys{constructor(l,u){this.zoom=l,u?(this.now=u.now,this.fadeDuration=u.fadeDuration,this.transition=u.transition,this.pitch=u.pitch,this.brightness=u.brightness,this.worldview=u.worldview):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(l){return(function(u,f){for(let g of u)if(!w7(g.charCodeAt(0),f))return!1;return!0})(l,J_.isLoaded())}}class mS{constructor(l,u,f,g){this.property=l,this.value=u,this.expression=(function(C,w,D,P){if(rE(C))return new ag(C,w);if(aE(C)||Array.isArray(C)&&C.length>0){let B=cS(C,w,D,P);if(B.result==="error")throw new Error(B.value.map(q=>`${q.key}: ${q.message}`).join(", "));return B.value}{let B=C;return typeof C=="string"&&w.type==="color"&&(B=Ds.parse(C)),{kind:"constant",configDependencies:new Set,evaluate:()=>B}}})(u===void 0?l.specification.default:u,l.specification,f,g)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(l,u,f){return this.property.possiblyEvaluate(this,l,u,f)}}class z2{constructor(l,u,f){this.property=l,this.value=new mS(l,void 0,u,f)}transitioned(l,u){return new TF(this.property,this.value,u,ri({},l.transition,this.transition),l.now)}untransitioned(){return new TF(this.property,this.value,null,{},0)}}class qx{constructor(l,u,f){this._properties=l,this._values=Object.create(l.defaultTransitionablePropertyValues),this._scope=u,this._options=f,this.configDependencies=new Set}getValue(l){return ho(this._values[l].value.value)}setValue(l,u){this._values.hasOwnProperty(l)||(this._values[l]=new z2(this._values[l].property,this._scope,this._options)),this._values[l].value=new mS(this._values[l].property,u===null?void 0:ho(u),this._scope,this._options),this._values[l].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[l].value.expression.configDependencies]))}setTransitionOrValue(l,u){u&&(this._options=u);let f=this._properties.properties;if(l)for(let g in l){let C=l[g];if(g.endsWith("-transition")){let w=g.slice(0,-11);f[w]&&this.setTransition(w,C)}else f.hasOwnProperty(g)&&this.setValue(g,C)}}getTransition(l){return ho(this._values[l].transition)}setTransition(l,u){this._values.hasOwnProperty(l)||(this._values[l]=new z2(this._values[l].property)),this._values[l].transition=ho(u)||void 0}serialize(){let l={};for(let u of Object.keys(this._values)){let f=this.getValue(u);f!==void 0&&(l[u]=f);let g=this.getTransition(u);g!==void 0&&(l[`${u}-transition`]=g)}return l}transitioned(l,u){let f=new U2(this._properties);for(let g of Object.keys(this._values))f._values[g]=this._values[g].transitioned(l,u._values[g]);return f}untransitioned(){let l=new U2(this._properties);for(let u of Object.keys(this._values))l._values[u]=this._values[u].untransitioned();return l}}class TF{constructor(l,u,f,g,C){let w=g.delay||0,D=g.duration||0;C=C||0,this.property=l,this.value=u,this.begin=C+w,this.end=this.begin+D,l.specification.transition&&(g.delay||g.duration)&&(this.prior=f)}possiblyEvaluate(l,u,f){let g=l.now||0,C=this.value.possiblyEvaluate(l,u,f),w=this.prior;if(w){if(g>this.end)return this.prior=null,C;if(this.value.isDataDriven())return this.prior=null,C;if(g":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":{}}},"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]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function UV(p){return p instanceof Number||p instanceof String||p instanceof Boolean?p.valueOf():p}function qm(p){if(Array.isArray(p))return p.map(qm);if(p instanceof Object&&!(p instanceof Number||p instanceof String||p instanceof Boolean)){let l={};for(let u in p)l[u]=qm(p[u]);return l}return UV(p)}function cE(p){if(p===!0||p===!1)return!0;if(!Array.isArray(p)||p.length===0)return!1;switch(p[0]){case"has":return p.length>=2&&p[1]!=="$id"&&p[1]!=="$type";case"in":return p.length>=3&&(typeof p[1]!="string"||Array.isArray(p[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return p.length!==3||Array.isArray(p[1])||Array.isArray(p[2]);case"any":case"all":for(let l of p.slice(1))if(!cE(l)&&typeof l!="boolean")return!1;return!0;default:return!0}}function Sv(p,l="",u=null,f="fill"){if(p==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};cE(p)||(p=mE(p));let g=p,C=!0;try{C=(function(q){if(!$x(q))return q;let $=qm(q);return uE($),$=dE($),$})(g)}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(g,null,2)}
`)}let w=null,D=null;if(f!=="background"&&f!=="sky"&&f!=="slot"){D=Zt[`filter_${f}`];let q=eC(C,D,l,u);if(q.result==="error")throw new Error(q.value.map($=>`${$.key}: ${$.message}`).join(", "));w=($,K,ne)=>q.value.evaluate($,K,{},ne)}let P=null,B=null;if(C!==g){let q=eC(g,D,l,u);if(q.result==="error")throw new Error(q.value.map($=>`${$.key}: ${$.message}`).join(", "));P=($,K,ne,re,ge)=>q.value.evaluate($,K,{},ne,void 0,void 0,re,ge),B=!eS(q.value.expression)}return{filter:w,dynamicFilter:P||void 0,needGeometry:pE(C),needFeature:!!B}}function dE(p){if(!Array.isArray(p))return p;let l=(function(u){if(yu.has(u[0])){for(let f=1;fdE(u))}function uE(p){let l=!1,u=[];if(p[0]==="case"){for(let f=1;f",">=","<","<=","to-boolean"]);function nC(p,l){return pl?1:0}function pE(p){if(!Array.isArray(p))return!1;if(p[0]==="within"||p[0]==="distance")return!0;for(let l=1;l"||l==="<="||l===">="?hS(p[1],p[2],l):l==="any"?(u=p.slice(1),["any"].concat(u.map(mE))):l==="all"?["all"].concat(p.slice(1).map(mE)):l==="none"?["all"].concat(p.slice(1).map(mE).map(hE)):l==="in"?EF(p[1],p.slice(2)):l==="!in"?hE(EF(p[1],p.slice(2))):l==="has"?H2(p[1]):l!=="!has"||hE(H2(p[1]));var u}function hS(p,l,u){switch(p){case"$type":return[`filter-type-${u}`,l];case"$id":return[`filter-id-${u}`,l];default:return[`filter-${u}`,p,l]}}function EF(p,l){if(l.length===0)return!1;switch(p){case"$type":return["filter-type-in",["literal",l]];case"$id":return["filter-id-in",["literal",l]];default:return l.length>200&&!l.some(u=>typeof u!=typeof l[0])?["filter-in-large",p,["literal",l.sort(nC)]]:["filter-in-small",p,["literal",l]]}}function H2(p){switch(p){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",p]}}function hE(p){return["!",p]}let Kx="";function rC(p,l){return l?`${p}${Kx}${l}`:p}let Iv="-transition",S7=new Set(["fill","line","background","hillshade","raster"]);class Ud extends Hb{constructor(l,u,f,g,C){if(super(),this.id=l.id,this.fqid=rC(this.id,f),this.type=l.type,this.scope=f,this.lut=g,this.options=C,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,l.type!=="custom"){if(this.metadata=l.metadata,this.minzoom=l.minzoom,this.maxzoom=l.maxzoom,l.type&&l.type!=="background"&&l.type!=="sky"&&l.type!=="slot"){this.source=l.source,this.sourceLayer=l["source-layer"],this.filter=l.filter;let w=eC(this.filter,Zt[`filter_${l.type}`]);w.result!=="error"&&(this.configDependencies=new Set([...this.configDependencies,...w.value.configDependencies]))}if(l.slot&&(this.slot=l.slot),u.layout&&(this._unevaluatedLayout=new iC(u.layout,this.scope,C),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),u.paint){this._transitionablePaint=new qx(u.paint,this.scope,C);for(let w in l.paint)this.setPaintProperty(w,l.paint[w]);for(let w in l.layout)this.setLayoutProperty(w,l.layout[w]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ss(u.paint)}}}onAdd(l){}onRemove(l){}isDraped(l){return!this.is3D(!0)&&S7.has(this.type)}getLayoutProperty(l){return l==="visibility"?this.visibility:this._unevaluatedLayout.getValue(l)}setLayoutProperty(l,u){if(this.type==="custom"&&l==="visibility")return void(this.visibility=u);let f=this._unevaluatedLayout;f._properties.properties[l]&&(f.setValue(l,u),this.configDependencies=new Set([...this.configDependencies,...f.configDependencies]),l==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(l){return l.endsWith(Iv)?this._transitionablePaint.getTransition(l.slice(0,-11)):this._transitionablePaint.getValue(l)}setPaintProperty(l,u){let f=this._transitionablePaint,g=f._properties.properties;if(l.endsWith(Iv)){let $=l.slice(0,-11);return g[$]&&f.setTransition($,u||void 0),!1}if(!g[l])return!1;let C=f._values[l],w=C.value.isDataDriven(),D=C.value;f.setValue(l,u),this.configDependencies=new Set([...this.configDependencies,...f.configDependencies]),this._handleSpecialPaintPropertyUpdate(l);let P=f._values[l].value,B=P.isDataDriven(),q=l.endsWith("pattern")||l==="line-dasharray";return B||w||q||this._handleOverridablePaintPropertyUpdate(l,D,P)}_handleSpecialPaintPropertyUpdate(l){}getProgramIds(){return null}getDefaultProgramParams(l,u,f){return null}_handleOverridablePaintPropertyUpdate(l,u,f){return!1}isHidden(l){return!!(this.minzoom&&l=this.maxzoom)||this.visibility==="none"}updateTransitions(l){this._transitioningPaint=this._transitionablePaint.transitioned(l,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(l,u){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(l,void 0,u)),this.paint=this._transitioningPaint.possiblyEvaluate(l,void 0,u)}serialize(){return ga({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()},(l,u)=>!(l===void 0||u==="layout"&&!Object.keys(l).length||u==="paint"&&!Object.keys(l).length))}is3D(l){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 l in this.paint._values){let u=this.paint.get(l);if(u instanceof wv&&iy(u.property.specification)&&(u.value.kind==="source"||u.value.kind==="composite")&&u.value.isStateDependent)return!0}return!1}compileFilter(l){this._filterCompiled||(this._featureFilter=Sv(this.filter,this.scope,l),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(l){this._stats&&(l.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(l){}queryIntersectsFeature(l,u,f,g,C,w,D,P,B){}}let HV={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class fS{constructor(l,u){this._structArray=l,this._pos1=u*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Ml{constructor(){this.capacity=-1,this.resize(0)}static serialize(l,u){return l._trim(),u&&u.add(l.arrayBuffer),{length:l.length,arrayBuffer:l.arrayBuffer}}static deserialize(l){let u=Object.create(this.prototype);return u.arrayBuffer=l.arrayBuffer,u.length=l.length,u.capacity=l.arrayBuffer.byteLength/u.bytesPerElement,u._refreshViews(),u}_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(l){this.reserve(l),this.length=l}reserve(l){if(l>this.capacity){this.capacity=Math.max(l,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let u=this.uint8;this._refreshViews(),u&&this.uint8.set(u)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...l){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...l){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 Oa(p,l=1){let u=0,f=0;return{members:p.map(g=>{let C=HV[g.type].BYTES_PER_ELEMENT,w=u=AF(u,Math.max(l,C)),D=g.components||1;return f=Math.max(f,C),u+=C*D,{name:g.name,type:g.type,components:D,offset:w}}),size:AF(u,Math.max(f,l)),alignment:l}}function AF(p,l){return Math.ceil(p/l)*l}class Rh extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u){let f=this.length;return this.resize(f+1),this.emplace(f,l,u)}emplace(l,u,f){let g=2*l;return this.int16[g+0]=u,this.int16[g+1]=f,l}}Rh.prototype.bytesPerElement=4,Jn(Rh,"StructArrayLayout2i4");class Yx extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,f){let g=this.length;return this.resize(g+1),this.emplace(g,l,u,f)}emplace(l,u,f,g){let C=3*l;return this.int16[C+0]=u,this.int16[C+1]=f,this.int16[C+2]=g,l}}Yx.prototype.bytesPerElement=6,Jn(Yx,"StructArrayLayout3i6");class Wx extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,f,g){let C=this.length;return this.resize(C+1),this.emplace(C,l,u,f,g)}emplace(l,u,f,g,C){let w=4*l;return this.int16[w+0]=u,this.int16[w+1]=f,this.int16[w+2]=g,this.int16[w+3]=C,l}}Wx.prototype.bytesPerElement=8,Jn(Wx,"StructArrayLayout4i8");class Qx extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l){let u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.float32[1*l+0]=u,l}}Qx.prototype.bytesPerElement=4,Jn(Qx,"StructArrayLayout1f4");class G2 extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f){let g=this.length;return this.resize(g+1),this.emplace(g,l,u,f)}emplace(l,u,f,g){let C=4*l,w=2*l;return this.int16[C+0]=u,this.int16[C+1]=f,this.float32[w+1]=g,l}}G2.prototype.bytesPerElement=8,Jn(G2,"StructArrayLayout2i1f8");class j2 extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,f){let g=this.length;return this.resize(g+1),this.emplace(g,l,u,f)}emplace(l,u,f,g){let C=4*l;return this.int16[C+0]=u,this.int16[C+1]=f,this.int16[C+2]=g,l}}j2.prototype.bytesPerElement=8,Jn(j2,"StructArrayLayout3i8");class lm extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C){let w=this.length;return this.resize(w+1),this.emplace(w,l,u,f,g,C)}emplace(l,u,f,g,C,w){let D=5*l;return this.int16[D+0]=u,this.int16[D+1]=f,this.int16[D+2]=g,this.int16[D+3]=C,this.int16[D+4]=w,l}}lm.prototype.bytesPerElement=10,Jn(lm,"StructArrayLayout5i10");class sg extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C,w,D){let P=this.length;return this.resize(P+1),this.emplace(P,l,u,f,g,C,w,D)}emplace(l,u,f,g,C,w,D,P){let B=6*l,q=12*l,$=3*l;return this.int16[B+0]=u,this.int16[B+1]=f,this.uint8[q+4]=g,this.uint8[q+5]=C,this.uint8[q+6]=w,this.uint8[q+7]=D,this.float32[$+2]=P,l}}sg.prototype.bytesPerElement=12,Jn(sg,"StructArrayLayout2i4ub1f12");class lg extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f){let g=this.length;return this.resize(g+1),this.emplace(g,l,u,f)}emplace(l,u,f,g){let C=3*l;return this.float32[C+0]=u,this.float32[C+1]=f,this.float32[C+2]=g,l}}lg.prototype.bytesPerElement=12,Jn(lg,"StructArrayLayout3f12");class oC extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C){let w=this.length;return this.resize(w+1),this.emplace(w,l,u,f,g,C)}emplace(l,u,f,g,C,w){let D=6*l,P=3*l;return this.uint16[D+0]=u,this.uint16[D+1]=f,this.uint16[D+2]=g,this.uint16[D+3]=C,this.float32[P+2]=w,l}}oC.prototype.bytesPerElement=12,Jn(oC,"StructArrayLayout4ui1f12");class Tv extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,f,g){let C=this.length;return this.resize(C+1),this.emplace(C,l,u,f,g)}emplace(l,u,f,g,C){let w=4*l;return this.uint16[w+0]=u,this.uint16[w+1]=f,this.uint16[w+2]=g,this.uint16[w+3]=C,l}}Tv.prototype.bytesPerElement=8,Jn(Tv,"StructArrayLayout4ui8");class Ev extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C,w){let D=this.length;return this.resize(D+1),this.emplace(D,l,u,f,g,C,w)}emplace(l,u,f,g,C,w,D){let P=6*l;return this.int16[P+0]=u,this.int16[P+1]=f,this.int16[P+2]=g,this.int16[P+3]=C,this.int16[P+4]=w,this.int16[P+5]=D,l}}Ev.prototype.bytesPerElement=12,Jn(Ev,"StructArrayLayout6i12");class fE extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C,w,D,P,B,q,$,K){let ne=this.length;return this.resize(ne+1),this.emplace(ne,l,u,f,g,C,w,D,P,B,q,$,K)}emplace(l,u,f,g,C,w,D,P,B,q,$,K,ne){let re=12*l;return this.int16[re+0]=u,this.int16[re+1]=f,this.int16[re+2]=g,this.int16[re+3]=C,this.uint16[re+4]=w,this.uint16[re+5]=D,this.uint16[re+6]=P,this.uint16[re+7]=B,this.int16[re+8]=q,this.int16[re+9]=$,this.int16[re+10]=K,this.int16[re+11]=ne,l}}fE.prototype.bytesPerElement=24,Jn(fE,"StructArrayLayout4i4ui4i24");class Zx extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C,w){let D=this.length;return this.resize(D+1),this.emplace(D,l,u,f,g,C,w)}emplace(l,u,f,g,C,w,D){let P=10*l,B=5*l;return this.int16[P+0]=u,this.int16[P+1]=f,this.int16[P+2]=g,this.float32[B+2]=C,this.float32[B+3]=w,this.float32[B+4]=D,l}}Zx.prototype.bytesPerElement=20,Jn(Zx,"StructArrayLayout3i3f20");class aC extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f,g){let C=this.length;return this.resize(C+1),this.emplace(C,l,u,f,g)}emplace(l,u,f,g,C){let w=4*l;return this.float32[w+0]=u,this.float32[w+1]=f,this.float32[w+2]=g,this.float32[w+3]=C,l}}aC.prototype.bytesPerElement=16,Jn(aC,"StructArrayLayout4f16");class q2 extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(l){let u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.uint32[1*l+0]=u,l}}q2.prototype.bytesPerElement=4,Jn(q2,"StructArrayLayout1ul4");class Oh extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u){let f=this.length;return this.resize(f+1),this.emplace(f,l,u)}emplace(l,u,f){let g=2*l;return this.uint16[g+0]=u,this.uint16[g+1]=f,l}}Oh.prototype.bytesPerElement=4,Jn(Oh,"StructArrayLayout2ui4");class Xx extends Ml{_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(l,u,f,g,C,w,D,P,B,q,$,K,ne){let re=this.length;return this.resize(re+1),this.emplace(re,l,u,f,g,C,w,D,P,B,q,$,K,ne)}emplace(l,u,f,g,C,w,D,P,B,q,$,K,ne,re){let ge=20*l,ve=10*l;return this.int16[ge+0]=u,this.int16[ge+1]=f,this.int16[ge+2]=g,this.int16[ge+3]=C,this.int16[ge+4]=w,this.float32[ve+3]=D,this.float32[ve+4]=P,this.float32[ve+5]=B,this.float32[ve+6]=q,this.int16[ge+14]=$,this.uint32[ve+8]=K,this.uint16[ge+18]=ne,this.uint16[ge+19]=re,l}}Xx.prototype.bytesPerElement=40,Jn(Xx,"StructArrayLayout5i4f1i1ul2ui40");class $2 extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C,w,D){let P=this.length;return this.resize(P+1),this.emplace(P,l,u,f,g,C,w,D)}emplace(l,u,f,g,C,w,D,P){let B=8*l;return this.int16[B+0]=u,this.int16[B+1]=f,this.int16[B+2]=g,this.int16[B+4]=C,this.int16[B+5]=w,this.int16[B+6]=D,this.int16[B+7]=P,l}}$2.prototype.bytesPerElement=16,Jn($2,"StructArrayLayout3i2i2i16");class Jx extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C){let w=this.length;return this.resize(w+1),this.emplace(w,l,u,f,g,C)}emplace(l,u,f,g,C,w){let D=4*l,P=8*l;return this.float32[D+0]=u,this.float32[D+1]=f,this.float32[D+2]=g,this.int16[P+6]=C,this.int16[P+7]=w,l}}Jx.prototype.bytesPerElement=16,Jn(Jx,"StructArrayLayout2f1f2i16");class e1 extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C,w){let D=this.length;return this.resize(D+1),this.emplace(D,l,u,f,g,C,w)}emplace(l,u,f,g,C,w,D){let P=20*l,B=5*l;return this.uint8[P+0]=u,this.uint8[P+1]=f,this.float32[B+1]=g,this.float32[B+2]=C,this.float32[B+3]=w,this.float32[B+4]=D,l}}e1.prototype.bytesPerElement=20,Jn(e1,"StructArrayLayout2ub4f20");class Rl extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,f){let g=this.length;return this.resize(g+1),this.emplace(g,l,u,f)}emplace(l,u,f,g){let C=3*l;return this.uint16[C+0]=u,this.uint16[C+1]=f,this.uint16[C+2]=g,l}}Rl.prototype.bytesPerElement=6,Jn(Rl,"StructArrayLayout3ui6");class t1 extends Ml{_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(l,u,f,g,C,w,D,P,B,q,$,K,ne,re,ge,ve,De,Ve,Be,$e,St){let yt=this.length;return this.resize(yt+1),this.emplace(yt,l,u,f,g,C,w,D,P,B,q,$,K,ne,re,ge,ve,De,Ve,Be,$e,St)}emplace(l,u,f,g,C,w,D,P,B,q,$,K,ne,re,ge,ve,De,Ve,Be,$e,St,yt){let vt=30*l,Vt=15*l,Ht=60*l;return this.int16[vt+0]=u,this.int16[vt+1]=f,this.int16[vt+2]=g,this.float32[Vt+2]=C,this.float32[Vt+3]=w,this.uint16[vt+8]=D,this.uint16[vt+9]=P,this.uint32[Vt+5]=B,this.uint32[Vt+6]=q,this.uint32[Vt+7]=$,this.uint16[vt+16]=K,this.uint16[vt+17]=ne,this.uint16[vt+18]=re,this.float32[Vt+10]=ge,this.float32[Vt+11]=ve,this.uint8[Ht+48]=De,this.uint8[Ht+49]=Ve,this.uint8[Ht+50]=Be,this.uint32[Vt+13]=$e,this.int16[vt+28]=St,this.uint8[Ht+58]=yt,l}}t1.prototype.bytesPerElement=60,Jn(t1,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class gS extends Ml{_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(l,u,f,g,C,w,D,P,B,q,$,K,ne,re,ge,ve,De,Ve,Be,$e,St,yt,vt,Vt,Ht,ki,Xt,Bi,_n,Ki,an,hn,Ai){let sn=this.length;return this.resize(sn+1),this.emplace(sn,l,u,f,g,C,w,D,P,B,q,$,K,ne,re,ge,ve,De,Ve,Be,$e,St,yt,vt,Vt,Ht,ki,Xt,Bi,_n,Ki,an,hn,Ai)}emplace(l,u,f,g,C,w,D,P,B,q,$,K,ne,re,ge,ve,De,Ve,Be,$e,St,yt,vt,Vt,Ht,ki,Xt,Bi,_n,Ki,an,hn,Ai,sn){let Jt=20*l,Di=40*l,yn=80*l;return this.float32[Jt+0]=u,this.float32[Jt+1]=f,this.int16[Di+4]=g,this.int16[Di+5]=C,this.int16[Di+6]=w,this.int16[Di+7]=D,this.int16[Di+8]=P,this.int16[Di+9]=B,this.int16[Di+10]=q,this.int16[Di+11]=$,this.int16[Di+12]=K,this.uint16[Di+13]=ne,this.uint16[Di+14]=re,this.uint16[Di+15]=ge,this.uint16[Di+16]=ve,this.uint16[Di+17]=De,this.uint16[Di+18]=Ve,this.uint16[Di+19]=Be,this.uint16[Di+20]=$e,this.uint16[Di+21]=St,this.uint16[Di+22]=yt,this.uint16[Di+23]=vt,this.uint16[Di+24]=Vt,this.uint16[Di+25]=Ht,this.uint16[Di+26]=ki,this.uint16[Di+27]=Xt,this.uint32[Jt+14]=Bi,this.float32[Jt+15]=_n,this.float32[Jt+16]=Ki,this.float32[Jt+17]=an,this.float32[Jt+18]=hn,this.uint8[yn+76]=Ai,this.uint16[Di+39]=sn,l}}gS.prototype.bytesPerElement=80,Jn(gS,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class gE extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C,w){let D=this.length;return this.resize(D+1),this.emplace(D,l,u,f,g,C,w)}emplace(l,u,f,g,C,w,D){let P=6*l;return this.float32[P+0]=u,this.float32[P+1]=f,this.float32[P+2]=g,this.float32[P+3]=C,this.float32[P+4]=w,this.float32[P+5]=D,l}}gE.prototype.bytesPerElement=24,Jn(gE,"StructArrayLayout6f24");class sy extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C){let w=this.length;return this.resize(w+1),this.emplace(w,l,u,f,g,C)}emplace(l,u,f,g,C,w){let D=5*l;return this.float32[D+0]=u,this.float32[D+1]=f,this.float32[D+2]=g,this.float32[D+3]=C,this.float32[D+4]=w,l}}sy.prototype.bytesPerElement=20,Jn(sy,"StructArrayLayout5f20");class DF extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C,w,D){let P=this.length;return this.resize(P+1),this.emplace(P,l,u,f,g,C,w,D)}emplace(l,u,f,g,C,w,D,P){let B=7*l;return this.float32[B+0]=u,this.float32[B+1]=f,this.float32[B+2]=g,this.float32[B+3]=C,this.float32[B+4]=w,this.float32[B+5]=D,this.float32[B+6]=P,l}}DF.prototype.bytesPerElement=28,Jn(DF,"StructArrayLayout7f28");class _S extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C,w,D,P,B,q,$){let K=this.length;return this.resize(K+1),this.emplace(K,l,u,f,g,C,w,D,P,B,q,$)}emplace(l,u,f,g,C,w,D,P,B,q,$,K){let ne=11*l;return this.float32[ne+0]=u,this.float32[ne+1]=f,this.float32[ne+2]=g,this.float32[ne+3]=C,this.float32[ne+4]=w,this.float32[ne+5]=D,this.float32[ne+6]=P,this.float32[ne+7]=B,this.float32[ne+8]=q,this.float32[ne+9]=$,this.float32[ne+10]=K,l}}_S.prototype.bytesPerElement=44,Jn(_S,"StructArrayLayout11f44");class yS extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C,w,D,P,B){let q=this.length;return this.resize(q+1),this.emplace(q,l,u,f,g,C,w,D,P,B)}emplace(l,u,f,g,C,w,D,P,B,q){let $=9*l;return this.float32[$+0]=u,this.float32[$+1]=f,this.float32[$+2]=g,this.float32[$+3]=C,this.float32[$+4]=w,this.float32[$+5]=D,this.float32[$+6]=P,this.float32[$+7]=B,this.float32[$+8]=q,l}}yS.prototype.bytesPerElement=36,Jn(yS,"StructArrayLayout9f36");class Av extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u){let f=this.length;return this.resize(f+1),this.emplace(f,l,u)}emplace(l,u,f){let g=2*l;return this.float32[g+0]=u,this.float32[g+1]=f,l}}Av.prototype.bytesPerElement=8,Jn(Av,"StructArrayLayout2f8");class _E extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l,u,f,g){let C=this.length;return this.resize(C+1),this.emplace(C,l,u,f,g)}emplace(l,u,f,g,C){let w=6*l;return this.uint32[3*l+0]=u,this.uint16[w+2]=f,this.uint16[w+3]=g,this.uint16[w+4]=C,l}}_E.prototype.bytesPerElement=12,Jn(_E,"StructArrayLayout1ul3ui12");class kF extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(l){let u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.uint16[1*l+0]=u,l}}kF.prototype.bytesPerElement=2,Jn(kF,"StructArrayLayout1ui2");class yE extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C,w,D,P,B,q,$,K,ne,re,ge,ve){let De=this.length;return this.resize(De+1),this.emplace(De,l,u,f,g,C,w,D,P,B,q,$,K,ne,re,ge,ve)}emplace(l,u,f,g,C,w,D,P,B,q,$,K,ne,re,ge,ve,De){let Ve=16*l;return this.float32[Ve+0]=u,this.float32[Ve+1]=f,this.float32[Ve+2]=g,this.float32[Ve+3]=C,this.float32[Ve+4]=w,this.float32[Ve+5]=D,this.float32[Ve+6]=P,this.float32[Ve+7]=B,this.float32[Ve+8]=q,this.float32[Ve+9]=$,this.float32[Ve+10]=K,this.float32[Ve+11]=ne,this.float32[Ve+12]=re,this.float32[Ve+13]=ge,this.float32[Ve+14]=ve,this.float32[Ve+15]=De,l}}yE.prototype.bytesPerElement=64,Jn(yE,"StructArrayLayout16f64");class bf extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(l,u,f,g,C,w,D){let P=this.length;return this.resize(P+1),this.emplace(P,l,u,f,g,C,w,D)}emplace(l,u,f,g,C,w,D,P){let B=10*l,q=5*l;return this.uint16[B+0]=u,this.uint16[B+1]=f,this.uint16[B+2]=g,this.uint16[B+3]=C,this.float32[q+2]=w,this.float32[q+3]=D,this.float32[q+4]=P,l}}bf.prototype.bytesPerElement=20,Jn(bf,"StructArrayLayout4ui3f20");class K2 extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(l){let u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.int16[1*l+0]=u,l}}K2.prototype.bytesPerElement=2,Jn(K2,"StructArrayLayout1i2");class vE extends Ml{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(l){let u=this.length;return this.resize(u+1),this.emplace(u,l)}emplace(l,u){return this.uint8[1*l+0]=u,l}}vE.prototype.bytesPerElement=1,Jn(vE,"StructArrayLayout1ub1");class MF extends fS{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]}}MF.prototype.size=40;class RF extends Xx{get(l){return new MF(this,l)}}Jn(RF,"CollisionBoxArray");class Y2 extends fS{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(l){this._structArray.uint8[this._pos1+49]=l}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(l){this._structArray.uint8[this._pos1+50]=l}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(l){this._structArray.uint32[this._pos4+13]=l}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(l){this._structArray.uint8[this._pos1+58]=l}}Y2.prototype.size=60;class bE extends t1{get(l){return new Y2(this,l)}}Jn(bE,"PlacedSymbolArray");class e0 extends fS{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(l){this._structArray.uint32[this._pos4+14]=l}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(l){this._structArray.float32[this._pos4+18]=l}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}e0.prototype.size=80;class W2 extends gS{get(l){return new e0(this,l)}}Jn(W2,"SymbolInstanceArray");class CE extends Qx{getoffsetX(l){return this.float32[1*l+0]}}Jn(CE,"GlyphOffsetArray");class Q2 extends Rh{getx(l){return this.int16[2*l+0]}gety(l){return this.int16[2*l+1]}}Jn(Q2,"SymbolLineVertexArray");class i1 extends fS{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]}}i1.prototype.size=12;class n1 extends _E{get(l){return new i1(this,l)}}Jn(n1,"FeatureIndexArray");class Ha extends Oh{geta_centroid_pos0(l){return this.uint16[2*l+0]}geta_centroid_pos1(l){return this.uint16[2*l+1]}}Jn(Ha,"FillExtrusionCentroidArray");class xE extends fS{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]}}xE.prototype.size=6;class Z2 extends Yx{get(l){return new xE(this,l)}}Jn(Z2,"FillExtrusionWallArray");let sC=Oa([{name:"a_pos",components:2,type:"Int16"}],4),I7=Oa([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),OF=Oa([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class cc{constructor(l=[]){this.segments=l}_prepareSegment(l,u,f,g){let C=this.segments[this.segments.length-1];return l>cc.MAX_VERTEX_ARRAY_LENGTH&&ba(`Max vertices per segment is ${cc.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${l}`),(!C||C.vertexLength+l>cc.MAX_VERTEX_ARRAY_LENGTH||C.sortKey!==g)&&(C={vertexOffset:u,primitiveOffset:f,vertexLength:0,primitiveLength:0},g!==void 0&&(C.sortKey=g),this.segments.push(C)),C}prepareSegment(l,u,f,g){return this._prepareSegment(l,u.length,f.length,g)}get(){return this.segments}destroy(){for(let l of this.segments)for(let u in l.vaos)l.vaos[u].destroy()}static simpleSegment(l,u,f,g){return new cc([{vertexOffset:l,primitiveOffset:u,vertexLength:f,primitiveLength:g,vaos:{},sortKey:0}])}}function cm(p,l){return 256*(p=nt(Math.floor(p),0,255))+nt(Math.floor(l),0,255)}cc.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Jn(cc,"SegmentVector");let T7=Oa([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),FF=Oa([{name:"a_pattern_b",components:4,type:"Uint16"}]),GV=Oa([{name:"a_dash",components:4,type:"Uint16"}]);class wE{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(l,u,f,g){this.ids.push(vS(l)),this.positions.push(u,f,g)}eachPosition(l,u){let f=vS(l),g=0,C=this.ids.length-1;for(;g>1;this.ids[w]>=f?C=w:g=w+1}for(;this.ids[g]===f;)u(this.positions[3*g],this.positions[3*g+1],this.positions[3*g+2]),g++}static serialize(l,u){let f=new Float64Array(l.ids),g=new Uint32Array(l.positions);return PF(f,g,0,f.length-1),u&&(u.add(f.buffer),u.add(g.buffer)),{ids:f,positions:g}}static deserialize(l){let u=new wE,f;u.ids=l.ids,u.positions=l.positions;for(let g of u.ids)g!==f&&u.uniqueIds.push(g),f=g;return u.indexed=!0,u}}function vS(p){let l=+p;return!isNaN(l)&&Number.MIN_SAFE_INTEGER<=l&&l<=Number.MAX_SAFE_INTEGER?l:Rx(String(p))}function PF(p,l,u,f){for(;u>1],C=u-1,w=f+1;for(;;){do C++;while(p[C]g);if(C>=w)break;X2(p,C,w),X2(l,3*C,3*w),X2(l,3*C+1,3*w+1),X2(l,3*C+2,3*w+2)}w-u`u_${C}`),this.type=f,this.context=g}setUniform(l,u,f,g,C){let w=g.constantOr(this.value);u.set(l,C,w instanceof Ds?w.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.value==="none"?null:this.context.lut):w)}getBinding(l,u){return this.type==="color"?new NF(l):new ol(l)}}class CS{constructor(l,u){this.uniformNames=u.map(f=>`u_${f}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(l,u){this.pixelRatio=l.pixelRatio||1,this.pattern=l.tl.concat(l.br),this.patternTransition=u?u.tl.concat(u.br):this.pattern}setUniform(l,u,f,g,C){let w=null;C!=="u_pattern"&&C!=="u_dash"||(w=this.pattern),C==="u_pattern_b"&&(w=this.patternTransition),C==="u_pixel_ratio"&&(w=this.pixelRatio),w&&u.set(l,C,w)}getBinding(l,u){return u==="u_pattern"||u==="u_pattern_b"||u==="u_dash"?new r1(l):new ol(l)}}class ly{constructor(l,u,f,g){this.expression=l,this.type=f,this.maxValue=0,this.paintVertexAttributes=u.map(C=>({name:`a_${C}`,type:"Float32",components:f==="color"?2:1,offset:0})),this.paintVertexArray=new g}populatePaintArray(l,u,f,g,C,w,D,P){let B=this.paintVertexArray.length,q=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Ys(0,{brightness:w,worldview:P}),u,{},C,g,D):this.expression.kind==="constant"&&this.expression.value,$=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Ys(0,{brightness:w,worldview:P}),u,{},C,g,D):this.lutExpression.value)==="none";this.paintVertexArray.resize(l),this._setPaintValue(B,l,q,$?null:this.context.lut)}updatePaintArray(l,u,f,g,C,w,D,P){let B=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:D,worldview:P},f,g,void 0,C):this.expression.kind==="constant"&&this.expression.value,q=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Ys(0,{brightness:D,worldview:P}),f,g,void 0,C):this.lutExpression.value)==="none";this._setPaintValue(l,u,B,q?null:this.context.lut)}_setPaintValue(l,u,f,g){if(this.type==="color"){let C=VF(f.toPremultipliedRenderColor(g));for(let w=l;w`u_${D}_t`),this.type=f,this.useIntegerZoom=g,this.context=C,this.maxValue=0,this.paintVertexAttributes=u.map(D=>({name:`a_${D}`,type:"Float32",components:f==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(l,u,f,g,C,w,D,P){let B=this.expression.evaluate(new Ys(this.context.zoom,{brightness:w,worldview:P}),u,{},C,g,D),q=this.expression.evaluate(new Ys(this.context.zoom+1,{brightness:w,worldview:P}),u,{},C,g,D),$=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Ys(0,{brightness:w,worldview:P}),u,{},C,g,D):this.lutExpression.value)==="none",K=this.paintVertexArray.length;this.paintVertexArray.resize(l),this._setPaintValue(K,l,B,q,$?null:this.context.lut)}updatePaintArray(l,u,f,g,C,w,D,P){let B=this.expression.evaluate({zoom:this.context.zoom,brightness:D,worldview:P},f,g,void 0,C),q=this.expression.evaluate({zoom:this.context.zoom+1,brightness:D,worldview:P},f,g,void 0,C),$=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new Ys(0,{brightness:D,worldview:P}),f,g,void 0,C):this.lutExpression.value)==="none";this._setPaintValue(l,u,B,q,$?null:this.context.lut)}_setPaintValue(l,u,f,g,C){if(this.type==="color"){let w=VF(f.toPremultipliedRenderColor(C)),D=VF(f.toPremultipliedRenderColor(C));for(let P=l;P!0){this.binders={},this._buffers=[],this.context=u;let g=[];for(let C in l.paint._values){let w=l.paint.get(C);if(C.endsWith("-use-theme")||!f(C)||!(w instanceof wv&&iy(w.property.specification)))continue;let D=zF(C,l.type),P=w.value,B=w.property.specification.type,q=!!w.property.useIntegerZoom,$=C==="line-dasharray"||C.endsWith("pattern"),K=l.paint.get(`${C}-use-theme`),ne=C==="line-dasharray"&&l.layout.get("line-cap").value.kind!=="constant"||K&&K.value.kind!=="constant";if(P.kind!=="constant"||ne)if(P.kind==="source"||ne||$){let re=TE(C,B,"source");this.binders[C]=$?new dg(P,D,B,re,l.id):new ly(P,D,B,re),g.push(`/a_${C}`)}else{let re=TE(C,B,"composite");this.binders[C]=new cg(P,D,B,q,u,re),g.push(`/z_${C}`)}else this.binders[C]=$?new CS(P.value,D):new SE(P.value,D,B,u),g.push(`/u_${C}`);K&&(this.binders[C].lutExpression=K.value)}this.cacheKey=g.sort().join("")}getMaxValue(l){let u=this.binders[l];return u instanceof ly||u instanceof cg?u.maxValue:0}populatePaintArrays(l,u,f,g,C,w,D,P){for(let B in this.binders){let q=this.binders[B];q.context=this.context,(q instanceof ly||q instanceof cg||q instanceof dg)&&q.populatePaintArray(l,u,f,g,C,w,D,P)}}setConstantPatternPositions(l,u){for(let f in this.binders){let g=this.binders[f];g instanceof CS&&g.setConstantPatternPositions(l,u)}}getPatternTransitionVertexBuffer(l){let u=this.binders[l];return u instanceof dg?u.paintTransitionVertexBuffer:null}updatePaintArrays(l,u,f,g,C,w,D,P,B,q){let $=!1,K=Object.keys(l),ne=K.length!==0&&!P,re=ne?K:u.uniqueIds;this.context.lut=C.lut;for(let ge in this.binders){let ve=this.binders[ge];if(ve.context=this.context,(ve instanceof ly||ve instanceof cg||ve instanceof dg)&&ve.expression&&ve.expression.kind&&ve.expression.kind!=="constant"&&(ve.expression.isStateDependent===!0||ve.expression.isLightConstant===!1)){let De=C.paint.get(ge);ve.expression=De.value;for(let Ve of re){let Be=l[Ve.toString()];u.eachPosition(Ve,($e,St,yt)=>{let vt=g.feature($e);ve.updatePaintArray(St,yt,vt,Be,w,D,B,q)})}if(!ne)for(let Ve of f.uniqueIds){let Be=l[Ve.toString()];f.eachPosition(Ve,($e,St,yt)=>{let vt=g.feature($e);ve.updatePaintArray(St,yt,vt,Be,w,D,B,q)})}$=!0}}return $}defines(){let l=[];for(let u in this.binders){let f=this.binders[u];(f instanceof SE||f instanceof CS)&&l.push(...f.uniformNames.map(g=>`#define HAS_UNIFORM_${g}`))}return l}getBinderAttributes(){let l=[];for(let u in this.binders){let f=this.binders[u];if(f instanceof ly||f instanceof cg||f instanceof dg)for(let g=0;g!0){this.programConfigurations={};for(let g of l)this.programConfigurations[g.id]=new Np(g,u,f);this.needsUpload=!1,this._featureMap=new wE,this._featureMapWithoutIds=new wE,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(l,u,f,g,C,w,D,P,B){for(let q in this.programConfigurations)this.programConfigurations[q].populatePaintArrays(l,u,g,C,w,D,P,B);u.id!==void 0?this._featureMap.add(u.id,f,this._bufferOffset,l):(this._featureMapWithoutIds.add(this._idlessCounter,f,this._bufferOffset,l),this._idlessCounter+=1),this._bufferOffset=l,this.needsUpload=!0}updatePaintArrays(l,u,f,g,C,w,D,P){for(let B of f)this.needsUpload=this.programConfigurations[B.id].updatePaintArrays(l,this._featureMap,this._featureMapWithoutIds,u,B,g,C,w,D||0,P)||this.needsUpload}get(l){return this.programConfigurations[l]}upload(l){if(this.needsUpload){for(let u in this.programConfigurations)this.programConfigurations[u].upload(l);this.needsUpload=!1}}destroy(){for(let l in this.programConfigurations)this.programConfigurations[l].destroy()}}let IE={"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 zF(p,l){return IE[p]||[p.replace(`${l}-`,"").replace(/-/g,"_")]}let $V={"line-pattern":{source:oC,composite:oC},"fill-pattern":{source:oC,composite:oC},"fill-extrusion-pattern":{source:oC,composite:oC},"line-dasharray":{source:Tv,composite:Tv}},KV={color:{source:Av,composite:aC},number:{source:Qx,composite:Av}};function TE(p,l,u){let f=$V[p];return f&&f[u]||KV[l][u]}Jn(SE,"ConstantBinder"),Jn(CS,"PatternConstantBinder"),Jn(ly,"SourceExpressionBinder"),Jn(dg,"PatternCompositeBinder"),Jn(cg,"CompositeExpressionBinder"),Jn(Np,"ProgramConfiguration",{omit:["_buffers"]}),Jn(Cf,"ProgramConfigurationSet");let Lp=wn/Math.PI/2,t0=5,y=6,c=16383,m=64,v=[m,32,16],T=-Lp,A=Lp;function O(p,l,u,f=Lp){return u=sa(u),[p*Math.sin(u)*f,-l*f,p*Math.cos(u)*f]}function V(p,l,u){return O(Math.cos(sa(p)),Math.sin(sa(p)),l,u)}let j=63710088e-1,Y=2*Math.PI*j;class W{constructor(l,u){if(isNaN(l)||isNaN(u))throw new Error(`Invalid LngLat object: (${l}, ${u})`);if(this.lng=+l,this.lat=+u,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new W(ci(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(l){let u=Math.PI/180,f=this.lat*u,g=l.lat*u,C=Math.sin(f)*Math.sin(g)+Math.cos(f)*Math.cos(g)*Math.cos((l.lng-this.lng)*u);return j*Math.acos(Math.min(C,1))}toBounds(l=0){let u=360*l/40075017,f=u/Math.cos(Math.PI/180*this.lat);return new oe({lng:this.lng-f,lat:this.lat-u},{lng:this.lng+f,lat:this.lat+u})}toEcef(l){return V(this.lat,this.lng,Lp+l*Lp/j)}static convert(l){if(l instanceof W)return l;if(Array.isArray(l)&&(l.length===2||l.length===3))return new W(Number(l[0]),Number(l[1]));if(!Array.isArray(l)&&typeof l=="object"&&l!==null)return new W(Number("lng"in l?l.lng:l.lon),Number(l.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 oe{constructor(l,u){if(l)if(u)this.setSouthWest(l).setNorthEast(u);else if(l.length===4){let f=l;this.setSouthWest([f[0],f[1]]).setNorthEast([f[2],f[3]])}else{let f=l;this.setSouthWest(f[0]).setNorthEast(f[1])}}setNorthEast(l){return this._ne=l instanceof W?new W(l.lng,l.lat):W.convert(l),this}setSouthWest(l){return this._sw=l instanceof W?new W(l.lng,l.lat):W.convert(l),this}extend(l){let u=this._sw,f=this._ne,g,C;if(l instanceof W)g=l,C=l;else{if(!(l instanceof oe))return Array.isArray(l)?l.length===4||l.every(Array.isArray)?this.extend(oe.convert(l)):this.extend(W.convert(l)):typeof l=="object"&&l!==null&&l.hasOwnProperty("lat")&&(l.hasOwnProperty("lon")||l.hasOwnProperty("lng"))?this.extend(W.convert(l)):this;if(g=l._sw,C=l._ne,!g||!C)return this}return u||f?(u.lng=Math.min(g.lng,u.lng),u.lat=Math.min(g.lat,u.lat),f.lng=Math.max(C.lng,f.lng),f.lat=Math.max(C.lat,f.lat)):(this._sw=new W(g.lng,g.lat),this._ne=new W(C.lng,C.lat)),this}getCenter(){return new W((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 W(this.getWest(),this.getNorth())}getSouthEast(){return new W(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(l){let{lng:u,lat:f}=W.convert(l),g=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(g=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=f&&f<=this._ne.lat&&g}static convert(l){if(l)return l instanceof oe?l:new oe(l)}}let te=0,ae=25.5;function Ce(p){return Y*Math.cos(p*Math.PI/180)}function _e(p){return(180+p)/360}function Ie(p){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+p*Math.PI/360)))/360}function we(p,l){return p/Ce(l)}function Le(p){return 360*p-180}function qe(p){return 360/Math.PI*Math.atan(Math.exp((180-360*p)*Math.PI/180))-90}function Xe(p,l){return p*Ce(qe(l))}let st=85.051129;function _t(p){return Math.cos(sa(nt(p,-st,st)))}function Ct(p,l){let u=nt(l,te,ae),f=Math.pow(2,u);return _t(p)*Y/(512*f)}function lt(p){return 1/Math.cos(p*Math.PI/180)}function ut(p,l=0){let u=Math.exp(Math.PI*(1-(p.y+l/wn)/(1<=P?(Qt(p,l,u,B,q,C,$,D,P),Qt(p,B,q,f,g,$,w,D,P)):p.push(w)}function Nt(p,l,u){let f=p[0],g=f.x,C=f.y;l(f);let w=[f];for(let D=1;Dp.x+1||fp.y+1)&&ba("Geometry exceeds allowed extent, reduce your vector tile buffer size"),p}function Mt(p,l,u){let f=p.loadGeometry(),g=p.extent,C=wn/g;if(l&&u&&u.projection.isReprojectedInTileSpace){let w=1<{let ne=Le((l.x+K.x/g)/w),re=qe((l.y+K.y/g)/w),ge=q.project(ne,re);K.x=(ge.x*D-P)*g,K.y=(ge.y*D-B)*g};for(let K=0;K=g||re.y<0||re.y>=g||($(re),ne.push(re));f[K]=ne}}for(let w of f)for(let D of w)ei(D,C);return f}function yi(p,l){return{type:p.type,id:p.id,properties:p.properties,geometry:l?Mt(p):[]}}class ti{constructor(l,u,f,g,C){this.properties={},this.extent=f,this.type=0,this.id=void 0,this._pbf=l,this._geometry=-1,this._keys=g,this._values=C,l.readFields(Xi,this,u)}loadGeometry(){let l=this._pbf;l.pos=this._geometry;let u=l.readVarint()+l.pos,f=[],g,C=1,w=0,D=0,P=0;for(;l.pos>3}if(w--,C===1||C===2)D+=l.readSVarint(),P+=l.readSVarint(),C===1&&(g&&f.push(g),g=[]),g&&g.push(new Ti(D,P));else{if(C!==7)throw new Error(`unknown command ${C}`);g&&g.push(g[0].clone())}}return g&&f.push(g),f}bbox(){let l=this._pbf;l.pos=this._geometry;let u=l.readVarint()+l.pos,f=1,g=0,C=0,w=0,D=1/0,P=-1/0,B=1/0,q=-1/0;for(;l.pos>3}if(g--,f===1||f===2)C+=l.readSVarint(),w+=l.readSVarint(),CP&&(P=C),wq&&(q=w);else if(f!==7)throw new Error(`unknown command ${f}`)}return[D,B,P,q]}toGeoJSON(l,u,f){let g=this.extent*Math.pow(2,f),C=this.extent*l,w=this.extent*u,D=this.loadGeometry();function P(K){return[360*(K.x+C)/g-180,360/Math.PI*Math.atan(Math.exp((1-2*(K.y+w)/g)*Math.PI))-90]}function B(K){return K.map(P)}let q;if(this.type===1){let K=[];for(let re of D)K.push(re[0]);let ne=B(K);q=K.length===1?{type:"Point",coordinates:ne[0]}:{type:"MultiPoint",coordinates:ne}}else if(this.type===2){let K=D.map(B);q=K.length===1?{type:"LineString",coordinates:K[0]}:{type:"MultiLineString",coordinates:K}}else{if(this.type!==3)throw new Error("unknown feature type");{let K=(function(re){let ge=re.length;if(ge<=1)return[re];let ve=[],De,Ve;for(let Be=0;Be=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[l];let u=this._pbf.readVarint()+this._pbf.pos;return new ti(this._pbf,u,this.extent,this._keys,this._values)}}function xn(p,l,u){p===15?l.version=u.readVarint():p===1?l.name=u.readString():p===5?l.extent=u.readVarint():p===2?l._features.push(u.pos):p===3?l._keys.push(u.readString()):p===4&&l._values.push((function(f){let g=null,C=f.readVarint()+f.pos;for(;f.pos>3;g=w===1?f.readString():w===2?f.readFloat():w===3?f.readDouble():w===4?f.readVarint64():w===5?f.readVarint():w===6?f.readSVarint():w===7?f.readBoolean():null}if(g==null)throw new Error("unknown feature value");return g})(u))}class ur{constructor(l,u){this.layers=l.readFields(Tr,{},u)}}function Tr(p,l,u){if(p===3){let f=new on(u,u.readVarint()+u.pos);f.length&&(l[f.name]=f)}}let $n="3d_elevation_id",wr="level";class vr{constructor(){this._valid=!1}reset(l){return this.feature=l,this._valid=!0,this._geometry=l.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(l,u){return this._valid&&l(u(this._geometry)),this}require(l,u,f){return this.get(l,!0,u,f)}optional(l,u,f){return this.get(l,!1,u,f)}success(){return this._valid}get(l,u,f,g){let C=this.feature.properties.hasOwnProperty(l)?+this.feature.properties[l]:void 0;return this._valid&&C!==void 0&&!Number.isNaN(C)?f(g?g(C):C):u&&(this._valid=!1),this}}class fo{constructor(l,u){this.featureFunc=l,this.vertexFunc=u}parseFeature(l,u,f){return this.featureFunc(l,u,f)}parseVertex(l,u,f){return this.vertexFunc(l,u,f)}}let No=new fo((p,l,u)=>p.reset(l).require($n,f=>{u.id=f}).optional("fixed_height_relative",f=>{u.constantHeight=f},Xa.decodeRelativeHeight).geometry(f=>{u.bounds=f},sF).success(),(p,l,u)=>p.reset(l).require($n,f=>{u.id=f}).require("elevation_idx",f=>{u.idx=f}).require("extent",f=>{u.extent=f}).require("height_relative",f=>{u.height=f},Xa.decodeRelativeHeight).geometry(f=>{u.position=f},Xa.getPoint).success()),la=new fo((p,l,u)=>p.reset(l).require($n,f=>{u.id=f}).optional("fixed_height",f=>{u.constantHeight=f},Xa.decodeMetricHeight).geometry(f=>{u.bounds=f},sF).success(),(p,l,u)=>p.reset(l).require($n,f=>{u.id=f}).require("elevation_idx",f=>{u.idx=f}).require("extent",f=>{u.extent=f}).require("height",f=>{u.height=f},Xa.decodeMetricHeight).geometry(f=>{u.position=f},Xa.getPoint).success());class Xa{static getPoint(l){return lo(l[0][0].x,l[0][0].y)}static decodeRelativeHeight(l){return 1e-4*l*5}static decodeMetricHeight(l){return 1e-4*l}static parse(l){let u=[],f=[],g=l.length,C=new vr;for(let D=0;D=0;if(C===0)return 0;C!==l.length&&(u=!1)}return u?2:1}function es(p,l){for(let u of p.projections){let f=pl(l,p.points[0],u.axis);if(u.projection[1]f[1])return 0}return 1}function ls(p,l){let u=0,f=[0,0,0,0];for(let w=0;w=0&&u++;var g,C;return u}class cs{constructor(l,u){this.points=l||new Array(8).fill([0,0,0]),this.planes=u||new Array(6).fill([0,0,0,0]),this.bounds=aa.fromPoints(this.points),this.projections=[],this.frustumEdges=[_i([],this.points[2],this.points[3]),_i([],this.points[0],this.points[3]),_i([],this.points[4],this.points[0]),_i([],this.points[5],this.points[1]),_i([],this.points[6],this.points[2]),_i([],this.points[7],this.points[3])];for(let f of this.frustumEdges){let g=[0,-f[2],f[1]],C=[f[2],0,-f[0]];this.projections.push({axis:g,projection:pl(this.points,this.points[0],g)}),this.projections.push({axis:C,projection:pl(this.points,this.points[0],C)})}}static fromInvProjectionMatrix(l,u,f,g){let C=Math.pow(2,f),w=[[-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(B=>{let q=wi([],B,l),$=1/q[3]/u*C;return(K=q)[0]=(ne=q)[0]*(re=[$,$,g?1/q[3]:$,$])[0],K[1]=ne[1]*re[1],K[2]=ne[2]*re[2],K[3]=ne[3]*re[3],K;var K,ne,re}),D=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(B=>{let q=mt([],hi([],_i([],w[B[0]],w[B[1]]),_i([],w[B[2]],w[B[1]]))),$=-li(q,w[B[1]]);return q.concat($)}),P=[];for(let B=0;BB[1]||B[0]>P[1])return 0}return 1}containsPoint(l){for(let u of this.planes){let f=u[3];if(li([u[0],u[1],u[2]],l)+f<0)return!1}return!0}}class aa{static fromPoints(l){let u=[1/0,1/0,1/0],f=[-1/0,-1/0,-1/0];for(let g of l)Ze(u,u,g),wt(f,f,g);return new aa(u,f)}static fromTileIdAndHeight(l,u,f){let g=1<l.max[u]||l.min[u]>this.max[u])return!1;return!0}intersectsAabbXY(l){return!(this.min[0]>l.max[0]||l.min[0]>this.max[0]||this.min[1]>l.max[1]||l.min[1]>this.max[1])}encapsulate(l){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],l.min[u]),this.max[u]=Math.max(this.max[u],l.max[u])}encapsulatePoint(l){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],l[u]),this.max[u]=Math.max(this.max[u],l[u])}closestPoint(l){return[Math.max(Math.min(this.max[0],l[0]),this.min[0]),Math.max(Math.min(this.max[1],l[1]),this.min[1]),Math.max(Math.min(this.max[2],l[2]),this.min[2])]}}Jn(aa,"Aabb");class Gs{constructor(l,u){this.feature=l,this.metersToTile=u,this.index=0}get(){let l=this.feature.vertices[this.index],u=this.feature.vertexProps[this.index].dir,f=u[1],g=-u[0],C=(l.extent+1)*this.metersToTile;return[new Ti(Math.trunc(l.position[0]+f*C),Math.trunc(l.position[1]+g*C)),new Ti(Math.trunc(l.position[0]-f*C),Math.trunc(l.position[1]-g*C))]}next(){this.index++}valid(){return this.index{return D.a0?at(P,P,1/B):be(0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(l){if(this.edges.length===0)return;let u=0,f=Number.POSITIVE_INFINITY,g=0,C=lo(l.x,l.y);for(let w=0;w0?Ua(De,ve)/Ve:0,$e=nt(Be,0,1),St=Math.abs((Be-$e)*this.edgeProps[w].len),yt=As(vo(),C,q),vt=St+Math.abs(Ua(yt,lo(P[1],-P[0])));vt=0;--u){let f=this.edges[u].a,g=this.edges[u].b,{position:C,height:w,extent:D}=this.vertices[f],{position:P,height:B,extent:q}=this.vertices[g],$=this.vertexProps[f].dir,K=this.vertexProps[g].dir,ne=be(C[0]/l,C[1]/l,w),re=be(P[0]/l,P[1]/l,B),ge=be($[1],-$[0],0);at(ge,ge,D);let ve=be(K[1],-K[0],0);if(at(ve,ve,q),this.distSqLines(be(ne[0]+.5*ge[0],ne[1]+.5*ge[1],ne[2]+.5*ge[2]),be(re[0]-.5*ve[0],re[1]-.5*ve[1],re[2]-.5*ve[2]),be(ne[0]-.5*ge[0],ne[1]-.5*ge[1],ne[2]-.5*ge[2]),be(re[0]+.5*ve[0],re[1]+.5*ve[1],re[2]+.5*ve[2]))<=.0025000000000000005)continue;let De=this.vertices.length,Ve=Po(vo(),C,P);this.vertices.push({position:gc(Ve,Ve,.5),height:.5*(w+B),extent:.5*(D+q)});let Be=Po(vo(),$,K);this.vertexProps.push({dir:gu(Be,Be)}),this.edges.splice(u,1),this.edgeProps.splice(u,1),this.edges.push({a:f,b:De}),this.edges.push({a:De,b:g});let $e=As(vo(),this.vertices[De].position,C),St=kc($e),yt={vec:$e,dir:gc(vo(),$e,1/St),len:St};this.edgeProps.push(yt),this.edgeProps.push(yt)}}distSqLines(l,u,f,g){let C=We(Me(),u,l),w=We(Me(),g,f),D=We(Me(),l,f),P=li(C,C),B=li(C,w),q=li(C,D),$=li(w,w),K=li(w,D),ne=P*$-B*B;if(ne===0){let ve=li(D,w)/li(w,w);return ui(Hi(Me(),f,g,ve),l)}let re=(B*K-q*$)/ne,ge=(P*K-B*q)/ne;return ui(Hi(Me(),l,u,re),Hi(Me(),f,g,ge))}}class yc{static parseFrom(l,u){let f=Xa.parse(l);if(!f)return[];let{vertices:g,features:C}=f,w=1/ut(u);C.sort((q,$)=>q.id-$.id),g.sort((q,$)=>q.id-$.id||q.idx-$.idx),g=g.filter((q,$,K)=>$===K.findIndex(ne=>ne.id===q.id&&ne.idx===q.idx));let D=new Array,P=0,B=g.length;for(let q of C){if(q.constantHeight){D.push(new ms(q.id,q.bounds,q.constantHeight));continue}for(;P!==B&&g[P].idg.id===f)}}class ja{constructor(l,u){this.zScale=1,this.xOffset=0,this.yOffset=0,l.equals(u)||(this.zScale=Math.pow(2,u.z-l.z),this.xOffset=(l.x*this.zScale-u.x)*wn,this.yOffset=(l.y*this.zScale-u.y)*wn)}constantElevation(l,u){if(l.constantHeight!=null)return this.computeBiasedHeight(l.constantHeight,u)}pointElevation(l,u,f){let g=this.constantElevation(u,f);return g??(l.x=l.x*this.zScale+this.xOffset,l.y=l.y*this.zScale+this.yOffset,this.computeBiasedHeight(u.pointElevation(l),f))}computeBiasedHeight(l,u){return u<=0?l:l+u*Ft(0,u,l>=0?l:Math.abs(.5*l))}}Jn(ms,"ElevationFeature");class xs{constructor(l){this.zoom=l.zoom,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=l.index,this.hasPattern=!1,this.projection=l.projection,this.layoutVertexArray=new Rh,this.indexArray=new Rl,this.segments=new cc,this.programConfigurations=new Cf(l.layers,{zoom:l.zoom,lut:l.lut}),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new Qx),this.worldview=l.worldview}updateFootprints(l,u){}populate(l,u,f,g){let C=this.layers[0],w=[],D=null;C.type==="circle"&&(D=C.layout.get("circle-sort-key"));for(let{feature:B,id:q,index:$,sourceLayerIndex:K}of l){let ne=this.layers[0]._featureFilter.needGeometry,re=yi(B,ne);if(!this.layers[0]._featureFilter.filter(new Ys(this.zoom,{worldview:this.worldview}),re,f))continue;let ge=D?D.evaluate(re,{},f):void 0,ve={id:q,properties:B.properties,type:B.type,sourceLayerIndex:K,index:$,geometry:ne?re.geometry:Mt(B,f,g),patterns:{},sortKey:ge};w.push(ve)}D&&w.sort((B,q)=>B.sortKey-q.sortKey);let P=null;g.projection.name==="globe"&&(this.globeExtVertexArray=new Ev,P=g.projection);for(let B of w){let{geometry:q,index:$,sourceLayerIndex:K}=B,ne=l[$].feature;this.addFeature(B,q,$,u.availableImages,f,P,u.brightness,u.elevationFeatures),u.featureIndex.insert(ne,q,$,K,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(l,u,f,g,C,w,D){this.programConfigurations.updatePaintArrays(l,u,C,f,g,w,D,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,sC.members),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=l.createVertexBuffer(this.globeExtVertexArray,OF.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=l.createVertexBuffer(this.elevatedLayoutVertexArray,I7.members))),this.programConfigurations.upload(l),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(l,u,f,g,C,w,D,P){let B;this.elevationMode!=="none"&&(B=yc.getElevationFeature(l,P));for(let q of u)for(let $ of q){let K=$.x,ne=$.y;if(K<0||K>=wn||ne<0||ne>=wn)continue;if(w){let ve=w.projectTilePoint(K,ne,C),De=w.upVector(C,K,ne);this.addGlobeExtVertex(ve,De),this.addGlobeExtVertex(ve,De),this.addGlobeExtVertex(ve,De),this.addGlobeExtVertex(ve,De)}let re=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,l.sortKey),ge=re.vertexLength;if(this.addCircleVertex(K,ne,-1,-1),this.addCircleVertex(K,ne,1,-1),this.addCircleVertex(K,ne,1,1),this.addCircleVertex(K,ne,-1,1),this.elevationMode!=="none"){let ve=B?B.pointElevation(new Ti(K,ne)):0;this.hasElevation=this.hasElevation||ve!==0;for(let De=0;De<4;De++)this.elevatedLayoutVertexArray.emplaceBack(ve)}this.indexArray.emplaceBack(ge,ge+1,ge+2),this.indexArray.emplaceBack(ge,ge+2,ge+3),re.vertexLength+=4,re.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,f,{},g,C,D,void 0,this.worldview)}addCircleVertex(l,u,f,g){this.layoutVertexArray.emplaceBack(2*l+(f+1)/2,2*u+(g+1)/2)}addGlobeExtVertex(l,u){this.globeExtVertexArray.emplaceBack(l.x,l.y,l.z,u[0]*16384,u[1]*16384,u[2]*16384)}}function al(p,l){for(let u=0;u1){if(np(p,l))return!0;for(let f=0;f1?u:u.sub(l)._mult(g)._add(l))}function t_(p,l){let u,f,g,C=!1;for(let w=0;wl.y!=g.y>l.y&&l.x<(g.x-f.x)*(l.y-f.y)/(g.y-f.y)+f.x&&(C=!C)}return C}function Vp(p,l){let u=!1;for(let f=0,g=p.length-1;fl.y!=w.y>l.y&&l.x<(w.x-C.x)*(l.y-C.y)/(w.y-C.y)+C.x&&(u=!u)}return u}function nd(p,l,u,f,g){for(let w of p)if(l<=w.x&&u<=w.y&&f>=w.x&&g>=w.y)return!0;let C=[new Ti(l,u),new Ti(l,g),new Ti(f,g),new Ti(f,u)];if(p.length>2){for(let w of C)if(Vp(p,w))return!0}for(let w=0;wg.x&&l.x>g.x||p.yg.y&&l.y>g.y)return!1;let C=td(p,l,u[0]);return C!==td(p,l,u[1])||C!==td(p,l,u[2])||C!==td(p,l,u[3])}function Sl(p,l,u,f,g,C){let w=l.y-p.y,D=p.x-l.x;if(C=C||0){let P=w*w+D*D;if(P===0)return!0;let B=Math.sqrt(P);w/=B,D/=B}return!((u.x-p.x)*w+(u.y-p.y)*D-C<0||(f.x-p.x)*w+(f.y-p.y)*D-C<0||(g.x-p.x)*w+(g.y-p.y)*D-C<0)}function Hd(p,l,u,f,g,C,w){return!(Sl(p,l,f,g,C,w)||Sl(l,u,f,g,C,w)||Sl(u,p,f,g,C,w)||Sl(f,g,p,l,u,w)||Sl(g,C,p,l,u,w)||Sl(C,f,p,l,u,w))}function rp(p,l,u){let f=l.paint.get(p).value;return f.kind==="constant"?f.value:u.programConfigurations.get(l.id).getMaxValue(p)}function rd(p){return Math.sqrt(p[0]*p[0]+p[1]*p[1])}function pg(p,l,u,f,g){if(!l[0]&&!l[1])return p;let C=Ti.convert(l)._mult(g);u==="viewport"&&C._rotate(-f);let w=[];for(let D=0;D>u&&l.y===this.y>>u}url(l,u){let f=(function(C,w,D){var P=a1(256*C,256*(w=Math.pow(2,D)-w-1),D),B=a1(256*(C+1),256*(w+1),D);return P[0]+","+P[1]+","+B[0]+","+B[1]})(this.x,this.y,this.z),g=(function(C,w,D){let P,B="";for(let q=C;q>0;q--)P=1<this.canonical.z?new Gd(l,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Gd(l,this.wrap,l,this.canonical.x>>u,this.canonical.y>>u)}calculateScaledKey(l,u=!0){if(this.overscaledZ===l&&u)return this.key;if(l>this.canonical.z)return mg(this.wrap*+u,l,this.canonical.z,this.canonical.x,this.canonical.y);{let f=this.canonical.z-l;return mg(this.wrap*+u,l,l,this.canonical.x>>f,this.canonical.y>>f)}}isChildOf(l){if(l.wrap!==this.wrap)return!1;let u=this.canonical.z-l.canonical.z;return l.overscaledZ===0||l.overscaledZ>u&&l.canonical.y===this.canonical.y>>u}children(l){if(this.overscaledZ>=l)return[new Gd(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let u=this.canonical.z+1,f=2*this.canonical.x,g=2*this.canonical.y;return[new Gd(u,this.wrap,u,f,g),new Gd(u,this.wrap,u,f+1,g),new Gd(u,this.wrap,u,f,g+1),new Gd(u,this.wrap,u,f+1,g+1)]}isLessThan(l){return this.wrapl.wrap)&&(this.overscaledZl.overscaledZ)&&(this.canonical.xl.canonical.x)&&this.canonical.y{let l=p.canonical.x-1,u=p.wrap;return l<0&&(l=(1<{let l=p.canonical.x+1,u=p.wrap;return l===1<new Gd(p.overscaledZ,p.wrap,p.canonical.z,p.canonical.x,(p.canonical.y===0?1<new Gd(p.overscaledZ,p.wrap,p.canonical.z,p.canonical.x,p.canonical.y===(1<1?null:(function(f,g,C,w){let D=Math.sin(C);return f*(Math.sin((1-w)*C)/D)+g*(Math.sin(w*C)/D)})(p.a[l],p.b[l],p.angle,nt(u,0,1))+p.center[l]}function cC(p){if(p.z<=1)return r0e[p.z+2*p.y+p.x];let l=XV(ZV(p));return aa.fromPoints(l)}function l1(p,l,u){return at(p,p,1-u),Dt(p,p,l,u)}function MJ(p,l,u){for(let f of p)In(f,f,l),at(f,f,u)}function UF(p,l,u,f){let g=l/p.worldSize,C=p.globeMatrix;if(u.z<=1){let Ht=cC(u).getCorners();return MJ(Ht,C,g),aa.fromPoints(Ht)}let w=ZV(u,f),D=XV(w,Lp+QV(p._tileCoverLift));MJ(D,C,g);let P=Number.MAX_VALUE,B=[-P,-P,-P],q=[P,P,P];if(w.contains(p.center)){for(let Xt of D)Ze(q,q,Xt),wt(B,B,Xt);B[2]=0;let Ht=p.point,ki=[Ht.x*g,Ht.y*g,0];return Ze(q,q,ki),wt(B,B,ki),new aa(q,B)}if(p._tileCoverLift>0){for(let Ht of D)Ze(q,q,Ht),wt(B,B,Ht);return new aa(q,B)}let $=[C[12]*g,C[13]*g,C[14]*g],K=w.getCenter(),ne=nt(p.center.lat,-st,st),re=nt(K.lat,-st,st),ge=_e(p.center.lng),ve=Ie(ne),De=ge-_e(K.lng),Ve=ve-Ie(re);De>.5?De-=1:De<-.5&&(De+=1);let Be=0;Math.abs(De)>Math.abs(Ve)?Be=De>=0?1:3:(Be=Ve>=0?0:2,Dt($,$,[C[4]*g,C[5]*g,C[6]*g],-Math.sin(sa(Ve>=0?w.getSouth():w.getNorth()))*Lp));let $e=D[Be],St=D[(Be+1)%4],yt=new o0e($e,St,$),vt=[E7(yt,0)||$e[0],E7(yt,1)||$e[1],E7(yt,2)||$e[2]],Vt=wS(p.zoom);if(Vt>0){let Ht=(function({x:Xt,y:Bi,z:_n},Ki,an,hn,Ai){let sn=1/(1<<_n),Jt=Xt*sn,Di=Jt+sn,yn=Bi*sn,ln=yn+sn,Sr=0,lr=(Jt+Di)/2-hn;return lr>.5?Sr=-1:lr<-.5&&(Sr=1),Jt=((Jt+Sr)*Ki-(hn*=Ki))*an+hn,Di=((Di+Sr)*Ki-hn)*an+hn,yn=(yn*Ki-(Ai*=Ki))*an+Ai,ln=(ln*Ki-Ai)*an+Ai,[[Jt,ln,0],[Di,ln,0],[Di,yn,0],[Jt,yn,0]]})(u,l,p._pixelsPerMercatorPixel,ge,ve);for(let Xt=0;XtMath.PI/2*1.01}let FJ=sa(85),a0e=Math.cos(FJ),D7=Math.sin(FJ),PJ=M(),NJ=p=>{let l=[];return p.paint.get("circle-pitch-alignment")==="map"&&l.push("PITCH_WITH_MAP"),p.paint.get("circle-pitch-scale")==="map"&&l.push("SCALE_WITH_MAP"),l};function LJ(p,l,u,f,g,C,w,D,P){if(C&&p.queryGeometry.isAboveHorizon)return!1;C&&(P*=p.pixelToTileUnitsFactor);let B=p.tileID.canonical,q=u.projection.upVectorScale(B,u.center.lat,u.worldSize).metersToTile;for(let $ of l)for(let K of $){let ne=K.add(D),re=g&&u.elevation?u.elevation.exaggeration()*g.getElevationAt(ne.x,ne.y,!0):0,ge=u.projection.projectTilePoint(ne.x,ne.y,B);if(re>0){let Be=u.projection.upVector(B,ne.x,ne.y);ge.x+=Be[0]*q*re,ge.y+=Be[1]*q*re,ge.z+=Be[2]*q*re}let ve=C?ne:s0e(ge.x,ge.y,ge.z,f),De=C?p.tilespaceRays.map(Be=>c0e(Be,re)):p.queryGeometry.screenGeometry,Ve=wi([],[ge.x,ge.y,ge.z,1],f);if(!w&&C?P*=Ve[3]/u.cameraToCenterDistance:w&&!C&&(P*=u.cameraToCenterDistance/Ve[3]),C){let Be=qe((K.y/wn+B.y)/(1<p.width||g.height>p.height||u.x>p.width-g.width||u.y>p.height-g.height)throw new RangeError("out of range source coordinates for image copy");if(g.width>l.width||g.height>l.height||f.x>l.width-g.width||f.y>l.height-g.height)throw new RangeError("out of range destination coordinates for image copy");let P=p.data,B=l.data,q=C===4&&D;for(let $=0;${l[p.evaluationKey]=P;let B=p.expression.evaluate(l),q=B?B.toNonPremultipliedRenderColor(null):null;q&&(g.data[w+D+0]=Math.floor(255*q.r),g.data[w+D+1]=Math.floor(255*q.g),g.data[w+D+2]=Math.floor(255*q.b),g.data[w+D+3]=Math.floor(255*q.a))};if(p.clips)for(let w=0,D=0;w80*u){D=p[0],P=p[1];let q=D,$=P;for(let K=u;Kq&&(q=ne),re>$&&($=re)}B=Math.max(q-D,$-P),B=B!==0?32767/B:0}return qF(C,w,u,D,P,B,0),w}function qJ(p,l,u,f,g){let C;if(g===(function(w,D,P,B){let q=0;for(let $=D,K=P-B;$0)for(let w=l;w=l;w-=f)C=R7(w/f|0,p[w],p[w+1],C);return C&&nk(C,C.next)&&(ES(C),C=C.next),C}function EE(p,l){if(!p)return p;l||(l=p);let u,f=p;do if(u=!1,f.steiner||!nk(f,f.next)&&Vu(f.prev,f,f.next)!==0)f=f.next;else{if(ES(f),f=l=f.prev,f===f.next)break;u=!0}while(u||f!==l);return l}function qF(p,l,u,f,g,C,w){if(!p)return;!w&&C&&(function(P,B,q,$){let K=P;do K.z===0&&(K.z=vu(K.x,K.y,B,q,$)),K.prevZ=K.prev,K.nextZ=K.next,K=K.next;while(K!==P);K.prevZ.nextZ=null,K.prevZ=null,(function(ne){let re,ge=1;do{let ve,De=ne;ne=null;let Ve=null;for(re=0;De;){re++;let Be=De,$e=0;for(let yt=0;yt0||St>0&&Be;)$e!==0&&(St===0||!Be||De.z<=Be.z)?(ve=De,De=De.nextZ,$e--):(ve=Be,Be=Be.nextZ,St--),Ve?Ve.nextZ=ve:ne=ve,ve.prevZ=Ve,Ve=ve;De=Be}Ve.nextZ=null,ge*=2}while(re>1)})(K)})(p,f,g,C);let D=p;for(;p.prev!==p.next;){let P=p.prev,B=p.next;if(C?M7(p,f,g,C):u0e(p))l.push(P.i,p.i,B.i),ES(p),p=B.next,D=B.next;else if((p=B)===D){w?w===1?qF(p=p0e(EE(p),l),l,u,f,g,C,2):w===2&&c1(p,l,u,f,g,C):qF(EE(p),l,u,f,g,C,1);break}}}function u0e(p){let l=p.prev,u=p,f=p.next;if(Vu(l,u,f)>=0)return!1;let g=l.x,C=u.x,w=f.x,D=l.y,P=u.y,B=f.y,q=Math.min(g,C,w),$=Math.min(D,P,B),K=Math.max(g,C,w),ne=Math.max(D,P,B),re=f.next;for(;re!==l;){if(re.x>=q&&re.x<=K&&re.y>=$&&re.y<=ne&&$F(g,D,C,P,w,B,re.x,re.y)&&Vu(re.prev,re,re.next)>=0)return!1;re=re.next}return!0}function M7(p,l,u,f){let g=p.prev,C=p,w=p.next;if(Vu(g,C,w)>=0)return!1;let D=g.x,P=C.x,B=w.x,q=g.y,$=C.y,K=w.y,ne=Math.min(D,P,B),re=Math.min(q,$,K),ge=Math.max(D,P,B),ve=Math.max(q,$,K),De=vu(ne,re,l,u,f),Ve=vu(ge,ve,l,u,f),Be=p.prevZ,$e=p.nextZ;for(;Be&&Be.z>=De&&$e&&$e.z<=Ve;){if(Be.x>=ne&&Be.x<=ge&&Be.y>=re&&Be.y<=ve&&Be!==g&&Be!==w&&$F(D,q,P,$,B,K,Be.x,Be.y)&&Vu(Be.prev,Be,Be.next)>=0||(Be=Be.prevZ,$e.x>=ne&&$e.x<=ge&&$e.y>=re&&$e.y<=ve&&$e!==g&&$e!==w&&$F(D,q,P,$,B,K,$e.x,$e.y)&&Vu($e.prev,$e,$e.next)>=0))return!1;$e=$e.nextZ}for(;Be&&Be.z>=De;){if(Be.x>=ne&&Be.x<=ge&&Be.y>=re&&Be.y<=ve&&Be!==g&&Be!==w&&$F(D,q,P,$,B,K,Be.x,Be.y)&&Vu(Be.prev,Be,Be.next)>=0)return!1;Be=Be.prevZ}for(;$e&&$e.z<=Ve;){if($e.x>=ne&&$e.x<=ge&&$e.y>=re&&$e.y<=ve&&$e!==g&&$e!==w&&$F(D,q,P,$,B,K,$e.x,$e.y)&&Vu($e.prev,$e,$e.next)>=0)return!1;$e=$e.nextZ}return!0}function p0e(p,l){let u=p;do{let f=u.prev,g=u.next.next;!nk(f,g)&&WJ(f,u,u.next,g)&&AE(f,g)&&AE(g,f)&&(l.push(f.i,u.i,g.i),ES(u),ES(u.next),u=p=g),u=u.next}while(u!==p);return EE(u)}function c1(p,l,u,f,g,C){let w=p;do{let D=w.next.next;for(;D!==w.prev;){if(w.i!==D.i&&m0e(w,D)){let P=QJ(w,D);return w=EE(w,w.next),P=EE(P,P.next),qF(w,l,u,f,g,C,0),void qF(P,l,u,f,g,C,0)}D=D.next}w=w.next}while(w!==p)}function $J(p,l){let u=p.x-l.x;return u===0&&(u=p.y-l.y,u===0)&&(u=(p.next.y-p.y)/(p.next.x-p.x)-(l.next.y-l.y)/(l.next.x-l.x)),u}function t4(p,l){let u=(function(g,C){let w=C,D=g.x,P=g.y,B,q=-1/0;if(nk(g,w))return w;do{if(nk(g,w.next))return w.next;if(P<=w.y&&P>=w.next.y&&w.next.y!==w.y){let ge=w.x+(P-w.y)*(w.next.x-w.x)/(w.next.y-w.y);if(ge<=D&&ge>q&&(q=ge,B=w.x=w.x&&w.x>=K&&D!==w.x&&YJ(PB.x||w.x===B.x&&Bu(B,w)))&&(B=w,re=ge)}w=w.next}while(w!==$);return B})(p,l);if(!u)return l;let f=QJ(u,p);return EE(f,f.next),EE(u,u.next)}function Bu(p,l){return Vu(p.prev,p,l.prev)<0&&Vu(l.next,p,p.next)<0}function vu(p,l,u,f,g){return(p=1431655765&((p=858993459&((p=252645135&((p=16711935&((p=(p-u)*g|0)|p<<8))|p<<4))|p<<2))|p<<1))|(l=1431655765&((l=858993459&((l=252645135&((l=16711935&((l=(l-f)*g|0)|l<<8))|l<<4))|l<<2))|l<<1))<<1}function KJ(p){let l=p,u=p;do(l.x=(p-w)*(C-D)&&(p-w)*(f-D)>=(u-w)*(l-D)&&(u-w)*(C-D)>=(g-w)*(f-D)}function $F(p,l,u,f,g,C,w,D){return!(p===w&&l===D)&&YJ(p,l,u,f,g,C,w,D)}function m0e(p,l){return p.next.i!==l.i&&p.prev.i!==l.i&&!(function(u,f){let g=u;do{if(g.i!==u.i&&g.next.i!==u.i&&g.i!==f.i&&g.next.i!==f.i&&WJ(g,g.next,u,f))return!0;g=g.next}while(g!==u);return!1})(p,l)&&(AE(p,l)&&AE(l,p)&&(function(u,f){let g=u,C=!1,w=(u.x+f.x)/2,D=(u.y+f.y)/2;do g.y>D!=g.next.y>D&&g.next.y!==g.y&&w<(g.next.x-g.x)*(D-g.y)/(g.next.y-g.y)+g.x&&(C=!C),g=g.next;while(g!==u);return C})(p,l)&&(Vu(p.prev,p,l.prev)||Vu(p,l.prev,l))||nk(p,l)&&Vu(p.prev,p,p.next)>0&&Vu(l.prev,l,l.next)>0)}function Vu(p,l,u){return(l.y-p.y)*(u.x-l.x)-(l.x-p.x)*(u.y-l.y)}function nk(p,l){return p.x===l.x&&p.y===l.y}function WJ(p,l,u,f){let g=TS(Vu(p,l,u)),C=TS(Vu(p,l,f)),w=TS(Vu(u,f,p)),D=TS(Vu(u,f,l));return g!==C&&w!==D||!(g!==0||!KF(p,u,l))||!(C!==0||!KF(p,f,l))||!(w!==0||!KF(u,p,f))||!(D!==0||!KF(u,l,f))}function KF(p,l,u){return l.x<=Math.max(p.x,u.x)&&l.x>=Math.min(p.x,u.x)&&l.y<=Math.max(p.y,u.y)&&l.y>=Math.min(p.y,u.y)}function TS(p){return p>0?1:p<0?-1:0}function AE(p,l){return Vu(p.prev,p,p.next)<0?Vu(p,l,p.next)>=0&&Vu(p,p.prev,l)>=0:Vu(p,l,p.prev)<0||Vu(p,p.next,l)<0}function QJ(p,l){let u=hg(p.i,p.x,p.y),f=hg(l.i,l.x,l.y),g=p.next,C=l.prev;return p.next=l,l.prev=p,u.next=g,g.prev=u,f.next=u,u.prev=f,C.next=f,f.prev=C,f}function R7(p,l,u,f){let g=hg(p,l,u);return f?(g.next=f.next,g.prev=f,f.next.prev=g,f.next=g):(g.prev=g,g.next=g),g}function ES(p){p.next.prev=p.prev,p.prev.next=p.next,p.prevZ&&(p.prevZ.nextZ=p.nextZ),p.nextZ&&(p.nextZ.prevZ=p.prevZ)}function hg(p,l,u){return{i:p,x:l,y:u,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function dC(p,l){let u=p.length;if(u<=1)return[p];let f=[],g,C;for(let w=0;w1)for(let w=0;wB<=0&&q<=0||B>=wn&&q>=wn;for(let B of u){let q=B.va,$=B.vb;(f(q.x,$.x)||f(q.y,$.y))&&(B.type="border")}let g=u.filter(B=>B.type!=="unevaluated"),C=u.filter(B=>B.type==="unevaluated");if(C.length===0)return new AS;C.sort((B,q)=>B.hash===q.hash?B.isTunnel===q.isTunnel?0:B.isTunnel?-1:1:B.hashB.hashC!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Cf(u,{zoom:f,lut:g},C=>C!=="fill-bridge-guard-rail-color")}addVertices(l,u){let f=this.unevalVertices.length;for(let g=0;g=C.min.x&&$.x<=C.max.x&&$.y>=C.min.y&&$.y<=C.max.y||K.x>=C.min.x&&K.x<=C.max.x&&K.y>=C.min.y&&K.y<=C.max.y||Oc($,K,D))||this.isOnBorder($.x,K.x)||this.isOnBorder($.y,K.y))continue;let ne=Ba.computeEdgeHash(this.unevalVertices[B],this.unevalVertices[q]),re,ge=this.vertexHashLookup.get(Ba.computePosHash($));ge!=null?re=ge.next:(ge=this.vertexHashLookup.get(Ba.computePosHash(K)),re=ge!=null?ge.prev:ne),this.unevalEdges.push({polygonIdx:l,a:B,b:q,hash:ne,portalHash:re,isTunnel:g,type:"unevaluated",featureInfo:w})}}addPortalCandidates(l,u,f,g,C){if(u.length===0)return;this.portalPolygons.add(l,{geometry:u,zLevel:C});let w=u[0];this.vertexHashLookup.clear();let D=Ba.computeEdgeHash(w[w.length-2],w[w.length-1]);for(let P=0;P({vertexOffset:0,primitiveOffset:this.indexArray.length}),f=K=>{K.primitiveLength=this.indexArray.length-K.primitiveOffset},g=new d1(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(l.portals,this.unevalEdges);let C=u(),w=u(),D=u(),P=(K,ne)=>{K.sort((ge,ve)=>ge.type===ne&&ve.type!==ne?-1:ge.type!==ne&&ve.type===ne?1:0);let re=K.findIndex(ge=>ge.type!==ne);return re>=0?re:K.length},B=0;this.unevalEdges.length>0&&(B=P(this.unevalEdges,"none"),this.constructBridgeStructures(g,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:B},this.tileToMeters)),f(D);let q=u(),$=u();if(this.unevalEdges.length>0){let K=this.unevalEdges.splice(B),ne=P(K,"tunnel")+B;this.unevalEdges.push(...K),this.constructTunnelStructures(g,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:B},{min:B,max:ne})}f(q),g.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),f($),g.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),f(w),g.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),f(C),this.maskSegments=cc.simpleSegment(0,$.primitiveOffset,0,$.primitiveLength),this.depthSegments=cc.simpleSegment(0,w.primitiveOffset,0,w.primitiveLength),this.renderableBridgeSegments=cc.simpleSegment(0,D.primitiveOffset,0,D.primitiveLength),this.renderableTunnelSegments=cc.simpleSegment(0,q.primitiveOffset,0,q.primitiveLength),this.shadowCasterSegments=cc.simpleSegment(0,C.primitiveOffset,0,C.primitiveLength)}update(l,u,f,g,C,w,D,P){this.bridgeProgramConfigurations.updatePaintArrays(l,u,C,f,g,w,D,P),this.tunnelProgramConfigurations.updatePaintArrays(l,u,C,f,g,w,D,P)}upload(l){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=l.createVertexBuffer(this.vertexPositions,d0e.members),this.vertexBufferNormal=l.createVertexBuffer(this.vertexNormals,IS.members),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(l),this.tunnelProgramConfigurations.upload(l))}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(l,u,f,g,C){let w=(D,P)=>{for(let B=0;BIt(an,u[hn].x,u[hn].y,f[hn]*P),$=Me(),K=Me(),ne=Me(),re=Me(),ge=Me(),ve=(an,hn)=>{let Ai=D.get(Ba.computePosHash(u[hn])),sn=Ai.from,Jt=Ai.to;if(!sn||!Jt)return;q($,sn),q(K,hn),q(ne,Jt),Nr(re),Oe($,K)||(_i(ge,K,$),mt(re,ge)),Oe(ne,K)||(_i(ge,ne,K),rt(re,re,mt(ge,ge)));let Di=Ot(re);return Di>0?at(an,re,1/Di):void 0},De=Number.POSITIVE_INFINITY;this.sortSubarray(g,C.min,C.max,(an,hn)=>an.featureInfo.featureIndex-hn.featureInfo.featureIndex);let Ve=Me(),Be=Me(),$e=Me(),St=Me(),yt=Me(),vt=Me(),Vt=Me(),Ht=Me(),ki=Me(),Xt=[Me(),Me(),Me(),Me()],Bi=[Me(),Me(),Me(),Me()],_n=[{coord:new Ti(0,0),height:0},{coord:new Ti(0,0),height:0}],Ki=(an,hn)=>an>hn;for(let an=C.min;anDe.featureInfo.featureIndex-Ve.featureInfo.featureIndex;this.sortSubarray(g,C.min,C.max,P),this.sortSubarray(g,w.min,w.max,P);let B=De=>mt(De,De),q=[{coord:new Ti(0,0),height:0},{coord:new Ti(0,0),height:0}],$=(De,Ve)=>DeD.hash===P.hash?P.polygonIdx-D.polygonIdx:P.hash>D.hash?1:-1);let f=0,g=0,C=0,w=u[f].polygonIdx;do g++,(g===u.length||u[f].hash!==u[g].hash)&&((g-f==1||u[g-1].polygonIdx!==w)&&(CB.portalHashq.hash?D++:q.hash>B.portalHash?P++:(B.type=q.type,D++)}}}isOnBorder(l,u){return l<=0&&u<=0||l>=wn&&u>=wn}addFeatureSection(l,u,f,g){return l!==u&&(u=l,f.push({featureIndex:l,vertexStart:g.getVertexCount()}),g.clearVertexLookup()),u}sortSubarray(l,u,f,g){let C=l.slice(u,f);C.sort(g),l.splice(u,C.length,...C)}static computeEdgeHash(l,u){return(l.y===u.y&&l.x>u.x||l.y>u.y)&&([l,u]=[u,l]),BigInt(Ba.computePosHash(l))<<32n|BigInt(Ba.computePosHash(u))}static computePosHash(l){return((65535&l.x)<<16|65535&l.y)>>>0}}var P7,i0={exports:{}},N7=(P7||(P7=1,(function(p,l){(function(u){function f(et,tt){return et>tt?1:et0){var cr=vn+Math.floor(On/2),po={key:tt[cr],data:vi[cr],parent:et};return po.left=w(po,tt,vi,vn,cr),po.right=w(po,tt,vi,cr+1,Nn),po}return null}function D(et,tt,vi,vn,Nn){if(!(vi>=vn)){for(var On=et[vi+vn>>1],cr=vi-1,po=vn+1;;){do cr++;while(Nn(et[cr],On)<0);do po--;while(Nn(et[po],On)>0);if(cr>=po)break;var Ta=et[cr];et[cr]=et[po],et[po]=Ta,Ta=tt[cr],tt[cr]=tt[po],tt[po]=Ta}D(et,tt,vi,po,Nn),D(et,tt,po+1,vn,Nn)}}g.prototype.rotateLeft=function(et){var tt=et.right;tt&&(et.right=tt.left,tt.left&&(tt.left.parent=et),tt.parent=et.parent),et.parent?et===et.parent.left?et.parent.left=tt:et.parent.right=tt:this._root=tt,tt&&(tt.left=et),et.parent=tt},g.prototype.rotateRight=function(et){var tt=et.left;tt&&(et.left=tt.right,tt.right&&(tt.right.parent=et),tt.parent=et.parent),et.parent?et===et.parent.left?et.parent.left=tt:et.parent.right=tt:this._root=tt,tt&&(tt.right=et),et.parent=tt},g.prototype._splay=function(et){for(;et.parent;){var tt=et.parent;tt.parent?tt.left===et&&tt.parent.left===tt?(this.rotateRight(tt.parent),this.rotateRight(tt)):tt.right===et&&tt.parent.right===tt?(this.rotateLeft(tt.parent),this.rotateLeft(tt)):tt.left===et&&tt.parent.right===tt?(this.rotateRight(tt),this.rotateLeft(tt)):(this.rotateLeft(tt),this.rotateRight(tt)):tt.left===et?this.rotateRight(tt):this.rotateLeft(tt)}},g.prototype.splay=function(et){for(var tt,vi,vn,Nn,On;et.parent;)(vi=(tt=et.parent).parent)&&vi.parent?((vn=vi.parent).left===vi?vn.left=et:vn.right=et,et.parent=vn):(et.parent=null,this._root=et),Nn=et.left,On=et.right,et===tt.left?(vi&&(vi.left===tt?(tt.right?(vi.left=tt.right,vi.left.parent=vi):vi.left=null,tt.right=vi,vi.parent=tt):(Nn?(vi.right=Nn,Nn.parent=vi):vi.right=null,et.left=vi,vi.parent=et)),On?(tt.left=On,On.parent=tt):tt.left=null,et.right=tt,tt.parent=et):(vi&&(vi.right===tt?(tt.left?(vi.right=tt.left,vi.right.parent=vi):vi.right=null,tt.left=vi,vi.parent=tt):(On?(vi.left=On,On.parent=vi):vi.left=null,et.right=vi,vi.parent=et)),Nn?(tt.right=Nn,Nn.parent=tt):tt.right=null,et.left=tt,tt.parent=et)},g.prototype.replace=function(et,tt){et.parent?et===et.parent.left?et.parent.left=tt:et.parent.right=tt:this._root=tt,tt&&(tt.parent=et.parent)},g.prototype.minNode=function(et){if(et===void 0&&(et=this._root),et)for(;et.left;)et=et.left;return et},g.prototype.maxNode=function(et){if(et===void 0&&(et=this._root),et)for(;et.right;)et=et.right;return et},g.prototype.insert=function(et,tt){var vi=this._root,vn=null,Nn=this._compare;if(this._noDuplicates)for(;vi;){if(vn=vi,Nn(vi.key,et)===0)return;vi=Nn(vi.key,et)<0?vi.right:vi.left}else for(;vi;)vn=vi,vi=Nn(vi.key,et)<0?vi.right:vi.left;return vi={key:et,data:tt,left:null,right:null,parent:vn},vn?Nn(vn.key,vi.key)<0?vn.right=vi:vn.left=vi:this._root=vi,this.splay(vi),this._size++,vi},g.prototype.find=function(et){for(var tt=this._root,vi=this._compare;tt;){var vn=vi(tt.key,et);if(vn<0)tt=tt.right;else{if(!(vn>0))return tt;tt=tt.left}}return null},g.prototype.contains=function(et){for(var tt=this._root,vi=this._compare;tt;){var vn=vi(et,tt.key);if(vn===0)return!0;tt=vn<0?tt.left:tt.right}return!1},g.prototype.remove=function(et){var tt=this.find(et);if(!tt)return!1;if(this.splay(tt),tt.left)if(tt.right){var vi=this.minNode(tt.right);vi.parent!==tt&&(this.replace(vi,vi.right),vi.right=tt.right,vi.right.parent=vi),this.replace(tt,vi),vi.left=tt.left,vi.left.parent=vi}else this.replace(tt,tt.left);else this.replace(tt,tt.right);return this._size--,!0},g.prototype.removeNode=function(et){if(!et)return!1;if(this.splay(et),et.left)if(et.right){var tt=this.minNode(et.right);tt.parent!==et&&(this.replace(tt,tt.right),tt.right=et.right,tt.right.parent=tt),this.replace(et,tt),tt.left=et.left,tt.left.parent=tt}else this.replace(et,et.left);else this.replace(et,et.right);return this._size--,!0},g.prototype.erase=function(et){var tt=this.find(et);if(tt){this.splay(tt);var vi=tt.left,vn=tt.right,Nn=null;vi&&(vi.parent=null,Nn=this.maxNode(vi),this.splay(Nn),this._root=Nn),vn&&(vi?Nn.right=vn:this._root=vn,vn.parent=Nn),this._size--}},g.prototype.pop=function(){var et=this._root,tt=null;if(et){for(;et.left;)et=et.left;tt={key:et.key,data:et.data},this.remove(et.key)}return tt},g.prototype.next=function(et){var tt=et;if(tt)if(tt.right)for(tt=tt.right;tt&&tt.left;)tt=tt.left;else for(tt=et.parent;tt&&tt.right===et;)et=tt,tt=tt.parent;return tt},g.prototype.prev=function(et){var tt=et;if(tt)if(tt.left)for(tt=tt.left;tt&&tt.right;)tt=tt.right;else for(tt=et.parent;tt&&tt.left===et;)et=tt,tt=tt.parent;return tt},g.prototype.forEach=function(et){for(var tt=this._root,vi=[],vn=!1,Nn=0;!vn;)tt?(vi.push(tt),tt=tt.left):vi.length>0?(et(tt=vi.pop(),Nn++),tt=tt.right):vn=!0;return this},g.prototype.range=function(et,tt,vi,vn){for(var Nn=[],On=this._compare,cr=this._root;Nn.length!==0||cr;)if(cr)Nn.push(cr),cr=cr.left;else{if(On((cr=Nn.pop()).key,tt)>0)break;if(On(cr.key,et)>=0&&vi.call(vn,cr))return this;cr=cr.right}return this},g.prototype.keys=function(){for(var et=this._root,tt=[],vi=[],vn=!1;!vn;)et?(tt.push(et),et=et.left):tt.length>0?(et=tt.pop(),vi.push(et.key),et=et.right):vn=!0;return vi},g.prototype.values=function(){for(var et=this._root,tt=[],vi=[],vn=!1;!vn;)et?(tt.push(et),et=et.left):tt.length>0?(et=tt.pop(),vi.push(et.data),et=et.right):vn=!0;return vi},g.prototype.at=function(et){for(var tt=this._root,vi=[],vn=!1,Nn=0;!vn;)if(tt)vi.push(tt),tt=tt.left;else if(vi.length>0){if(tt=vi.pop(),Nn===et)return tt;Nn++,tt=tt.right}else vn=!0;return null},g.prototype.load=function(et,tt,vi){if(et===void 0&&(et=[]),tt===void 0&&(tt=[]),vi===void 0&&(vi=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var vn=et.length;return vi&&D(et,tt,0,vn-1,this._compare),this._root=w(null,et,tt,0,vn),this._size=vn,this},g.prototype.min=function(){var et=this.minNode(this._root);return et?et.key:null},g.prototype.max=function(){var et=this.maxNode(this._root);return et?et.key:null},g.prototype.isEmpty=function(){return this._root===null},C.size.get=function(){return this._size},g.createTree=function(et,tt,vi,vn,Nn){return new g(vi,Nn).load(et,tt,vn)},Object.defineProperties(g.prototype,C);var P=0,B=1,q=2,$=3,K=0,ne=1,re=2,ge=3;function ve(et,tt,vi){tt===null?(et.inOut=!1,et.otherInOut=!0):(et.isSubject===tt.isSubject?(et.inOut=!tt.inOut,et.otherInOut=tt.otherInOut):(et.inOut=!tt.otherInOut,et.otherInOut=tt.isVertical()?!tt.inOut:tt.inOut),tt&&(et.prevInResult=!De(tt,vi)||tt.isVertical()?tt.prevInResult:tt));var vn=De(et,vi);et.resultTransition=vn?(function(Nn,On){var cr,po=!Nn.inOut,Ta=!Nn.otherInOut;switch(On){case K:cr=po&&Ta;break;case ne:cr=po||Ta;break;case ge:cr=po^Ta;break;case re:cr=Nn.isSubject?po&&!Ta:Ta&&!po}return cr?1:-1})(et,vi):0}function De(et,tt){switch(et.type){case P:switch(tt){case K:return!et.otherInOut;case ne:return et.otherInOut;case re:return et.isSubject&&et.otherInOut||!et.isSubject&&!et.otherInOut;case ge:return!0}break;case q:return tt===K||tt===ne;case $:return tt===re;case B:return!1}return!1}var Ve=function(et,tt,vi,vn,Nn){this.left=tt,this.point=et,this.otherEvent=vi,this.isSubject=vn,this.type=Nn||P,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},Be={inResult:{configurable:!0}};function $e(et,tt){return et[0]===tt[0]&&et[1]===tt[1]}Ve.prototype.isBelow=function(et){var tt=this.point,vi=this.otherEvent.point;return this.left?(tt[0]-et[0])*(vi[1]-et[1])-(vi[0]-et[0])*(tt[1]-et[1])>0:(vi[0]-et[0])*(tt[1]-et[1])-(tt[0]-et[0])*(vi[1]-et[1])>0},Ve.prototype.isAbove=function(et){return!this.isBelow(et)},Ve.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},Be.inResult.get=function(){return this.resultTransition!==0},Ve.prototype.clone=function(){var et=new Ve(this.point,this.left,this.otherEvent,this.isSubject,this.type);return et.contourId=this.contourId,et.resultTransition=this.resultTransition,et.prevInResult=this.prevInResult,et.isExteriorRing=this.isExteriorRing,et.inOut=this.inOut,et.otherInOut=this.otherInOut,et},Object.defineProperties(Ve.prototype,Be);var St=11102230246251565e-32,yt=134217729,vt=(3+8*St)*St;function Vt(et,tt,vi,vn,Nn){var On,cr,po,Ta,Ea=tt[0],da=vn[0],hl=0,jc=0;da>Ea==da>-Ea?(On=Ea,Ea=tt[++hl]):(On=da,da=vn[++jc]);var ta=0;if(hlEa==da>-Ea?(po=On-((cr=Ea+On)-Ea),Ea=tt[++hl]):(po=On-((cr=da+On)-da),da=vn[++jc]),On=cr,po!==0&&(Nn[ta++]=po);hlEa==da>-Ea?(po=On-((cr=On+Ea)-(Ta=cr-On))+(Ea-Ta),Ea=tt[++hl]):(po=On-((cr=On+da)-(Ta=cr-On))+(da-Ta),da=vn[++jc]),On=cr,po!==0&&(Nn[ta++]=po);for(;hl0!=hl>0)return jc;var ta=Math.abs(da+hl);return Math.abs(jc)>=ki*ta?jc:-(function(dc,Ul,js,Fc,Zl,Hl,$l){var sl,ua,fl,Pc,co,ts,Xl,od,uc,bu,Tl,au,r_,Km,dm,o_,RS,Cu,op=dc-Zl,Ym=js-Zl,If=Ul-Hl,Ph=Fc-Hl;_n[0]=(dm=(od=op-(Xl=(ts=yt*op)-(ts-op)))*(bu=Ph-(uc=(ts=yt*Ph)-(ts-Ph)))-((Km=op*Ph)-Xl*uc-od*uc-Xl*bu))-((Tl=dm-(RS=(od=If-(Xl=(ts=yt*If)-(ts-If)))*(bu=Ym-(uc=(ts=yt*Ym)-(ts-Ym)))-((o_=If*Ym)-Xl*uc-od*uc-Xl*bu)))+(co=dm-Tl))+(co-RS),_n[1]=(r_=Km-((au=Km+Tl)-(co=au-Km))+(Tl-co))-((Tl=r_-o_)+(co=r_-Tl))+(co-o_),_n[2]=au-((Cu=au+Tl)-(co=Cu-au))+(Tl-co),_n[3]=Cu;var pk=(function(jfn,J4e){for(var e5e=J4e[0],Cye=1;Cye<4;Cye++)e5e+=J4e[Cye];return e5e})(0,_n),xj=Xt*$l;if(pk>=xj||-pk>=xj||(sl=dc-(op+(co=dc-op))+(co-Zl),fl=js-(Ym+(co=js-Ym))+(co-Zl),ua=Ul-(If+(co=Ul-If))+(co-Hl),Pc=Fc-(Ph+(co=Fc-Ph))+(co-Hl),sl===0&&ua===0&&fl===0&&Pc===0)||(xj=Bi*$l+vt*Math.abs(pk),(pk+=op*Pc+Ph*sl-(If*fl+Ym*ua))>=xj||-pk>=xj))return pk;Ai[0]=(dm=(od=sl-(Xl=(ts=yt*sl)-(ts-sl)))*(bu=Ph-(uc=(ts=yt*Ph)-(ts-Ph)))-((Km=sl*Ph)-Xl*uc-od*uc-Xl*bu))-((Tl=dm-(RS=(od=ua-(Xl=(ts=yt*ua)-(ts-ua)))*(bu=Ym-(uc=(ts=yt*Ym)-(ts-Ym)))-((o_=ua*Ym)-Xl*uc-od*uc-Xl*bu)))+(co=dm-Tl))+(co-RS),Ai[1]=(r_=Km-((au=Km+Tl)-(co=au-Km))+(Tl-co))-((Tl=r_-o_)+(co=r_-Tl))+(co-o_),Ai[2]=au-((Cu=au+Tl)-(co=Cu-au))+(Tl-co),Ai[3]=Cu;var qkt=Vt(4,_n,4,Ai,Ki);Ai[0]=(dm=(od=op-(Xl=(ts=yt*op)-(ts-op)))*(bu=Pc-(uc=(ts=yt*Pc)-(ts-Pc)))-((Km=op*Pc)-Xl*uc-od*uc-Xl*bu))-((Tl=dm-(RS=(od=If-(Xl=(ts=yt*If)-(ts-If)))*(bu=fl-(uc=(ts=yt*fl)-(ts-fl)))-((o_=If*fl)-Xl*uc-od*uc-Xl*bu)))+(co=dm-Tl))+(co-RS),Ai[1]=(r_=Km-((au=Km+Tl)-(co=au-Km))+(Tl-co))-((Tl=r_-o_)+(co=r_-Tl))+(co-o_),Ai[2]=au-((Cu=au+Tl)-(co=Cu-au))+(Tl-co),Ai[3]=Cu;var $kt=Vt(qkt,Ki,4,Ai,an);Ai[0]=(dm=(od=sl-(Xl=(ts=yt*sl)-(ts-sl)))*(bu=Pc-(uc=(ts=yt*Pc)-(ts-Pc)))-((Km=sl*Pc)-Xl*uc-od*uc-Xl*bu))-((Tl=dm-(RS=(od=ua-(Xl=(ts=yt*ua)-(ts-ua)))*(bu=fl-(uc=(ts=yt*fl)-(ts-fl)))-((o_=ua*fl)-Xl*uc-od*uc-Xl*bu)))+(co=dm-Tl))+(co-RS),Ai[1]=(r_=Km-((au=Km+Tl)-(co=au-Km))+(Tl-co))-((Tl=r_-o_)+(co=r_-Tl))+(co-o_),Ai[2]=au-((Cu=au+Tl)-(co=Cu-au))+(Tl-co),Ai[3]=Cu;var Kkt=Vt($kt,an,4,Ai,hn);return hn[Kkt-1]})(Nn,On,cr,po,Ta,Ea,ta)})(et[0],et[1],tt[0],tt[1],vi[0],vi[1]);return vn>0?-1:vn<0?1:0}function Jt(et,tt){var vi=et.point,vn=tt.point;return vi[0]>vn[0]?1:vi[0]vn[1]?1:-1:(function(Nn,On,cr,po){return Nn.left!==On.left?Nn.left?1:-1:sn(cr,Nn.otherEvent.point,On.otherEvent.point)!==0?Nn.isBelow(On.otherEvent.point)?-1:1:!Nn.isSubject&&On.isSubject?1:-1})(et,tt,vi)}function Di(et,tt,vi){var vn=new Ve(tt,!1,et,et.isSubject),Nn=new Ve(tt,!0,et.otherEvent,et.isSubject);return $e(et.point,et.otherEvent.point)&&console.warn("what is that, a collapsed segment?",et),vn.contourId=Nn.contourId=et.contourId,Jt(Nn,et.otherEvent)>0&&(et.otherEvent.left=!0,Nn.left=!1),et.otherEvent.otherEvent=Nn,et.otherEvent=vn,vi.push(Nn),vi.push(vn),vi}function yn(et,tt){return et[0]*tt[1]-et[1]*tt[0]}function ln(et,tt){return et[0]*tt[0]+et[1]*tt[1]}function Sr(et,tt,vi){var vn=(function(Ta,Ea,da,hl,jc){var ta=[Ea[0]-Ta[0],Ea[1]-Ta[1]],dc=[hl[0]-da[0],hl[1]-da[1]];function Ul(ts,Xl,od){return[ts[0]+Xl*od[0],ts[1]+Xl*od[1]]}var js=[da[0]-Ta[0],da[1]-Ta[1]],Fc=yn(ta,dc),Zl=Fc*Fc,Hl=ln(ta,ta);if(Zl>0){var $l=yn(js,dc)/Fc;if($l<0||$l>1)return null;var sl=yn(js,ta)/Fc;return sl<0||sl>1?null:$l===0||$l===1?[Ul(Ta,$l,ta)]:sl===0||sl===1?[Ul(da,sl,dc)]:[Ul(Ta,$l,ta)]}if((Zl=(Fc=yn(js,ta))*Fc)>0)return null;var ua=ln(ta,js)/Hl,fl=ua+ln(ta,dc)/Hl,Pc=Math.min(ua,fl),co=Math.max(ua,fl);return Pc<=1&&co>=0?Pc===1?[Ul(Ta,Pc>0?Pc:0,ta)]:co===0?[Ul(Ta,co<1?co:1,ta)]:[Ul(Ta,Pc>0?Pc:0,ta),Ul(Ta,co<1?co:1,ta)]:null})(et.point,et.otherEvent.point,tt.point,tt.otherEvent.point),Nn=vn?vn.length:0;if(Nn===0||Nn===1&&($e(et.point,tt.point)||$e(et.otherEvent.point,tt.otherEvent.point))||Nn===2&&et.isSubject===tt.isSubject)return 0;if(Nn===1)return $e(et.point,vn[0])||$e(et.otherEvent.point,vn[0])||Di(et,vn[0],vi),$e(tt.point,vn[0])||$e(tt.otherEvent.point,vn[0])||Di(tt,vn[0],vi),1;var On=[],cr=!1,po=!1;return $e(et.point,tt.point)?cr=!0:Jt(et,tt)===1?On.push(tt,et):On.push(et,tt),$e(et.otherEvent.point,tt.otherEvent.point)?po=!0:Jt(et.otherEvent,tt.otherEvent)===1?On.push(tt.otherEvent,et.otherEvent):On.push(et.otherEvent,tt.otherEvent),cr&&po||cr?(tt.type=B,et.type=tt.inOut===et.inOut?q:$,cr&&!po&&Di(On[1].otherEvent,On[0].point,vi),2):po?(Di(On[0],On[1].point,vi),3):On[0]!==On[3].otherEvent?(Di(On[0],On[1].point,vi),Di(On[1],On[2].point,vi),3):(Di(On[0],On[1].point,vi),Di(On[3].otherEvent,On[2].point,vi),3)}function lr(et,tt){if(et===tt)return 0;if(sn(et.point,et.otherEvent.point,tt.point)!==0||sn(et.point,et.otherEvent.point,tt.otherEvent.point)!==0)return $e(et.point,tt.point)?et.isBelow(tt.otherEvent.point)?-1:1:et.point[0]===tt.point[0]?et.point[1]tt.contourId?1:-1:Jt(et,tt)===1?1:-1}var nn=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function un(et,tt,vi,vn){var Nn,On=et+1,cr=tt[et].point,po=tt.length;for(Onvn;)On--;return On}nn.prototype.isExterior=function(){return this.holeOf==null};var pr=En,Yn=En;function En(et,tt){if(!(this instanceof En))return new En(et,tt);if(this.data=et||[],this.length=this.data.length,this.compare=tt||Zn,this.length>0)for(var vi=(this.length>>1)-1;vi>=0;vi--)this._down(vi)}function Zn(et,tt){return ettt?1:0}En.prototype={push:function(et){this.data.push(et),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var et=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),et}},peek:function(){return this.data[0]},_up:function(et){for(var tt=this.data,vi=this.compare,vn=tt[et];et>0;){var Nn=et-1>>1,On=tt[Nn];if(vi(vn,On)>=0)break;tt[et]=On,et=Nn}tt[et]=vn},_down:function(et){for(var tt=this.data,vi=this.compare,vn=this.length>>1,Nn=tt[et];et=0)break;tt[et]=po,et=On}tt[et]=Nn}},pr.default=Yn;var Jr=Math.max,bo=Math.min,Zo=0;function Mo(et,tt,vi,vn,Nn,On){var cr,po,Ta,Ea,da,hl;for(cr=0,po=et.length-1;cr0?hl.left=!0:da.left=!0;var jc=Ta[0],ta=Ta[1];Nn[0]=bo(Nn[0],jc),Nn[1]=bo(Nn[1],ta),Nn[2]=Jr(Nn[2],jc),Nn[3]=Jr(Nn[3],ta),vn.push(da),vn.push(hl)}}var Fa=[];function _a(et,tt,vi){typeof et[0][0][0]=="number"&&(et=[et]),typeof tt[0][0][0]=="number"&&(tt=[tt]);var vn=(function(ta,dc,Ul){var js=null;return ta.length*dc.length==0&&(Ul===K?js=Fa:Ul===re?js=ta:Ul!==ne&&Ul!==ge||(js=ta.length===0?dc:ta)),js})(et,tt,vi);if(vn)return vn===Fa?null:vn;var Nn=[1/0,1/0,-1/0,-1/0],On=[1/0,1/0,-1/0,-1/0],cr=(function(ta,dc,Ul,js,Fc){var Zl,Hl,$l,sl,ua,fl,Pc=new pr(null,Jt);for($l=0,sl=ta.length;$ljs[2]||js[0]>Ul[2]||Ul[1]>js[3]||js[1]>Ul[3])&&(Fc===K?Zl=Fa:Fc===re?Zl=ta:Fc!==ne&&Fc!==ge||(Zl=ta.concat(dc))),Zl})(et,tt,Nn,On,vi))return vn===Fa?null:vn;for(var po=(function(ta){var dc,Ul,js=(function($l){var sl,ua,fl,Pc,co=[];for(ua=0,fl=$l.length;ua0){var Tl=ts[bu];if(Tl.holeOf!=null){var au=Tl.holeOf;ts[au].holeIds.push(Xl),od.holeOf=au,od.depth=ts[bu].depth}else ts[bu].holeIds.push(Xl),od.holeOf=bu,od.depth=ts[bu].depth+1}else od.holeOf=null,od.depth=ts[bu].depth}else od.holeOf=null,od.depth=0;return od})(js[dc],Zl,$l),ua=function(co){Fc[co]=!0,co=js.length)&&js[fl];);Zl.push(sl)}};for(dc=0,Ul=js.length;dcPc||Zl===re&&co.point[0]>js[2])break;if(co.left){$l=Hl=ua.insert(co),Hl=Hl!==(sl=ua.minNode())?ua.prev(Hl):null,$l=ua.next($l);var ts=Hl?Hl.key:null;if(ve(co,ts,Zl),$l&&Sr(co,$l.key,ta)===2&&(ve(co,ts,Zl),ve($l.key,co,Zl)),Hl&&Sr(Hl.key,co,ta)===2){var Xl=Hl;ve(ts,(Xl=Xl!==sl?ua.prev(Xl):null)?Xl.key:null,Zl),ve(co,ts,Zl)}}else $l=Hl=ua.find(co=co.otherEvent),Hl&&$l&&(Hl=Hl!==sl?ua.prev(Hl):null,$l=ua.next($l),ua.remove(co),$l&&Hl&&Sr(Hl.key,$l.key,ta))}return fl})(cr,0,0,Nn,On,vi)),Ta=[],Ea=0;Ea{w.push(new Ti($,P+($-D)/(B-D)*(q-P)))}:(w,D,P,B,q,$)=>{w.push(new Ti(D+($-P)/(q-P)*(B-D),$))};for(let w of p){let D=[];for(let P of w){if(P.length<=2)continue;let B=[];for(let K=0;Kl&&C(B,ne,re,ge,ve,l):De>u?Ve=l&&C(B,ne,re,ge,ve,l),Ve>u&&De<=u&&C(B,ne,re,ge,ve,u)}let q=P[P.length-1],$=f===0?q.x:q.y;$>=l&&$<=u&&B.push(q),B.length&&(q=B[B.length-1],B[0].x===q.x&&B[0].y===q.y||B.push(B[0]),D.push(B))}D.length&&g.push(D)}return g}function ud(p,l){let u=n4(p),f=n4([l]),g=N7.intersection(u,f);return g==null?[]:YF(g)}function f0e(p,l){let f=n4(p,65536);for(;l.valid();l.next()){let[g,C]=l.get(),w=g.x*65536,D=g.y*65536,P=C.x*65536,B=C.y*65536,q=P-w,$=B-D,K=Math.hypot(q,$),ne=Math.trunc($/K*3),re=-Math.trunc(q/K*3);f=N7.diff(f,[[[w,D],[P,B],[P+ne,B+re],[w+ne,D+re],[w,D]]])}return YF(f,1/65536)}function n4(p,l=1){return[p.map(u=>u.map(f=>[f.x*l,f.y*l]))]}function YF(p,l=1){return p.map(u=>u.map((f,g)=>{let C=f.map(w=>new Ti(w[0]*l,w[1]*l).round());return g>0&&C.reverse(),C}))}class L7{constructor(l,u){this.layoutVertexArray=new Rh,this.indexArray=new Rl,this.lineIndexArray=new Oh,this.triangleSegments=new cc,this.lineSegments=new cc,this.programConfigurations=new Cf(l.layers,{zoom:l.zoom,lut:l.lut}),this.uploaded=!1,u&&(this.elevatedLayoutVertexArray=new Qx)}update(l,u,f,g,C,w,D,P){this.programConfigurations.updatePaintArrays(l,u,C,f,g,w,D,P)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,i_.members),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.lineIndexBuffer=l.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=l.createVertexBuffer(this.elevatedLayoutVertexArray,yp.members))),this.programConfigurations.upload(l),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(l,u,f,g,C,w,D){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,l,u,f,g,C,w,void 0,D)}}class B7{constructor(l){this.zoom=l.zoom,this.pixelRatio=l.pixelRatio,this.overscaling=l.overscaling,this.layers=l.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=l.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=l.lut,this.bufferData=new L7(l,!1),this.elevationBufferData=new L7(l,!0),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=l.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=l.sourceLayerIndex,this.worldview=l.worldview}updateFootprints(l,u){}populate(l,u,f,g){this.hasPattern=O7("fill",this.layers,this.pixelRatio,u);let C=this.layers[0].layout.get("fill-sort-key"),w=[];for(let{feature:D,id:P,index:B,sourceLayerIndex:q}of l){let $=this.layers[0]._featureFilter.needGeometry,K=yi(D,$);if(!this.layers[0]._featureFilter.filter(new Ys(this.zoom,{worldview:this.worldview}),K,f))continue;let ne=C?C.evaluate(K,{},f,u.availableImages):void 0,re={id:P,properties:D.properties,type:D.type,sourceLayerIndex:q,index:B,geometry:$?K.geometry:Mt(D,f,g),patterns:{},sortKey:ne};w.push(re)}C&&w.sort((D,P)=>D.sortKey-P.sortKey);for(let D of w){let{geometry:P,index:B,sourceLayerIndex:q}=D;if(this.hasPattern){let $=F7("fill",this.layers,D,this.zoom,this.pixelRatio,u);this.patternFeatures.push($)}else this.addFeature(D,P,B,f,{},u.availableImages,u.brightness,u.elevationFeatures);u.featureIndex.insert(l[B].feature,P,B,q,this.index)}}update(l,u,f,g,C,w,D){this.bufferData.update(l,u,f,g,C,w,D,this.worldview),this.elevationBufferData.update(l,u,f,g,C,w,D,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(l,u,f,g,C,w,D,this.worldview)}addFeatures(l,u,f,g,C,w){for(let D of this.patternFeatures)this.addFeature(D,D.geometry,D.index,u,f,g,w,l.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(l){this.bufferData.upload(l),this.elevationBufferData.upload(l),this.elevatedStructures&&this.elevatedStructures.upload(l)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(l,u,f,g,C,w=[],D,P){let B=dC(u,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(l,B,g,f,P):this.addGeometry(B,this.bufferData),this.bufferData.populatePaintArrays(l,f,C,w,g,D,this.worldview),this.elevationBufferData.populatePaintArrays(l,f,C,w,g,D,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(l,u,f,g,C){this.elevatedStructures&&(this.elevatedStructures.construct(l),this.elevatedStructures.populatePaintArrays(u,f,g,C,this.worldview))}addElevatedRoadFeature(l,u,f,g,C){let w=new Array,D=yc.getElevationFeature(l,C);if(!D)return void this.addGeometry(u,this.bufferData);{let B=this.clipPolygonsToTile(u,1);B.length>0&&w.push({polygons:B,elevationFeature:D,elevationTileID:f})}let P={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(l,{},f),featureIndex:g};for(let B of w)if(B.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Ba(B.elevationTileID,this.layers,this.zoom,this.lut));let $=B.elevationFeature.isTunnel(),K=0;l.properties.hasOwnProperty(wr)&&(K=+l.properties[wr]);for(let ne of B.polygons)this.elevatedStructures.addPortalCandidates(B.elevationFeature.id,ne,$,B.elevationFeature,K)}B.elevationFeature.constantHeight==null&&(B.polygons=this.prepareElevatedPolygons(B.polygons,B.elevationFeature,B.elevationTileID));let q=new ja(f,B.elevationTileID);this.addElevatedGeometry(B.polygons,q,B.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,g,P)}}addElevatedGeometry(l,u,f,g,C,w){let D={elevation:f,elevationSampler:u,bias:g,index:C,featureInfo:w},[P,B]=this.addGeometry(l,this.elevationBufferData,D);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:P,max:B}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,P),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,B))}addGeometry(l,u,f){let g=Number.POSITIVE_INFINITY,C=Number.NEGATIVE_INFINITY,w=null;f&&(w=f.elevationSampler.constantElevation(f.elevation,f.bias),w!=null&&(g=w,C=w));let D=(P,B,q)=>{if(f!=null)if(B.push(P),w!=null)u.elevatedLayoutVertexArray.emplaceBack(w),q.push(w);else{let $=f.elevationSampler.pointElevation(P,f.elevation,f.bias);u.elevatedLayoutVertexArray.emplaceBack($),q.push($),g=Math.min(g,$),C=Math.max(C,$)}};for(let P of l){let B=0;for(let Be of P)B+=Be.length;let q=u.triangleSegments.prepareSegment(B,u.layoutVertexArray,u.indexArray),$=q.vertexLength,K=[],ne=[],re=[],ge=[],ve=[],De=u.layoutVertexArray.length;for(let Be of P){if(Be.length===0)continue;Be!==P[0]&&ne.push(K.length/2);let $e=u.lineSegments.prepareSegment(Be.length,u.layoutVertexArray,u.lineIndexArray),St=$e.vertexLength;f&&ve.push(u.layoutVertexArray.length-De),D(Be[0],re,ge),u.layoutVertexArray.emplaceBack(Be[0].x,Be[0].y),u.lineIndexArray.emplaceBack(St+Be.length-1,St),K.push(Be[0].x),K.push(Be[0].y);for(let yt=1;yt0&&f&&this.elevationMode==="hd-road-base"){let Be=f.elevation.isTunnel(),$e=f.elevation.safeArea,St=this.elevatedStructures.addVertices(re,ge);this.elevatedStructures.addTriangles(Ve,St,Be);let yt=ve.length;if(yt>0){for(let vt=0;vt=f&&ne.max.x<=C&&ne.min.y>=g&&ne.max.y<=w?P:B).push(K)}if(P.length===l.length)return l;let q=[new Ti(f,g),new Ti(C,g),new Ti(C,w),new Ti(f,w),new Ti(f,g)],$=P;for(let K of B)$.push(...ud(K,q));return $}}let JJ,eee,tee,iee;Jn(B7,"FillBucket",{omit:["layers","patternFeatures"]}),Jn(L7,"FillBufferData"),Jn(Ba,"ElevatedStructures");class r4{constructor(l,u,f,g){if(this.triangleCount=u.length/3,this.min=new Ti(0,0),this.max=new Ti(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||l.length===0)return;let[C,w]=[l[0].clone(),l[0].clone()];for(let $=1;$$.cellIdx-K.cellIdx||$.triIdx-K.triIdx);let q=0;for(;qthis.max.x||this.min.x>l.x||l.y>this.max.y||this.min.y>l.y)return;let f=uC(l.x-this.min.x,this.xScale,this.cellsX),g=uC(l.y-this.min.y,this.yScale,this.cellsY),C=this.cells[g*this.cellsX+f];if(C){this._lazyInitLookup();for(let w=0;wthis.max.x||this.min.x>u.x||l.y>this.max.y||this.min.y>u.y)return;this._lazyInitLookup();let g=uC(l.x-this.min.x,this.xScale,this.cellsX),C=uC(u.x-this.min.x,this.xScale,this.cellsX),w=uC(l.y-this.min.y,this.yScale,this.cellsY),D=uC(u.y-this.min.y,this.yScale,this.cellsY);for(let P=w;P<=D;P++)for(let B=g;B<=C;B++){let q=this.cells[P*this.cellsX+B];if(q)for(let $=0;$u.fqid),this.index=l.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.footprints=[],this.worldview=l.worldview}updateFootprints(l,u){for(let f of this.footprints)u.push({footprint:f,id:l})}populate(l,u,f,g){let C=[];for(let{feature:w,id:D,index:P,sourceLayerIndex:B}of l){let q=this.layers[0]._featureFilter.needGeometry,$=yi(w,q);if(!this.layers[0]._featureFilter.filter(new Ys(this.zoom,{worldview:this.worldview}),$,f))continue;let K={id:D,properties:w.properties,type:w.type,sourceLayerIndex:B,index:P,geometry:q?$.geometry:Mt(w,f,g),patterns:{}};C.push(K)}for(let w of C){let{geometry:D,index:P,sourceLayerIndex:B}=w;this.addFeature(w,D,P,f,{},u.availableImages,u.brightness),u.featureIndex.insert(l[P].feature,D,P,B,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(l){}update(l,u,f,g,C,w,D){}destroy(){}addFeature(l,u,f,g,C,w=[],D){for(let P of dC(u,2)){let B=[],q=[],$=[],K=new Ti(1/0,1/0),ne=new Ti(-1/0,-1/0);for(let ve of P)if(ve.length!==0){ve!==P[0]&&$.push(q.length/2);for(let De=0;Dew===g)===void 0})(f,p.clipScope)}function vp(p,l){return p.x-l.x||p.y-l.y}function fg(p,l){return vp(p.min,l.min)===0&&vp(p.max,l.max)===0}function U7(p,l){return!(p.min.x>l.max.x||p.max.xl.max.y||p.max.ynew Ti((P.x+C.x*wn)*D-w.x*wn,(P.y+C.y*wn)*D-w.y*wn))}return H7(u,g,p.indices,0,p.indices.length,0,0)}function cee(p,l,u,f){let g=Math.pow(2,f.z-u.z);return new Ti((p+u.x*wn)*g-f.x*wn,(l+u.y*wn)*g-f.y*wn)}function a4(p,l){let u=[];l.grid.queryPoint(p,u);let f=l.indices,g=l.vertices;for(let C=0;C0&&(f.length>1&&u.push(f),f=[])}return f.length>1&&u.push(f),u}let j7=ti.types,uee=["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"],pee=["fill-extrusion-flood-light-ground-radius"],C0e=Math.pow(2,13),x0e=Math.pow(2,15)-1,mee=new Ti(0,1),DS=2147483648;function pC(p,l,u,f,g,C,w,D){p.emplaceBack((l<<1)+w,(u<<1)+C,(Math.floor(f*C0e)<<1)+g,Math.round(D))}function QF(p,l,u){p.emplaceBack(l.x*wn,l.y*wn,u?1:0)}function s4(p,l,u,f,g,C){p.emplaceBack(l.x,l.y,(u.x<<1)+f,(u.y<<1)+g,C)}function ZF(p,l,u){p.emplaceBack(l.x,l.y,l.z,u[0]*16384,u[1]*16384,u[2]*16384)}class hee{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class fee{constructor(){this.centroidXY=new Ti(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 Ti(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Ti(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new Ti(this.max.x-this.min.x,this.max.y-this.min.y)}}class q7{constructor(){this.acc=new Ti(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(l,u){l.min.x===Number.MAX_VALUE&&(l.min.x=l.max.x=u.x,l.min.y=l.max.y=u.y)}appendEdge(l,u,f){this.accCount++,this.acc._add(u);let g=!!this.borders;u.xl.max.x&&(l.max.x=u.x,g=!0),u.yl.max.y&&(l.max.y=u.y,g=!0),((u.x===0||u.x===wn)&&u.x===f.x)!=((u.y===0||u.y===wn)&&u.y===f.y)&&this.processBorderOverlap(u,f),g&&this.checkBorderIntersection(u,f)}checkBorderIntersection(l,u){u.x<0!=l.x<0&&this.addBorderIntersection(0,Cr(u.y,l.y,(0-u.x)/(l.x-u.x))),u.x>wn!=l.x>wn&&this.addBorderIntersection(1,Cr(u.y,l.y,(wn-u.x)/(l.x-u.x))),u.y<0!=l.y<0&&this.addBorderIntersection(2,Cr(u.x,l.x,(0-u.y)/(l.y-u.y))),u.y>wn!=l.y>wn&&this.addBorderIntersection(3,Cr(u.x,l.x,(wn-u.y)/(l.y-u.y)))}addBorderIntersection(l,u){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 f=this.borders[l];uf[1]&&(f[1]=u)}processBorderOverlap(l,u){if(l.x===u.x){if(l.y===u.y)return;let f=l.x===0?0:1;this.addBorderIntersection(f,u.y),this.addBorderIntersection(f,l.y)}else{let f=l.y===0?2:3;this.addBorderIntersection(f,u.x),this.addBorderIntersection(f,l.x)}}centroid(){return this.accCount===0?new Ti(0,0):new Ti(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((l,u)=>l+ +(u[0]!==Number.MAX_VALUE),0):0}}function $7(p,l){let u=p.add(l)._unit(),f=nt(p.x*u.x+p.y*u.y,-1,1);var g,C,w;return g=Math.acos(f),Math.min(4,Math.max(-4,Math.tan(g)))/4*x0e*((C=p).x*(w=l).y-C.y*w.x<0?-1:1)}let w0e=[p=>p.x<0,p=>p.x>wn,p=>p.y<0,p=>p.y>wn];function S0e(p,l,u,f){let g=[4];if(f===0)return g;u._mult(f);let C=p.sub(u),w=l.sub(u),D=[p,l,C,w];for(let P=0;P<4;P++)for(let B of D)if(w0e[P](B)){g.push(P);break}return g}class K7{constructor(l){this.vertexArray=new lm,this.indexArray=new Rl,this.programConfigurations=new Cf(l.layers,{zoom:l.zoom,lut:l.lut},u=>pee.includes(u)),this._segments=new cc,this.hiddenByLandmarkVertexArray=new vE,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new cc}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(l,u,f,g=!1){let C=l.length;if(C>2){let w=Math.max(0,this._segments.get().length-1),D=this._segments._prepareSegment(4*C,this.vertexArray.length,2*this._segmentToGroundQuads[w].length),P;w!==this._segments.get().length-1&&(w++,this._segmentToGroundQuads[w]=[],this._segmentToRegionTriCounts[w]=[0,0,0,0,0]);{let B=l[0],q=l[1];P=$7(B.sub(l[C-1])._perp()._unit(),q.sub(B)._perp()._unit())}for(let B=0;Bg.region-C.region);for(let f=0;fP+B,0);let D=0;for(let P=0;P<=4;P++){let B=w[P];if(B!==0){let q=this.regionSegments[P];q||(q=this.regionSegments[P]=new cc);let $={vertexOffset:C.vertexOffset,primitiveOffset:C.primitiveOffset+D,vertexLength:C.vertexLength,primitiveLength:B};q.get().push($)}D+=B}for(let P=0;P0?this.hiddenByLandmarkVertexBuffer=l.createVertexBuffer(this.hiddenByLandmarkVertexArray,V7.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 l=0;l<=4;l++){let u=this.regionSegments[l];u&&u.destroy()}}}}class l4{constructor(l){this.zoom=l.zoom,this.canonical=l.canonical,this.overscaling=l.overscaling,this.layers=l.layers,this.pixelRatio=l.pixelRatio,this.layerIds=this.layers.map(u=>u.fqid),this.index=l.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=l.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Rl,this.footprintVertices=new Rh,this.footprintSegments=[],this.layoutVertexArray=new Wx,this.centroidVertexArray=new Ha,this.wallVertexArray=new Z2,this.indexArray=new Rl,this.programConfigurations=new Cf(l.layers,{zoom:l.zoom,lut:l.lut},u=>uee.includes(u)),this.segments=new cc,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.groundEffect=new K7(l),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=l.worldview}updateFootprints(l,u){}populate(l,u,f,g){this.features=[],this.hasPattern=O7("fill-extrusion",this.layers,this.pixelRatio,u),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=ut(f),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:C,id:w,index:D,sourceLayerIndex:P}of l){let B=this.layers[0]._featureFilter.needGeometry,q=yi(C,B);if(!this.layers[0]._featureFilter.filter(new Ys(this.zoom,{worldview:this.worldview}),q,f))continue;let $={id:w,sourceLayerIndex:P,index:D,geometry:B?q.geometry:Mt(C,f,g),properties:C.properties,type:C.type,patterns:{}},K=this.layoutVertexArray.length,ne=j7[$.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:C.id,feature:F7("fill-extrusion",this.layers,$,this.zoom,this.pixelRatio,u)});else if(this.wallMode)for(let re of $.geometry)for(let ge of dee(re,ne))this.addFeature(C.id,$,[ge],D,f,{},u.availableImages,g,u.brightness);else this.addFeature(C.id,$,$.geometry,D,f,{},u.availableImages,g,u.brightness);u.featureIndex.insert(C,$.geometry,D,P,this.index,K)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(l,u,f,g,C,w){for(let{featureId:D,feature:P}of this.features){let B=j7[P.type]==="Polygon",{geometry:q}=P;if(this.wallMode)for(let $ of q)for(let K of dee($,B))this.addFeature(D,P,[K],P.index,u,f,g,C,w);else this.addFeature(D,P,q,P.index,u,f,g,C,w)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(l,u,f,g,C,w,D){this.programConfigurations.updatePaintArrays(l,u,C,f,g,w,D,this.worldview),this.groundEffect.update(l,u,C,f,g,w,D,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,z7),this.indexBuffer=l.createIndexBuffer(this.indexArray),this.wallVertexBuffer=l.createVertexBuffer(this.wallVertexArray,v0e.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=l.createVertexBuffer(this.layoutVertexExtArray,b0e.members,!0)),this.groundEffect.upload(l)),this.groundEffect.uploadPaintProperties(l),this.programConfigurations.upload(l),this.uploaded=!0}uploadCentroid(l){this.groundEffect.uploadHiddenByLandmark(l),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=l.createVertexBuffer(this.centroidVertexArray,y0e.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(l,u,f,g,C,w,D,P,B){let q=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(u,{})/this.tileToMeter,$=[new Ti(0,0),new Ti(wn,wn)],K=P.projection,ne=K.name==="globe",re=this.wallMode||j7[u.type]==="Polygon",ge=new q7;ge.centroidDataIndex=this.centroidData.length;let ve=new fee;ve.buildingId=l,u.properties&&u.properties.hasOwnProperty("building_id")&&(ve.buildingId=u.properties.building_id);let De=this.layers[0].paint.get("fill-extrusion-base").evaluate(u,{},C)<=0,Ve=this.layers[0].paint.get("fill-extrusion-height").evaluate(u,{},C),Be;if(ve.height=Ve,ve.vertexArrayOffset=this.layoutVertexArray.length,ve.groundVertexArrayOffset=this.groundEffect.vertexArray.length,ne&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Ev),this.wallMode){if(ne)return void ba("Non zero fill-extrusion-line-width is not yet supported on globe.");if(f.length!==1)return;Be=(function(Xt){let Bi=Xt[0].x===Xt[Xt.length-1].x&&Xt[0].y===Xt[Xt.length-1].y;(function(un){let pr=0,Yn=un.length;for(let En=0;En=0})(Xt)||(Xt=Xt.reverse());let Ki={geometry:[],joinNormals:[],indices:[]},an=[],hn=[],Ai=[],sn=Xt.length;for(;sn>=2&&Xt[sn-1].equals(Xt[sn-2]);)sn--;if(sn<(Bi?3:2))return Ki;let Jt,Di,yn,ln,Sr,lr=0;for(;lr0,Jr="miter",bo=2;Jr==="miter"&&En>bo&&(Jr="bevel"),Jr==="bevel"&&(En>100&&(Jr="flipbevel"),En{let et=new Ti(Mo.x,Mo.y),tt=new Ti(Mo.x,Mo.y);et.x+=Fa.x*Ql,et.y+=Fa.y*Ql,tt.x-=Fa.x*Math.max(_a,1),tt.y-=Fa.y*Math.max(_a,1),Ai.push(Fa),an.push(et),hn.push(tt)};if(Jr==="miter")pr._mult(En),Zo(Jt,pr,0,0);else if(Jr==="flipbevel")pr=Sr.mult(-1),Zo(Jt,pr,0,0),Zo(Jt,pr.mult(-1),0,0);else{let Mo=-Math.sqrt(En*En-1),Fa=Zn?Mo:0,_a=Zn?0:Mo;Di&&Zo(Jt,ln,Fa,_a),yn&&Zo(Jt,Sr,Fa,_a)}}Ki.geometry=[...an,...hn.reverse(),an[0]],Ki.joinNormals=[...Ai,...Ai.reverse(),Ai[Ai.length-1]];let nn=Ki.geometry.length-1;for(let un=0;unXt<(Bi.length-1)/2||Xt===Bi.length-1,St=this.wallMode?[f]:dC(f,500);for(let Xt=St.length-1;Xt>=0;Xt--){let Bi=St[Xt];(Bi.length===0||(yt=Bi[0]).every(_n=>_n.x<=0)||yt.every(_n=>_n.x>=wn)||yt.every(_n=>_n.y<=0)||yt.every(_n=>_n.y>=wn))&&St.splice(Xt,1)}var yt;let vt;if(ne)vt=xee(St,$,C);else{vt=[];for(let Xt of St)vt.push({polygon:Xt,bounds:$})}let Vt=re?this.edgeRadius:0,Ht=Vt>0&&this.zoom<17,ki=(Xt,Bi)=>{if(Xt.length===0)return!1;let _n=Xt[Xt.length-1];return Bi.x===_n.x&&Bi.y===_n.y};for(let{polygon:Xt,bounds:Bi}of vt){let _n=0,Ki=0;for(let sn of Xt)re&&!sn[0].equals(sn[sn.length-1])&&sn.push(sn[0]),Ki+=re?sn.length-1:sn.length;let an=this.segments.prepareSegment((re?5:4)*Ki,this.layoutVertexArray,this.indexArray);ve.footprintSegIdx<0&&(ve.footprintSegIdx=this.footprintSegments.length),ve.polygonSegIdx<0&&(ve.polygonSegIdx=this.polygonSegments.length);let hn={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},Ai=new hee;if(Ai.vertexOffset=this.footprintVertices.length,Ai.indexOffset=3*this.footprintIndices.length,Ai.ringIndices=[],re){let sn=[],Jt=[];_n=an.vertexLength;for(let yn=0;yn4&&vee(Jt[Jt.length-2],Jt[0],Jt[1]),yn=Vt?I0e(Jt[Jt.length-2],Jt[0],Jt[1],Vt):0,ln=[],Sr,lr,nn;lr=Jt[1].sub(Jt[0])._perp()._unit();let un=!0;for(let pr=1,Yn=0;pr0?1:0,Fa=En.dist(Zn);if(Yn+Fa>32768&&(Yn=0),Vt){nn=Jr.sub(Zn)._perp()._unit();let tt=_ee(En,Zn,Jr,gee(lr,nn),Vt);isNaN(tt)&&(tt=0);let vi=Zn.sub(En)._unit();En=En.add(vi.mult(yn))._round(),Zn=Zn.add(vi.mult(-tt))._round(),yn=tt,lr=nn,De&&this.zoom>=17&&(ki(ln,En)||ln.push(En),ki(ln,Zn)||ln.push(Zn))}let _a=an.vertexLength,Ql=Jt.length>4&&vee(En,Zn,Jr),et=bee(Yn,Di,un);if(pC(this.layoutVertexArray,En.x,En.y,Zo,Mo,0,0,et),pC(this.layoutVertexArray,En.x,En.y,Zo,Mo,0,1,et),this.wallMode){let tt=$e(pr-1,Jt),vi=Be.joinNormals[pr-1];QF(this.wallVertexArray,vi,tt),QF(this.wallVertexArray,vi,tt)}if(Yn+=Fa,et=bee(Yn,Ql,!un),Di=Ql,pC(this.layoutVertexArray,Zn.x,Zn.y,Zo,Mo,0,0,et),pC(this.layoutVertexArray,Zn.x,Zn.y,Zo,Mo,0,1,et),this.wallMode){let tt=$e(pr,Jt),vi=Be.joinNormals[pr];QF(this.wallVertexArray,vi,tt),QF(this.wallVertexArray,vi,tt)}if(an.vertexLength+=4,this.indexArray.emplaceBack(_a+0,_a+1,_a+2),this.indexArray.emplaceBack(_a+1,_a+3,_a+2),an.primitiveLength+=2,Vt){let tt=_n+(pr===1?Jt.length-2:pr-2),vi=pr===1?_n:tt+1;if(this.indexArray.emplaceBack(_a+1,tt,_a+3),this.indexArray.emplaceBack(tt,vi,_a+3),an.primitiveLength+=2,Sr===void 0&&(Sr=_a),!Y7(Jr,Jt[pr],Bi)){let vn=pr===Jt.length-1?Sr:an.vertexLength;this.indexArray.emplaceBack(_a+2,_a+3,vn),this.indexArray.emplaceBack(_a+3,vn+1,vn),this.indexArray.emplaceBack(_a+3,vi,vn+1),an.primitiveLength+=3}un=!un}if(ne){let tt=this.layoutVertexExtArray,vi=K.projectTilePoint(En.x,En.y,C),vn=K.projectTilePoint(Zn.x,Zn.y,C),Nn=K.upVector(C,En.x,En.y),On=K.upVector(C,Zn.x,Zn.y);ZF(tt,vi,Nn),ZF(tt,vi,Nn),ZF(tt,vn,On),ZF(tt,vn,On)}}re&&(_n+=Jt.length-1),De&&Vt&&this.zoom>=17&&(ln.length!==0&&ki(ln,ln[0])&&ln.pop(),this.groundEffect.addData(ln,Bi,q,Vt>0))}this.footprintSegments.push(Ai),hn.triangleCount=this.indexArray.length-hn.triangleArrayOffset,this.polygonSegments.push(hn),++ve.footprintSegLen,++ve.polygonSegLen}if(ve.vertexCount=this.layoutVertexArray.length-ve.vertexArrayOffset,ve.groundVertexCount=this.groundEffect.vertexArray.length-ve.groundVertexArrayOffset,ve.vertexCount!==0){if(ve.centroidXY=ge.borders?mee:this.encodeCentroid(ge,ve),this.centroidData.push(ve),ge.borders){this.featuresOnBorder.push(ge);let Xt=this.featuresOnBorder.length-1;for(let Bi=0;Bithis.featuresOnBorder[u].borders[l][0]-this.featuresOnBorder[f].borders[l][0])}splitToSubtiles(){let l=[];for(let D=0;Dwn),q=2*B+(+(P.min.x+P.max.x>wn)^B);for(let $=0;$D.triangleSegmentIdx===P.triangleSegmentIdx?D.subtile-P.subtile:D.triangleSegmentIdx-P.triangleSegmentIdx);let f=0,g=0,C=0;for(let D of l){if(D.triangleSegmentIdx!==f)break;C++}let w=l.length;for(;g!==l.length;){f=l[g].triangleSegmentIdx;let D=0,P=g,B=g;for(let q=P;q0&&this.triangleSubSegments.push({segment:ne,min:$,max:K}),P=B;for(let re=P;re[ge[0]*(1-De[0])+ve[0]*De[0],ge[1]*(1-De[1])+ve[1]*De[1]],ne=[],re=[];for(let ge of this.triangleSubSegments){ne[0]=ge.min.x/wn,ne[1]=ge.min.y/wn,re[0]=ge.max.x/wn,re[1]=ge.max.y/wn;let ve=K(q,$,ne),De=K(q,$,re);if(new aa([ve[0],ve[1],C],[De[0],De[1],w]).intersectsPrecise(f)===0){B&&(g.segments.push(B),B=void 0);continue}let Ve=ge.segment;B&&B.vertexOffset!==Ve.vertexOffset&&(g.segments.push(B),B=void 0),B?(B.vertexLength+=Ve.vertexLength,B.primitiveLength+=Ve.primitiveLength):B={vertexOffset:Ve.vertexOffset,primitiveLength:Ve.primitiveLength,vertexLength:Ve.vertexLength,primitiveOffset:Ve.primitiveOffset,sortKey:void 0,vaos:{}}}return B&&g.segments.push(B),g}encodeCentroid(l,u){let f=l.centroid(),g=u.span(),C=Math.min(7,Math.round(g.x*this.tileToMeter/10)),w=Math.min(7,Math.round(g.y*this.tileToMeter/10));return new Ti(nt(f.x,1,wn-1)<<3|C,nt(f.y,1,wn-1)<<3|w)}encodeBorderCentroid(l){if(!l.borders)return new Ti(0,0);let u=l.borders,f=Number.MAX_VALUE;if(u[0][0]!==f||u[1][0]!==f){let g=u[0][0]!==f?0:1;return new Ti(6|(u[0][0]!==f?0:65528),(u[g][0]+u[g][1])/2<<3|6)}{let g=u[2][0]!==f?2:3;return new Ti((u[g][0]+u[g][1])/2<<3|6,6|(u[2][0]!==f?0:65528))}}showCentroid(l){let u=this.centroidData[l.centroidDataIndex];u.flags&=2147483647,u.centroidXY.x=0,u.centroidXY.y=0,this.writeCentroidToBuffer(u)}writeCentroidToBuffer(l){this.groundEffect.updateHiddenByLandmark(l);let u=l.vertexArrayOffset,f=l.vertexCount+l.vertexArrayOffset,g=l.flags&DS?mee:l.centroidXY,C=this.centroidVertexArray.geta_centroid_pos0(u);if(this.centroidVertexArray.geta_centroid_pos1(u)!==g.y||C!==g.x){for(let w=u;wP.max.x||P.min.x>w.max.x||w.min.y>P.max.y||P.min.y>w.max.y))for(let B=0;Bu!=ne>u&&l<(this.footprintVertices.int16[2*(q+w.vertexOffset)+0]-$)*(u-K)/(ne-K)+$&&(g=!g)}D=P}}return g}getHeightAtTileCoord(l,u){let f=Number.NEGATIVE_INFINITY,g=!0,C=4*(l+wn)*wn+(u+wn);if(this.partLookup.hasOwnProperty(C)){let w=this.partLookup[C];return w?{height:w.height,hidden:!!(w.flags&DS)}:void 0}for(let w of this.centroidData)l>w.max.x||w.min.x>l||u>w.max.y||w.min.y>u||w.height<=f||this.footprintContainsPoint(l,u,w)&&(f=w.height,this.partLookup[C]=w,g=!!(w.flags&DS));if(f!==Number.NEGATIVE_INFINITY)return{height:f,hidden:g};this.partLookup[C]=void 0}}function gee(p,l){let u=p.add(l)._unit();return p.x*u.x+p.y*u.y}function I0e(p,l,u,f){let g=l.sub(p)._perp()._unit(),C=u.sub(l)._perp()._unit();return _ee(p,l,u,gee(g,C),f)}function _ee(p,l,u,f,g){let C=Math.sqrt(1-f*f);return Math.min(p.dist(l)/3,l.dist(u)/3,g*C/f)}function Y7(p,l,u){return p.xu[1].x&&l.x>u[1].x||p.yu[1].y&&l.y>u[1].y}function yee(p,l){return p.xl[1].x||p.yl[1].y}function vee(p,l,u){if(p.x<0||p.x>=wn||l.x<0||l.x>=wn||u.x<0||u.x>=wn)return!1;let f=u.sub(l),g=f.perp(),C=p.sub(l);return(f.x*C.x+f.y*C.y)/Math.sqrt((f.x*f.x+f.y*f.y)*(C.x*C.x+C.y*C.y))>-.866&&g.x*C.x+g.y*C.y<0}function bee(p,l,u){let f=l?2|p:-3&p;return u?1|f:-2&f}function Cee(){let p=Math.PI/32,l=Math.tan(p),u=j;return u*Math.sqrt(1+2*l*l)-u}function xee(p,l,u){let f=1<{for(let Vt of yt)re.push({polygon:Vt,bounds:vt})},ve=Math.ceil(Math.log2(q)),De=Math.ceil(Math.log2($)),Ve=ve-De,Be=[];for(let yt=0;yt0?0:1);for(let yt=0;ytvt+1?St.push({polygons:Ki,bounds:hn,depth:vt+1}):ge(Ki,hn)}if(an.length){let hn=[new Ti(Vt===0?_n:Ht.x,Vt===1?_n:Ht.y),ki];Be.length>vt+1?St.push({polygons:an,bounds:hn,depth:vt+1}):ge(an,hn)}}return re})(p,l,Math.ceil((C-g)/11.25),Math.ceil((w-D)/11.25),1,(P,B,q)=>{if(P===0)return .5*(B+q);{let $=qe((u.y+B/wn)/f);return(Ie(.5*(qe((u.y+q/wn)/f)+$))*f-u.y)*wn}})}function T0e(p,l,u,f,g,C){let w=Math.pow(2,f.z-g.z);for(let D=0;D=P[w]&&(D=l,P=p),D[w]g&&Tee(D,P,w,g),D[w]C&&Tee(P,D,w,C)}}function c4(p,l,u,f,g,C){let w=[];for(let D=0;D=f&&re.x>=f||(ne.x>=f?ne=new Ti(f,ne.y+(f-ne.x)/(re.x-ne.x)*(re.y-ne.y))._round():re.x>=f&&(re=new Ti(f,ne.y+(f-ne.x)/(re.x-ne.x)*(re.y-ne.y))._round()),ne.y>=g&&re.y>=g||(ne.y>=g?ne=new Ti(ne.x+(g-ne.y)/(re.y-ne.y)*(re.x-ne.x),g)._round():re.y>=g&&(re=new Ti(ne.x+(g-ne.y)/(re.y-ne.y)*(re.x-ne.x),g)._round()),B&&ne.equals(B[B.length-1])||(B=[ne],w.push(B),C&&C.push({progress:{min:ve+Aee(De,Ve,ne)*ge,max:1},parentIndex:D,prevPoint:De,nextPoint:Ve})),B.push(re),C&&(C[C.length-1].progress.max=ve+Aee(De,Ve,re)*ge,C[C.length-1].nextPoint=Ve)))))}if(C&&$>0)for(let K=q;KB.t-q.t);let w=0,D=0,P=[];for(f.push(P);w!==p.length;){if(D===C.length){for(;w!==p.length;)P.length!==0&&P[P.length-1].equals(p[w])||P.push(p[w]),w++;break}C[D].t<=w?(P.length!==0&&P[P.length-1].equals(C[D].point)||P.push(C[D].point),Math.trunc(C[D].t),D++):(P.length!==0&&P[P.length-1].equals(p[w])||P.push(p[w]),w++)}}function Aee(p,l,u){return p.x!==l.x?(u.x-p.x)/(l.x-p.x):p.y!==l.y?(u.y-p.y)/(l.y-p.y):0}function XF(p,l){return p.x*l.x+p.y*l.y}function Dee(p,l){if(p.length===1){let u=0,f=l[u++],g;for(;!g||f.equals(g);)if(g=l[u++],!g)return 1/0;for(;u{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 Mee{constructor(){this.tasks={},this.taskQueue=[],ro(["process"],this),this.invoker=new kee(this.process),this.nextId=0}add(l,u){let f=this.nextId++,g=(function({type:C,isSymbolTile:w,zoom:D}){return D=D||0,C==="message"?0:C!=="maybePrepare"||w?C!=="parseTile"||w?C==="parseTile"&&w?300-D:C==="maybePrepare"&&w?400-D:500:200-D:100-D})(u);if(g===0){try{l()}finally{}return null}return this.tasks[f]={fn:l,metadata:u,priority:g,id:f},this.taskQueue.push(f),this.invoker.trigger(),{cancel:()=>{delete this.tasks[f]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(f=>!!this.tasks[f]),!this.taskQueue.length)return;let l=this.pick();if(l===null)return;let u=this.tasks[l];if(delete this.tasks[l],this.taskQueue.length&&this.invoker.trigger(),!u)return;u.fn()}finally{}}pick(){let l=null,u=1/0;for(let g=0;g{f&&delete this.callbacks[D],this.target.postMessage({id:D,type:"",targetMapId:g,sourceMapId:this.mapId})}}}receive(l){let u=l.data;if(!u)return;let f=u.id;if(f&&(!u.targetMapId||this.mapId===u.targetMapId))if(u.type===""){let g=this.cancelCallbacks[f];delete this.cancelCallbacks[f],g&&g.cancel()}else if(u.mustQueue||rl(self)){let g=this.callbacks[f],C=this.scheduler.add(()=>this.processTask(f,u),g&&g.metadata||{type:"message"});C&&(this.cancelCallbacks[f]=C)}else this.processTask(f,u)}processTask(l,u){if(delete this.cancelCallbacks[l],u.type===""){let f=this.callbacks[l];delete this.callbacks[l],f&&(u.error?f(Mh(u.error)):f(null,Mh(u.data)))}else{let f=new Set,g=u.hasCallback?(w,D)=>{this.target.postMessage({id:l,type:"",sourceMapId:this.mapId,error:w?oy(w):null,data:oy(D,f)},f)}:()=>{},C=Mh(u.data);if(this.parent[u.type])this.parent[u.type](u.sourceMapId,C,g);else if(this.parent.getWorkerSource){let w=u.type.split("."),{source:D,scope:P}=C;this.parent.getWorkerSource(u.sourceMapId,w[0],D,P)[w[1]](C,g)}else g(new Error(`Could not find function ${u.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var JF={workerUrl:"",workerClass:null,workerParams:void 0};let W7="mapboxgl_preloaded_worker_pool",rk=(()=>{class p{constructor(){this.active={}}acquire(u,f=p.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{f.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[W7]}numActive(){return Object.keys(this.active).length}}return p.workerCount=2,p})();class ok{constructor(l,u,f="Worker",g=rk.workerCount){this.workerPool=l,this.actors=[],this.currentActor=0,this.id=qi();let C=this.workerPool.acquire(this.id,g);for(let w=0;w{this.ready=!0})}broadcast(l,u,f){Ut(this.actors,(g,C)=>{g.send(l,u,C)},f=f||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(l=>{l.remove()}),this.actors=[],this.workerPool.release(this.id)}}let eP,Q7;function Fh(){return eP||(eP=new rk),eP}ok.Actor=Ree;class Z7{constructor(l){this.module=l}createIntArray(l){let u=new Int32Array(l),f=this.module.malloc(u.length*u.BYTES_PER_ELEMENT);return this.module.heap32.set(u,f/u.BYTES_PER_ELEMENT),f}createFloatArray(l){let u=new Float32Array(l),f=this.module.malloc(u.length*u.BYTES_PER_ELEMENT);return this.module.heapF32.set(u,f/u.BYTES_PER_ELEMENT),f}createStringBuffer(l){let u=this.module.malloc(l.length+1);for(let f=0;fg.arrayBuffer()).then(g=>{l.buffers[u]=g})}function zee(p,l){let u=p.json.bufferViews[l];return new Uint8Array(p.buffers[u.buffer],u.byteOffset||0,u.byteLength)}function R0e(p,l,u,f){if(p.uri){let g=Vee(p.uri,f);return fetch(g).then(C=>C.blob()).then(C=>createImageBitmap(C)).then(C=>{l.images[u]=C})}if(p.bufferView!==void 0){let g=zee(l,p.bufferView),C=new Blob([g],{type:p.mimeType});return createImageBitmap(C).then(w=>{l.images[u]=w})}}function Uee(p,l=0,u){let f={json:null,images:[],buffers:[]};if(new Uint32Array(p,l,1)[0]===Lee){let q=new Uint32Array(p,l),$=2,K=(q[$++]>>2)-3,ne=q[$++]>>2;if($++,f.json=JSON.parse(Bee.decode(q.subarray($,$+ne))),$+=ne,${let q=[],$=D&&D.includes(rP),K=D&&D.includes(h4);if($&&q.push((function(){if(!kv)return tP??(tP=(function(ne){let re,ge=null;function ve(){re=new Uint8Array(ge.buffer)}function De(){throw new Error("Unexpected Draco error.")}let Ve={a:{a:De,d:function(Be,$e,St){return re.copyWithin(Be,$e,$e+St)},c:function(Be){let $e=re.length,St=Math.max(Be>>>0,Math.ceil(1.2*$e)),yt=Math.ceil((St-$e)/65536);try{return ge.grow(yt),ve(),!0}catch{return!1}},b:De}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(ne,Ve):ne.then(Be=>Be.arrayBuffer()).then(Be=>WebAssembly.instantiate(Be,Ve))).then(Be=>{let{Rb:$e,Qb:St,P:yt,T:vt,X:Vt,Ja:Ht,La:ki,Qa:Xt,Va:Bi,Wa:_n,eb:Ki,jb:an,f:hn,e:Ai,yb:sn,zb:Jt,Ab:Di,Bb:yn,Db:ln,Gb:Sr}=Be.instance.exports;ge=Ai;let lr=(()=>{let nn=0,un=0,pr=0,Yn=0;return En=>{pr&&($e(Yn),$e(nn),un+=pr,pr=nn=0),nn||(un+=128,nn=St(un));let Zn=En.length+7&-8,Jr=nn;Zn>=un&&(pr=Zn,Jr=Yn=St(Zn));for(let bo=0;bo{kv=ne,tP=void 0}))})()),K&&q.push((function(){if(iP)return;let ne=(function(re){let ge,ve=WebAssembly.instantiateStreaming(re,{}).then(Be=>{ge=Be.instance,ge.exports.__wasm_call_ctors()}),De={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Ve={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:ve,supported:!0,decodeGltfBuffer(Be,$e,St,yt,vt,Vt){(function(Ht,ki,Xt,Bi,_n,Ki,an){let hn=Ht.exports.sbrk,Ai=Bi+3&-4,sn=hn(Ai*_n),Jt=hn(Ki.length),Di=new Uint8Array(Ht.exports.memory.buffer);Di.set(Ki,Jt);let yn=ki(sn,Bi,_n,Jt,Ki.length);if(yn===0&&an&&an(sn,Ai,_n),Xt.set(Di.subarray(sn,sn+Bi*_n)),hn(sn-hn(0)),yn!==0)throw new Error(`Malformed buffer data: ${yn}`)})(ge,ge.exports[Ve[vt]],Be,$e,St,yt,ge.exports[De[Vt]])}}})(fetch(Pee()));return ne.ready.then(()=>{iP=ne})})()),C)for(let ne=0;ne{if($&&w)for(let{primitives:ne}of w)for(let re of ne)D0e(re,f);if(K&&w&&P)for(let ne of P)k0e(ne,f);return f})})}function J7(p){switch(p){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 ej(p){switch(p){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 tj{constructor(l,u,f,g){this.context=l,this.format=f,this.useMipmap=g&&g.useMipmap,this.texture=l.gl.createTexture(),this.update(u,{premultiply:g&&g.premultiply})}update(l,u){let f=l&&l instanceof HTMLVideoElement&&l.width===0?l.videoWidth:l.width,g=l&&l instanceof HTMLVideoElement&&l.height===0?l.videoHeight:l.height,{context:C}=this,{gl:w}=C,{x:D,y:P}=u&&u.position?u.position:{x:0,y:0},B=D+f,q=P+g;!this.size||this.size[0]===B&&this.size[1]===q||(w.bindTexture(w.TEXTURE_2D,null),w.deleteTexture(this.texture),this.texture=w.createTexture(),this.size=null),w.bindTexture(w.TEXTURE_2D,this.texture),C.pixelStoreUnpackFlipY.set(!1),C.pixelStoreUnpack.set(1),C.pixelStoreUnpackPremultiplyAlpha.set(this.format===w.RGBA8&&(!u||u.premultiply!==!1));let $=l instanceof HTMLImageElement||l instanceof HTMLCanvasElement||l instanceof HTMLVideoElement||l instanceof ImageData||ImageBitmap&&l instanceof ImageBitmap;if(!this.size&&B>0&&q>0){let K=this.useMipmap?Math.floor(Math.log2(Math.max(B,q)))+1:1;w.texStorage2D(w.TEXTURE_2D,K,this.format,B,q),this.size=[B,q]}if(this.size)if($)w.texSubImage2D(w.TEXTURE_2D,0,D,P,J7(this.format),ej(this.format),l);else{let K=l.data;K&&w.texSubImage2D(w.TEXTURE_2D,0,D,P,f,g,J7(this.format),ej(this.format),K)}this.useMipmap&&w.generateMipmap(w.TEXTURE_2D)}bind(l,u,f=!1){let{context:g}=this,{gl:C}=g;C.bindTexture(C.TEXTURE_2D,this.texture),l!==this.minFilter&&(C.texParameteri(C.TEXTURE_2D,C.TEXTURE_MAG_FILTER,l),C.texParameteri(C.TEXTURE_2D,C.TEXTURE_MIN_FILTER,this.useMipmap&&!f?l===C.NEAREST?C.NEAREST_MIPMAP_NEAREST:C.LINEAR_MIPMAP_LINEAR:l),this.minFilter=l),u!==this.wrapS&&(C.texParameteri(C.TEXTURE_2D,C.TEXTURE_WRAP_S,u),C.texParameteri(C.TEXTURE_2D,C.TEXTURE_WRAP_T,u),this.wrapS=u)}bindExtraParam(l,u,f,g,C){let{context:w}=this,{gl:D}=w;D.bindTexture(D.TEXTURE_2D,this.texture),u!==this.magFilter&&(D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MAG_FILTER,u),this.magFilter=u),l!==this.minFilter&&(D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MIN_FILTER,this.useMipmap?l===D.NEAREST?D.NEAREST_MIPMAP_NEAREST:D.LINEAR_MIPMAP_LINEAR:l),this.minFilter=l),f!==this.wrapS&&(D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_S,f),this.wrapS=f),g!==this.wrapT&&(D.texParameteri(D.TEXTURE_2D,D.TEXTURE_WRAP_T,g),this.wrapT=g),C!==this.compareMode&&(C?(D.texParameteri(D.TEXTURE_2D,D.TEXTURE_COMPARE_MODE,D.COMPARE_REF_TO_TEXTURE),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_COMPARE_FUNC,C)):D.texParameteri(D.TEXTURE_2D,D.TEXTURE_COMPARE_MODE,D.NONE),this.compareMode=C)}destroy(){let{gl:l}=this.context;l.deleteTexture(this.texture),this.texture=null}}class oP{constructor(l,u){this.context=l,this.texture=u}bind(l,u){let{context:f}=this,{gl:g}=f;g.bindTexture(g.TEXTURE_2D,this.texture),l!==this.minFilter&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MAG_FILTER,l),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_MIN_FILTER,l),this.minFilter=l),u!==this.wrapS&&(g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_S,u),g.texParameteri(g.TEXTURE_2D,g.TEXTURE_WRAP_T,u),this.wrapS=u)}}let O0e=Oa([{name:"a_pos_3f",components:3,type:"Float32"}]),F0e=Oa([{name:"a_color_3f",components:3,type:"Float32"}]),P0e=Oa([{name:"a_color_4f",components:4,type:"Float32"}]),N0e=Oa([{name:"a_uv_2f",components:2,type:"Float32"}]),L0e=Oa([{name:"a_normal_3f",components:3,type:"Float32"}]),B0e=Oa([{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"}]),V0e=Oa([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function R(p,l){let u=ee(p.projection,p.zoom,p.width,p.height),f=(function(C,w,D,P,B){let q=new W(D.lng-180*Te,D.lat),$=new W(D.lng+180*Te,D.lat),K=C.project(q.lng,q.lat),ne=C.project($.lng,$.lat),re=-Math.atan2(ne.y-K.y,ne.x-K.x),ge=ht.fromLngLat(D);ge.y=nt(ge.y,-1+Te,1-Te);let ve=ge.toLngLat(),De=C.project(ve.lng,ve.lat),Ve=ht.fromLngLat(ve);Ve.x+=Te;let Be=Ve.toLngLat(),$e=C.project(Be.lng,Be.lat),St=kt($e.x-De.x,$e.y-De.y,re),yt=ht.fromLngLat(ve);yt.y+=Te;let vt=yt.toLngLat(),Vt=C.project(vt.lng,vt.lat),Ht=kt(Vt.x-De.x,Vt.y-De.y,re),ki=Math.abs(St.x)/Math.abs(Ht.y),Xt=k([]);pe(Xt,Xt,-re*(1-(B?0:P)));let Bi=k([]);return G(Bi,Bi,[1,1-(1-ki)*P,1]),Bi[4]=-Ht.x/Ht.y*P,pe(Bi,Bi,re),z(Bi,Xt,Bi),Bi})(p.projection,0,p.center,u,l),g=U(p);return G(f,f,[g,g,1]),f}function U(p){let l=p.projection,u=ee(p.projection,p.zoom,p.width,p.height),f=Ke(l,p.center),g=Ke(l,W.convert(l.center));return Math.pow(2,f*u+(1-u)*g)}function ee(p,l,u,f,g=1/0){let C=p.range;if(!C)return 0;let w=Math.min(g,Math.max(u,f)),D=Math.log(w/1024)/Math.LN2;return Ft(C[0]+D,C[1]+D,l)}let Te=1/4e4;function Ke(p,l){let u=nt(l.lat,-st,st),f=new W(l.lng-180*Te,u),g=new W(l.lng+180*Te,u),C=p.project(f.lng,u),w=p.project(g.lng,u),D=ht.fromLngLat(f),P=ht.fromLngLat(g),B=w.x-C.x,q=w.y-C.y,$=P.x-D.x,K=P.y-D.y,ne=Math.sqrt(($*$+K*K)/(B*B+q*q));return Math.log(ne)/Math.LN2}function kt(p,l,u){let f=Math.cos(u),g=Math.sin(u);return{x:p*f-l*g,y:p*g+l*f}}function ni(p,l,u){k(p),pe(p,p,sa(l[2])),Z(p,p,sa(l[0])),ce(p,p,sa(l[1])),G(p,p,u),z(p,p,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function Ei(p,l,u,f,g,C,w,D){let P=[u[0]-l[0],u[1]-l[1],0],B=[f[0]-l[0],f[1]-l[1],0];if(He(P)<1e-12||He(B)<1e-12)return Wi(p);let q=hi([],P,B);mt(q,q),We(B,f,l),P[2]=(C-g)*D,B[2]=(w-g)*D;let $=P;return hi($,P,B),mt($,$),Ao(p,q,$)}function Yi(p,l,u=!1){let f=wS(l.zoom),g=(function(C,w,D){let P=w.worldSize,B=[C[12],C[13],C[14]],q=qe(B[1]/P),$=Le(B[0]/P),K=k([]),ne=we(1,q)*P,re=we(1,0)*P*Ct(q,w.zoom),ge=1/e4(P),ve=re*ge;if(D){let $e=ee(w.projection,w.zoom,w.width,w.height,1024);ve=ge*w.projection.pixelSpaceConversion(w.center.lat,P,$e)}let De=V(q,$);rt(De,De,at([],mt([],De),ne*ve*B[2]));let Ve=(function($e){let St=[$e[0],$e[1],$e[2]],yt=[0,1,0],vt=hi([],yt,St);return hi(yt,St,vt),Wt(yt)===0&&(yt=[0,1,0],hi(vt,St,yt)),mt(vt,vt),mt(yt,yt),mt(St,St),[vt[0],vt[1],vt[2],0,yt[0],yt[1],yt[2],0,St[0],St[1],St[2],0,$e[0],$e[1],$e[2],1]})(De);G(K,K,[ve,ve,ve*ne]),H(K,K,[-B[0],-B[1],-B[2]]);let Be=z([],w.globeMatrix,Ve);return z(Be,Be,K),z(Be,Be,C),Be})(p,l,u);if(f>0){let C=(function(w,D){let P=D.worldSize,B=we(1,0)*P*Ct(D.center.lat,D.zoom)/e4(P),q=we(1,D.center.lat)*P,$=k([]);return ce($,$,sa(D.center.lng)),Z($,$,sa(D.center.lat)),H($,$,[0,0,Lp]),G($,$,[B,B,B*q]),H($,$,[D.point.x-.5*P,D.point.y-.5*P,0]),z($,$,w),z($,D.globeMatrix,$)})(p,l);return(function(w,D,P){let B=(re,ge,ve)=>{let De=He(re),Ve=He(ge),Be=l1(re,ge,ve);return at(Be,Be,1/He(Be)*Cr(De,Ve,ve))},q=B([w[0],w[1],w[2]],[D[0],D[1],D[2]],P),$=B([w[4],w[5],w[6]],[D[4],D[5],D[6]],P),K=B([w[8],w[9],w[10]],[D[8],D[9],D[10]],P),ne=l1([w[12],w[13],w[14]],[D[12],D[13],D[14]],P);return[q[0],q[1],q[2],0,$[0],$[1],$[2],0,K[0],K[1],K[2],0,ne[0],ne[1],ne[2],1]})(g,C,f)}return g}function ar(p,l,u,f){let g=aa.projectAabbCorners(f,u),C=Number.MAX_VALUE,w=-1;for(let B=0;Bnew Ti(g[B][0],g[B][1]),P;switch(w){case 0:case 6:P=[D(1),D(5),D(4),D(7),D(3),D(2),D(1)];break;case 1:case 7:P=[D(0),D(4),D(5),D(6),D(2),D(3),D(0)];break;case 3:case 5:P=[D(1),D(0),D(4),D(7),D(6),D(2),D(1)];break;default:P=[D(1),D(5),D(6),D(7),D(3),D(0),D(1)]}if(al(p,P))return C}let er=64,yr={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Do(p,l,u,f,g,C,w,D,P,B=!1){let q=u.zoom,$=u.project(f),K=Ct(f.lat,q),ne=1/K;k(p),H(p,p,[$.x+w[0]*ne,$.y+w[1]*ne,w[2]]);let re=1,ge=1,ve=u.worldSize;if(B){if(u.projection.name==="mercator"){let $e=0;u.elevation&&($e=u.elevation.getAtPointOrZero(new ht($.x/ve,$.y/ve),0));let St=wi([],[$.x,$.y,$e,1],u.projMatrix)[3]/u.cameraToCenterDistance;re=St,ge=St*Ct(u.center.lat,q)}else if(u.projection.name==="globe"){let $e=Yi(p,u),St=[0,0,0,1];wi(St,St,z([],u.projMatrix,$e));let yt=St[3]/u.cameraToCenterDistance,vt=wS(q),Vt=u.projection.pixelsPerMeter(f.lat,ve)*Ct(f.lat,q),Ht=u.projection.pixelsPerMeter(u.center.lat,ve)*Ct(u.center.lat,q);re=yt/Cr(Vt,_t(u.center.lat),vt),ge=yt*K/Vt,re*=Ht,ge*=Ht}}else re=ne;G(p,p,[re,re,ge]);let De=[...p],Ve=l.orientation,Be=[];if(ni(Be,[Ve[0]+g[0],Ve[1]+g[1],Ve[2]+g[2]],C),z(p,De,Be),D&&u.elevation){let $e=0,St=[];if(P&&u.elevation){$e=(function(vt,Vt,Ht,ki,Xt){let Bi=Vt.elevation;if(!Bi)return 0;let _n=aa.projectAabbCorners(Ht,ki),Ki=we(1,Xt.lat)*Vt.worldSize,an=(function(un,pr){let Yn=[0,0,1],En=[{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 Zn of En){let Jr=un[Zn.corners[0]],bo=un[Zn.corners[1]],Zo=un[Zn.corners[2]],Mo=[bo[0]-Jr[0],bo[1]-Jr[1],pr*(bo[2]-Jr[2])],Fa=hi(Mo,Mo,[Zo[0]-Jr[0],Zo[1]-Jr[1],pr*(Zo[2]-Jr[2])]);mt(Fa,Fa),Zn.dotProductWithUp=li(Fa,Yn)}return En.sort((Zn,Jr)=>Zn.dotProductWithUp-Jr.dotProductWithUp),En[0].corners})(_n,Ki),hn=_n[an[0]],Ai=_n[an[1]],sn=_n[an[2]],Jt=_n[an[3]],Di=Bi.getAtPointOrZero(new ht(hn[0]/Vt.worldSize,hn[1]/Vt.worldSize),0),yn=Bi.getAtPointOrZero(new ht(Ai[0]/Vt.worldSize,Ai[1]/Vt.worldSize),0),ln=Bi.getAtPointOrZero(new ht(sn[0]/Vt.worldSize,sn[1]/Vt.worldSize),0),Sr=Bi.getAtPointOrZero(new ht(Jt[0]/Vt.worldSize,Jt[1]/Vt.worldSize),0),lr=(Di+Sr)/2,nn=(yn+ln)/2;return lr>nn?yn=l.gl.NEAREST_MIPMAP_NEAREST}),p.uploaded=!0,p.image=null)}function hs(p,l,u){p.indexBuffer=l.createIndexBuffer(p.indexArray,!1,!0),p.vertexBuffer=l.createVertexBuffer(p.vertexArray,O0e.members,!1,!0),p.normalArray&&(p.normalBuffer=l.createVertexBuffer(p.normalArray,L0e.members,!1,!0)),p.texcoordArray&&(p.texcoordBuffer=l.createVertexBuffer(p.texcoordArray,N0e.members,!1,!0)),p.colorArray&&(p.colorBuffer=l.createVertexBuffer(p.colorArray,(p.colorArray.bytesPerElement===12?F0e:P0e).members,!1,!0)),p.featureArray&&(p.pbrBuffer=l.createVertexBuffer(p.featureArray,V0e.members,!0)),p.segments=cc.simpleSegment(0,0,p.vertexArray.length,p.indexArray.length);let f=p.material;f.pbrMetallicRoughness.baseColorTexture&&ca(f.pbrMetallicRoughness.baseColorTexture,l),f.pbrMetallicRoughness.metallicRoughnessTexture&&ca(f.pbrMetallicRoughness.metallicRoughnessTexture,l),f.normalTexture&&ca(f.normalTexture,l),f.occlusionTexture&&ca(f.occlusionTexture,l,u),f.emissionTexture&&ca(f.emissionTexture,l)}function ml(p,l,u){if(p.meshes)for(let f of p.meshes)hs(f,l,u);if(p.children)for(let f of p.children)ml(f,l,u)}function qa(p){if(p.meshes)for(let l of p.meshes)l.indexArray.destroy(),l.vertexArray.destroy(),l.colorArray&&l.colorArray.destroy(),l.normalArray&&l.normalArray.destroy(),l.texcoordArray&&l.texcoordArray.destroy(),l.featureArray&&l.featureArray.destroy();if(p.children)for(let l of p.children)qa(l)}function zl(p){if(p.meshes)for(let u of p.meshes)u.vertexBuffer&&(u.vertexBuffer.destroy(),u.indexBuffer.destroy(),u.normalBuffer&&u.normalBuffer.destroy(),u.texcoordBuffer&&u.texcoordBuffer.destroy(),u.colorBuffer&&u.colorBuffer.destroy(),u.pbrBuffer&&u.pbrBuffer.destroy(),u.segments.destroy(),u.material&&((l=u.material).pbrMetallicRoughness.baseColorTexture&&l.pbrMetallicRoughness.baseColorTexture.gfxTexture&&l.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),l.pbrMetallicRoughness.metallicRoughnessTexture&&l.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&l.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),l.normalTexture&&l.normalTexture.gfxTexture&&l.normalTexture.gfxTexture.destroy(),l.emissionTexture&&l.emissionTexture.gfxTexture&&l.emissionTexture.gfxTexture.destroy(),l.occlusionTexture&&l.occlusionTexture.gfxTexture&&l.occlusionTexture.gfxTexture.destroy()));var l;if(p.children)for(let u of p.children)zl(u)}function Il(p,l){let u=p.json.bufferViews[l.bufferView],f=p4[l.componentType];return new f(p.buffers[u.buffer],(l.byteOffset||0)+(u.byteOffset||0),l.count*(u.byteStride&&u.byteStride!==nP[l.type]*f.BYTES_PER_ELEMENT?u.byteStride/f.BYTES_PER_ELEMENT:nP[l.type]))}function gg(p,l,u,f){let g=p4[l.componentType],C=(function(q){switch(q){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}})(g),w=p.json.bufferViews[l.bufferView],D=w.byteStride?w.byteStride/g.BYTES_PER_ELEMENT:nP[l.type],P=u.float32,B=P.length/u.capacity;for(let q=0,$=0;q0){for(let ve=0;ve0){C.texcoordArray=new Av;let K=l.json.accessors[g.TEXCOORD_0];C.texcoordArray.resize(K.count);let ne=Il(l,K);gg(l,K,C.texcoordArray,ne)}if(g._FEATURE_ID_RGBA4444!==void 0){let K=l.json.accessors[g._FEATURE_ID_RGBA4444];l.json.extensionsUsed&&l.json.extensionsUsed.includes("EXT_meshopt_compression")&&(C.featureData=Il(l,K))}g._FEATURE_RGBA4444!==void 0&&(C.featureData=new Uint32Array(Il(l,l.json.accessors[g._FEATURE_RGBA4444]).buffer));let $=p.material;return C.material=(function(K,ne){let{emissiveFactor:re=[0,0,0],alphaMode:ge="OPAQUE",alphaCutoff:ve=.5,normalTexture:De,occlusionTexture:Ve,emissiveTexture:Be,doubleSided:$e}=K,{baseColorFactor:St=[1,1,1,1],metallicFactor:yt=1,roughnessFactor:vt=1,baseColorTexture:Vt,metallicRoughnessTexture:Ht}=K.pbrMetallicRoughness||{},ki=Ve?ne[Ve.index]:void 0;if(Ve&&Ve.extensions&&Ve.extensions.KHR_texture_transform&&ki){let Xt=Ve.extensions.KHR_texture_transform;ki.offsetScale=[Xt.offset[0],Xt.offset[1],Xt.scale[0],Xt.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Ds(...St),metallicFactor:yt,roughnessFactor:vt,baseColorTexture:Vt?ne[Vt.index]:void 0,metallicRoughnessTexture:Ht?ne[Ht.index]:void 0},doubleSided:$e,emissiveFactor:new Ds(...re),alphaMode:ge,alphaCutoff:ve,normalTexture:De?ne[De.index]:void 0,occlusionTexture:ki,emissionTexture:Be?ne[Be.index]:void 0,defined:K.defined===void 0}})($!==void 0?l.json.materials[$]:{defined:!1},u),C}function n_(p,l,u){let{matrix:f,rotation:g,translation:C,scale:w,mesh:D,extras:P,children:B}=p,q={};if(q.matrix=f||(function($,K,ne,re){var ge=K[0],ve=K[1],De=K[2],Ve=K[3],Be=ge+ge,$e=ve+ve,St=De+De,yt=ge*Be,vt=ge*$e,Vt=ge*St,Ht=ve*$e,ki=ve*St,Xt=De*St,Bi=Ve*Be,_n=Ve*$e,Ki=Ve*St,an=re[0],hn=re[1],Ai=re[2];return $[0]=(1-(Ht+Xt))*an,$[1]=(vt+Ki)*an,$[2]=(Vt-_n)*an,$[3]=0,$[4]=(vt-Ki)*hn,$[5]=(1-(yt+Xt))*hn,$[6]=(ki+Bi)*hn,$[7]=0,$[8]=(Vt+_n)*Ai,$[9]=(ki-Bi)*Ai,$[10]=(1-(yt+Ht))*Ai,$[11]=0,$[12]=ne[0],$[13]=ne[1],$[14]=ne[2],$[15]=1,$})([],g||[0,0,0,1],C||[0,0,0],w||[1,1,1]),D!==void 0){q.meshes=u[D];let $=q.anchor=[0,0];for(let K of q.meshes){let{min:ne,max:re}=K.aabb;$[0]+=ne[0]+re[0],$[1]+=ne[1]+re[1]}$[0]=Math.floor($[0]/q.meshes.length/2),$[1]=Math.floor($[1]/q.meshes.length/2)}if(P&&(P.id&&(q.id=P.id),P.lights&&(q.lights=(function($){if(!$.length)return[];let K=(function(De){let Ve=atob(De),Be=new Uint8Array(Ve.length);for(let $e=0;$e1&&f[f.length-1].equals(f[0])&&f.pop();let g=0;for(let w=0;w0&&f.reverse();let C=ik(f.flatMap(w=>[w.x,w.y]),[]);return C.length===0?null:{vertices:f,indices:C}}function u1(p,l){let u=[],f=[],g=0,C=[];for(let w of p){g=u.length;let D=w.vertexArray.float32,P=w.indexArray.uint16;for(let B=0;B0&&([f[w+1],f[w+2]]=[f[w+2],f[w+1]])}return{vertices:u,indices:f}}function ij(p){let l=(function(P,B){let q=[],$=WebGL2RenderingContext;if(P.json.textures)for(let K of P.json.textures){let ne={magFilter:$.LINEAR,minFilter:$.NEAREST,wrapS:$.REPEAT,wrapT:$.REPEAT};K.sampler!==void 0&&Object.assign(ne,P.json.samplers[K.sampler]),q.push({image:B[K.source],sampler:ne,uploaded:!1})}return q})(p,p.images),u=(function(P,B){let q=[];for(let $ of P.json.meshes){let K=[];for(let ne of $.primitives)K.push(_g(ne,P,B));q.push(K)}return q})(p,l),{scenes:f,scene:g,nodes:C}=p.json,w=f?f[g||0].nodes:C,D=[];for(let P of w)D.push(n_(C[P],p,u));return(function(P,B,q){let $={},K=new Set;for(let ne=0;ne0){let ne=Array.from(K.values()).sort((re,ge)=>re-ge);for(let re=ne.length-1;re>=0;re--)P.splice(ne[re],1)}})(D,w,p.json.nodes),D}function RDt(p){p.heightmap=new Float32Array(4096),p.heightmap.fill(-1);let l=p.vertexArray.float32,u=p.aabb.min[0]-1,f=p.aabb.min[1]-1,g=er/(p.aabb.max[0]-u+2),C=er/(p.aabb.max[1]-f+2);for(let w=0;wp.heightmap[B*er+P]&&(p.heightmap[B*er+P]=D)}}function VBe(p,l,u,f,g){u.reserve(u.length+4*p.length),f.reserve(f.length+10*p.length),g.reserve(g.length+10*p.length);let C=f.length;for(let w of p){let D=Math.min(10,Math.max(4,1.3*w.height))*l,P=[-w.normal[1],w.normal[0],0],B=Math.min(.29,.1*w.width/w.depth),q=w.width-2*w.depth*l*(B+.01),$=Dt([],w.pos,P,q/2),K=Dt([],w.pos,P,-q/2),ne=[$[0],$[1],$[2]+w.height],re=[K[0],K[1],K[2]+w.height],ge=Dt([],w.normal,P,B);at(ge,ge,D);let ve=Dt([],w.normal,P,-B);at(ve,ve,D),rt(ge,$,ge),rt(ve,K,ve),$[2]+=.1,K[2]+=.1,f.emplaceBack(ge[0],ge[1],ge[2]),f.emplaceBack(ve[0],ve[1],ve[2]),f.emplaceBack($[0],$[1],$[2]),f.emplaceBack(K[0],K[1],K[2]),f.emplaceBack(ne[0],ne[1],ne[2]),f.emplaceBack(re[0],re[1],re[2]),f.emplaceBack($[0],$[1],$[2]),f.emplaceBack(K[0],K[1],K[2]),f.emplaceBack(ge[0],ge[1],ge[2]),f.emplaceBack(ve[0],ve[1],ve[2]);let De=q/D/2;g.emplaceBack(-De-B,-1,De,.8),g.emplaceBack(De+B,-1,De,.8),g.emplaceBack(-De,0,De,1.3),g.emplaceBack(De,0,De,1.3),g.emplaceBack(De+B,-.8,De,.7),g.emplaceBack(De+B,-.8,De,.7),g.emplaceBack(0,0,De,1.3),g.emplaceBack(0,0,De,1.3),g.emplaceBack(De+B,-1.2,De,.8),g.emplaceBack(De+B,-1.2,De,.8),u.emplaceBack(6+C,4+C,8+C),u.emplaceBack(7+C,9+C,5+C),u.emplaceBack(0+C,1+C,2+C),u.emplaceBack(1+C,3+C,2+C),C+=10}}function ODt(p,l){let u={};u.indexArray=new Rl,u.vertexArray=new lg,u.colorArray=new aC,VBe(p,l,u.indexArray,u.vertexArray,u.colorArray);let f={defined:!0};f.emissiveFactor=Ds.black;let g={};return g.baseColorFactor=Ds.white,f.pbrMetallicRoughness=g,u.material=f,u.aabb=new aa([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),u}let zBe=Oa([{name:"a_pos_3f",components:3,type:"Float32"}]),FDt=Oa([{name:"a_normal_3",components:3,type:"Int16"}]),UBe=Oa([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),PDt=Oa([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),HBe=ti.types,z0e=32767;function NDt(p,l){let u=wn+l;for(let f of p)for(let g of f)if(g.x<-l||g.x>u||g.y<-l||g.y>u)return!1;return!0}class GBe{constructor(l){this.layoutAOArray=[],this.indexArrayForConflationUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.featuresOnBorder=[],this.buildingFeatures=[],this.footprintLookup={},this.zoom=l.zoom,this.canonical=l.canonical,this.layers=l.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=l.index,this.hasPattern=!1,this.worldview=l.worldview,this.layoutVertexArray=new lg,this.layoutNormalArray=new Yx,this.layoutColorArray=new Oh,this.indexArray=new Rl,this.indexArrayForConflation=new Rl,this.entranceBloom={layoutVertexArray:new lg,layoutVertexBuffer:null,layoutAttenuationArray:new aC,layoutAttenuationBuffer:null,layoutColorArray:new Oh,layoutColorBuffer:null,indexArray:new Rl,indexArrayForConflation:new Rl,indexBuffer:null,segmentsBucket:new cc},this.programConfigurations=new Cf(l.layers,{zoom:l.zoom,lut:l.lut}),this.segmentsBucket=new cc,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=l.projection,this.groundEffect=new K7(l)}get segments(){return this.segmentsBucket}get bloomGeometry(){return this.entranceBloom}updateFootprints(l,u){for(let f of this.footprints)u.push({footprint:f,id:l})}prepare(){return(function(){if(u4!=null||Oee!=null)return null;if(kS!=null)return kS;let l=fetch(Ju.BUILDING_GEN_URL);return kS=(function(u){let f,g,C,w;function D(){f=new Uint8Array(w.buffer),g=new Int32Array(w.buffer),C=new Float32Array(w.buffer)}function P(){throw new Error("Unexpected BuildingGen error.")}let B=()=>{},q={a:{a:P,f:function($){let K=f.length,ne=Math.max($>>>0,Math.ceil(1.2*K)),re=Math.ceil((ne-K)/65536);try{return w.grow(re),D(),!0}catch{return!1}},g:P,b:B,c:B,d:B,e:B}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(u,q):u.then($=>$.arrayBuffer()).then($=>WebAssembly.instantiate($,q))).then($=>{let K=$.instance.exports;return(0,K.g)(),w=K.f,D(),new Z7({setStyle:K.h,setAOOptions:K.i,setMetricOptions:K.j,setStructuralOptions:K.k,setFacadeOptions:K.l,setFauxFacadeOptions:K.m,setFacadeClassifierOptions:K.n,addFeature:K.o,addFacade:K.p,generateMesh:K.q,getLastError:K.r,getMeshCount:K.s,getPositionsPtr:K.t,getPositionsLength:K.u,getNormalsPtr:K.v,getNormalsLength:K.w,getColorsPtr:K.x,getColorsLength:K.y,getAOPtr:K.z,getAOLength:K.A,getUVPtr:K.B,getUVLength:K.C,getFauxFacadePtr:K.D,getFauxFacadeLength:K.E,getIndicesPtr:K.F,getIndicesLength:K.G,getBuildingPart:K.H,getRingCount:K.I,getRingPtr:K.J,getRingLength:K.K,free:K.L,malloc:K.M,heapU8:f,heap32:g,heapF32:C})})})(l).then(u=>(kS=null,u4=u,u4)).catch(u=>{ba("Could not load building-gen"),kS=null,Oee=u}),kS})()}populate(l,u,f,g){let C=Nee();if(!C)return;let w=ut(f);this.tileToMeter=w,this.brightness=u.brightness,C.setStyle({convertToMeters:!1,entranceColorRgb:[1,1,1],facadeGlazingColorRgb:[.5607843137254902,.6745098039215687,.7215686274509804],normalScale:[1,-1,w],ridgeHeight:3,roofColorRgb:[.886274516,.784313738,.713725507],tileToMeters:w,tileZoom:16,wallColorRgb:[.988235294,.933333337,.811764717]}),C.setAOOptions(!1,.3),C.setMetricOptions(!1,16),C.setStructuralOptions(!0),C.setFacadeOptions(4,!0),C.setFauxFacadeOptions(!1,!1,1),C.setFacadeClassifierOptions(3);let D=new Map;for(let{feature:P}of l){if(HBe[P.type]!=="LineString")continue;let B=this.layers[0]._featureFilter.needGeometry,q=yi(P,B);if(!this.layers[0]._featureFilter.filter(new Ys(this.zoom),q,f))continue;let $=B?q.geometry:Mt(P,f,g),K=[];for(let ve of $)for(let De of ve)K.push({x:De.x,y:De.y});let ne={coordinates:K,crossPerc:P.properties.cross_perc,distanceToRoad:P.properties.distance_to_road,entrances:P.properties.entrances,sourceId:0},re=P.properties.source_id,ge=D.get(re);ge||(ge=[],D.set(re,ge)),ge.push(ne)}this.maxHeight=0;for(let{feature:P,index:B}of l){if(HBe[P.type]==="LineString")continue;let q=this.layers[0]._featureFilter.needGeometry,$=yi(P,q);if(!this.layers[0]._featureFilter.filter(new Ys(this.zoom),$,f))continue;let K=q?$.geometry:Mt(P,f,g),ne=dC(K,500);if(!NDt(K,163))continue;let re=this.layers[0],ge=re.layout.get("building-base").evaluate(P,{},f),ve=re.layout.get("building-height").evaluate(P,{},f),De=re.layout.get("building-roof-shape").evaluate(P,{},f),Ve=re.paint.get("building-ambient-occlusion-intensity"),Be=re.paint.get("building-ambient-occlusion-ground-radius")/this.tileToMeter;if(De==="flat")continue;let $e=P.properties.source_id,St;St=D.has($e)?D.get($e):[];let yt=[],vt=new Ti(1/0,1/0),Vt=new Ti(-1/0,-1/0);for(let nn of ne)if(nn.length>0){let un=[];for(let pr of nn){let Yn=[];for(let En=pr.length-1;En>=0;En--){let Zn=pr[En];Yn.push({x:Zn.x,y:Zn.y}),vt.x=Math.min(vt.x,Zn.x),vt.y=Math.min(vt.y,Zn.y),Vt.x=Math.max(Vt.x,Zn.x),Vt.y=Math.max(Vt.y,Zn.y)}un.push(Yn)}yt.push({id:P.id,height:ve,minHeight:ge,sourceId:0,roofType:De,coordinates:un})}let Ht=C.generateMesh(yt,St);if(typeof Ht=="string"||Ht.meshes.length===0||Ht.modifiedPolygonRings.length===0)continue;let ki=0;for(let nn of Ht.meshes)ki+=nn.positions.length/3;let Xt=this.segmentsBucket.prepareSegment(ki,this.layoutVertexArray,this.indexArray),Bi=[],_n=null,Ki=0,an=-1,hn=this.indexArray.length,Ai=0;for(let nn of Ht.meshes){let un=this.layoutVertexArray.length;if(nn.buildingPart==="entrance"){let Yn=new Array;for(let bo=0;bown||vt.y<0||Vt.y>wn)&&this.featuresOnBorder.push({featureId:P.id,footprintIndex:this.footprints.length});{let nn=ik(Jt,null,2),un=new r4(Di,nn,8,256),pr=P.id;P.properties&&P.properties.hasOwnProperty("building_id")&&(pr=P.properties.building_id),this.footprints.push({vertices:Di,indices:nn,grid:un,min:yn,max:ln,buildingId:pr,hiddenFlags:0,indicesOffset:hn,indicesLength:sn,bloomIndicesOffset:Ki,bloomIndicesLength:an,groundEffectVertexOffset:Sr,groundEffectVertexLength:lr,segment:Xt,height:Ai})}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,P,B,{},u.availableImages,f,u.brightness),this.groundEffect.addPaintPropertiesData(P,B,{},u.availableImages,f,u.brightness)}this.groundEffect.prepareBorderSegments(),this.evaluate(this.layers[0])}update(l,u,f,g,C,w,D){this.programConfigurations.updatePaintArrays(l,u,C,f,g,w,D),this.groundEffect.update(l,u,C,f,g,w,D)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,zBe.members),this.layoutNormalBuffer=l.createVertexBuffer(this.layoutNormalArray,FDt.members),this.entranceBloom.layoutVertexBuffer=l.createVertexBuffer(this.entranceBloom.layoutVertexArray,zBe.members),this.entranceBloom.layoutAttenuationBuffer=l.createVertexBuffer(this.entranceBloom.layoutAttenuationArray,PDt.members),this.uploadUpdatedColorBuffer(l),this.uploadUpdatedIndexBuffer(l),this.groundEffect.upload(l)),this.groundEffect.uploadPaintProperties(l),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.layoutNormalBuffer.destroy(),this.layoutColorBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segmentsBucket.destroy(),this.entranceBloom.layoutVertexBuffer.destroy(),this.entranceBloom.layoutColorBuffer.destroy(),this.entranceBloom.layoutAttenuationBuffer.destroy(),this.entranceBloom.indexBuffer.destroy(),this.entranceBloom.segmentsBucket.destroy())}updateFootprintHiddenFlags(l,u,f=!0){let g=!1,C=f?u:0,w=0|(f?-1:~u);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(let D of l){let P=this.footprints[D],B=P.hiddenFlags&w|C;P.hiddenFlags!==B&&(P.hiddenFlags=B,g=!0,this.groundEffect.updateHiddenByLandmarkRange(P.groundEffectVertexOffset,P.groundEffectVertexLength,P.hiddenFlags!==0))}return g&&(this.indexArrayForConflationUploaded=!1),g}uploadUpdatedIndexBuffer(l){if(this.groundEffect.uploadHiddenByLandmark(l),!this.indexArrayForConflationUploaded&&this.indexArray.length!==0){this.indexArrayForConflation.resize(this.indexArray.length),this.indexArrayForConflation.uint16.set(this.indexArray.uint16),this.entranceBloom.indexArrayForConflation.resize(this.entranceBloom.indexArray.length),this.entranceBloom.indexArrayForConflation.uint16.set(this.entranceBloom.indexArray.uint16);for(let u of this.footprints){let f=u.indicesOffset+u.indicesLength;if(u.hiddenFlags!==0){for(let C=u.indicesOffset;Cw.max.x||P.max.xw.max.y||P.max.yD.max.x||D.min.x>l||u>D.max.y||D.min.y>u||D.height<=f||a4(w,D)&&(f=D.height,this.footprintLookup[C]=D,g=D.hiddenFlags!==0);if(f!==Number.NEGATIVE_INFINITY)return{height:f,hidden:g};this.footprintLookup[C]=void 0}}function LDt(p,l,u,f,g,C){let w=Math.pow(2,f.z-g.z);for(let D=0;D1&&(P=l[++D]);let q=Math.abs(B-P.left),$=Math.abs(B-P.right),K=Math.min(q,$),ne,re=C/f*(g+1);if(P.isDash){let ge=g-Math.abs(re);ne=Math.sqrt(K*K+ge*ge)}else ne=g-Math.sqrt(K*K+re*re);this.image.data[w+B]=Math.max(0,Math.min(255,ne+128))}}}addRegularDash(l,u){for(let P=l.length-1;P>=0;--P){let B=l[P],q=l[P+1];B.zeroLength?l.splice(P,1):q&&q.isDash===B.isDash&&(q.left=B.left,l.splice(P,1))}let f=l[0],g=l[l.length-1];f.isDash===g.isDash&&(f.left=g.left-this.width,g.right=f.right+this.width);let C=this.width*this.nextRow,w=0,D=l[w];for(let P=0;P1&&(D=l[++w]);let B=Math.abs(P-D.left),q=Math.abs(P-D.right),$=Math.min(B,q);this.image.data[C+P]=Math.max(0,Math.min(255,(D.isDash?$:-$)+u+128))}}addDash(l,u){let f=this.getKey(l,u);if(this.positions[f])return this.positions[f];let g=u==="round",C=g?7:0,w=2*C+1;if(this.nextRow+w>this.height)return ba("LineAtlas out of space"),null;l.length===0&&l.push(1);let D=0;for(let q=0;qu.fqid),this.index=l.index,this.projection=l.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(u=>{this.gradients[u.id]={}}),this.layoutVertexArray=new sg,this.layoutVertexArray2=new lg,this.patternVertexArray=new lg,this.indexArray=new Rl,this.programConfigurations=new Cf(l.layers,{zoom:l.zoom,lut:l.lut}),this.segments=new cc,this.maxLineLength=0,this.zOffsetVertexArray=new lg,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.tessellationStep=l.tessellationStep?l.tessellationStep:wn/64,this.worldview=l.worldview}updateFootprints(l,u){}populate(l,u,f,g){this.hasPattern=O7("line",this.layers,this.pixelRatio,u);let C=this.layers[0].layout.get("line-sort-key");this.tileToMeter=ut(f);let w=this.layers[0].layout.get("line-elevation-reference");if(w==="hd-road-markup")this.elevationType="road";else{let K=this.layers[0].layout.get("line-z-offset"),ne=K.isConstant()&&!K.constantOr(0);this.elevationType=w!=="sea"&&w!=="ground"&&ne?"none":"offset",this.elevationType==="offset"&&w==="none"&&ba(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}let D=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&D!==void 0;let P=[];for(let{feature:K,id:ne,index:re,sourceLayerIndex:ge}of l){let ve=this.layers[0]._featureFilter.needGeometry,De=yi(K,ve);if(!this.layers[0]._featureFilter.filter(new Ys(this.zoom,{worldview:this.worldview}),De,f))continue;let Ve=C?C.evaluate(De,{},f):void 0,Be={id:ne,properties:K.properties,type:K.type,sourceLayerIndex:ge,index:re,geometry:ve?De.geometry:Mt(K,f,g),patterns:{},sortKey:Ve};P.push(Be)}C&&P.sort((K,ne)=>K.sortKey-ne.sortKey);let{lineAtlas:B,featureIndex:q}=u,$=this.addConstantDashes(B);for(let K of P){let{geometry:ne,index:re,sourceLayerIndex:ge}=K;if($&&this.addFeatureDashes(K,B),this.hasPattern){let ve=F7("line",this.layers,K,this.zoom,this.pixelRatio,u);this.patternFeatures.push(ve)}else this.addFeature(K,ne,re,f,B.positions,u.availableImages,u.brightness,u.elevationFeatures);q.insert(l[re].feature,ne,re,ge,this.index)}}addConstantDashes(l){let u=!1;for(let f of this.layers){let g=f.paint.get("line-dasharray").value,C=f.layout.get("line-cap").value;if(g.kind!=="constant"||C.kind!=="constant")u=!0;else{let w=C.value,D=g.value;if(!D)continue;l.addDash(D,w)}}return u}addFeatureDashes(l,u){let f=this.zoom;for(let g of this.layers){let C=g.paint.get("line-dasharray").value,w=g.layout.get("line-cap").value;if(C.kind==="constant"&&w.kind==="constant")continue;let D,P;if(C.kind==="constant"){if(D=C.value,!D)continue}else D=C.evaluate({zoom:f},l);P=w.kind==="constant"?w.value:w.evaluate({zoom:f},l),u.addDash(D,P),l.patterns[g.id]=[u.getKey(D,P)]}}update(l,u,f,g,C,w,D,P){this.programConfigurations.updatePaintArrays(l,u,C,f,g,w,D,P)}addFeatures(l,u,f,g,C,w){for(let D of this.patternFeatures)this.addFeature(D,D.geometry,D.index,u,f,g,w)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(l){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=l.createVertexBuffer(this.layoutVertexArray2,HDt)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=l.createVertexBuffer(this.patternVertexArray,jDt)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=l.createVertexBuffer(this.zOffsetVertexArray,VDt.members,!0)),this.layoutVertexBuffer=l.createVertexBuffer(this.layoutVertexArray,zDt),this.indexBuffer=l.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(l),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(l){if(l.properties&&l.properties.hasOwnProperty("mapbox_clip_start")&&l.properties.hasOwnProperty("mapbox_clip_end"))return{start:+l.properties.mapbox_clip_start,end:+l.properties.mapbox_clip_end}}addFeature(l,u,f,g,C,w,D,P){let B=this.layers[0].layout,q=B.get("line-join").evaluate(l,{}),$=B.get("line-cap").evaluate(l,{}),K=B.get("line-miter-limit"),ne=B.get("line-round-limit");this.lineClips=this.lineFeatureClips(l),this.lineFeature=l,this.zOffsetValue=B.get("line-z-offset").value;let re=this.layers[0].paint.get("line-width").value;if(re.kind!=="constant"&&re.isLineProgressConstant===!1&&(this.variableWidthValue=re),this.elevationType==="road"){let ge=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(l,u,g,P,q,$,K,ne)){let[ve,De]=this.clipRuntimeLinesToTile(u,1);for(let Ve=0;Ve>1,this.layoutVertexArray.int16[6*re+1]>>1),ve=ne.pointElevation(ge,$.elevation,.05);this.updateHeightRange(ve),this.zOffsetVertexArray.emplaceBack(ve,0,0)}else this.fillNonElevatedRoadSegment(K)}return!0}prepareElevatedLines(l,u,f){if(u.constantHeight!=null)return l;let g=[],C=1/ut(f);for(let w of l)E0e(w,new Gs(u,C),0,g);return g}fillNonElevatedRoadSegment(l){for(let u=l;u0,$=P&&P.progress.max<1;if(this.lineClips){let Vt={min:this.lineClips.start,max:this.lineClips.end},Ht=1;if(P){let Bi=this.lineClips.end-this.lineClips.start;Vt=(function(_n,Ki,an){return{min:MT(_n.min,Ki,an),max:MT(_n.max,Ki,an)}})(P.progress,{min:0,max:1},Vt),Bi>0&&(Ht=(Vt.max-Vt.min)/Bi)}let ki=+u.properties.mapbox_clip_feature_len,Xt=+u.properties.mapbox_clip_seg_len;if(Number.isNaN(ki)||Number.isNaN(Xt)){for(let _n=0;_n=2&&l[ne-1].equals(l[ne-2]);)ne--;let re=0;for(;re0,sn=this.overscaling<=16?15*wn/(512*this.overscaling):0;if(Ht&&ki==="round"){if(Kiw&&(ki="bevel"),ki==="bevel"&&(Ki>2&&(ki="flipbevel"),Ki2*sn){let yn=ve.sub(ve.sub(De)._mult(sn/Jt)._round());this.updateDistance(De,yn),this.addCurrentVertex(yn,Be,0,0,ge,vt),De=yn}this.updateDistance(De,ve),Bi._mult(Ki),this.addCurrentVertex(ve,Bi,0,0,ge,vt);let Di=ve.dist(Ve);if(Di>2*sn){let yn=ve.add(Ve.sub(ve)._mult(sn/Di)._round());this.updateDistance(ve,yn),this.addCurrentVertex(yn,$e,0,0,ge,vt),ve=yn}}else Bi._mult(Ki),this.addCurrentVertex(ve,Bi,0,0,ge,vt);else if(ki==="flipbevel"){if(Ki>100)Bi=$e.mult(-1);else{let Jt=Ki*Be.add($e).mag()/Be.sub($e).mag();Bi._perp()._mult(Jt*(Ai?-1:1))}this.addCurrentVertex(ve,Bi,0,0,ge,vt),this.addCurrentVertex(ve,Bi.mult(-1),0,0,ge,vt)}else if(ki==="bevel"||ki==="fakeround"){vt!=null&&De&&this.addCurrentVertex(ve,yt||Be,-1,-1,ge,vt);let Jt=ve.dist(De)<=2*sn&&ki!=="bevel",Di=Bi.mult(Ai?1:-1);Di._mult(Ki);let yn=$e.mult(Ai?-1:1),ln=Be.mult(Ai?-1:1),Sr=this.evaluateLineProgressFeatures(this.distance);if(vt==null&&(this.addHalfVertex(ve,Di.x,Di.y,!1,!Ai,0,ge,Sr),Jt||this.addHalfVertex(ve,Di.x+2*ln.x,Di.y+2*ln.y,!1,Ai,0,ge,Sr)),ki==="fakeround"){let lr=Math.round(180*an/Math.PI/20);this.addHalfVertex(ve,ln.x,ln.y,!1,Ai,0,ge,Sr);for(let nn=0;nn1){this.lineSoFar=l.w;let ge=(u.x-l.x)/$,ve=(u.y-l.y)/$,De=(u.z-l.z)/$,Ve=(u.w-l.w)/$;for(let Be=1;Be<$;++Be){l.x+=ge,l.y+=ve,l.z+=De,this.lineSoFar+=Ve,K+=Ve;let $e=this.evaluateLineProgressFeatures(this.prevDistance+K);this.scaledDistance=(this.prevDistance+K)/this.totalDistance,this.addHalfVertex(l,f,g,q,!1,D,B,$e),this.addHalfVertex(l,C,w,q,!0,-P,B,$e)}}this.lineSoFar=u.w,this.scaledDistance=ne;let re=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(u,f,g,q,!1,D,B,re),this.addHalfVertex(u,C,w,q,!0,-P,B,re)}evaluateLineProgressFeatures(l){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+l)/this.totalFeatureLength):ba(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let u=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(u=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:u}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:u}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:u}}addCurrentVertex(l,u,f,g,C,w,D=!1){let P=u.x+u.y*f,B=u.y-u.x*f,q=u.y*g-u.x,$=-u.y-u.x*g;if(w!=null){let K=this.elevationType==="offset",ne=-10,re=wn+10,ge=w.zOffset,ve=new Iee(l.x,l.y,ge,this.lineSoFar),De=!!K&&H0e(l,ne,re),Ve=this.lineSoFar,Be=this.distance;if(this.currentVertex)if(De){let $e=this.currentVertexIsOutside,St=this.currentVertex,yt=new Iee(l.x,l.y,ge,this.lineSoFar);if(Eee(St,yt,ne,re),!H0e(yt,ne,re)){if($e){this.e1=this.e2=-1,this.distance-=St.dist(ve),this.lineSoFar=St.w;let vt=this.evaluateLineProgressFeatures(St.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(St,P,B,D,!1,f,C,vt),this.addHalfVertex(St,q,$,D,!0,-g,C,vt),this.prevDistance=this.distance}this.distance=this.prevDistance+St.dist(yt),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(St,yt,P,B,q,$,f,g,C,D),this.distance=Be,this.scaledDistance=this.distance/this.totalDistance}}else{let $e=this.currentVertex;if(this.currentVertexIsOutside){Eee($e,ve,ne,re),this.e1=this.e2=-1,this.distance-=$e.dist(ve),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=$e.w;let St=this.evaluateLineProgressFeatures($e.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex($e,P,B,D,!1,f,C,St),this.addHalfVertex($e,q,$,D,!0,-g,C,St),this.prevDistance=this.distance,this.distance=Be,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo($e,ve,P,B,q,$,f,g,C,D)}else De||(this.addHalfVertex(l,P,B,D,!1,f,C,w),this.addHalfVertex(l,q,$,D,!0,-g,C,w));this.currentVertex=ve,this.currentVertexIsOutside=De,this.lineSoFar=Ve}else this.addHalfVertex(l,P,B,D,!1,f,C,w),this.addHalfVertex(l,q,$,D,!0,-g,C,w)}addHalfVertex({x:l,y:u},f,g,C,w,D,P,B){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),w||this.segmentPoints.push(this.lineSoFar-this.segmentStart,D)),this.layoutVertexArray.emplaceBack((l<<1)+(C?1:0),(u<<1)+(w?1:0),Math.round(63*f)+128,Math.round(63*g)+128,1+(D===0?0:D<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){let $=Cr(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,$)}let q=P.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,q),P.primitiveLength++),w?this.e2=q:this.e1=q,B!=null&&this.zOffsetVertexArray.emplaceBack(B.zOffset,B.variableWidth,B.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(l,u){this.prevDistance=this.distance,this.distance+=l.dist(u),this.updateScaledDistance()}}function H0e(p,l,u){return p.xu||p.yu}let KBe,YBe;function WBe(p,l,u){return l*(wn/(p.tileSize*Math.pow(2,u-p.tileID.overscaledZ)))}Jn(U0e,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});let QBe=(p,l,u)=>(1-u)*p+u*l;function ZBe(p,l){return 1/WBe(p,1,l.tileZoom)}function XBe(p,l,u,f){return p.translatePosMatrix(f||l.tileID.projMatrix,l,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}let JBe=p=>{let l=[];eVe(p)&&l.push("RENDER_LINE_DASH"),p.paint.get("line-gradient")&&l.push("RENDER_LINE_GRADIENT");let u=p.paint.get("line-trim-offset");u[0]===0&&u[1]===0||l.push("RENDER_LINE_TRIM_OFFSET"),p.paint.get("line-border-width").constantOr(1)!==0&&l.push("RENDER_LINE_BORDER");let f=p.layout.get("line-join").constantOr("miter")==="none",g=!!p.paint.get("line-pattern").constantOr(1);return f&&g&&l.push("LINE_JOIN_NONE"),l};function eVe(p){let l=p.paint.get("line-dasharray").value;return l.value||l.kind!=="constant"}let G0e,tVe=()=>G0e||(G0e={layout:KBe||(KBe=new Rc({"line-cap":new qn(Zt.layout_line["line-cap"]),"line-join":new qn(Zt.layout_line["line-join"]),"line-miter-limit":new fn(Zt.layout_line["line-miter-limit"]),"line-round-limit":new fn(Zt.layout_line["line-round-limit"]),"line-sort-key":new qn(Zt.layout_line["line-sort-key"]),"line-z-offset":new qn(Zt.layout_line["line-z-offset"]),"line-elevation-reference":new fn(Zt.layout_line["line-elevation-reference"]),"line-cross-slope":new fn(Zt.layout_line["line-cross-slope"]),visibility:new fn(Zt.layout_line.visibility),"line-width-unit":new fn(Zt.layout_line["line-width-unit"])})),paint:YBe||(YBe=new Rc({"line-opacity":new qn(Zt.paint_line["line-opacity"]),"line-color":new qn(Zt.paint_line["line-color"]),"line-translate":new fn(Zt.paint_line["line-translate"]),"line-translate-anchor":new fn(Zt.paint_line["line-translate-anchor"]),"line-width":new qn(Zt.paint_line["line-width"]),"line-gap-width":new qn(Zt.paint_line["line-gap-width"]),"line-offset":new qn(Zt.paint_line["line-offset"]),"line-blur":new qn(Zt.paint_line["line-blur"]),"line-dasharray":new qn(Zt.paint_line["line-dasharray"]),"line-pattern":new qn(Zt.paint_line["line-pattern"]),"line-pattern-cross-fade":new fn(Zt.paint_line["line-pattern-cross-fade"]),"line-gradient":new ay(Zt.paint_line["line-gradient"]),"line-trim-offset":new fn(Zt.paint_line["line-trim-offset"]),"line-trim-fade-range":new fn(Zt.paint_line["line-trim-fade-range"]),"line-trim-color":new fn(Zt.paint_line["line-trim-color"]),"line-emissive-strength":new fn(Zt.paint_line["line-emissive-strength"]),"line-border-width":new qn(Zt.paint_line["line-border-width"]),"line-border-color":new qn(Zt.paint_line["line-border-color"]),"line-occlusion-opacity":new fn(Zt.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new qn({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new qn({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new qn({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new qn({type:"string",default:"default","property-type":"data-driven"})}))},G0e);class YDt extends qn{possiblyEvaluate(l,u){return u=new Ys(Math.floor(u.zoom),{now:u.now,fadeDuration:u.fadeDuration,transition:u.transition,worldview:u.worldview}),super.possiblyEvaluate(l,u)}evaluate(l,u,f,g){return u=ri({},u,{zoom:Math.floor(u.zoom)}),super.evaluate(l,u,f,g)}}let nj;function iVe(p,l){return l>0?l+2*p:p}let WDt=Oa([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),QDt=Oa([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),ZDt=Oa([{name:"a_projected_pos",components:4,type:"Float32"}],4);Oa([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let XDt=Oa([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),JDt=Oa([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),e2t=Oa([{name:"a_texb",components:2,type:"Uint16"}]),t2t=Oa([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),i2t=Oa([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Oa([{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 nVe=Oa([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),n2t=Oa([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Oa([{name:"triangle",components:3,type:"Uint16"}]),Oa([{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"}]),Oa([{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"}]),Oa([{type:"Float32",name:"offsetX"}]),Oa([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var zp=24;function r2t(p,l,u){return p.sections.forEach(f=>{f.text=(function(g,C,w){let D=C.layout.get("text-transform").evaluate(w,{});return D==="uppercase"?g=g.toLocaleUpperCase():D==="lowercase"&&(g=g.toLocaleLowerCase()),J_.applyArabicShaping&&(g=J_.applyArabicShaping(g)),g})(f.text,l,u)}),p}let rj={"!":"\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 o2t(p){return p==="\uFE36"||p==="\uFE48"||p==="\uFE38"||p==="\uFE44"||p==="\uFE42"||p==="\uFE3E"||p==="\uFE3C"||p==="\uFE3A"||p==="\uFE18"||p==="\uFE40"||p==="\uFE10"||p==="\uFE13"||p==="\uFE14"||p==="\uFF40"||p==="\uFFE3"||p==="\uFE11"||p==="\uFE12"}function a2t(p){return p==="\uFE35"||p==="\uFE47"||p==="\uFE37"||p==="\uFE43"||p==="\uFE41"||p==="\uFE3D"||p==="\uFE3B"||p==="\uFE39"||p==="\uFE17"||p==="\uFE3F"}let j0e=4294967296,rVe=1/j0e,oVe=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),Hee=class{constructor(p=new Uint8Array(16)){this.buf=ArrayBuffer.isView(p)?p:new Uint8Array(p),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(p,l,u=this.length){for(;this.pos>3,C=this.pos;this.type=7&f,p(g,l,this),this.pos===C&&this.skip(f)}return l}readMessage(p,l){return this.readFields(p,l,this.readVarint()+this.pos)}readFixed32(){let p=this.dataView.getUint32(this.pos,!0);return this.pos+=4,p}readSFixed32(){let p=this.dataView.getInt32(this.pos,!0);return this.pos+=4,p}readFixed64(){let p=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*j0e;return this.pos+=8,p}readSFixed64(){let p=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*j0e;return this.pos+=8,p}readFloat(){let p=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,p}readDouble(){let p=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,p}readVarint(p){let l=this.buf,u,f;return f=l[this.pos++],u=127&f,f<128?u:(f=l[this.pos++],u|=(127&f)<<7,f<128?u:(f=l[this.pos++],u|=(127&f)<<14,f<128?u:(f=l[this.pos++],u|=(127&f)<<21,f<128?u:(f=l[this.pos],u|=(15&f)<<28,(function(g,C,w){let D=w.buf,P,B;if(B=D[w.pos++],P=(112&B)>>4,B<128||(B=D[w.pos++],P|=(127&B)<<3,B<128)||(B=D[w.pos++],P|=(127&B)<<10,B<128)||(B=D[w.pos++],P|=(127&B)<<17,B<128)||(B=D[w.pos++],P|=(127&B)<<24,B<128)||(B=D[w.pos++],P|=(1&B)<<31,B<128))return f4(g,P,C);throw new Error("Expected varint not more than 10 bytes")})(u,p,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let p=this.readVarint();return p%2==1?(p+1)/-2:p/2}readBoolean(){return!!this.readVarint()}readString(){let p=this.readVarint()+this.pos,l=this.pos;return this.pos=p,p-l>=12&&oVe?oVe.decode(this.buf.subarray(l,p)):(function(u,f,g){let C="",w=f;for(;w239?4:D>223?3:D>191?2:1;if(w+K>g)break;K===1?D<128&&($=D):K===2?(P=u[w+1],(192&P)==128&&($=(31&D)<<6|63&P,$<=127&&($=null))):K===3?(P=u[w+1],B=u[w+2],(192&P)==128&&(192&B)==128&&($=(15&D)<<12|(63&P)<<6|63&B,($<=2047||$>=55296&&$<=57343)&&($=null))):K===4&&(P=u[w+1],B=u[w+2],q=u[w+3],(192&P)==128&&(192&B)==128&&(192&q)==128&&($=(15&D)<<18|(63&P)<<12|(63&B)<<6|63&q,($<=65535||$>=1114112)&&($=null))),$===null?($=65533,K=1):$>65535&&($-=65536,C+=String.fromCharCode($>>>10&1023|55296),$=56320|1023&$),C+=String.fromCharCode($),w+=K}return C})(this.buf,l,p)}readBytes(){let p=this.readVarint()+this.pos,l=this.buf.subarray(this.pos,p);return this.pos=p,l}readPackedVarint(p=[],l){let u=this.readPackedEnd();for(;this.pos127;);else if(l===2)this.pos=this.readVarint()+this.pos;else if(l===5)this.pos+=4;else{if(l!==1)throw new Error(`Unimplemented type: ${l}`);this.pos+=8}}writeTag(p,l){this.writeVarint(p<<3|l)}realloc(p){let l=this.length||16;for(;l268435455||p<0?(function(l,u){let f,g;if(l>=0?(f=l%4294967296|0,g=l/4294967296|0):(f=~(-l%4294967296),g=~(-l/4294967296),4294967295^f?f=f+1|0:(f=0,g=g+1|0)),l>=18446744073709552e3||l<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");u.realloc(10),(function(C,w,D){D.buf[D.pos++]=127&C|128,C>>>=7,D.buf[D.pos++]=127&C|128,C>>>=7,D.buf[D.pos++]=127&C|128,C>>>=7,D.buf[D.pos++]=127&C|128,D.buf[D.pos]=127&(C>>>=7)})(f,0,u),(function(C,w){let D=(7&C)<<4;w.buf[w.pos++]|=D|((C>>>=3)?128:0),C&&(w.buf[w.pos++]=127&C|((C>>>=7)?128:0),C&&(w.buf[w.pos++]=127&C|((C>>>=7)?128:0),C&&(w.buf[w.pos++]=127&C|((C>>>=7)?128:0),C&&(w.buf[w.pos++]=127&C|((C>>>=7)?128:0),C&&(w.buf[w.pos++]=127&C)))))})(g,u)})(p,this):(this.realloc(4),this.buf[this.pos++]=127&p|(p>127?128:0),p<=127||(this.buf[this.pos++]=127&(p>>>=7)|(p>127?128:0),p<=127||(this.buf[this.pos++]=127&(p>>>=7)|(p>127?128:0),p<=127||(this.buf[this.pos++]=p>>>7&127))))}writeSVarint(p){this.writeVarint(p<0?2*-p-1:2*p)}writeBoolean(p){this.writeVarint(+p)}writeString(p){p=String(p),this.realloc(4*p.length),this.pos++;let l=this.pos;this.pos=(function(f,g,C){for(let w,D,P=0;P55295&&w<57344){if(!D){w>56319||P+1===g.length?(f[C++]=239,f[C++]=191,f[C++]=189):D=w;continue}if(w<56320){f[C++]=239,f[C++]=191,f[C++]=189,D=w;continue}w=D-55296<<10|w-56320|65536,D=null}else D&&(f[C++]=239,f[C++]=191,f[C++]=189,D=null);w<128?f[C++]=w:(w<2048?f[C++]=w>>6|192:(w<65536?f[C++]=w>>12|224:(f[C++]=w>>18|240,f[C++]=w>>12&63|128),f[C++]=w>>6&63|128),f[C++]=63&w|128)}return C})(this.buf,p,this.pos);let u=this.pos-l;u>=128&&aVe(l,u,this),this.pos=l-1,this.writeVarint(u),this.pos+=u}writeFloat(p){this.realloc(4),this.dataView.setFloat32(this.pos,p,!0),this.pos+=4}writeDouble(p){this.realloc(8),this.dataView.setFloat64(this.pos,p,!0),this.pos+=8}writeBytes(p){let l=p.length;this.writeVarint(l),this.realloc(l);for(let u=0;u