{"bundle":"var kx=Object.defineProperty;var Dx=(e,t,r)=>t in e?kx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ye=(e,t,r)=>Dx(e,typeof t!=\"symbol\"?t+\"\":t,r);var Pt=class extends Error{constructor(r,i,a){super(r);Ye(this,\"method\");Ye(this,\"code\");Ye(this,\"name\",\"AtlasBridgeError\");this.method=i,this.code=a}};var zl=\"atlas-bridge\";var Up=\"atlas.connect\";var $p=\"__atlasRenderGate\";function jp(e){if(typeof e!=\"object\"||e===null)return!1;let t=e;return t.channel===zl&&typeof t.v==\"number\"&&typeof t.data==\"object\"&&t.data!==null}function ir(e){let t=e.seed?{seq:0,value:e.seed.value}:null,r=null,i=0,a=new Set,n=null,s=0,o=async()=>{let c=++i;s+=1;try{let p=await e.load();if(t!==null&&c<=t.seq)return t.value;t={seq:c,value:p};for(let{onValue:d}of a)d(p);return p}catch(p){if(c===i){r={error:p},e.onLoadError?.(p);for(let{onError:f}of a)f(p)}throw p}finally{s-=1}},l=()=>{o().catch(()=>{})},u=()=>s>0,h=c=>{if(t===null||u()){l();return}let p=c(t.value);if(p===null){l();return}t={...t,value:p};for(let{onValue:d}of a)d(p)};return{value(){return a.size>0&&t!==null?Promise.resolve(t.value):o()},subscribe(c,p){let d={onValue:c,onError:p};return a.add(d),a.size===1&&(n=e.invalidations?.(l,h)??null,l()),t!==null?c(t.value):r!==null&&!u()&&p(r.error),()=>{a.delete(d),a.size===0&&(n?.(),n=null)}}}}function Gp(){let e=null,t=new Set,r=new Set,i=null;return{live:{value(){return e!==null?Promise.resolve(e.value):i!==null?Promise.reject(i.error):new Promise((a,n)=>{r.add({resolve:a,reject:n})})},subscribe(a,n){let s={onValue:a,onError:n};return t.add(s),e!==null?a(e.value):i!==null&&n(i.error),()=>{t.delete(s)}}},push(a){if(i===null){e={value:a};for(let n of r)n.resolve(a);r.clear();for(let{onValue:n}of t)n(a)}},close(a){if(i===null){i={error:a};for(let n of r)n.reject(a);if(r.clear(),e===null)for(let{onError:n}of t)n(a)}}}}function Rl(e){return new Pt(`Chat session ${e} is closed`,\"atlas.ai.close\",\"SESSION_CLOSED\")}function qp(e){let t=new Map,r=n=>{let s=t.get(n);if(s)return s.holders+=1,s;let o=Gp(),l=e.on(\"aiState\",h=>{let c=h;c.sessionId===n&&o.push(c)}),u={live:o,stopListening:l,holders:1,attached:e.call(\"atlas.ai.attach\",{sessionId:n}).then(()=>{})};return t.set(n,u),u},i=(n,s)=>{s.holders-=1,!(s.holders>0)&&(t.delete(n),s.stopListening(),s.live.close(Rl(n)),e.call(\"atlas.ai.detach\",{sessionId:n}).catch(()=>{}))},a=(n,s)=>{let o=!1;return{sessionId:n,live:()=>s.live.live,send:async(l,u,h)=>{if(o)throw Rl(n);await e.call(\"atlas.ai.send\",{sessionId:n,message:l,context:u},h)},cancel:async l=>{if(o)throw Rl(n);await e.call(\"atlas.ai.cancel\",{sessionId:n},l)},close:()=>{o||(o=!0,i(n,s))}}};return{listSessions:async n=>await e.call(\"atlas.ai.listSessions\",{},n),open:async n=>{let s=n??(await e.call(\"atlas.ai.createSession\",{})).sessionId,o=r(s);try{await o.attached}catch(l){throw i(s,o),l}return a(s,o)}}}function Zp(e,t){return{...e,...t}}function Fx(e,t){let r=0,i=e.features.map(a=>{let n=typeof a.id==\"number\"&&t.get(a.id);return n?(r+=1,{...a,properties:Zp(a.properties,n)}):a});return r!==t.size?null:{...e,features:i}}function zx(e,t){let r=0,i=e.rows.map(a=>{let n=t.get(a.id);return n?(r+=1,{...a,properties:Zp(a.properties,n)}):a});return r!==t.size?null:{...e,rows:i}}function Rx(e){return e.addedRowIds.length>0||e.deletedRowIds.length>0||!e.updatedRows||e.updatedRows.length===0?null:new Map(e.updatedRows.map(t=>[t.id,t.properties]))}function Lx(e){return(e.rpn===void 0||e.rpn===null)&&e.opts===void 0&&e.hostFilters===\"ignore\"}function Wp(e){let t=new Map,r=(n,s,o)=>{let l=`${n}:${JSON.stringify(s)}`,u=t.get(l);if(u)return u;let h=ir({load:async()=>await e.call(n,s),invalidations:(c,p)=>{let d=e.on(\"dataChange\",m=>{let g=m;if(g.datasetId!==s.datasetId)return;let y=o(g);y?p(y):c()});if(s.hostFilters===\"ignore\")return d;let f=e.on(\"filterChange\",m=>{m.datasetId===s.datasetId&&c()});return()=>{d(),f()}}});return t.set(l,h),h},i=(n,s,o)=>r(n,s,l=>{let u=Lx(s)?Rx(l):null;return u?h=>o(h,u):null}),a=(n,s)=>r(n,s,()=>null);return{data:{live:n=>i(\"atlas.data.query\",n,Fx)},rows:{live:n=>i(\"atlas.data.queryTable\",n,zx)},scalar:{live:n=>a(\"atlas.data.scalar\",n)},aggregate:{live:n=>a(\"atlas.data.aggregate\",n)},histogram:{live:n=>a(\"atlas.data.histogram\",n)},statistics:{live:n=>a(\"atlas.data.statistics\",n)}}}var Xp=\"atlas.embed.reply\";function Hp(e){let t=!1,r=i=>e.call(\"atlas.embed.post\",i);return{on(i){let a=e.on(\"embedMessage\",n=>{let{type:s,id:o,payload:l,origin:u}=n;i({type:s,payload:l,origin:u,reply:h=>r({type:Xp,payload:h??null,origin:u,...o!==void 0&&{id:o}})})});return t||(t=!0,e.call(\"atlas.embed.listen\",{})),a},post:(i,a)=>r({type:i,payload:a??null})}}var Yp=\"mc-dataset-\";function Kp(e){return`${Yp}${e}`}function Jp(e,t){return`${Yp}${e}-${t}`}var Bx=[\"fill\",\"line\",\"circle\"],Qp=[\"any\",[\"==\",[\"geometry-type\"],\"Polygon\"],[\"==\",[\"geometry-type\"],\"MultiPolygon\"]],ed=[\"any\",[\"==\",[\"geometry-type\"],\"Point\"],[\"==\",[\"geometry-type\"],\"MultiPoint\"]];function Ox(e){let{view:t}=e;if(t.kind===\"raster\")return[\"raster\"];if(t.renderAs===\"heatmap\")return[\"heatmap\"];let r=[...Bx];return t.paint[\"fill-extrusion-height\"]!==void 0&&r.push(\"fill-extrusion\"),(t.layout?.[\"text-field\"]!==void 0||t.layout?.[\"icon-image\"]!==void 0)&&r.push(\"symbol\"),r}var Vx={fill:Qp,line:[\"any\",[\"==\",[\"geometry-type\"],\"LineString\"],[\"==\",[\"geometry-type\"],\"MultiLineString\"],[\"==\",[\"geometry-type\"],\"Polygon\"],[\"==\",[\"geometry-type\"],\"MultiPolygon\"]],circle:ed,heatmap:ed,\"fill-extrusion\":Qp,symbol:void 0};function Nx(e){let t=e.filter(r=>r!==void 0);if(t.length!==0)return t.length===1?t[0]:[\"all\",...t]}function Ux(e,...t){if(e!==\"raster\")return Nx([Vx[e],...t])}var $x=[[\"fill-extrusion-\",\"fill-extrusion\"],[\"heatmap-\",\"heatmap\"],[\"fill-\",\"fill\"],[\"line-\",\"line\"],[\"circle-\",\"circle\"],[\"text-\",\"symbol\"],[\"icon-\",\"symbol\"]];function jx(e){for(let[t,r]of $x)if(e.startsWith(t))return r;return null}function Gx(e,t){if(t===\"raster\")return e;let r={};for(let[i,a]of Object.entries(e))jx(i)===t&&(r[i]=a);return r}function qx(e,t){return t!==\"symbol\"||!e?{}:{...e}}function Zx(e){let{source:t}=e;switch(t.kind){case\"mvt\":return{type:\"vector\",tiles:[t.tileUrlTemplate]};case\"raster-tiles\":return{type:\"raster\",tiles:[t.tileUrlTemplate],tileSize:t.tileSize,...t.bounds!==void 0&&{bounds:t.bounds}};case\"wms\":return{type:\"raster\",tiles:[t.requestUrl],tileSize:t.tileSize,...t.bounds!==void 0&&{bounds:t.bounds}};case\"geojson\":return{type:\"geojson\",data:t.data};default:{let r=t;return null}}}function td(e,t){if(e.cluster?.enabled===!0)return{kind:\"unsupported\",reason:\"cluster\",detail:\"Clustering needs a worker that re-clusters per viewport; it cannot be expressed as static source + layers.\"};let r=Zx(e);if(!r)return{kind:\"unsupported\",reason:\"source-kind\",detail:`This bundle cannot render a '${e.source.kind}' source. Rebuild the interface against the current bridge.`};let i=Kp(e.dataset),a=e.source.kind===\"mvt\"?e.source.sourceLayer:void 0,n=e.view.kind===\"vector\"?e.view.layout:void 0,s=e.visibility===\"hidden\"?\"none\":\"visible\",o=e.zoomRange?.min,l=e.zoomRange?.max,u=Ox(e).map(h=>{let c=Ux(h,e.filter,t);return{id:Jp(e.dataset,h),type:h,source:i,...a!==void 0&&{\"source-layer\":a},paint:Gx(e.view.paint,h),...o!==void 0&&{minzoom:o},...l!==void 0&&{maxzoom:l},...c!==void 0&&{filter:c},layout:{...qx(n,h),visibility:s}}});return{kind:\"ready\",sourceId:i,source:r,layers:u}}function Wx(e,t,r){return{id:e,name:t,spec:r,maplibre:r===null?null:td(r)}}function rd(e,t){let r=new Map,i=async n=>{let s=r.get(n);if(s!==void 0)return s;let o=await e.call(\"atlas.layers.getLayerSpec\",{datasetId:n});return r.set(n,o),o};return ir({load:async()=>{let[n,s]=await Promise.all([e.call(\"atlas.layers.getDatasets\",{}),t.value()]),o=new Map(s.map(h=>[h.id,h.name])),l=new Set(n);for(let h of r.keys())l.has(h)||r.delete(h);let u=await Promise.all(n.map(i));return n.map((h,c)=>Wx(h,o.get(h)??h,u[c]??null))},invalidations:n=>{let s=e.on(\"specChange\",l=>{r.delete(l.datasetId),n()}),o=e.on(\"datasetListChange\",()=>{r.clear(),n()});return()=>{s(),o()}}})}var Xx=Object.create,xf=Object.defineProperty,Hx=Object.getOwnPropertyDescriptor,Yx=Object.getOwnPropertyNames,Kx=Object.getPrototypeOf,vf=Object.prototype.hasOwnProperty,sh=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Jx=(e,t,r,i)=>{if(t&&typeof t==\"object\"||typeof t==\"function\")for(var a=Yx(t),n=0,s=a.length,o;n<s;n++)o=a[n],!vf.call(e,o)&&o!==r&&xf(e,o,{get:(l=>t[l]).bind(null,o),enumerable:!(i=Hx(t,o))||i.enumerable});return e},Qx=(e,t,r)=>(r=e==null?{}:Xx(Kx(e)),Jx(t||!e||!e.__esModule||!vf.call(e,\"default\")?xf(r,\"default\",{value:e,enumerable:!0}):r,e));function C(e,t){this.x=e,this.y=t}C.prototype={clone(){return new C(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){let t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){let t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){let e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){let t=Math.cos(e),r=Math.sin(e),i=t*this.x-r*this.y,a=r*this.x+t*this.y;return this.x=i,this.y=a,this},_rotateAround(e,t){let r=Math.cos(e),i=Math.sin(e),a=t.x+r*(this.x-t.x)-i*(this.y-t.y),n=t.y+i*(this.x-t.x)+r*(this.y-t.y);return this.x=a,this.y=n,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:C},C.convert=function(e){if(e instanceof C)return e;if(Array.isArray(e))return new C(+e[0],+e[1]);if(e.x!==void 0&&e.y!==void 0)return new C(+e.x,+e.y);throw Error(\"Expected [x, y] or {x, y} point format\")};function ev(e,t,r,i){let a=3*e,n=3*(r-e)-a,s=1-a-n,o=3*t,l=3*(i-t)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let m=0;m<8;m++){let g=((s*p+n)*p+a)*p-h;if(Math.abs(g)<c)return((u*p+l)*p+o)*p;let y=(3*s*p+2*n)*p+a;if(Math.abs(y)<1e-6)break;p-=g/y}let d=0,f=1;p=h;for(let m=0;m<20;m++){let g=((s*p+n)*p+a)*p;if(Math.abs(g-h)<c)break;h>g?d=p:f=p,p=(d+f)*.5}return((u*p+l)*p+o)*p}}var id;function oh(){return id??(id=typeof OffscreenCanvas<\"u\"&&new OffscreenCanvas(1,1).getContext(\"2d\")&&typeof createImageBitmap==\"function\"),id}var Ss;function bf(){if(Ss==null&&(Ss=!1,oh())){let e=new OffscreenCanvas(5,5).getContext(\"2d\",{willReadFrequently:!0});if(e){for(let r=0;r<25;r++){let i=r*4;e.fillStyle=`rgb(${i},${i+1},${i+2})`,e.fillRect(r%5,Math.floor(r/5),1,1)}let t=e.getImageData(0,0,5,5).data;for(let r=0;r<100;r++)if(r%4!=3&&t[r]!==r){Ss=!0;break}}}return Ss||!1}var Ze=typeof Float32Array<\"u\"?Float32Array:Array;Math.PI/180,180/Math.PI;function lh(){var e=new Ze(9);return Ze!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function tv(e){var t=e[0],r=e[1],i=e[2],a=e[3],n=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*(u*n-s*l)+r*(-u*a+s*o)+i*(l*a-n*o)}function wf(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function rv(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r+r,o=i+i,l=a+a,u=r*s,h=i*s,c=i*o,p=a*s,d=a*o,f=a*l,m=n*s,g=n*o,y=n*l;return e[0]=1-c-f,e[3]=h-y,e[6]=p+g,e[1]=h+y,e[4]=1-u-f,e[7]=d-m,e[2]=p-g,e[5]=d+m,e[8]=1-u-c,e}function Vr(){var e=new Ze(16);return Ze!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function to(e){var t=new Ze(16);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function Tf(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Kt(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ma(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=t[4],o=t[5],l=t[6],u=t[7],h=t[8],c=t[9],p=t[10],d=t[11],f=t[12],m=t[13],g=t[14],y=t[15],_=r*o-i*s,x=r*l-a*s,v=r*u-n*s,w=i*l-a*o,b=i*u-n*o,T=a*u-n*l,I=h*m-c*f,S=h*g-p*f,D=h*y-d*f,R=c*g-p*m,F=c*y-d*m,E=p*y-d*g,M=_*E-x*F+v*R+w*D-b*S+T*I;return M?(M=1/M,e[0]=(o*E-l*F+u*R)*M,e[1]=(a*F-i*E-n*R)*M,e[2]=(m*T-g*b+y*w)*M,e[3]=(p*b-c*T-d*w)*M,e[4]=(l*D-s*E-u*S)*M,e[5]=(r*E-a*D+n*S)*M,e[6]=(g*v-f*T-y*x)*M,e[7]=(h*T-p*v+d*x)*M,e[8]=(s*F-o*D+u*I)*M,e[9]=(i*D-r*F-n*I)*M,e[10]=(f*b-m*v+y*_)*M,e[11]=(c*v-h*b-d*_)*M,e[12]=(o*S-s*R-l*I)*M,e[13]=(r*R-i*S+a*I)*M,e[14]=(m*x-f*w-g*_)*M,e[15]=(h*w-c*x+p*_)*M,e):null}function Jt(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=t[4],l=t[5],u=t[6],h=t[7],c=t[8],p=t[9],d=t[10],f=t[11],m=t[12],g=t[13],y=t[14],_=t[15],x=r[0],v=r[1],w=r[2],b=r[3];return e[0]=x*i+v*o+w*c+b*m,e[1]=x*a+v*l+w*p+b*g,e[2]=x*n+v*u+w*d+b*y,e[3]=x*s+v*h+w*f+b*_,x=r[4],v=r[5],w=r[6],b=r[7],e[4]=x*i+v*o+w*c+b*m,e[5]=x*a+v*l+w*p+b*g,e[6]=x*n+v*u+w*d+b*y,e[7]=x*s+v*h+w*f+b*_,x=r[8],v=r[9],w=r[10],b=r[11],e[8]=x*i+v*o+w*c+b*m,e[9]=x*a+v*l+w*p+b*g,e[10]=x*n+v*u+w*d+b*y,e[11]=x*s+v*h+w*f+b*_,x=r[12],v=r[13],w=r[14],b=r[15],e[12]=x*i+v*o+w*c+b*m,e[13]=x*a+v*l+w*p+b*g,e[14]=x*n+v*u+w*d+b*y,e[15]=x*s+v*h+w*f+b*_,e}function ze(e,t,r){var i=r[0],a=r[1],n=r[2],s,o,l,u,h,c,p,d,f,m,g,y;return t===e?(e[12]=t[0]*i+t[4]*a+t[8]*n+t[12],e[13]=t[1]*i+t[5]*a+t[9]*n+t[13],e[14]=t[2]*i+t[6]*a+t[10]*n+t[14],e[15]=t[3]*i+t[7]*a+t[11]*n+t[15]):(s=t[0],o=t[1],l=t[2],u=t[3],h=t[4],c=t[5],p=t[6],d=t[7],f=t[8],m=t[9],g=t[10],y=t[11],e[0]=s,e[1]=o,e[2]=l,e[3]=u,e[4]=h,e[5]=c,e[6]=p,e[7]=d,e[8]=f,e[9]=m,e[10]=g,e[11]=y,e[12]=s*i+h*a+f*n+t[12],e[13]=o*i+c*a+m*n+t[13],e[14]=l*i+p*a+g*n+t[14],e[15]=u*i+d*a+y*n+t[15]),e}function at(e,t,r){var i=r[0],a=r[1],n=r[2];return e[0]=t[0]*i,e[1]=t[1]*i,e[2]=t[2]*i,e[3]=t[3]*i,e[4]=t[4]*a,e[5]=t[5]*a,e[6]=t[6]*a,e[7]=t[7]*a,e[8]=t[8]*n,e[9]=t[9]*n,e[10]=t[10]*n,e[11]=t[11]*n,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Ni(e,t,r){var i=Math.sin(r),a=Math.cos(r),n=t[4],s=t[5],o=t[6],l=t[7],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=n*a+u*i,e[5]=s*a+h*i,e[6]=o*a+c*i,e[7]=l*a+p*i,e[8]=u*a-n*i,e[9]=h*a-s*i,e[10]=c*a-o*i,e[11]=p*a-l*i,e}function uh(e,t,r){var i=Math.sin(r),a=Math.cos(r),n=t[0],s=t[1],o=t[2],l=t[3],u=t[8],h=t[9],c=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a-u*i,e[1]=s*a-h*i,e[2]=o*a-c*i,e[3]=l*a-p*i,e[8]=n*i+u*a,e[9]=s*i+h*a,e[10]=o*i+c*a,e[11]=l*i+p*a,e}function Nr(e,t,r){var i=Math.sin(r),a=Math.cos(r),n=t[0],s=t[1],o=t[2],l=t[3],u=t[4],h=t[5],c=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=n*a+u*i,e[1]=s*a+h*i,e[2]=o*a+c*i,e[3]=l*a+p*i,e[4]=u*a-n*i,e[5]=h*a-s*i,e[6]=c*a-o*i,e[7]=p*a-l*i,e}function Sf(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function iv(e,t,r,i,a){var n=1/Math.tan(t/2);if(e[0]=n/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,a!=null&&a!==1/0){var s=1/(i-a);e[10]=(a+i)*s,e[14]=2*a*i*s}else e[10]=-1,e[14]=-2*i;return e}var ro=iv;function av(e,t,r,i,a,n,s){var o=1/(t-r),l=1/(i-a),u=1/(n-s);return e[0]=-2*o,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*o,e[13]=(a+i)*l,e[14]=(s+n)*u,e[15]=1,e}var ur=av;function Ef(e,t){var r=e[0],i=e[1],a=e[2],n=e[3],s=e[4],o=e[5],l=e[6],u=e[7],h=e[8],c=e[9],p=e[10],d=e[11],f=e[12],m=e[13],g=e[14],y=e[15],_=t[0],x=t[1],v=t[2],w=t[3],b=t[4],T=t[5],I=t[6],S=t[7],D=t[8],R=t[9],F=t[10],E=t[11],M=t[12],A=t[13],k=t[14],H=t[15];return Math.abs(r-_)<=1e-6*Math.max(1,Math.abs(r),Math.abs(_))&&Math.abs(i-x)<=1e-6*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-v)<=1e-6*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(n-w)<=1e-6*Math.max(1,Math.abs(n),Math.abs(w))&&Math.abs(s-b)<=1e-6*Math.max(1,Math.abs(s),Math.abs(b))&&Math.abs(o-T)<=1e-6*Math.max(1,Math.abs(o),Math.abs(T))&&Math.abs(l-I)<=1e-6*Math.max(1,Math.abs(l),Math.abs(I))&&Math.abs(u-S)<=1e-6*Math.max(1,Math.abs(u),Math.abs(S))&&Math.abs(h-D)<=1e-6*Math.max(1,Math.abs(h),Math.abs(D))&&Math.abs(c-R)<=1e-6*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(p-F)<=1e-6*Math.max(1,Math.abs(p),Math.abs(F))&&Math.abs(d-E)<=1e-6*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(f-M)<=1e-6*Math.max(1,Math.abs(f),Math.abs(M))&&Math.abs(m-A)<=1e-6*Math.max(1,Math.abs(m),Math.abs(A))&&Math.abs(g-k)<=1e-6*Math.max(1,Math.abs(g),Math.abs(k))&&Math.abs(y-H)<=1e-6*Math.max(1,Math.abs(y),Math.abs(H))}function If(){var e=new Ze(3);return Ze!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function io(e){var t=new Ze(3);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function di(e){var t=e[0],r=e[1],i=e[2];return Math.sqrt(t*t+r*r+i*i)}function ad(e,t,r){var i=new Ze(3);return i[0]=e,i[1]=t,i[2]=r,i}function Ot(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function nv(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function Me(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function Ln(e,t,r,i){return e[0]=t[0]+r[0]*i,e[1]=t[1]+r[1]*i,e[2]=t[2]+r[2]*i,e}function Af(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function At(e,t){var r=t[0],i=t[1],a=t[2],n=r*r+i*i+a*a;return n>0&&(n=1/Math.sqrt(n)),e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e}function je(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Et(e,t,r){var i=t[0],a=t[1],n=t[2],s=r[0],o=r[1],l=r[2];return e[0]=a*l-n*o,e[1]=n*s-i*l,e[2]=i*o-a*s,e}function Mf(e,t,r){var i=t[0],a=t[1],n=t[2],s=r[3]*i+r[7]*a+r[11]*n+r[15];return s||(s=1),e[0]=(r[0]*i+r[4]*a+r[8]*n+r[12])/s,e[1]=(r[1]*i+r[5]*a+r[9]*n+r[13])/s,e[2]=(r[2]*i+r[6]*a+r[10]*n+r[14])/s,e}function Pf(e,t,r){var i=t[0],a=t[1],n=t[2];return e[0]=i*r[0]+a*r[3]+n*r[6],e[1]=i*r[1]+a*r[4]+n*r[7],e[2]=i*r[2]+a*r[5]+n*r[8],e}function ao(e,t,r){var i=r[0],a=r[1],n=r[2],s=r[3],o=t[0],l=t[1],u=t[2],h=a*u-n*l,c=n*o-i*u,p=i*l-a*o;return h+=h,c+=c,p+=p,e[0]=o+s*h+a*p-n*c,e[1]=l+s*c+n*h-i*p,e[2]=u+s*p+i*c-a*h,e}function Bn(e,t,r,i){var a=[],n=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],n[0]=a[0],n[1]=a[1]*Math.cos(i)-a[2]*Math.sin(i),n[2]=a[1]*Math.sin(i)+a[2]*Math.cos(i),e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function Pa(e,t,r,i){var a=[],n=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],n[0]=a[2]*Math.sin(i)+a[0]*Math.cos(i),n[1]=a[1],n[2]=a[2]*Math.cos(i)-a[0]*Math.sin(i),e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function no(e,t,r,i){var a=[],n=[];return a[0]=t[0]-r[0],a[1]=t[1]-r[1],a[2]=t[2]-r[2],n[0]=a[0]*Math.cos(i)-a[1]*Math.sin(i),n[1]=a[0]*Math.sin(i)+a[1]*Math.cos(i),n[2]=a[2],e[0]=n[0]+r[0],e[1]=n[1]+r[1],e[2]=n[2]+r[2],e}function Cf(e){return e[0]=0,e[1]=0,e[2]=0,e}var wr=nv,On=di;(function(){var e=If();return function(t,r,i,a,n,s){var o,l;for(r||(r=3),i||(i=0),l=a?Math.min(a*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],e[2]=t[o+2],n(e,e,s),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2];return t}})();function sv(){var e=new Ze(4);return Ze!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function ov(e,t,r,i){var a=new Ze(4);return a[0]=e,a[1]=t,a[2]=r,a[3]=i,a}function lv(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function kf(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function uv(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r*r+i*i+a*a+n*n;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=i*s,e[2]=a*s,e[3]=n*s,e}function We(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3];return e[0]=r[0]*i+r[4]*a+r[8]*n+r[12]*s,e[1]=r[1]*i+r[5]*a+r[9]*n+r[13]*s,e[2]=r[2]*i+r[6]*a+r[10]*n+r[14]*s,e[3]=r[3]*i+r[7]*a+r[11]*n+r[15]*s,e}var Df=lv;(function(){var e=sv();return function(t,r,i,a,n,s){var o,l;for(r||(r=4),i||(i=0),l=a?Math.min(a*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],e[2]=t[o+2],e[3]=t[o+3],n(e,e,s),t[o]=e[0],t[o+1]=e[1],t[o+2]=e[2],t[o+3]=e[3];return t}})();function nd(){var e=new Ze(4);return Ze!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function hv(e,t,r){r*=.5;var i=Math.sin(r);return e[0]=i*t[0],e[1]=i*t[1],e[2]=i*t[2],e[3]=Math.cos(r),e}function Ff(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=r[0],l=r[1],u=r[2],h=r[3];return e[0]=i*h+s*o+a*u-n*l,e[1]=a*h+s*l+n*o-i*u,e[2]=n*h+s*u+i*l-a*o,e[3]=s*h-i*o-a*l-n*u,e}function dn(e,t,r,i){var a=t[0],n=t[1],s=t[2],o=t[3],l=r[0],u=r[1],h=r[2],c=r[3],p,d=a*l+n*u+s*h+o*c,f,m,g;return d<0&&(d=-d,l=-l,u=-u,h=-h,c=-c),1-d>1e-6?(p=Math.acos(d),f=Math.sin(p),m=Math.sin((1-i)*p)/f,g=Math.sin(i*p)/f):(m=1-i,g=i),e[0]=m*a+g*l,e[1]=m*n+g*u,e[2]=m*s+g*h,e[3]=m*o+g*c,e}function cv(e,t){var r=t[0]+t[4]+t[8],i;if(r>0)i=Math.sqrt(r+1),e[3]=.5*i,i=.5/i,e[0]=(t[5]-t[7])*i,e[1]=(t[6]-t[2])*i,e[2]=(t[1]-t[3])*i;else{var a=0;t[4]>t[0]&&(a=1),t[8]>t[a*3+a]&&(a=2);var n=(a+1)%3,s=(a+2)%3;i=Math.sqrt(t[a*3+a]-t[n*3+n]-t[s*3+s]+1),e[a]=.5*i,i=.5/i,e[3]=(t[n*3+s]-t[s*3+n])*i,e[n]=(t[n*3+a]+t[a*3+n])*i,e[s]=(t[s*3+a]+t[a*3+s])*i}return e}function so(e,t,r,i){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:\"zyx\",n=Math.PI/360;t*=n,i*=n,r*=n;var s=Math.sin(t),o=Math.cos(t),l=Math.sin(r),u=Math.cos(r),h=Math.sin(i),c=Math.cos(i);switch(a){case\"xyz\":e[0]=s*u*c+o*l*h,e[1]=o*l*c-s*u*h,e[2]=o*u*h+s*l*c,e[3]=o*u*c-s*l*h;break;case\"xzy\":e[0]=s*u*c-o*l*h,e[1]=o*l*c-s*u*h,e[2]=o*u*h+s*l*c,e[3]=o*u*c+s*l*h;break;case\"yxz\":e[0]=s*u*c+o*l*h,e[1]=o*l*c-s*u*h,e[2]=o*u*h-s*l*c,e[3]=o*u*c+s*l*h;break;case\"yzx\":e[0]=s*u*c+o*l*h,e[1]=o*l*c+s*u*h,e[2]=o*u*h-s*l*c,e[3]=o*u*c-s*l*h;break;case\"zxy\":e[0]=s*u*c-o*l*h,e[1]=o*l*c+s*u*h,e[2]=o*u*h+s*l*c,e[3]=o*u*c-s*l*h;break;case\"zyx\":e[0]=s*u*c-o*l*h,e[1]=o*l*c+s*u*h,e[2]=o*u*h-s*l*c,e[3]=o*u*c+s*l*h;break;default:throw Error(\"Unknown angle order \"+a)}return e}var hh=ov,sd=uv;(function(){var e=If(),t=ad(1,0,0),r=ad(0,1,0);return function(i,a,n){var s=je(a,n);return s<-.999999?(Et(e,t,a),On(e)<1e-6&&Et(e,r,a),At(e,e),hv(i,e,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Et(e,a,n),i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=1+s,sd(i,i))}})(),(function(){var e=nd(),t=nd();return function(r,i,a,n,s,o){return dn(e,i,s,o),dn(t,a,n,o),dn(r,e,t,2*o*(1-o)),r}})(),(function(){var e=lh();return function(t,r,i,a){return e[0]=i[0],e[3]=i[1],e[6]=i[2],e[1]=a[0],e[4]=a[1],e[7]=a[2],e[2]=-r[0],e[5]=-r[1],e[8]=-r[2],sd(t,cv(t,e))}})();function oo(){var e=new Ze(2);return Ze!=Float32Array&&(e[0]=0,e[1]=0),e}function od(e,t){var r=new Ze(2);return r[0]=e,r[1]=t,r}function ch(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function ph(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)}function pv(e){var t=e[0],r=e[1];return t*t+r*r}function dv(e,t){return e[0]*t[0]+e[1]*t[1]}function dh(e){return e[0]=0,e[1]=0,e}var zf=pv;(function(){var e=oo();return function(t,r,i,a,n,s){var o,l;for(r||(r=2),i||(i=0),l=a?Math.min(a*r+i,t.length):t.length,o=i;o<l;o+=r)e[0]=t[o],e[1]=t[o+1],n(e,e,s),t[o]=e[0],t[o+1]=e[1];return t}})();var z=8192;function Ct(e,t,r){return t*(z/(e.tileSize*2**(r-e.tileID.overscaledZ)))}function it(e){return e instanceof Error?e:Error(typeof e==\"string\"?e:String(e))}function fi(){return new Float64Array(4)}function _e(){return new Float64Array(3)}function Vt(){return new Float64Array(16)}function Ca(){let e=new Float64Array(16);return Kt(e),e}function fh(){let e=new Float32Array(16);return Kt(e),e}function Ur(e,t,r,i,a=!1){if(!r[0]&&!r[1])return[0,0];let n=a?i===\"map\"?-e.bearingInRadians:0:i===\"viewport\"?e.bearingInRadians:0;if(n){let s=Math.sin(n),o=Math.cos(n);r=[r[0]*o-r[1]*s,r[0]*s+r[1]*o]}return[a?r[0]:Ct(t,r[0],e.zoom),a?r[1]:Ct(t,r[1],e.zoom)]}function lo(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]}function Nt(e,t,r){let i=tv([e[0],e[1],e[2],t[0],t[1],t[2],r[0],r[1],r[2]]);if(i===0)return null;let a=Et([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),n=Et([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),s=Et([],[e[0],e[1],e[2]],[t[0],t[1],t[2]]),o=Me([],a,-e[3]);return Ot(o,o,Me([],n,-t[3])),Ot(o,o,Me([],s,-r[3])),Me(o,o,1/i),o}function Rf(e,t,r){let i=e[0]*r[0]+e[1]*r[1]+e[2]*r[2],a=t[0]*r[0]+t[1]*r[1]+t[2]*r[2];return a===0?null:(-i-r[3])/a}function Vn(e,t,r,i){let a=Math.sqrt(e*e+t*t),n=Math.sqrt(r*r+i*i);e/=a,t/=a,r/=n,i/=n;let s=e*r+t*i,o=Math.acos(s);return-t*r+e*i>0?o:-o}function kt(e,t){let r=ci(e,360),i=ci(t,360),a=i-r,n=i>r?a-360:a+360;return Math.abs(a)<Math.abs(n)?a:n}function Nn(e,t){let r=ci(e,Math.PI*2),i=ci(t,Math.PI*2);return Math.min(Math.abs(r-i),Math.abs(r-i+Math.PI*2),Math.abs(r-i-Math.PI*2))}function ci(e,t){return(e%t+t)%t}function Un(e,t,r,i,a){return Ui(i,a,te((e-t)/(r-t),0,1))}function Ui(e,t,r){return e*(1-r)+t*r}function Lf(e){let t=1/0,r=1/0,i=-1/0,a=-1/0;for(let n of e)t=Math.min(t,n.x),r=Math.min(r,n.y),i=Math.max(i,n.x),a=Math.max(a,n.y);return[t,r,i,a]}function Bf(e){if(!e.length)return new Set;let t=Math.max(...e.map(l=>l.canonical.z)),r=1/0,i=-1/0,a=1/0,n=-1/0,s=[];for(let l of e){let{x:u,y:h,z:c}=l.canonical,p=2**(t-c),d=u*p,f=h*p;s.push({id:l,x:d,y:f}),d<r&&(r=d),d>i&&(i=d),f<a&&(a=f),f>n&&(n=f)}let o=new Set;for(let l of s)(l.x===r||l.x===i||l.y===a||l.y===n)&&o.add(l.id);return o}function fv(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function uo(e,t,r,i){return ev(e,t,r,i)}var ho=uo(.25,.1,.25,1);function te(e,t,r){return Math.min(r,Math.max(t,e))}function Ut(e,t,r){let i=r-t,a=((e-t)%i+i)%i+t;return a===t?r:a}function j(e,...t){for(let r of t)for(let i in r)e[i]=r[i];return e}function ka(e,t){let r={};for(let i of t)i in e&&(r[i]=e[i]);return r}var mv=1;function mh(){return mv++}function gv(e){return Math.log(e)/Math.LN2%1==0}function Of(e){return e<=1?1:2**Math.ceil(Math.log(e)/Math.LN2)}function bt(e){return 2**e}function dt(e){return Math.log(e)/Math.LN2}function Dt(e,t,r){if(t<=0)return e;let i=1/t;return r===void 0||Math.abs(r)<1e-10?Math.round(e*i)/i:(r>0?Math.ceil(e*i-1e-9):Math.floor(e*i+1e-10))/i}function co(e,t,r){let i={};for(let a in e)i[a]=t.call(r||this,e[a],a,e);return i}function gh(e,t,r){let i={};for(let a in e)t.call(r||this,e[a],a,e)&&(i[a]=e[a]);return i}function sr(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!sr(e[r],t[r]))return!1;return!0}if(typeof e==\"object\"&&e&&t!==null){if(typeof t!=\"object\"||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!sr(e[r],t[r]))return!1;return!0}return e===t}function St(e){return Array.isArray(e)?e.map(St):typeof e==\"object\"&&e?co(e,St):e}var ld={};function pe(e){ld[e]||(typeof console<\"u\"&&console.warn(e),ld[e]=!0)}function oi(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function Vf(e,t,r,i){let a=t.y-e.y,n=t.x-e.x,s=i.y-r.y,o=i.x-r.x,l=s*n-o*a;if(l===0)return null;let u=e.y-r.y,h=e.x-r.x,c=(o*u-s*h)/l;return new C(e.x+c*n,e.y+c*a)}function Nf([e,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,[e*Math.cos(t)*Math.sin(r),e*Math.sin(t)*Math.sin(r),e*Math.cos(r)]}function Li(e){return typeof WorkerGlobalScope<\"u\"&&e!==void 0&&e instanceof WorkerGlobalScope}function Uf(e){let t=/(?:^|(?:\\s*\\,\\s*))([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)(?:\\=(?:([^\\x00-\\x20\\(\\)<>@\\,;\\:\\\\\"\\/\\[\\]\\?\\=\\{\\}\\x7F]+)|(?:\\\"((?:[^\"\\\\]|\\\\.)*)\\\")))?/g,r={};if(e.replace(t,(i,a,n,s)=>{let o=n||s;return r[a]=!o||o.toLowerCase(),\"\"}),r[\"max-age\"]){let i=parseInt(r[\"max-age\"],10);isNaN(i)?delete r[\"max-age\"]:r[\"max-age\"]=i}return r}var Ll=null;function $f(e){if(Ll==null){let t=e.navigator?e.navigator.userAgent:null;Ll=!!e.safari||!!(t&&(/\\b(iPad|iPhone|iPod)\\b/.test(t)||t.match(\"Safari\")&&!t.match(\"Chrome\")))}return Ll}function mi(e){return typeof ImageBitmap<\"u\"&&e instanceof ImageBitmap}var jf=async(e,t)=>{if(e.byteLength===0)return createImageBitmap(new ImageData(1,1),t);let r=new Blob([new Uint8Array(e)],{type:\"image/png\"});try{return createImageBitmap(r,t)}catch(i){throw Error(`Could not load image because of ${it(i).message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}},ud=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=\",Gf=e=>new Promise((t,r)=>{let i=new Image;i.onload=()=>{t(i),URL.revokeObjectURL(i.src),i.onload=null,window.requestAnimationFrame(()=>i.src=ud)},i.onerror=()=>r(Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\"));let a=new Blob([new Uint8Array(e)],{type:\"image/png\"});i.src=e.byteLength?URL.createObjectURL(a):ud});function yv(e,t,r,i,a){let n=Math.max(-t,0)*4,s=(Math.max(0,r)-r)*i*4+n,o=i*4,l=Math.max(0,t),u=Math.max(0,r),h=Math.min(e.width,t+i),c=Math.min(e.height,r+a);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:s,stride:o}]}}async function qf(e,t,r,i,a){if(typeof VideoFrame>\"u\")throw Error(\"VideoFrame not supported\");let n=new VideoFrame(e,{timestamp:0});try{let s=n?.format;if(!s||!(s.startsWith(\"BGR\")||s.startsWith(\"RGB\")))throw Error(`Unrecognized format ${s}`);let o=s.startsWith(\"BGR\"),l=new Uint8ClampedArray(i*a*4);if(await n.copyTo(l,yv(e,t,r,i,a)),o)for(let u=0;u<l.length;u+=4){let h=l[u];l[u]=l[u+2],l[u+2]=h}return l}finally{n.close()}}function Vs(e,t,r,i){return e.addEventListener(t,r,i),{unsubscribe:()=>{e.removeEventListener(t,r,i)}}}function Fe(e){return e*Math.PI/180}function Pi(e){return e/Math.PI*180}function yh(e,t){return e.roll==t.roll&&e.pitch==t.pitch&&e.bearing==t.bearing}function Zf(e){let t=new Float64Array(9);rv(t,e);let r=Pi(-Math.asin(te(t[2],-1,1))),i,a;return Math.hypot(t[5],t[8])<.001?(i=0,a=-Pi(Math.atan2(t[3],t[4]))):(i=Pi(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),a=Pi(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:i,pitch:r+90,bearing:a}}function Wf(e,t,r){let i=od(t.x-r.x,t.y-r.y),a=od(e.x-r.x,e.y-r.y),n=i[0]*a[1]-i[1]*a[0];return Pi(Math.atan2(n,dv(i,a)))}function _h(e,t,r){let i=new Float64Array(4);return so(i,e,t-90,r),i}var hr=85.051129,Xf={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Hf={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0};function Yf(e,t){return Xf[t]&&\"touches\"in e}function Kf(e,t){if(!Hf[t])return!1;let r=e,i=r?.target?.ownerDocument?.defaultView||window;return r instanceof i.MouseEvent||r instanceof i.WheelEvent}function Jf(e){return Xf[e]||Hf[e]}var hd=\"AbortError\",Da=class extends Error{constructor(e=hd){super(e instanceof Error?e.message:e),this.name=hd,e instanceof Error&&e.stack&&(this.stack=e.stack)}};function $r(e){return e instanceof Error&&e.name===\"AbortError\"}function po(e){if(e.aborted)throw new Da(e.reason)}var Tr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:\"\"};function xh(e){return Tr.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf(\"://\"))]}function vh(e,t){Tr.REGISTERED_PROTOCOLS[e]=t}var Ns=\"global-dispatcher\",vn=class extends Error{constructor(e,t,r,i){super(`AJAXError: ${t} (${e}): ${r}`),this.status=e,this.statusText=t,this.url=r,this.body=i}};function fo(){if(Li(self))return self.worker?.referrer;if(window.location.protocol===\"blob:\")try{return window.parent.location.href}catch{}return window.location.href}var _v=e=>e.startsWith(\"file:\")||fo()?.startsWith(\"file:\")&&!/^\\w+:/.test(e);async function xv(e,t){let r=new Request(e.url,{method:e.method||\"GET\",body:e.body,credentials:e.credentials,headers:e.headers,cache:e.cache,referrer:fo(),referrerPolicy:e.referrerPolicy,signal:t.signal});e.type===\"json\"&&!r.headers.has(\"Accept\")&&r.headers.set(\"Accept\",\"application/json\");let i;try{i=await fetch(r)}catch(s){throw $r(s)?s:new vn(0,it(s).message,e.url,new Blob)}if(!i.ok){let s=await i.blob();throw new vn(i.status,i.statusText,e.url,s)}let a;a=e.type===\"arrayBuffer\"||e.type===\"image\"?i.arrayBuffer():e.type===\"json\"?i.json():i.text();let n=await a;return po(t.signal),{data:n,cacheControl:i.headers.get(\"Cache-Control\"),expires:i.headers.get(\"Expires\"),etag:i.headers.get(\"ETag\")}}function vv(e,t){return new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(e.method||\"GET\",e.url,!0),(e.type===\"arrayBuffer\"||e.type===\"image\")&&(a.responseType=\"arraybuffer\");for(let n in e.headers)a.setRequestHeader(n,e.headers[n]);e.type===\"json\"&&(a.responseType=\"text\",e.headers?.Accept||a.setRequestHeader(\"Accept\",\"application/json\")),a.withCredentials=e.credentials===\"include\",a.onerror=()=>{i(Error(a.statusText))},a.onload=()=>{if(!t.signal.aborted)if((a.status>=200&&a.status<300||a.status===0)&&a.response!==null){let n=a.response;if(e.type===\"json\")try{n=JSON.parse(a.response)}catch(s){i(s);return}r({data:n,cacheControl:a.getResponseHeader(\"Cache-Control\"),expires:a.getResponseHeader(\"Expires\"),etag:a.getResponseHeader(\"ETag\")})}else{let n=new Blob([a.response],{type:a.getResponseHeader(\"Content-Type\")});i(new vn(a.status,a.statusText,e.url,n))}},t.signal.addEventListener(\"abort\",()=>{a.abort(),i(new Da(t.signal.reason))}),a.send(e.body)})}var $n=async function(e,t){if(e.url.includes(\"://\")&&!/^https?:|^file:/.test(e.url)){let r=xh(e.url);if(r){let i=await r(e,t);return!i.data&&e.type===\"arrayBuffer\"?j(i,{data:new ArrayBuffer(0)}):i}if(Li(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:\"GR\",data:e,targetMapId:Ns},t)}if(!_v(e.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,\"signal\"))return xv(e,t);if(Li(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:\"GR\",data:e,mustQueue:!0,targetMapId:Ns},t)}return vv(e,t)},jn=(e,t)=>$n(j(e,{type:\"json\"}),t),Qf=(e,t)=>$n(j(e,{type:\"arrayBuffer\"}),t);function bh(e){if(!e||e.startsWith(\"data:image/\"))return!0;if(e.startsWith(\"blob:\")&&(e=e.slice(5),e.startsWith(\"null\")))return!1;if(e.indexOf(\"://\")<=0)return!0;let t=new URL(e),r=window.location;return t.protocol===r.protocol&&t.host===r.host}var em=e=>{let t=window.document.createElement(\"video\");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(let i of e){let a=window.document.createElement(\"source\");bh(i)||(t.crossOrigin=\"Anonymous\"),a.src=i,t.appendChild(a)}})};function cd(e,t,r){r[e]?.includes(t)||(r[e]||(r[e]=[]),r[e].push(t))}function Bl(e,t,r){if(r?.[e]){let i=r[e].indexOf(t);i!==-1&&r[e].splice(i,1)}}var Fa=class{constructor(e,t={}){j(this,t),this.type=e}},X=class extends Fa{constructor(e,t={}){super(\"error\",j({error:e},t))}},wt=class{on(e,t){return this._listeners||(this._listeners={}),cd(e,t,this._listeners),{unsubscribe:()=>{this.off(e,t)}}}off(e,t){return Bl(e,t,this._listeners),Bl(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners||(this._oneTimeListeners={}),cd(e,t,this._oneTimeListeners),this):new Promise(r=>this.once(e,r))}fire(e,t){let r=typeof e==\"string\"?new Fa(e,t||{}):e,i=r.type;if(this.listens(i)){r.target=this;let a=this._listeners?.[i]?.slice()??[];for(let o of a)o.call(this,r);let n=this._oneTimeListeners?.[i]?.slice()??[];for(let o of n)Bl(i,o,this._oneTimeListeners),o.call(this,r);let s=this._eventedParent;s&&(j(r,typeof this._eventedParentData==\"function\"?this._eventedParentData():this._eventedParentData),s.fire(r))}else r instanceof X&&console.error(r.error);return this}listens(e){return!!(this._listeners?.[e]?.length||this._oneTimeListeners?.[e]?.length||this._eventedParent?.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}},tm={$version:8,$root:{version:{required:!0,type:\"enum\",values:[8]},name:{type:\"string\"},metadata:{type:\"*\"},center:{type:\"array\",value:\"number\",length:2},centerAltitude:{type:\"number\"},zoom:{type:\"number\"},bearing:{type:\"number\",default:0,period:360,units:\"degrees\"},pitch:{type:\"number\",default:0,units:\"degrees\"},roll:{type:\"number\",default:0,units:\"degrees\"},state:{type:\"state\",default:{}},light:{type:\"light\"},sky:{type:\"sky\"},projection:{type:\"projection\"},terrain:{type:\"terrain\"},sources:{required:!0,type:\"sources\"},sprite:{type:\"sprite\"},glyphs:{type:\"string\"},\"font-faces\":{type:\"fontFaces\"},transition:{type:\"transition\"},layers:{required:!0,type:\"array\",value:\"layer\"}},sources:{\"*\":{type:\"source\"}},source:[\"source_vector\",\"source_raster\",\"source_raster_dem\",\"source_geojson\",\"source_video\",\"source_image\"],source_vector:{type:{required:!0,type:\"enum\",values:{vector:{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:\"enum\",values:{xyz:{},tms:{}},default:\"xyz\"},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},attribution:{type:\"string\"},promoteId:{type:\"promoteId\"},volatile:{type:\"boolean\",default:!1},encoding:{type:\"enum\",values:{mvt:{},mlt:{}},default:\"mvt\"},\"*\":{type:\"*\"}},source_raster:{type:{required:!0,type:\"enum\",values:{raster:{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},tileSize:{type:\"number\",default:512,units:\"pixels\"},scheme:{type:\"enum\",values:{xyz:{},tms:{}},default:\"xyz\"},attribution:{type:\"string\"},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_raster_dem:{type:{required:!0,type:\"enum\",values:{\"raster-dem\":{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},tileSize:{type:\"number\",default:512,units:\"pixels\"},attribution:{type:\"string\"},encoding:{type:\"enum\",values:{terrarium:{},mapbox:{},custom:{}},default:\"mapbox\"},redFactor:{type:\"number\",default:1},blueFactor:{type:\"number\",default:1},greenFactor:{type:\"number\",default:1},baseShift:{type:\"number\",default:0},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_geojson:{type:{required:!0,type:\"enum\",values:{geojson:{}}},data:{required:!0,type:\"*\"},maxzoom:{type:\"number\",default:18},attribution:{type:\"string\"},buffer:{type:\"number\",default:128,maximum:512,minimum:0},filter:{type:\"filter\"},tolerance:{type:\"number\",default:.375},cluster:{type:\"boolean\",default:!1},clusterRadius:{type:\"number\",default:50,minimum:0},clusterMaxZoom:{type:\"number\"},clusterMinPoints:{type:\"number\"},clusterProperties:{type:\"*\"},lineMetrics:{type:\"boolean\",default:!1},generateId:{type:\"boolean\",default:!1},promoteId:{type:\"promoteId\"}},source_video:{type:{required:!0,type:\"enum\",values:{video:{}}},urls:{required:!0,type:\"array\",value:\"string\"},coordinates:{required:!0,type:\"array\",length:4,value:{type:\"array\",length:2,value:\"number\"}}},source_image:{type:{required:!0,type:\"enum\",values:{image:{}}},url:{type:\"string\"},coordinates:{required:!0,type:\"array\",length:4,value:{type:\"array\",length:2,value:\"number\"}}},layer:{id:{type:\"string\",required:!0},type:{type:\"enum\",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},\"fill-extrusion\":{},raster:{},hillshade:{},\"color-relief\":{},background:{}},required:!0},metadata:{type:\"*\"},source:{type:\"string\"},\"source-layer\":{type:\"string\"},minzoom:{type:\"number\",minimum:0,maximum:24},maxzoom:{type:\"number\",minimum:0,maximum:24},filter:{type:\"filter\"},layout:{type:\"layout\"},paint:{type:\"paint\"}},layout:[\"layout_fill\",\"layout_line\",\"layout_circle\",\"layout_heatmap\",\"layout_fill-extrusion\",\"layout_symbol\",\"layout_raster\",\"layout_hillshade\",\"layout_color-relief\",\"layout_background\"],layout_background:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_fill:{\"fill-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_circle:{\"circle-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_heatmap:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},\"layout_fill-extrusion\":{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-rounded-corner-distance\":{type:\"number\",default:0,minimum:0,units:\"meters\",\"property-type\":\"constant\"}},layout_line:{\"line-cap\":{type:\"enum\",values:{butt:{},round:{},square:{}},default:\"butt\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-join\":{type:\"enum\",values:{bevel:{},round:{},miter:{}},default:\"miter\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-miter-limit\":{type:\"number\",default:2,requires:[{\"line-join\":\"miter\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-round-limit\":{type:\"number\",default:1.05,requires:[{\"line-join\":\"round\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_symbol:{\"symbol-placement\":{type:\"enum\",values:{point:{},line:{},\"line-center\":{}},default:\"point\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-spacing\":{type:\"number\",default:250,minimum:1,units:\"pixels\",requires:[{\"symbol-placement\":\"line\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-avoid-edges\":{type:\"boolean\",default:!1,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"symbol-z-order\":{type:\"enum\",values:{auto:{},\"viewport-y\":{},source:{}},default:\"auto\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-allow-overlap\":{type:\"boolean\",default:!1,requires:[\"icon-image\",{\"!\":\"icon-overlap\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-overlap\":{type:\"enum\",values:{never:{},always:{},cooperative:{}},requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-ignore-placement\":{type:\"boolean\",default:!1,requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-optional\":{type:\"boolean\",default:!1,requires:[\"icon-image\",\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-rotation-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-size\":{type:\"number\",default:1,minimum:0,units:\"factor of the original icon size\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-text-fit\":{type:\"enum\",values:{none:{},width:{},height:{},both:{}},default:\"none\",requires:[\"icon-image\",\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-text-fit-padding\":{type:\"array\",value:\"number\",length:4,default:[0,0,0,0],units:\"pixels\",requires:[\"icon-image\",\"text-field\",{\"icon-text-fit\":[\"both\",\"width\",\"height\"]}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-image\":{type:\"resolvedImage\",tokens:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-rotate\":{type:\"number\",default:0,period:360,units:\"degrees\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-padding\":{type:\"padding\",default:[2],units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-keep-upright\":{type:\"boolean\",default:!1,requires:[\"icon-image\",{\"icon-rotation-alignment\":\"map\"},{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-offset\":{type:\"array\",value:\"number\",length:2,default:[0,0],requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-anchor\":{type:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},default:\"center\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotation-alignment\":{type:\"enum\",values:{map:{},viewport:{},\"viewport-glyph\":{},auto:{}},default:\"auto\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-field\":{type:\"formatted\",default:\"\",tokens:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-font\":{type:\"array\",value:\"string\",default:[\"Open Sans Regular\",\"Arial Unicode MS Regular\"],requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-size\":{type:\"number\",default:16,minimum:0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-width\":{type:\"number\",default:10,minimum:0,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-line-height\":{type:\"number\",default:1.2,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-letter-spacing\":{type:\"number\",default:0,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-justify\":{type:\"enum\",values:{auto:{},left:{},center:{},right:{}},default:\"center\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-radial-offset\":{type:\"number\",units:\"ems\",default:0,requires:[\"text-field\"],\"property-type\":\"data-driven\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]}},\"text-variable-anchor\":{type:\"array\",value:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-variable-anchor-offset\":{type:\"variableAnchorOffsetCollection\",requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-anchor\":{type:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},default:\"center\",requires:[\"text-field\",{\"!\":\"text-variable-anchor\"}],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-angle\":{type:\"number\",default:45,units:\"degrees\",requires:[\"text-field\",{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-writing-mode\":{type:\"array\",value:\"enum\",values:{horizontal:{},vertical:{}},requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotate\":{type:\"number\",default:0,period:360,units:\"degrees\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-padding\":{type:\"number\",default:2,minimum:0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-keep-upright\":{type:\"boolean\",default:!0,requires:[\"text-field\",{\"text-rotation-alignment\":\"map\"},{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-transform\":{type:\"enum\",values:{none:{},uppercase:{},lowercase:{}},default:\"none\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-offset\":{type:\"array\",value:\"number\",units:\"ems\",length:2,default:[0,0],requires:[\"text-field\",{\"!\":\"text-radial-offset\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-allow-overlap\":{type:\"boolean\",default:!1,requires:[\"text-field\",{\"!\":\"text-overlap\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-overlap\":{type:\"enum\",values:{never:{},always:{},cooperative:{}},requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-ignore-placement\":{type:\"boolean\",default:!1,requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-optional\":{type:\"boolean\",default:!1,requires:[\"text-field\",\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-height-offset\":{type:\"number\",default:0,units:\"meters\",requires:[{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"symbol-height-anchor\":{type:\"enum\",values:{ground:{},absolute:{}},default:\"ground\",requires:[\"symbol-height-offset\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_raster:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_hillshade:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},\"layout_color-relief\":{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},filter:{type:\"boolean\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},filter_operator:{type:\"enum\",values:{\"==\":{},\"!=\":{},\">\":{},\">=\":{},\"<\":{},\"<=\":{},in:{},\"!in\":{},all:{},any:{},none:{},has:{},\"!has\":{}}},geometry_type:{type:\"enum\",values:{Point:{},LineString:{},Polygon:{}}},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:{},exponential:{},interval:{},categorical:{}},default:\"exponential\"},colorSpace:{type:\"enum\",values:{rgb:{},lab:{},hcl:{}},default:\"rgb\"},default:{type:\"*\",required:!1}},function_stop:{type:\"array\",minimum:0,maximum:24,value:[\"number\",\"color\"],length:2},expression:{type:\"array\",value:\"expression_name\",minimum:1},light:{anchor:{type:\"enum\",default:\"viewport\",values:{map:{},viewport:{}},\"property-type\":\"data-constant\",transition:!1,expression:{interpolated:!1,parameters:[\"zoom\"]}},position:{type:\"array\",default:[1.15,210,30],length:3,value:\"number\",\"property-type\":\"data-constant\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]}},color:{type:\"color\",\"property-type\":\"data-constant\",default:\"#ffffff\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},intensity:{type:\"number\",\"property-type\":\"data-constant\",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0}},sky:{\"sky-color\":{type:\"color\",\"property-type\":\"data-constant\",default:\"#88C6FC\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"horizon-color\":{type:\"color\",\"property-type\":\"data-constant\",default:\"#ffffff\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"fog-color\":{type:\"color\",\"property-type\":\"data-constant\",default:\"#ffffff\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"fog-ground-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"horizon-fog-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"sky-horizon-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"atmosphere-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0}},terrain:{source:{type:\"string\",required:!0},exaggeration:{type:\"number\",minimum:0,default:1}},projection:{type:{type:\"projectionDefinition\",default:\"mercator\",\"property-type\":\"data-constant\",transition:!1,expression:{interpolated:!0,parameters:[\"zoom\"]}}},paint:[\"paint_fill\",\"paint_line\",\"paint_circle\",\"paint_heatmap\",\"paint_fill-extrusion\",\"paint_symbol\",\"paint_raster\",\"paint_hillshade\",\"paint_color-relief\",\"paint_background\"],paint_fill:{\"fill-antialias\":{type:\"boolean\",default:!0,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-layer-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"global-state\"]},\"property-type\":\"data-constant\"},\"fill-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-outline-color\":{type:\"color\",transition:!0,requires:[{\"!\":\"fill-pattern\"},{\"fill-antialias\":!0}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"fill-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"}},\"paint_fill-extrusion\":{\"fill-extrusion-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"fill-extrusion-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"fill-extrusion-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"fill-extrusion-height\":{type:\"number\",default:0,minimum:0,units:\"meters\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-base\":{type:\"number\",default:0,minimum:0,units:\"meters\",transition:!0,requires:[\"fill-extrusion-height\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-vertical-gradient\":{type:\"boolean\",default:!0,transition:!1,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_line:{\"line-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-layer-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"global-state\"]},\"property-type\":\"data-constant\"},\"line-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"line-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"line-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-width\":{type:\"number\",default:1,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-gap-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-offset\":{type:\"number\",default:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-dasharray\":{type:\"array\",value:\"number\",minimum:0,transition:!0,units:\"line widths\",requires:[{\"!\":\"line-pattern\"}],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"line-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"line-gradient\":{type:\"color\",transition:!1,requires:[{\"!\":\"line-dasharray\"},{\"!\":\"line-pattern\"},{source:\"geojson\",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:[\"line-progress\"]},\"property-type\":\"color-ramp\"}},paint_circle:{\"circle-radius\":{type:\"number\",default:5,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-blur\":{type:\"number\",default:0,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"circle-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-scale\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{}},default:\"viewport\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-stroke-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"}},paint_heatmap:{\"heatmap-radius\":{type:\"number\",default:30,minimum:1,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-weight\":{type:\"number\",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-intensity\":{type:\"number\",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"heatmap-color\":{type:\"color\",default:[\"interpolate\",[\"linear\"],[\"heatmap-density\"],0,\"rgba(0, 0, 255, 0)\",.1,\"royalblue\",.3,\"cyan\",.5,\"lime\",.7,\"yellow\",1,\"red\"],transition:!1,expression:{interpolated:!0,parameters:[\"heatmap-density\"]},\"property-type\":\"color-ramp\"},\"heatmap-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_symbol:{\"icon-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-color\":{type:\"color\",default:\"rgba(0, 0, 0, 0)\",transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"icon-image\",\"icon-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-color\":{type:\"color\",default:\"#000000\",transition:!0,overridable:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-color\":{type:\"color\",default:\"rgba(0, 0, 0, 0)\",transition:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"text-field\",\"text-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_raster:{\"raster-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-hue-rotate\":{type:\"number\",default:0,period:360,transition:!0,units:\"degrees\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-min\":{type:\"number\",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-max\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-saturation\":{type:\"number\",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-contrast\":{type:\"number\",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},resampling:{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-resampling\":{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-fade-duration\":{type:\"number\",default:300,minimum:0,transition:!1,units:\"milliseconds\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-color\":{type:\"color\",transition:!1,expression:{interpolated:!0,parameters:[\"raster-value\"]},\"property-type\":\"color-ramp\"},\"raster-color-mix\":{type:\"array\",default:[1,0,0,0],length:4,value:\"number\",\"property-type\":\"data-constant\",transition:!0,requires:[\"raster-color\"],expression:{interpolated:!0,parameters:[\"zoom\"]}},\"raster-color-range\":{type:\"array\",default:[0,1],length:2,value:\"number\",\"property-type\":\"data-constant\",transition:!0,requires:[\"raster-color\"],expression:{interpolated:!0,parameters:[\"zoom\"]}}},paint_hillshade:{\"hillshade-illumination-direction\":{type:\"numberArray\",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-illumination-altitude\":{type:\"numberArray\",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-illumination-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"viewport\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-exaggeration\":{type:\"number\",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-shadow-color\":{type:\"colorArray\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-highlight-color\":{type:\"colorArray\",default:\"#FFFFFF\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-accent-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-method\":{type:\"enum\",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:\"standard\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},resampling:{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},\"paint_color-relief\":{\"color-relief-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"color-relief-color\":{type:\"color\",transition:!1,expression:{interpolated:!0,parameters:[\"elevation\"]},\"property-type\":\"color-ramp\"},resampling:{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_background:{\"background-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"background-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"background-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"cross-faded\"},\"background-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},transition:{duration:{type:\"number\",default:300,minimum:0,units:\"milliseconds\"},delay:{type:\"number\",default:0,minimum:0,units:\"milliseconds\"}},\"property-type\":{\"data-driven\":{type:\"property-type\"},\"cross-faded\":{type:\"property-type\"},\"cross-faded-data-driven\":{type:\"property-type\"},\"color-ramp\":{type:\"property-type\"},\"data-constant\":{type:\"property-type\"},constant:{type:\"property-type\"}},promoteId:{\"*\":{type:\"string\"}},interpolation:{type:\"array\",value:\"interpolation_name\",minimum:1},interpolation_name:{type:\"enum\",values:{linear:{syntax:{overloads:[{parameters:[],\"output-type\":\"interpolation\"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:[\"base\"],\"output-type\":\"interpolation\"}],parameters:[{name:\"base\",type:\"number literal\"}]}},\"cubic-bezier\":{syntax:{overloads:[{parameters:[\"x1\",\"y1\",\"x2\",\"y2\"],\"output-type\":\"interpolation\"}],parameters:[{name:\"x1\",type:\"number literal\"},{name:\"y1\",type:\"number literal\"},{name:\"x2\",type:\"number literal\"},{name:\"y2\",type:\"number literal\"}]}}}}},P=tm,rm=[\"type\",\"source\",\"source-layer\",\"minzoom\",\"maxzoom\",\"filter\",\"layout\"],L=class{constructor(e,t,r,i,a=\"error\"){this.message=(e?`${e}: `:\"\")+r,i&&(this.identifier=i),this.severity=a,t!=null&&t.__line__&&(this.line=t.__line__)}},za={kind:\"null\"},O={kind:\"number\"},Q={kind:\"string\"},ie={kind:\"boolean\"},nr={kind:\"color\"},mo={kind:\"projectionDefinition\"},Di={kind:\"object\"},ee={kind:\"value\"},bv={kind:\"error\"},go={kind:\"collator\"},Gn={kind:\"formatted\"},yo={kind:\"padding\"},bn={kind:\"colorArray\"},_o={kind:\"numberArray\"},qn={kind:\"resolvedImage\"},xo={kind:\"variableAnchorOffsetCollection\"};function vt(e,t){return{kind:\"array\",itemType:e,N:t}}function ve(e){if(e.kind===\"array\"){let t=ve(e.itemType);return typeof e.N==\"number\"?`array<${t}, ${e.N}>`:e.itemType.kind===\"value\"?\"array\":`array<${t}>`}return e.kind}var wv=[za,O,Q,ie,nr,mo,Gn,Di,vt(ee),yo,_o,bn,qn,xo];function wn(e,t){if(t.kind===\"error\")return null;if(e.kind===\"array\"){if(t.kind===\"array\"&&(t.N===0&&t.itemType.kind===\"value\"||!wn(e.itemType,t.itemType))&&(typeof e.N!=\"number\"||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind===\"value\"){for(let r of wv)if(!wn(r,t))return null}}return`Expected ${ve(e)} but found ${ve(t)} instead.`}function vo(e,t){return t.some(r=>r.kind===e.kind)}function li(e,t){return t.some(r=>r===\"null\"?e===null:r===\"array\"?Array.isArray(e):r===\"object\"?e&&!Array.isArray(e)&&typeof e==\"object\":r===typeof e)}function ri(e,t){return e.kind===\"array\"&&t.kind===\"array\"?e.itemType.kind===t.itemType.kind&&typeof e.N==\"number\":e.kind===t.kind}var im=.96422,am=.82521,nm=4/29,eu=6/29,sm=3*eu*eu,Tv=Math.PI/180,Sv=180/Math.PI;function om(e){return e%=360,e<0&&(e+=360),e}function lm([e,t,r,i]){e=Ol(e),t=Ol(t),r=Ol(r);let a,n,s=Vl((.2225045*e+.7168786*t+.0606169*r)/1);e===t&&t===r?a=n=s:(a=Vl((.4360747*e+.3850649*t+.1430804*r)/im),n=Vl((.0139322*e+.0971045*t+.7141733*r)/am));let o=116*s-16;return[o<0?0:o,500*(a-s),200*(s-n),i]}function Ol(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Vl(e){return e>.008856451679035631?e**(1/3):e/sm+nm}function um([e,t,r,i]){let a=(e+16)/116,n=isNaN(t)?a:a+t/500,s=isNaN(r)?a:a-r/200;return a=1*Ul(a),n=im*Ul(n),s=am*Ul(s),[Nl(3.1338561*n-1.6168667*a-.4906146*s),Nl(-.9787684*n+1.9161415*a+.033454*s),Nl(.0719453*n-.2289914*a+1.4052427*s),i]}function Nl(e){return e=e<=.00304?12.92*e:1.055*e**(1/2.4)-.055,e<0?0:e>1?1:e}function Ul(e){return e>eu?e*e*e:sm*(e-nm)}function Ev(e){let[t,r,i,a]=lm(e),n=Math.sqrt(r*r+i*i);return[Math.round(n*1e4)?om(Math.atan2(i,r)*Sv):NaN,n,t,a]}function Iv([e,t,r,i]){return e=isNaN(e)?0:e*Tv,um([r,Math.cos(e)*t,Math.sin(e)*t,i])}function Av([e,t,r,i]){e=om(e),t/=100,r/=100;function a(n){let s=(n+e/30)%12,o=t*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(s-3,9-s,1))}return[a(0),a(8),a(4),i]}var Mv=Object.hasOwn||function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};function fn(e,t){return Mv(e,t)?e[t]:void 0}function Pv(e){if(e=e.toLowerCase().trim(),e===\"transparent\")return[0,0,0,0];let t=fn(Cv,e);if(t){let[i,a,n]=t;return[i/255,a/255,n/255,1]}if(e.startsWith(\"#\")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let i=e.length<6?1:2,a=1;return[Es(e.slice(a,a+=i)),Es(e.slice(a,a+=i)),Es(e.slice(a,a+=i)),Es(e.slice(a,a+i)||\"ff\")]}if(e.startsWith(\"rgb\")){let i=e.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(i){let[a,n,s,o,l,u,h,c,p,d,f,m]=i,g=[o||\" \",h||\" \",d].join(\"\");if(g===\"  \"||g===\"  /\"||g===\",,\"||g===\",,,\"){let y=[s,u,p].join(\"\"),_=y===\"%%%\"?100:y===\"\"?255:0;if(_){let x=[sa(+n/_,0,1),sa(+l/_,0,1),sa(+c/_,0,1),f?pd(+f,m):1];if(dd(x))return x}}return}}let r=e.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(r){let[i,a,n,s,o,l,u,h,c]=r,p=[n||\" \",o||\" \",u].join(\"\");if(p===\"  \"||p===\"  /\"||p===\",,\"||p===\",,,\"){let d=[+a,sa(+s,0,100),sa(+l,0,100),h?pd(+h,c):1];if(dd(d))return Av(d)}}}function Es(e){return parseInt(e.padEnd(2,e),16)/255}function pd(e,t){return sa(t?e/100:e,0,1)}function sa(e,t,r){return Math.min(Math.max(t,e),r)}function dd(e){return!e.some(Number.isNaN)}var Cv={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function ui(e,t,r){return e+r*(t-e)}function ya(e,t,r){return e.map((i,a)=>ui(i,t[a],r))}function kv(e){return e===\"rgb\"||e===\"hcl\"||e===\"lab\"}var rt,J=(rt=class{constructor(t,r,i,a=1,n=!0){this.r=t,this.g=r,this.b=i,this.a=a,n||(this.r*=a,this.g*=a,this.b*=a,a||this.overwriteGetter(\"rgb\",[t,r,i,a]))}static parse(t){if(t instanceof rt)return t;if(typeof t!=\"string\")return;let r=Pv(t);if(r)return new rt(...r,!1)}get rgb(){let{r:t,g:r,b:i,a}=this,n=a||1/0;return this.overwriteGetter(\"rgb\",[t/n,r/n,i/n,a])}get hcl(){return this.overwriteGetter(\"hcl\",Ev(this.rgb))}get lab(){return this.overwriteGetter(\"lab\",lm(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){let[t,r,i,a]=this.rgb;return`rgba(${[t,r,i].map(n=>Math.round(n*255)).join(\",\")},${a})`}static interpolate(t,r,i,a=\"rgb\"){switch(a){case\"rgb\":{let[n,s,o,l]=ya(t.rgb,r.rgb,i);return new rt(n,s,o,l,!1)}case\"hcl\":{let[n,s,o,l]=t.hcl,[u,h,c,p]=r.hcl,d,f;if(!isNaN(n)&&!isNaN(u)){let x=u-n;u>n&&x>180?x-=360:u<n&&n-u>180&&(x+=360),d=n+i*x}else isNaN(n)?isNaN(u)?d=NaN:(d=u,(o===1||o===0)&&(f=h)):(d=n,(c===1||c===0)&&(f=s));let[m,g,y,_]=Iv([d,f??ui(s,h,i),ui(o,c,i),ui(l,p,i)]);return new rt(m,g,y,_,!1)}case\"lab\":{let[n,s,o,l]=um(ya(t.lab,r.lab,i));return new rt(n,s,o,l,!1)}}}},rt.black=new rt(0,0,0,1),rt.white=new rt(1,1,1,1),rt.transparent=new rt(0,0,0,0),rt.red=new rt(1,0,0,1),rt),Dv=[\"bottom\",\"center\",\"top\"],tu=class{constructor(e,t,r,i,a,n){this.text=e,this.image=t,this.scale=r,this.fontStack=i,this.textColor=a,this.verticalAlign=n}},Br=class zs{constructor(t){this.sections=t}static fromString(t){return new zs([new tu(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof zs?t:zs.fromString(t)}toString(){return this.sections.length===0?\"\":this.sections.map(t=>t.text).join(\"\")}},Sr=class sn{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof sn)return t;if(typeof t==\"number\")return new sn([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let r of t)if(typeof r!=\"number\")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new sn(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i){return new sn(ya(t.values,r.values,i))}},Er=class on{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof on)return t;if(typeof t==\"number\")return new on([t]);if(Array.isArray(t)){for(let r of t)if(typeof r!=\"number\")return;return new on(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i){return new on(ya(t.values,r.values,i))}},Xt=class ln{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ln)return t;if(typeof t==\"string\"){let i=J.parse(t);return i?new ln([i]):void 0}if(!Array.isArray(t))return;let r=[];for(let i of t){if(typeof i!=\"string\")return;let a=J.parse(i);if(!a)return;r.push(a)}return new ln(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i,a=\"rgb\"){let n=[];if(t.values.length!=r.values.length)throw Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let s=0;s<t.values.length;s++)n.push(J.interpolate(t.values[s],r.values[s],i,a));return new ln(n)}},we=class extends Error{constructor(e,t){super(e),this.name=\"RuntimeError\",this.path=t}toJSON(){return this.message}},Fv=new Set([\"center\",\"left\",\"right\",\"top\",\"bottom\",\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"]),gi=class Rs{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Rs)return t;if(!(!Array.isArray(t)||t.length<1||t.length%2!=0)){for(let r=0;r<t.length;r+=2){let i=t[r],a=t[r+1];if(typeof i!=\"string\"||!Fv.has(i)||!Array.isArray(a)||a.length!==2||typeof a[0]!=\"number\"||typeof a[1]!=\"number\")return}return new Rs(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,i,a){let n=t.values,s=r.values;if(n.length!==s.length)throw new we(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`,a);let o=[];for(let l=0;l<n.length;l+=2){if(n[l]!==s[l])throw new we(`Cannot interpolate values containing mismatched anchors. from[${l}]: ${n[l]}, to[${l}]: ${s[l]}`,a);o.push(n[l]);let[u,h]=n[l+1],[c,p]=s[l+1];o.push([ui(u,c,i),ui(h,p,i)])}return new Rs(o)}},br=class hm{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new hm({name:t,available:!1}):null}},jr=class oa{constructor(t,r,i){this.from=t,this.to=r,this.transition=i}toString(){return this.from===this.to&&this.transition===1?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(t,r,i){return new oa(t,r,i)}static parse(t){if(t instanceof oa)return t;if(Array.isArray(t)&&t.length===3&&typeof t[0]==\"string\"&&typeof t[1]==\"string\"&&typeof t[2]==\"number\")return new oa(t[0],t[1],t[2]);if(typeof t==\"object\"&&typeof t.from==\"string\"&&typeof t.to==\"string\"&&typeof t.transition==\"number\")return new oa(t.from,t.to,t.transition);if(typeof t==\"string\")return new oa(t,t,1)}},wh=class{constructor(e,t,r){this.sensitivity=e?t?\"variant\":\"case\":t?\"accent\":\"base\",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:\"search\"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};function cm(e,t,r,i){return typeof e==\"number\"&&e>=0&&e<=255&&typeof t==\"number\"&&t>=0&&t<=255&&typeof r==\"number\"&&r>=0&&r<=255?i===void 0||typeof i==\"number\"&&i>=0&&i<=1?null:`Invalid rgba value [${[e,t,r,i].join(\", \")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof i==\"number\"?[e,t,r,i]:[e,t,r]).join(\", \")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function _a(e){if(e===null||typeof e==\"string\"||typeof e==\"boolean\"||typeof e==\"number\"||e instanceof jr||e instanceof J||e instanceof wh||e instanceof Br||e instanceof Sr||e instanceof Er||e instanceof Xt||e instanceof gi||e instanceof br)return!0;if(Array.isArray(e)){for(let t of e)if(!_a(t))return!1;return!0}if(typeof e==\"object\"){for(let t in e)if(!_a(e[t]))return!1;return!0}return!1}function Pe(e){if(e===null)return za;if(typeof e==\"string\")return Q;if(typeof e==\"boolean\")return ie;if(typeof e==\"number\")return O;if(e instanceof J)return nr;if(e instanceof jr)return mo;if(e instanceof wh)return go;if(e instanceof Br)return Gn;if(e instanceof Sr)return yo;if(e instanceof Er)return _o;if(e instanceof Xt)return bn;if(e instanceof gi)return xo;if(e instanceof br)return qn;if(Array.isArray(e)){let t=e.length,r;for(let i of e){let a=Pe(i);if(!r)r=a;else{if(r===a)continue;r=ee;break}}return vt(r||ee,t)}return Di}function mn(e){let t=typeof e;return e===null?\"\":t===\"string\"||t===\"number\"||t===\"boolean\"?String(e):e instanceof J||e instanceof jr||e instanceof Br||e instanceof Sr||e instanceof Er||e instanceof Xt||e instanceof gi||e instanceof br?e.toString():JSON.stringify(e)}var xa=class pm{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!_a(t[1]))return r.error(`invalid value of type \"${typeof t[1]}\"`);let i=t[1],a=Pe(i),n=r.expectedType;return a.kind===\"array\"&&a.N===0&&n&&n.kind===\"array\"&&(typeof n.N!=\"number\"||n.N===0)&&(a=n),new pm(a,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},zv=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"],dm=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&\"id\"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type==\"number\"?zv[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&\"geometry\"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let t=this._parseColorCache.get(e);return t||(t=J.parse(e),this._parseColorCache.set(e,t)),t}};function bo(e,t,r){let i=e.length-1,a=0,n=i,s=0,o,l;for(;a<=n;)if(s=Math.floor((a+n)/2),o=e[s],l=e[s+1],o<=t){if(s===i||t<l)return s;a=s+1}else if(o>t)n=s-1;else throw new we(\"Input is not a number.\",r);return 0}var Th=class fm{constructor(t,r,i,a){this.type=t,this.input=r,this.key=a,this.labels=[],this.outputs=[];for(let[n,s]of i)this.labels.push(n),this.outputs.push(s)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error(\"Expected an even number of arguments.\");let i=r.parse(t[1],1,O);if(!i)return null;let a=[],n=null;r.expectedType&&r.expectedType.kind!==\"value\"&&(n=r.expectedType);for(let s=1;s<t.length;s+=2){let o=s===1?-1/0:t[s],l=t[s+1],u=s,h=s+1;if(typeof o!=\"number\")return r.error('Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.',u);if(a.length&&a[a.length-1][0]>=o)return r.error('Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.',u);let c=r.parse(l,h,n);if(!c)return null;n||(n=c.type),a.push([o,c])}return new fm(n,i,a,r.key)}evaluate(t){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(t);let a=this.input.evaluate(t);if(a<=r[0])return i[0].evaluate(t);let n=r.length;return a>=r[n-1]?i[n-1].evaluate(t):i[bo(r,a,this.key)].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Rv(e,t,r,i){let a=3*e,n=3*(r-e)-a,s=1-a-n,o=3*t,l=3*(i-t)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let m=0;m<8;m++){let g=((s*p+n)*p+a)*p-h;if(Math.abs(g)<c)return((u*p+l)*p+o)*p;let y=(3*s*p+2*n)*p+a;if(Math.abs(y)<1e-6)break;p-=g/y}let d=0,f=1;p=h;for(let m=0;m<20;m++){let g=((s*p+n)*p+a)*p;if(Math.abs(g-h)<c)break;h>g?d=p:f=p,p=(d+f)*.5}return((u*p+l)*p+o)*p}}var Ht=class ru{constructor(t,r,i,a,n,s){this.type=t,this.operator=r,this.interpolation=i,this.input=a,this.key=s,this.labels=[],this.outputs=[];for(let[o,l]of n)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(t,r,i,a){let n=0;if(t.name===\"exponential\")n=$l(r,t.base,i,a);else if(t.name===\"linear\")n=$l(r,1,i,a);else if(t.name===\"cubic-bezier\"){let s=t.controlPoints;n=Rv(s[0],s[1],s[2],s[3])($l(r,1,i,a))}return n}static parse(t,r){let[i,a,n,...s]=t;if(!Array.isArray(a)||a.length===0)return r.error(\"Expected an interpolation type expression.\",1);if(a[0]===\"linear\")a={name:\"linear\"};else if(a[0]===\"exponential\"){let u=a[1];if(typeof u!=\"number\")return r.error(\"Exponential interpolation requires a numeric base.\",1,1);a={name:\"exponential\",base:u}}else if(a[0]===\"cubic-bezier\"){let u=a.slice(1);if(u.length!==4||u.some(h=>typeof h!=\"number\"||h<0||h>1))return r.error(\"Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.\",1);a={name:\"cubic-bezier\",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(a[0])}`,1,0);if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error(\"Expected an even number of arguments.\");if(n=r.parse(n,2,O),!n)return null;let o=[],l=null;(i===\"interpolate-hcl\"||i===\"interpolate-lab\")&&r.expectedType!=bn?l=nr:r.expectedType&&r.expectedType.kind!==\"value\"&&(l=r.expectedType);for(let u=0;u<s.length;u+=2){let h=s[u],c=s[u+1],p=u+3,d=u+4;if(typeof h!=\"number\")return r.error('Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.',p);if(o.length&&o[o.length-1][0]>=h)return r.error('Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.',p);let f=r.parse(c,d,l);if(!f)return null;l||(l=f.type),o.push([h,f])}return!ri(l,O)&&!ri(l,mo)&&!ri(l,nr)&&!ri(l,yo)&&!ri(l,_o)&&!ri(l,bn)&&!ri(l,xo)&&!ri(l,vt(O))?r.error(`Type ${ve(l)} is not interpolatable.`):new ru(l,i,a,n,o,r.key)}evaluate(t){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(t);let a=this.input.evaluate(t);if(a<=r[0])return i[0].evaluate(t);let n=r.length;if(a>=r[n-1])return i[n-1].evaluate(t);let s=bo(r,a,this.key),o=r[s],l=r[s+1],u=ru.interpolationFactor(this.interpolation,a,o,l),h=i[s].evaluate(t),c=i[s+1].evaluate(t);switch(this.operator){case\"interpolate\":switch(this.type.kind){case\"number\":return ui(h,c,u);case\"color\":return J.interpolate(h,c,u);case\"padding\":return Sr.interpolate(h,c,u);case\"colorArray\":return Xt.interpolate(h,c,u);case\"numberArray\":return Er.interpolate(h,c,u);case\"variableAnchorOffsetCollection\":return gi.interpolate(h,c,u,this.key);case\"array\":return ya(h,c,u);case\"projectionDefinition\":return jr.interpolate(h,c,u)}case\"interpolate-hcl\":switch(this.type.kind){case\"color\":return J.interpolate(h,c,u,\"hcl\");case\"colorArray\":return Xt.interpolate(h,c,u,\"hcl\")}case\"interpolate-lab\":switch(this.type.kind){case\"color\":return J.interpolate(h,c,u,\"lab\");case\"colorArray\":return Xt.interpolate(h,c,u,\"lab\")}}}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function $l(e,t,r,i){let a=i-r,n=e-r;return a===0?0:t===1?n/a:(t**+n-1)/(t**+a-1)}var Ve={color:J.interpolate,number:ui,padding:Sr.interpolate,numberArray:Er.interpolate,colorArray:Xt.interpolate,variableAnchorOffsetCollection:gi.interpolate,array:ya},mm=class gm{constructor(t){this.type=Gn,this.sections=t}static parse(t,r){if(t.length<2)return r.error(\"Expected at least one argument.\");let i=t[1];if(!Array.isArray(i)&&typeof i==\"object\")return r.error(\"First argument must be an image or text section.\");let a=[],n=!1;for(let s=1;s<=t.length-1;++s){let o=t[s];if(n&&typeof o==\"object\"&&!Array.isArray(o)){n=!1;let l=null;if(o[\"font-scale\"]&&(l=r.parse(o[\"font-scale\"],1,O),!l))return null;let u=null;if(o[\"text-font\"]&&(u=r.parse(o[\"text-font\"],1,vt(Q)),!u))return null;let h=null;if(o[\"text-color\"]&&(h=r.parse(o[\"text-color\"],1,nr),!h))return null;let c=null;if(o[\"vertical-align\"]){if(typeof o[\"vertical-align\"]==\"string\"&&!Dv.includes(o[\"vertical-align\"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${o[\"vertical-align\"]}' instead.`);if(c=r.parse(o[\"vertical-align\"],1,Q),!c)return null}let p=a[a.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=r.parse(t[s],1,ee);if(!l)return null;let u=l.type.kind;if(u!==\"string\"&&u!==\"value\"&&u!==\"null\"&&u!==\"resolvedImage\")return r.error(\"Formatted text type must be 'string', 'value', 'image' or 'null'.\");n=!0,a.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new gm(a)}evaluate(t){return new Br(this.sections.map(r=>{let i=r.content.evaluate(t);return Pe(i)===qn?new tu(\"\",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new tu(mn(i),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(\",\"):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)}))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}};function ym(e,t,r=0,i=e.length-1,a=Lv){for(;i>r;){if(i-r>600){let l=i-r+1,u=t-r+1,h=Math.log(l),c=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1);ym(e,t,Math.max(r,Math.floor(t-u*c/l+p)),Math.min(i,Math.floor(t+(l-u)*c/l+p)),a)}let n=e[t],s=r,o=i;for(Qa(e,r,t),a(e[i],n)>0&&Qa(e,r,i);s<o;){for(Qa(e,s,o),s++,o--;a(e[s],n)<0;)s++;for(;a(e[o],n)>0;)o--}a(e[r],n)===0?Qa(e,r,o):(o++,Qa(e,o,i)),o<=t&&(r=o+1),t<=o&&(i=o-1)}}function Qa(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function Lv(e,t){return e<t?-1:+(e>t)}function Sh(e,t){if(e.length<=1)return[e];let r=[],i,a;for(let n of e){let s=Ov(n);s!==0&&(n.area=Math.abs(s),a===void 0&&(a=s<0),a===s<0?(i&&r.push(i),i=[n]):i.push(n))}if(i&&r.push(i),t>1)for(let n=0;n<r.length;n++)r[n].length<=t||(ym(r[n],t,1,r[n].length-1,Bv),r[n]=r[n].slice(0,t));return r}function Bv(e,t){return t.area-e.area}function Ov(e){let t=0;for(let r=0,i=e.length,a=i-1,n,s;r<i;a=r++)n=e[r],s=e[a],t+=(s.x-n.x)*(n.y+s.y);return t}var Is={string:Q,number:O,boolean:ie,object:Di},Dr=class _m{constructor(t,r,i){this.type=t,this.args=r,this.key=i}static parse(t,r){if(t.length<2)return r.error(\"Expected at least one argument.\");let i=1,a,n=t[0];if(n===\"array\"){let o;if(t.length>2){let u=t[1];if(typeof u!=\"string\"||!(u in Is)||u===\"object\")return r.error('The item type argument of \"array\" must be one of string, number, boolean',1);o=Is[u],i++}else o=ee;let l;if(t.length>3){if(t[2]!==null&&(typeof t[2]!=\"number\"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to \"array\" must be a positive integer literal',2);l=t[2],i++}a=vt(o,l)}else{if(!Is[n])throw Error(`Types doesn't contain name = ${n}`);a=Is[n]}let s=[];for(;i<t.length;i++){let o=r.parse(t[i],i,ee);if(!o)return null;s.push(o)}return new _m(a,s,r.key)}evaluate(t){for(let r=0;r<this.args.length;r++){let i=this.args[r].evaluate(t);if(!wn(this.type,Pe(i)))return i;if(r===this.args.length-1)throw new we(`Expected value to be of type ${ve(this.type)}, but found ${ve(Pe(i))} instead.`,this.key)}throw Error()}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},fd={\"to-boolean\":ie,\"to-color\":nr,\"to-number\":O,\"to-string\":Q},ha=class xm{constructor(t,r,i){this.type=t,this.args=r,this.key=i}static parse(t,r){if(t.length<2)return r.error(\"Expected at least one argument.\");let i=t[0];if(!fd[i])throw Error(`Can't parse ${i} as it is not part of the known types`);if((i===\"to-boolean\"||i===\"to-string\")&&t.length!==2)return r.error(\"Expected one argument.\");let a=fd[i],n=[];for(let s=1;s<t.length;s++){let o=r.parse(t[s],s,ee);if(!o)return null;n.push(o)}return new xm(a,n,r.key)}evaluate(t){switch(this.type.kind){case\"boolean\":return!!this.args[0].evaluate(t);case\"color\":{let r,i;for(let a of this.args){if(r=a.evaluate(t),i=null,r instanceof J)return r;if(typeof r==\"string\"){let n=t.parseColor(r);if(n)return n}else if(Array.isArray(r)&&(i=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:cm(r[0],r[1],r[2],r[3]),!i))return new J(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new we(i||`Could not parse color from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"padding\":{let r;for(let i of this.args){r=i.evaluate(t);let a=Sr.parse(r);if(a)return a}throw new we(`Could not parse padding from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"numberArray\":{let r;for(let i of this.args){r=i.evaluate(t);let a=Er.parse(r);if(a)return a}throw new we(`Could not parse numberArray from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"colorArray\":{let r;for(let i of this.args){r=i.evaluate(t);let a=Xt.parse(r);if(a)return a}throw new we(`Could not parse colorArray from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"variableAnchorOffsetCollection\":{let r;for(let i of this.args){r=i.evaluate(t);let a=gi.parse(r);if(a)return a}throw new we(`Could not parse variableAnchorOffsetCollection from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}case\"number\":{let r=null;for(let i of this.args){if(r=i.evaluate(t),r===null)return 0;let a=Number(r);if(!isNaN(a))return a}throw new we(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case\"formatted\":return Br.fromString(mn(this.args[0].evaluate(t)));case\"resolvedImage\":return br.fromString(mn(this.args[0].evaluate(t)));case\"projectionDefinition\":{let r=this.args[0].evaluate(t);if(jr.parse(r))return r;throw new we(`Could not parse projectionDefinition from value '${typeof r==\"string\"?r:JSON.stringify(r)}'`,this.key)}default:return mn(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},vm=class bm{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);let i=[];for(let n=1;n<t.length-1;n+=2){let s=t[n];if(typeof s!=\"string\")return r.error(`Expected string, but found ${typeof s} instead.`,n);if(/[^a-zA-Z0-9_]/.test(s))return r.error(\"Variable names must contain only alphanumeric characters or '_'.\",n);let o=r.parse(t[n+1],n+1);if(!o)return null;i.push([s,o])}let a=r.parse(t[t.length-1],t.length-1,r.expectedType,i);return a?new bm(i,a):null}outputDefined(){return this.result.outputDefined()}},wm=class Tm{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!=\"string\")return r.error(\"'var' expression requires exactly one string literal argument.\");let i=t[1];return r.scope.has(i)?new Tm(i,r.scope.get(i)):r.error(`Unknown variable \"${i}\". Make sure \"${i}\" has been bound in an enclosing \"let\" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},Vv=class Sm{constructor(t,r,i,a){this.type=t,this.index=r,this.input=i,this.key=a}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,O),a=r.parse(t[2],2,vt(r.expectedType||ee));if(!i||!a)return null;let n=a.type;return new Sm(n.itemType,i,a,r.key)}evaluate(t){let r=this.index.evaluate(t),i=this.input.evaluate(t);if(r<0)throw new we(`Array index out of bounds: ${r} < 0.`,this.key);if(r>=i.length)throw new we(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new we(`Array index must be an integer, but found ${r} instead.`,this.key);return i[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},Nv=class Em{constructor(t,r,i){this.needle=t,this.haystack=r,this.key=i,this.type=ie}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,ee),a=r.parse(t[2],2,ee);return!i||!a?null:vo(i.type,[ie,Q,O,za,ee])?new Em(i,a,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ve(i.type)} instead`)}evaluate(t){let r=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!i)return!1;if(!li(r,[\"boolean\",\"string\",\"number\",\"null\"]))throw new we(`Expected first argument to be of type boolean, string, number or null, but found ${ve(Pe(r))} instead.`,this.key);if(!li(i,[\"string\",\"array\"]))throw new we(`Expected second argument to be of type array or string, but found ${ve(Pe(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},Uv=class Im{constructor(t,r,i){this.needle=t,this._set=r,this.key=i,this.type=ie}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,ee);if(!i)return null;if(!vo(i.type,[ie,Q,O,za,ee]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ve(i.type)} instead`);let a=t[2];if(!Array.isArray(a))return r.concat(2).error(\"Expected the second argument to be an array of boolean, string, or number values.\");let n=new Set;for(let s=0;s<a.length;s++){let o=a[s],l=typeof o;if(o===null)return r.concat(2).error(`null is not allowed in the haystack at index ${s}.`);if(l!==\"boolean\"&&l!==\"string\"&&l!==\"number\")return r.concat(2).error(`Expected boolean, string, or number in haystack at index ${s}, but found ${ve(Pe(o))} instead.`);if(l===\"number\"&&Number.isNaN(o))return r.concat(2).error(`NaN is not allowed in the haystack at index ${s}.`);n.add(o)}return new Im(i,n,r.key)}evaluate(t){let r=this.needle.evaluate(t);if(!li(r,[\"boolean\",\"string\",\"number\",\"null\"]))throw new we(`Expected first argument to be of type boolean, string, number or null, but found ${ve(Pe(r))} instead.`,this.key);return this._set.has(r)}eachChild(t){t(this.needle)}outputDefined(){return!0}},$v=class iu{constructor(t,r,i,a){this.needle=t,this.haystack=r,this.key=i,this.fromIndex=a,this.type=O}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,ee),a=r.parse(t[2],2,ee);if(!i||!a)return null;if(!vo(i.type,[ie,Q,O,za,ee]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ve(i.type)} instead`);if(t.length===4){let n=r.parse(t[3],3,O);return n?new iu(i,a,r.key,n):null}return new iu(i,a,r.key)}evaluate(t){let r=this.needle.evaluate(t),i=this.haystack.evaluate(t);if(!li(r,[\"boolean\",\"string\",\"number\",\"null\"]))throw new we(`Expected first argument to be of type boolean, string, number or null, but found ${ve(Pe(r))} instead.`,this.key);let a;if(this.fromIndex&&(a=this.fromIndex.evaluate(t)),li(i,[\"string\"])){let n=i.indexOf(r,a);return n===-1?-1:[...i.slice(0,n)].length}if(li(i,[\"array\"]))return i.indexOf(r,a);throw new we(`Expected second argument to be of type array or string, but found ${ve(Pe(i))} instead.`,this.key)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},jv=class Am{constructor(t,r,i,a,n,s){this.inputType=t,this.type=r,this.input=i,this.cases=a,this.outputs=n,this.otherwise=s}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error(\"Expected an even number of arguments.\");let i,a;r.expectedType&&r.expectedType.kind!==\"value\"&&(a=r.expectedType);let n={},s=[];for(let u=2;u<t.length-1;u+=2){let h=t[u],c=t[u+1];Array.isArray(h)||(h=[h]);let p=r.concat(u);if(h.length===0)return p.error(\"Expected at least one branch label.\");for(let f of h){if(typeof f!=\"number\"&&typeof f!=\"string\")return p.error(\"Branch labels must be numbers or strings.\");if(typeof f==\"number\"&&Math.abs(f)>2**53-1)return p.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof f==\"number\"&&Math.floor(f)!==f)return p.error(\"Numeric branch labels must be integer values.\");if(!i)i=Pe(f);else if(p.checkSubtype(i,Pe(f)))return null;if(n[String(f)]!==void 0)return p.error(\"Branch labels must be unique.\");n[String(f)]=s.length}let d=r.parse(c,u,a);if(!d)return null;a||(a=d.type),s.push(d)}let o=r.parse(t[1],1,ee);if(!o)return null;let l=r.parse(t[t.length-1],t.length-1,a);return!l||o.type.kind!==\"value\"&&r.concat(1).checkSubtype(i,o.type)?null:new Am(i,a,o,n,s,l)}evaluate(t){let r=this.input.evaluate(t);return(Pe(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}},Gv=class Mm{constructor(t,r,i){this.type=t,this.branches=r,this.otherwise=i}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error(\"Expected an odd number of arguments.\");let i;r.expectedType&&r.expectedType.kind!==\"value\"&&(i=r.expectedType);let a=[];for(let s=1;s<t.length-1;s+=2){let o=r.parse(t[s],s,ie);if(!o)return null;let l=r.parse(t[s+1],s+1,i);if(!l)return null;a.push([o,l]),i||(i=l.type)}let n=r.parse(t[t.length-1],t.length-1,i);if(!n)return null;if(!i)throw Error(\"Can't infer output type\");return new Mm(i,a,n)}evaluate(t){for(let[r,i]of this.branches)if(r.evaluate(t))return i.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,i]of this.branches)t(r),t(i);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},qv=class au{constructor(t,r,i,a,n){this.type=t,this.input=r,this.beginIndex=i,this.key=a,this.endIndex=n}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${t.length-1} instead.`);let i=r.parse(t[1],1,ee),a=r.parse(t[2],2,O);if(!i||!a)return null;if(!vo(i.type,[vt(ee),Q,ee]))return r.error(`Expected first argument to be of type array or string, but found ${ve(i.type)} instead`);if(t.length===4){let n=r.parse(t[3],3,O);return n?new au(i.type,i,a,r.key,n):null}return new au(i.type,i,a,r.key)}evaluate(t){let r=this.input.evaluate(t),i=this.beginIndex.evaluate(t),a;if(this.endIndex&&(a=this.endIndex.evaluate(t)),li(r,[\"string\"]))return[...r].slice(i,a).join(\"\");if(li(r,[\"array\"]))return r.slice(i,a);throw new we(`Expected first argument to be of type array or string, but found ${ve(Pe(r))} instead.`,this.key)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}},Pm=class nu{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error(\"Expected at least one argument.\");let i=null,a=r.expectedType;a&&a.kind!==\"value\"&&(i=a);let n=[];for(let s of t.slice(1)){let o=r.parse(s,1+n.length,i,void 0,{typeAnnotation:\"omit\"});if(!o)return null;i||(i=o.type),n.push(o)}if(!i)throw Error(\"No output type\");return a&&n.some(s=>wn(a,s.type))?new nu(ee,n):new nu(i,n)}evaluate(t){let r=null,i=0,a;for(let n of this.args)if(i++,r=n.evaluate(t),r&&r instanceof br&&!r.available&&(a||(a=r.name),r=null,i===this.args.length&&(r=a)),r!==null)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}};function md(e,t){return e===\"==\"||e===\"!=\"?t.kind===\"boolean\"||t.kind===\"string\"||t.kind===\"number\"||t.kind===\"null\"||t.kind===\"value\":t.kind===\"string\"||t.kind===\"number\"||t.kind===\"value\"}function Zv(e,t,r){return t===r}function Wv(e,t,r){return t!==r}function Xv(e,t,r){return t<r}function Hv(e,t,r){return t>r}function Yv(e,t,r){return t<=r}function Kv(e,t,r){return t>=r}function Cm(e,t,r,i){return i.compare(t,r)===0}function Jv(e,t,r,i){return!Cm(e,t,r,i)}function Qv(e,t,r,i){return i.compare(t,r)<0}function eb(e,t,r,i){return i.compare(t,r)>0}function tb(e,t,r,i){return i.compare(t,r)<=0}function rb(e,t,r,i){return i.compare(t,r)>=0}function Ra(e,t,r){let i=e!==\"==\"&&e!==\"!=\";return class km{constructor(n,s,o,l){this.lhs=n,this.rhs=s,this.key=o,this.collator=l,this.type=ie,this.hasUntypedArgument=n.type.kind===\"value\"||s.type.kind===\"value\"}static parse(n,s){if(n.length!==3&&n.length!==4)return s.error(\"Expected two or three arguments.\");let o=n[0],l=s.parse(n[1],1,ee);if(!l)return null;if(!md(o,l.type))return s.concat(1).error(`\"${o}\" comparisons are not supported for type '${ve(l.type)}'.`);let u=s.parse(n[2],2,ee);if(!u)return null;if(!md(o,u.type))return s.concat(2).error(`\"${o}\" comparisons are not supported for type '${ve(u.type)}'.`);if(l.type.kind!==u.type.kind&&l.type.kind!==\"value\"&&u.type.kind!==\"value\")return s.error(`Cannot compare types '${ve(l.type)}' and '${ve(u.type)}'.`);i&&(l.type.kind===\"value\"&&u.type.kind!==\"value\"?l=new Dr(u.type,[l],s.key):l.type.kind!==\"value\"&&u.type.kind===\"value\"&&(u=new Dr(l.type,[u],s.key)));let h=null;if(n.length===4){if(l.type.kind!==\"string\"&&u.type.kind!==\"string\"&&l.type.kind!==\"value\"&&u.type.kind!==\"value\")return s.error(\"Cannot use collator to compare non-string types.\");if(h=s.parse(n[3],3,go),!h)return null}return new km(l,u,s.key,h)}evaluate(n){let s=this.lhs.evaluate(n),o=this.rhs.evaluate(n);if(i&&this.hasUntypedArgument){let l=Pe(s),u=Pe(o);if(l.kind!==u.kind||l.kind!==\"string\"&&l.kind!==\"number\")throw new we(`Expected arguments for \"${e}\" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!i&&this.hasUntypedArgument){let l=Pe(s),u=Pe(o);if(l.kind!==\"string\"||u.kind!==\"string\")return t(n,s,o)}return this.collator?r(n,s,o,this.collator.evaluate(n)):t(n,s,o)}eachChild(n){n(this.lhs),n(this.rhs),this.collator&&n(this.collator)}outputDefined(){return!0}}}var ib=Ra(\"==\",Zv,Cm),ab=Ra(\"!=\",Wv,Jv),nb=Ra(\"<\",Xv,Qv),sb=Ra(\">\",Hv,eb),ob=Ra(\"<=\",Yv,tb),lb=Ra(\">=\",Kv,rb),Dm=class Fm{constructor(t,r,i){this.type=go,this.locale=i,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error(\"Expected one argument.\");let i=t[1];if(typeof i!=\"object\"||Array.isArray(i))return r.error(\"Collator options argument must be an object.\");let a=r.parse(i[\"case-sensitive\"]!==void 0&&i[\"case-sensitive\"],1,ie);if(!a)return null;let n=r.parse(i[\"diacritic-sensitive\"]!==void 0&&i[\"diacritic-sensitive\"],1,ie);if(!n)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,Q),!s)?null:new Fm(a,n,s)}evaluate(t){return new wh(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}},ub=class zm{constructor(t,r,i,a,n,s){this.type=Q,this.number=t,this.locale=r,this.currency=i,this.unit=a,this.minFractionDigits=n,this.maxFractionDigits=s}static parse(t,r){if(t.length!==3)return r.error(\"Expected two arguments.\");let i=r.parse(t[1],1,O);if(!i)return null;let a=t[2];if(typeof a!=\"object\"||Array.isArray(a))return r.error(\"NumberFormat options argument must be an object.\");let n=null;if(a.locale&&(n=r.parse(a.locale,1,Q),!n))return null;let s=null;if(a.currency&&(s=r.parse(a.currency,1,Q),!s))return null;let o=null;if(a.unit&&(o=r.parse(a.unit,1,Q),!o))return null;if(s&&o)return r.error(\"NumberFormat options `currency` and `unit` are mutually exclusive\");let l=null;if(a[\"min-fraction-digits\"]&&(l=r.parse(a[\"min-fraction-digits\"],1,O),!l))return null;let u=null;return a[\"max-fraction-digits\"]&&(u=r.parse(a[\"max-fraction-digits\"],1,O),!u)?null:new zm(i,n,s,o,l,u)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?\"currency\":this.unit?\"unit\":\"decimal\",currency:this.currency?this.currency.evaluate(t):void 0,unit:this.unit?this.unit.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.unit&&t(this.unit),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},hb=class Rm{constructor(t){this.type=qn,this.input=t}static parse(t,r){if(t.length!==2)return r.error(\"Expected two arguments.\");let i=r.parse(t[1],1,Q);return i?new Rm(i):r.error(\"No image name provided.\")}evaluate(t){let r=this.input.evaluate(t),i=br.fromString(r);return i&&t.availableImages&&(i.available=t.availableImages.indexOf(r)>-1),i}eachChild(t){t(this.input)}outputDefined(){return!1}},cb=class Lm{constructor(t,r){this.input=t,this.key=r,this.type=O}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=r.parse(t[1],1);return i?i.type.kind!==\"array\"&&i.type.kind!==\"string\"&&i.type.kind!==\"value\"?r.error(`Expected argument of type string or array, but found ${ve(i.type)} instead.`):new Lm(i,r.key):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r==\"string\")return[...r].length;if(Array.isArray(r))return r.length;throw new we(`Expected value to be of type string or array, but found ${ve(Pe(r))} instead.`,this.key)}eachChild(t){t(this.input)}outputDefined(){return!1}},vr=8192;function pb(e,t){let r=db(e[0]),i=mb(e[1]),a=2**t.z;return[Math.round(r*a*vr),Math.round(i*a*vr)]}function Eh(e,t){let r=2**t.z,i=(e[0]/vr+t.x)/r,a=(e[1]/vr+t.y)/r;return[fb(i),gb(a)]}function db(e){return(180+e)/360}function fb(e){return e*360-180}function mb(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function gb(e){return 360/Math.PI*Math.atan(Math.exp((180-e*360)*Math.PI/180))-90}function Zn(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Tn(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function yb(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function _b(e,t,r){let i=e[0]-t[0],a=e[1]-t[1],n=e[0]-r[0],s=e[1]-r[1];return i*s-n*a===0&&i*n<=0&&a*s<=0}function wo(e,t,r,i){let a=[t[0]-e[0],t[1]-e[1]];return wb([i[0]-r[0],i[1]-r[1]],a)!==0&&!!(gd(e,t,r,i)&&gd(r,i,e,t))}function xb(e,t,r){for(let i of r)for(let a=0;a<i.length-1;++a)if(wo(e,t,i[a],i[a+1]))return!0;return!1}function La(e,t,r=!1){let i=!1;for(let a of t)for(let n=0;n<a.length-1;n++){if(_b(e,a[n],a[n+1]))return r;yb(e,a[n],a[n+1])&&(i=!i)}return i}function vb(e,t){for(let r of t)if(La(e,r))return!0;return!1}function Bm(e,t){for(let r of e)if(!La(r,t))return!1;for(let r=0;r<e.length-1;++r)if(xb(e[r],e[r+1],t))return!1;return!0}function bb(e,t){for(let r of t)if(Bm(e,r))return!0;return!1}function wb(e,t){return e[0]*t[1]-e[1]*t[0]}function gd(e,t,r,i){let a=e[0]-r[0],n=e[1]-r[1],s=t[0]-r[0],o=t[1]-r[1],l=i[0]-r[0],u=i[1]-r[1],h=a*u-l*n,c=s*u-l*o;return h>0&&c<0||h<0&&c>0}function Ih(e,t,r){let i=[];for(let a=0;a<e.length;a++){let n=[];for(let s=0;s<e[a].length;s++){let o=pb(e[a][s],r);Zn(t,o),n.push(o)}i.push(n)}return i}function Om(e,t,r){let i=[];for(let a=0;a<e.length;a++){let n=Ih(e[a],t,r);i.push(n)}return i}function Vm(e,t,r,i){if(e[0]<r[0]||e[0]>r[2]){let a=i*.5,n=e[0]-r[0]>a?-i:r[0]-e[0]>a?i:0;n===0&&(n=e[0]-r[2]>a?-i:r[2]-e[0]>a?i:0),e[0]+=n}Zn(t,e)}function Tb(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function yd(e,t,r,i){let a=2**i.z*vr,n=[i.x*vr,i.y*vr],s=[];for(let o of e)for(let l of o){let u=[l.x+n[0],l.y+n[1]];Vm(u,t,r,a),s.push(u)}return s}function _d(e,t,r,i){let a=2**i.z*vr,n=[i.x*vr,i.y*vr],s=[];for(let o of e){let l=[];for(let u of o){let h=[u.x+n[0],u.y+n[1]];Zn(t,h),l.push(h)}s.push(l)}if(t[2]-t[0]<=a/2){Tb(t);for(let o of s)for(let l of o)Vm(l,t,r,a)}return s}function Sb(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if(t.type===\"Polygon\"){let n=Ih(t.coordinates,i,a),s=yd(e.geometry(),r,i,a);if(!Tn(r,i))return!1;for(let o of s)if(!La(o,n))return!1}if(t.type===\"MultiPolygon\"){let n=Om(t.coordinates,i,a),s=yd(e.geometry(),r,i,a);if(!Tn(r,i))return!1;for(let o of s)if(!vb(o,n))return!1}return!0}function Eb(e,t){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],a=e.canonicalID();if(t.type===\"Polygon\"){let n=Ih(t.coordinates,i,a),s=_d(e.geometry(),r,i,a);if(!Tn(r,i))return!1;for(let o of s)if(!Bm(o,n))return!1}if(t.type===\"MultiPolygon\"){let n=Om(t.coordinates,i,a),s=_d(e.geometry(),r,i,a);if(!Tn(r,i))return!1;for(let o of s)if(!bb(o,n))return!1}return!0}var Ah=class Ls{constructor(t,r){this.type=ie,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(_a(t[1])){let i=t[1];if(i.type===\"FeatureCollection\"){let a=[];for(let n of i.features){let{type:s,coordinates:o}=n.geometry;s===\"Polygon\"&&a.push(o),s===\"MultiPolygon\"&&a.push(...o)}if(a.length)return new Ls(i,{type:\"MultiPolygon\",coordinates:a})}else if(i.type===\"Feature\"){let a=i.geometry.type;if(a===\"Polygon\"||a===\"MultiPolygon\")return new Ls(i,i.geometry)}else if(i.type===\"Polygon\"||i.type===\"MultiPolygon\")return new Ls(i,i)}return r.error(\"'within' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()===\"Point\")return Sb(t,this.geometries);if(t.geometryType()===\"LineString\")return Eb(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Nm=class{constructor(e=[],t=(r,i)=>r<i?-1:+(r>i)){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:r}=this,i=t[e];for(;e>0;){let a=e-1>>1,n=t[a];if(r(i,n)>=0)break;t[e]=n,e=a}t[e]=i}_down(e){let{data:t,compare:r}=this,i=this.length>>1,a=t[e];for(;e<i;){let n=(e<<1)+1,s=n+1;if(s<this.length&&r(t[s],t[n])<0&&(n=s),r(t[n],a)>=0)break;t[e]=t[n],e=n}t[e]=a}},xd=Math.PI/180,Mh=class{constructor(e){let t=xd*6378.137*1e3,r=Math.cos(e*xd),i=1/(1-.0066943799901413165*(1-r*r)),a=Math.sqrt(i);this.kx=t*a*r,this.ky=t*a*i*.9933056200098587}distance(e,t){let r=this.wrap(e[0]-t[0])*this.kx,i=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(e,t){let r=1/0,i,a,n,s;for(let o=0;o<e.length-1;o++){let l=e[o][0],u=e[o][1],h=this.wrap(e[o+1][0]-l)*this.kx,c=(e[o+1][1]-u)*this.ky,p=0;(h!==0||c!==0)&&(p=(this.wrap(t[0]-l)*this.kx*h+(t[1]-u)*this.ky*c)/(h*h+c*c),p>1?(l=e[o+1][0],u=e[o+1][1]):p>0&&(l+=h/this.kx*p,u+=c/this.ky*p)),h=this.wrap(t[0]-l)*this.kx,c=(t[1]-u)*this.ky;let d=h*h+c*c;d<r&&(r=d,i=l,a=u,n=o,s=p)}return{point:[i,a],index:n,t:Math.max(0,Math.min(1,s))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}};function Um(e,t){return t[0]-e[0]}function Us(e){return e[1]-e[0]+1}function Or(e,t){return e[1]>=e[0]&&e[1]<t}function su(e,t){if(e[0]>e[1])return[null,null];let r=Us(e);if(t){if(r===2)return[e,null];let a=Math.floor(r/2);return[[e[0],e[0]+a],[e[0]+a,e[1]]]}if(r===1)return[e,null];let i=Math.floor(r/2)-1;return[[e[0],e[0]+i],[e[0]+i+1,e[1]]]}function ou(e,t){if(!Or(t,e.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=t[0];i<=t[1];++i)Zn(r,e[i]);return r}function lu(e){let t=[1/0,1/0,-1/0,-1/0];for(let r of e)for(let i of r)Zn(t,i);return t}function vd(e){return e[0]!==-1/0&&e[1]!==-1/0&&e[2]!==1/0&&e[3]!==1/0}function Ph(e,t,r){if(!vd(e)||!vd(t))return NaN;let i=0,a=0;return e[2]<t[0]&&(i=t[0]-e[2]),e[0]>t[2]&&(i=e[0]-t[2]),e[1]>t[3]&&(a=e[1]-t[3]),e[3]<t[1]&&(a=t[1]-e[3]),r.distance([0,0],[i,a])}function Ci(e,t,r){let i=r.pointOnLine(t,e);return r.distance(e,i.point)}function Ch(e,t,r,i,a){let n=Math.min(Ci(e,[r,i],a),Ci(t,[r,i],a)),s=Math.min(Ci(r,[e,t],a),Ci(i,[e,t],a));return Math.min(n,s)}function Ib(e,t,r,i,a){if(!(Or(t,e.length)&&Or(i,r.length)))return 1/0;let n=1/0;for(let s=t[0];s<t[1];++s){let o=e[s],l=e[s+1];for(let u=i[0];u<i[1];++u){let h=r[u],c=r[u+1];if(wo(o,l,h,c))return 0;n=Math.min(n,Ch(o,l,h,c,a))}}return n}function Ab(e,t,r,i,a){if(!(Or(t,e.length)&&Or(i,r.length)))return NaN;let n=1/0;for(let s=t[0];s<=t[1];++s)for(let o=i[0];o<=i[1];++o)if(n=Math.min(n,a.distance(e[s],r[o])),n===0)return n;return n}function Mb(e,t,r){if(La(e,t,!0))return 0;let i=1/0;for(let a of t){let n=a[0],s=a[a.length-1];if(n!==s&&(i=Math.min(i,Ci(e,[s,n],r)),i===0))return i;let o=r.pointOnLine(a,e);if(i=Math.min(i,r.distance(e,o.point)),i===0)return i}return i}function Pb(e,t,r,i){if(!Or(t,e.length))return NaN;for(let n=t[0];n<=t[1];++n)if(La(e[n],r,!0))return 0;let a=1/0;for(let n=t[0];n<t[1];++n){let s=e[n],o=e[n+1];for(let l of r)for(let u=0,h=l.length,c=h-1;u<h;c=u++){let p=l[c],d=l[u];if(wo(s,o,p,d))return 0;a=Math.min(a,Ch(s,o,p,d,i))}}return a}function bd(e,t){for(let r of e)for(let i of r)if(La(i,t,!0))return!0;return!1}function Cb(e,t,r,i=1/0){let a=lu(e),n=lu(t);if(i!==1/0&&Ph(a,n,r)>=i)return i;if(Tn(a,n)){if(bd(e,t))return 0}else if(bd(t,e))return 0;let s=1/0;for(let o of e)for(let l=0,u=o.length,h=u-1;l<u;h=l++){let c=o[h],p=o[l];for(let d of t)for(let f=0,m=d.length,g=m-1;f<m;g=f++){let y=d[g],_=d[f];if(wo(c,p,y,_))return 0;s=Math.min(s,Ch(c,p,y,_,r))}}return s}function wd(e,t,r,i,a,n){if(!n)return;let s=Ph(ou(i,n),a,r);s<t&&e.push([s,n,[0,0]])}function As(e,t,r,i,a,n,s){if(!n||!s)return;let o=Ph(ou(i,n),ou(a,s),r);o<t&&e.push([o,n,s])}function $s(e,t,r,i,a=1/0){let n=Math.min(i.distance(e[0],r[0][0]),a);if(n===0)return n;let s=new Nm([[0,[0,e.length-1],[0,0]]],Um),o=lu(r);for(;s.length>0;){let l=s.pop();if(l[0]>=n)continue;let u=l[1],h=t?50:100;if(Us(u)<=h){if(!Or(u,e.length))return NaN;if(t){let c=Pb(e,u,r,i);if(isNaN(c)||c===0)return c;n=Math.min(n,c)}else for(let c=u[0];c<=u[1];++c){let p=Mb(e[c],r,i);if(n=Math.min(n,p),n===0)return 0}}else{let c=su(u,t);wd(s,n,i,e,o,c[0]),wd(s,n,i,e,o,c[1])}}return n}function js(e,t,r,i,a,n=1/0){let s=Math.min(n,a.distance(e[0],r[0]));if(s===0)return s;let o=new Nm([[0,[0,e.length-1],[0,r.length-1]]],Um);for(;o.length>0;){let l=o.pop();if(l[0]>=s)continue;let u=l[1],h=l[2],c=t?50:100,p=i?50:100;if(Us(u)<=c&&Us(h)<=p){if(!Or(u,e.length)&&Or(h,r.length))return NaN;let d;if(t&&i)d=Ib(e,u,r,h,a),s=Math.min(s,d);else if(t&&!i){let f=e.slice(u[0],u[1]+1);for(let m=h[0];m<=h[1];++m)if(d=Ci(r[m],f,a),s=Math.min(s,d),s===0)return s}else if(!t&&i){let f=r.slice(h[0],h[1]+1);for(let m=u[0];m<=u[1];++m)if(d=Ci(e[m],f,a),s=Math.min(s,d),s===0)return s}else d=Ab(e,u,r,h,a),s=Math.min(s,d)}else{let d=su(u,t),f=su(h,i);As(o,s,a,e,r,d[0],f[0]),As(o,s,a,e,r,d[0],f[1]),As(o,s,a,e,r,d[1],f[0]),As(o,s,a,e,r,d[1],f[1])}}return s}function kb(e,t){let r=e.geometry(),i=r.flat().map(s=>Eh([s.x,s.y],e.canonical));if(r.length===0)return NaN;let a=new Mh(i[0][1]),n=1/0;for(let s of t){switch(s.type){case\"Point\":n=Math.min(n,js(i,!1,[s.coordinates],!1,a,n));break;case\"LineString\":n=Math.min(n,js(i,!1,s.coordinates,!0,a,n));break;case\"Polygon\":n=Math.min(n,$s(i,!1,s.coordinates,a,n))}if(n===0)return n}return n}function Db(e,t){let r=e.geometry(),i=r.flat().map(s=>Eh([s.x,s.y],e.canonical));if(r.length===0)return NaN;let a=new Mh(i[0][1]),n=1/0;for(let s of t){switch(s.type){case\"Point\":n=Math.min(n,js(i,!0,[s.coordinates],!1,a,n));break;case\"LineString\":n=Math.min(n,js(i,!0,s.coordinates,!0,a,n));break;case\"Polygon\":n=Math.min(n,$s(i,!0,s.coordinates,a,n))}if(n===0)return n}return n}function Fb(e,t){let r=e.geometry();if(r.length===0||r[0].length===0)return NaN;let i=Sh(r,0).map(s=>s.map(o=>o.map(l=>Eh([l.x,l.y],e.canonical)))),a=new Mh(i[0][0][0][1]),n=1/0;for(let s of t)for(let o of i){switch(s.type){case\"Point\":n=Math.min(n,$s([s.coordinates],!1,o,a,n));break;case\"LineString\":n=Math.min(n,$s(s.coordinates,!0,o,a,n));break;case\"Polygon\":n=Math.min(n,Cb(o,s.coordinates,a,n))}if(n===0)return n}return n}function jl(e){return e.type===\"MultiPolygon\"?e.coordinates.map(t=>({type:\"Polygon\",coordinates:t})):e.type===\"MultiLineString\"?e.coordinates.map(t=>({type:\"LineString\",coordinates:t})):e.type===\"MultiPoint\"?e.coordinates.map(t=>({type:\"Point\",coordinates:t})):[e]}var kh=class Bs{constructor(t,r){this.type=O,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(_a(t[1])){let i=t[1];if(i.type===\"FeatureCollection\")return new Bs(i,i.features.map(a=>jl(a.geometry)).flat());if(i.type===\"Feature\")return new Bs(i,jl(i.geometry));if(\"type\"in i&&\"coordinates\"in i)return new Bs(i,jl(i))}return r.error(\"'distance' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()===\"Point\")return kb(t,this.geometries);if(t.geometryType()===\"LineString\")return Db(t,this.geometries);if(t.geometryType()===\"Polygon\")return Fb(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},zb=class $m{constructor(t){let r=null;for(let i of t)if(!r)r=i.type;else{if(r===i.type)continue;r=ee;break}this.type=vt(r??ee,t.length),this.arr=t}static parse(t,r){if(t.length!==2)return r.error(`'semiliteral' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!_a(t[1]))return r.error(`invalid value of type \"${typeof t[1]}\"`);let i=t[1],a=Pe(i);if(a.kind===\"array\"){let n=i.map(s=>r.parse(s,null,ee));return new $m(n)}return new xa(a,i)}evaluate(t){return this.arr.map(r=>r.evaluate(t))}eachChild(t){this.arr.forEach(t)}outputDefined(){return this.arr.every(t=>t.outputDefined())}},Dh=class jm{constructor(t){this.key=t,this.type=ee}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);let i=t[1];return i==null?r.error(\"Global state property must be defined.\"):typeof i==\"string\"?new jm(i):r.error(`Global state property must be string, but found ${typeof t[1]} instead.`)}evaluate(t){let r=t.globals?.globalState;return!r||Object.keys(r).length===0?null:fn(r,this.key)??null}eachChild(){}outputDefined(){return!1}},pa={\"==\":ib,\"!=\":ab,\">\":sb,\"<\":nb,\">=\":lb,\"<=\":ob,array:Dr,at:Vv,boolean:Dr,case:Gv,coalesce:Pm,collator:Dm,format:mm,image:hb,in:Nv,\"in-set\":Uv,\"index-of\":$v,interpolate:Ht,\"interpolate-hcl\":Ht,\"interpolate-lab\":Ht,length:cb,let:vm,literal:xa,match:jv,number:Dr,\"number-format\":ub,object:Dr,semiliteral:zb,slice:qv,step:Th,string:Dr,\"to-boolean\":ha,\"to-color\":ha,\"to-number\":ha,\"to-string\":ha,var:wm,within:Ah,distance:kh,\"global-state\":Dh},_r=class extends Error{constructor(e,t){super(t),this.message=t,this.key=e}},Rb=class Gm{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[i,a]of r)this.bindings[i]=a}concat(t){return new Gm(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw Error(`${t} not found in scope.`)}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}},qm=class Zm{constructor(t,r,i=[],a,n=new Rb,s=[]){this.registry=t,this.path=i,this.key=i.map(o=>`[${o}]`).join(\"\"),this.scope=n,this.errors=s,this.expectedType=a,this._isConstant=r}parse(t,r,i,a,n={}){return r?this.concat(r,i,a)._parse(t,n):this._parse(t,n)}_parse(t,r){(t===null||typeof t==\"string\"||typeof t==\"boolean\"||typeof t==\"number\")&&(t=[\"literal\",t]);let i=this.key;function a(n,s,o){return o===\"assert\"?new Dr(s,[n],i):o===\"coerce\"?new ha(s,[n],i):n}if(Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].');let n=t[0];if(typeof n!=\"string\")return this.error(`Expression name must be a string, but found ${typeof n} instead. If you wanted a literal array, use [\"literal\", [...]].`,0),null;let s=this.registry[n];if(s){let o=s.parse(t,this);if(!o)return null;if(this.expectedType){let l=this.expectedType,u=o.type;if((l.kind===\"string\"||l.kind===\"number\"||l.kind===\"boolean\"||l.kind===\"object\"||l.kind===\"array\")&&u.kind===\"value\")o=a(o,l,r.typeAnnotation||\"assert\");else if(l.kind===\"projectionDefinition\"&&[\"string\",\"array\",\"value\"].includes(u.kind)||[\"color\",\"formatted\",\"resolvedImage\"].includes(l.kind)&&[\"value\",\"string\"].includes(u.kind)||[\"padding\",\"numberArray\"].includes(l.kind)&&[\"value\",\"number\",\"array\"].includes(u.kind)||l.kind===\"colorArray\"&&[\"value\",\"string\",\"array\"].includes(u.kind)||l.kind===\"variableAnchorOffsetCollection\"&&[\"value\",\"array\"].includes(u.kind))o=a(o,l,r.typeAnnotation||\"coerce\");else if(this.checkSubtype(l,u))return null}if(!(o instanceof xa)&&o.type.kind!==\"resolvedImage\"&&this._isConstant(o)){let l=new dm;try{o=new xa(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression \"${n}\". If you wanted a literal array, use [\"literal\", [...]].`,0)}return t===void 0?this.error(\"'undefined' value invalid. Use null instead.\"):typeof t==\"object\"?this.error('Bare objects invalid. Use [\"literal\", {...}] instead.'):this.error(`Expected an array, but found ${typeof t} instead.`)}concat(t,r,i){let a=typeof t==\"number\"?this.path.concat(t):this.path,n=i?this.scope.concat(i):this.scope;return new Zm(this.registry,this._isConstant,a,r||null,n,this.errors)}error(t,...r){let i=`${this.key}${r.map(a=>`[${a}]`).join(\"\")}`;this.errors.push(new _r(i,t))}checkSubtype(t,r){let i=wn(t,r);return i&&this.error(i),i}},$i=class un{constructor(t,r,i,a,n){this.name=t,this.type=r,this._evaluate=i,this.args=a,this.key=n}evaluate(t){return this._evaluate(t,this.args,this.key)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){let i=t[0],a=un.definitions[i];if(!a)return r.error(`Unknown expression \"${i}\". If you wanted a literal array, use [\"literal\", [...]].`,0);let n=Array.isArray(a)?a[0]:a.type,s=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,o=s.filter(([u])=>!Array.isArray(u)||u.length===t.length-1),l=null;for(let[u,h]of o){l=new qm(r.registry,Gs,r.path,null,r.scope);let c=[],p=!1;for(let d=1;d<t.length;d++){let f=t[d],m=Array.isArray(u)?u[d-1]:u.type,g=l.parse(f,1+c.length,m);if(!g){p=!0;break}c.push(g)}if(!p){if(Array.isArray(u)&&u.length!==c.length){l.error(`Expected ${u.length} arguments, but found ${c.length} instead.`);continue}for(let d=0;d<c.length;d++){let f=Array.isArray(u)?u[d]:u.type,m=c[d];l.concat(d+1).checkSubtype(f,m.type)}if(l.errors.length===0)return new un(i,n,h,c,r.key)}}if(o.length===1)r.errors.push(...l.errors);else{let u=(o.length?o:s).map(([c])=>Bb(c)).join(\" | \"),h=[];for(let c=1;c<t.length;c++){let p=r.parse(t[c],1+h.length);if(!p)return null;h.push(ve(p.type))}r.error(`Expected arguments of type ${u}, but found (${h.join(\", \")}) instead.`)}return null}static register(t,r){un.definitions=r;for(let i in r)t[i]=un}};function Td(e,[t,r,i,a],n){t=t.evaluate(e),r=r.evaluate(e),i=i.evaluate(e);let s=a?a.evaluate(e):1,o=cm(t,r,i,s);if(o)throw new we(o,n);return new J(t/255,r/255,i/255,s,!1)}function Sd(e,t){return e in t&&t[e]!==void 0}function Gl(e,t){let r=t[e];return r===void 0?null:r}function Lb(e,t,r,i){for(;r<=i;){let a=r+i>>1;if(t[a]===e)return!0;t[a]>e?i=a-1:r=a+1}return!1}function Ei(e){return{type:e}}$i.register(pa,{error:[bv,[Q],(e,[t],r)=>{throw new we(t.evaluate(e),r)}],typeof:[Q,[ee],(e,[t])=>ve(Pe(t.evaluate(e)))],\"to-rgba\":[vt(O,4),[nr],(e,[t])=>{let[r,i,a,n]=t.evaluate(e).rgb;return[r*255,i*255,a*255,n]}],rgb:[nr,[O,O,O],Td],rgba:[nr,[O,O,O,O],Td],has:{type:ie,overloads:[[[Q],(e,[t])=>Sd(t.evaluate(e),e.properties())],[[Q,Di],(e,[t,r])=>Sd(t.evaluate(e),r.evaluate(e))]]},get:{type:ee,overloads:[[[Q],(e,[t])=>Gl(t.evaluate(e),e.properties())],[[Q,Di],(e,[t,r])=>Gl(t.evaluate(e),r.evaluate(e))]]},\"feature-state\":[ee,[Q],(e,[t])=>Gl(t.evaluate(e),e.featureState||{})],properties:[Di,[],e=>e.properties()],\"geometry-type\":[Q,[],e=>e.geometryType()],id:[ee,[],e=>e.id()],zoom:[O,[],e=>e.globals.zoom],\"heatmap-density\":[O,[],e=>e.globals.heatmapDensity||0],elevation:[O,[],e=>e.globals.elevation||0],\"line-progress\":[O,[],e=>e.globals.lineProgress||0],accumulated:[ee,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],pitch:[O,[],e=>e.globals.pitch||0],\"raster-value\":[O,[],e=>e.globals.rasterValue||0],\"+\":[O,Ei(O),(e,t)=>{let r=0;for(let i of t)r+=i.evaluate(e);return r}],\"*\":[O,Ei(O),(e,t)=>{let r=1;for(let i of t)r*=i.evaluate(e);return r}],\"-\":{type:O,overloads:[[[O,O],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[O],(e,[t])=>-t.evaluate(e)]]},\"/\":[O,[O,O],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],\"%\":[O,[O,O],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[O,[],()=>Math.LN2],pi:[O,[],()=>Math.PI],e:[O,[],()=>Math.E],\"^\":[O,[O,O],(e,[t,r])=>t.evaluate(e)**+r.evaluate(e)],sqrt:[O,[O],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[O,[O],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[O,[O],(e,[t])=>Math.log(t.evaluate(e))],log2:[O,[O],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[O,[O],(e,[t])=>Math.sin(t.evaluate(e))],cos:[O,[O],(e,[t])=>Math.cos(t.evaluate(e))],tan:[O,[O],(e,[t])=>Math.tan(t.evaluate(e))],asin:[O,[O],(e,[t])=>Math.asin(t.evaluate(e))],acos:[O,[O],(e,[t])=>Math.acos(t.evaluate(e))],atan:[O,[O],(e,[t])=>Math.atan(t.evaluate(e))],min:[O,Ei(O),(e,t)=>Math.min(...t.map(r=>r.evaluate(e)))],max:[O,Ei(O),(e,t)=>Math.max(...t.map(r=>r.evaluate(e)))],abs:[O,[O],(e,[t])=>Math.abs(t.evaluate(e))],round:[O,[O],(e,[t])=>{let r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[O,[O],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[O,[O],(e,[t])=>Math.ceil(t.evaluate(e))],\"filter-==\":[ie,[Q,ee],(e,[t,r])=>e.properties()[t.value]===r.value],\"filter-id-==\":[ie,[ee],(e,[t])=>e.id()===t.value],\"filter-type-==\":[ie,[Q],(e,[t])=>e.geometryType()===t.value],\"filter-<\":[ie,[Q,ee],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i<a}],\"filter-id-<\":[ie,[ee],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<i}],\"filter->\":[ie,[Q,ee],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i>a}],\"filter-id->\":[ie,[ee],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>i}],\"filter-<=\":[ie,[Q,ee],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i<=a}],\"filter-id-<=\":[ie,[ee],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r<=i}],\"filter->=\":[ie,[Q,ee],(e,[t,r])=>{let i=e.properties()[t.value],a=r.value;return typeof i==typeof a&&i>=a}],\"filter-id->=\":[ie,[ee],(e,[t])=>{let r=e.id(),i=t.value;return typeof r==typeof i&&r>=i}],\"filter-has\":[ie,[ee],(e,[t])=>{let r=t.value,i=e.properties();return r in i&&i[r]!==void 0}],\"filter-has-id\":[ie,[],e=>e.id()!==null&&e.id()!==void 0],\"filter-type-in\":[ie,[vt(Q)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],\"filter-id-in\":[ie,[vt(ee)],(e,[t])=>t.value.indexOf(e.id())>=0],\"filter-in-small\":[ie,[Q,vt(ee)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],\"filter-in-large\":[ie,[Q,vt(ee)],(e,[t,r])=>Lb(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:ie,overloads:[[[ie,ie],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Ei(ie),(e,t)=>{for(let r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:ie,overloads:[[[ie,ie],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Ei(ie),(e,t)=>{for(let r of t)if(r.evaluate(e))return!0;return!1}]]},\"!\":[ie,[ie],(e,[t])=>!t.evaluate(e)],\"is-supported-script\":[ie,[Q],(e,[t])=>{let r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[Q,[Q],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Q,[Q],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Q,Ei(ee),(e,t)=>t.map(r=>mn(r.evaluate(e))).join(\"\")],split:[vt(Q),[Q,Q],(e,[t,r])=>t.evaluate(e).split(r.evaluate(e))],join:[Q,[vt(Q),Q],(e,[t,r])=>t.evaluate(e).join(r.evaluate(e))],\"resolved-locale\":[Q,[go],(e,[t])=>t.evaluate(e).resolvedLocale()]});function Bb(e){return Array.isArray(e)?`(${e.map(ve).join(\", \")})`:`(${ve(e.type)}...)`}function Gs(e){if(e instanceof wm)return Gs(e.boundExpression);if(e instanceof $i&&e.name===\"error\"||e instanceof Dm||e instanceof Ah||e instanceof kh||e instanceof Dh)return!1;let t=e instanceof ha||e instanceof Dr,r=!0;return e.eachChild(i=>{r&&(r=t?Gs(i):i instanceof xa)}),r?To(e)&&So(e,[\"zoom\",\"heatmap-density\",\"elevation\",\"line-progress\",\"accumulated\",\"pitch\",\"raster-value\",\"is-supported-script\"]):!1}function To(e){if(e instanceof $i&&(e.name===\"get\"&&e.args.length===1||e.name===\"feature-state\"||e.name===\"has\"&&e.args.length===1||e.name===\"properties\"||e.name===\"geometry-type\"||e.name===\"id\"||/^filter-/.test(e.name))||e instanceof Ah||e instanceof kh)return!1;let t=!0;return e.eachChild(r=>{t&&!To(r)&&(t=!1)}),t}function Sn(e){if(e instanceof $i&&e.name===\"feature-state\")return!1;let t=!0;return e.eachChild(r=>{t&&!Sn(r)&&(t=!1)}),t}function So(e,t){if(e instanceof $i&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(i=>{r&&!So(i,t)&&(r=!1)}),r}function va(e){return e[\"property-type\"]===\"data-driven\"||e[\"property-type\"]===\"cross-faded-data-driven\"}function Wm(e){return!!e.expression&&e.expression.parameters.indexOf(\"zoom\")>-1}function Fh(e){return!!e.expression&&e.expression.interpolated}function En(e,...t){for(let r of t)for(let i in r)e[i]=r[i];return e}function ae(e){return e instanceof Number?\"number\":e instanceof String?\"string\":e instanceof Boolean?\"boolean\":Array.isArray(e)?\"array\":e===null?\"null\":typeof e}function Eo(e){return typeof e==\"object\"&&!!e&&!Array.isArray(e)&&Pe(e)===Di}function Ob(e){return e}function Vb(e){switch(e.type){case\"color\":return J.parse;case\"padding\":return Sr.parse;case\"numberArray\":return Er.parse;case\"colorArray\":return Xt.parse;default:return null}}function Nb(e){switch(e){case\"exponential\":return Hm;case\"interval\":return $b;case\"categorical\":return Ub;case\"identity\":return jb;default:throw Error(`Unknown function type \"${e}\"`)}}function Xm(e,t){let r=e.stops&&typeof e.stops[0][0]==\"object\",i=r||e.property!==void 0,a=r||!i,n=e.type||(Fh(t)?\"exponential\":\"interval\"),s=Vb(t);if(s&&(e=En({},e),e.stops&&(e.stops=e.stops.map(h=>[h[0],s(h[1])])),e.default?e.default=s(e.default):e.default=s(t.default)),e.colorSpace&&!kv(e.colorSpace))throw Error(`Unknown color space: \"${e.colorSpace}\"`);let o=Nb(n),l,u;if(n===\"categorical\"){l=Object.create(null);for(let h of e.stops)l[h[0]]=h[1];u=typeof e.stops[0][0]}if(r){let h={},c=[];for(let f=0;f<e.stops.length;f++){let m=e.stops[f],g=m[0].zoom;h[g]===void 0&&(h[g]={zoom:g,type:e.type,property:e.property,default:e.default,stops:[]},c.push(g)),h[g].stops.push([m[0].value,m[1]])}let p=[];for(let f of c)p.push([h[f].zoom,Xm(h[f],t)]);let d={name:\"linear\"};return{kind:\"composite\",interpolationType:d,interpolationFactor:Ht.interpolationFactor.bind(void 0,d),zoomStops:p.map(f=>f[0]),evaluate({zoom:f},m){return Hm({stops:p,base:e.base},t,f).evaluate(f,m)}}}if(a){let h=n===\"exponential\"?{name:\"exponential\",base:e.base===void 0?1:e.base}:null;return{kind:\"camera\",interpolationType:h,interpolationFactor:Ht.interpolationFactor.bind(void 0,h),zoomStops:e.stops.map(c=>c[0]),evaluate:({zoom:c})=>o(e,t,c,l,u)}}return{kind:\"source\",evaluate(h,c){let p=c&&c.properties?c.properties[e.property]:void 0;return p===void 0?Wn(e.default,t.default):o(e,t,p,l,u)}}}function Wn(e,t,r){if(e!==void 0)return e;if(t!==void 0)return t;if(r!==void 0)return r}function Ub(e,t,r,i,a){return Wn(typeof r===a?i[r]:void 0,e.default,t.default)}function $b(e,t,r){if(ae(r)!==\"number\")return Wn(e.default,t.default);let i=e.stops.length;if(i===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];let a=bo(e.stops.map(n=>n[0]),r,\"\");return e.stops[a][1]}function Hm(e,t,r){let i=e.base===void 0?1:e.base;if(ae(r)!==\"number\")return Wn(e.default,t.default);let a=e.stops.length;if(a===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[a-1][0])return e.stops[a-1][1];let n=bo(e.stops.map(h=>h[0]),r,\"\"),s=Gb(r,i,e.stops[n][0],e.stops[n+1][0]),o=e.stops[n][1],l=e.stops[n+1][1],u=Ve[t.type]||Ob;return typeof o.evaluate==\"function\"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(c!==void 0&&p!==void 0)return u(c,p,s,e.colorSpace)}}:u(o,l,s,e.colorSpace)}function jb(e,t,r){switch(t.type){case\"color\":r=J.parse(r);break;case\"formatted\":r=Br.fromString(r.toString());break;case\"resolvedImage\":r=br.fromString(r.toString());break;case\"padding\":r=Sr.parse(r);break;case\"colorArray\":r=Xt.parse(r);break;case\"numberArray\":r=Er.parse(r);break;default:ae(r)!==t.type&&(t.type!==\"enum\"||!t.values[r])&&(r=void 0)}return Wn(r,e.default,t.default)}function Gb(e,t,r,i){let a=i-r,n=e-r;return a===0?0:t===1?n/a:(t**+n-1)/(t**+a-1)}function uu(e){return{result:\"success\",value:e}}function la(e){return{result:\"error\",value:e}}var zh=class{constructor(e,t,r,i){this.expression=e,this._warningHistory={},this._evaluator=new dm,this._defaultValue=r?tg(r):null,this._enumValues=r&&r.type===\"enum\"?r.values:null,this._globalState=i,this._rootKey=t}evaluateWithoutErrorHandling(e,t,r,i,a,n){return this._globalState&&(e=ba(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=n,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,i,a,n){this._globalState&&(e=ba(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=a||null,this._evaluator.formattedSection=n||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s==\"number\"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new we(`Expected value to be one of ${Object.keys(this._enumValues).map(o=>JSON.stringify(o)).join(\", \")}, but found ${JSON.stringify(s)} instead.`,\"\");return s}catch(s){let o=s instanceof we?s.path:\"\",l=`${o}|${s.message}`;return this._warningHistory[l]||(this._warningHistory[l]=!0,typeof console<\"u\"&&console.warn(Ym(this._rootKey,o,s.message,this._defaultValue))),this._defaultValue}}};function Ym(e,t,r,i){return`${e}${t}: ${r}${i==null?\"\":` Falling back to ${String(i)}.`}`}function Km(e){if(!e)throw Error('rootKey must identify the location of the expression in the style JSON, e.g. \"layers[3].paint.line-width\".')}function Io(e){return Array.isArray(e)&&e.length>0&&typeof e[0]==\"string\"&&e[0]in pa}function Ao(e,t,r,i){Km(t);let a=new qm(pa,Gs,[],r?Wb(r):void 0),n=a.parse(e,void 0,void 0,void 0,r&&r.type===\"string\"?{typeAnnotation:\"coerce\"}:void 0);return n?uu(new zh(n,t,r,i)):la(a.errors)}var In=class{constructor(e,t,r){this.kind=e,this._styleExpression=t,this.isStateDependent=e!==\"constant\"&&!Sn(t.expression),this.globalStateRefs=Xn(t.expression),this._globalState=r}evaluateWithoutErrorHandling(e,t,r,i,a,n){return this._globalState&&(e=ba(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,a,n)}evaluate(e,t,r,i,a,n){return this._globalState&&(e=ba(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,a,n)}},qs=class{constructor(e,t,r,i,a){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent=e!==\"camera\"&&!Sn(t.expression),this.globalStateRefs=Xn(t.expression),this.interpolationType=i,this._globalState=a}evaluateWithoutErrorHandling(e,t,r,i,a,n){return this._globalState&&(e=ba(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,t,r,i,a,n)}evaluate(e,t,r,i,a,n){return this._globalState&&(e=ba(e,this._globalState)),this._styleExpression.evaluate(e,t,r,i,a,n)}interpolationFactor(e,t,r){return this.interpolationType?Ht.interpolationFactor(this.interpolationType,e,t,r):0}};function qb(e){return e._styleExpression!==void 0}function Jm(e,t,r,i){let a=Ao(e,t,r,i);if(a.result===\"error\")return a;let n=a.value.expression,s=To(n);if(!s&&!va(r))return la([new _r(\"\",\"data expressions not supported\")]);let o=So(n,[\"zoom\"]);if(!o&&!Wm(r))return la([new _r(\"\",\"zoom expressions not supported\")]);let l=Os(n);if(!l&&!o)return la([new _r(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.')]);if(l instanceof _r)return la([l]);if(l instanceof Ht&&!Fh(r))return la([new _r(\"\",'\"interpolate\" expressions cannot be used with this property')]);if(!l)return uu(s?new In(\"constant\",a.value,i):new In(\"source\",a.value,i));let u=l instanceof Ht?l.interpolation:void 0;return uu(s?new qs(\"camera\",a.value,l.labels,u,i):new qs(\"composite\",a.value,l.labels,u,i))}var Qm=class eg{constructor(t,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,Km(r),this._parameters=t,this._specification=i,this._rootKey=r,this._defaultValue=tg(i),this._warningHistory={};let a=Xm(this._parameters,this._specification);this.kind=a.kind,this.interpolationFactor=a.interpolationFactor,this.zoomStops=a.zoomStops,this.interpolationType=a.interpolationType,this._innerEvaluate=a.evaluate}evaluate(t,r){try{return this._innerEvaluate(t,r)}catch(i){let a=i instanceof Error?i.message:String(i),n=`|${a}`;return this._warningHistory[n]||(this._warningHistory[n]=!0,typeof console<\"u\"&&console.warn(Ym(this._rootKey,\"\",a,this._defaultValue))),this._defaultValue}}static deserialize(t){return new eg(t._parameters,t._rootKey,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification,_rootKey:t._rootKey}}};function Zb(e,t,r,i){if(Eo(e))return new Qm(e,t,r);if(Io(e)){let a=Jm(e,t,r,i);if(a.result===\"error\")throw Error(a.value.map(n=>`${n.key}: ${n.message}`).join(\", \"));return a.value}{let a=e;return r.type===\"color\"&&typeof e==\"string\"?a=J.parse(e):r.type===\"padding\"&&(typeof e==\"number\"||Array.isArray(e))?a=Sr.parse(e):r.type===\"numberArray\"&&(typeof e==\"number\"||Array.isArray(e))?a=Er.parse(e):r.type===\"colorArray\"&&(typeof e==\"string\"||Array.isArray(e))?a=Xt.parse(e):r.type===\"variableAnchorOffsetCollection\"&&Array.isArray(e)?a=gi.parse(e):r.type===\"projectionDefinition\"&&typeof e==\"string\"&&(a=jr.parse(e)),{globalStateRefs:new Set,_globalState:null,kind:\"constant\",evaluate:()=>a}}}function Os(e){let t=null;if(e instanceof vm)t=Os(e.result);else if(e instanceof Pm){for(let r of e.args)if(t=Os(r),t)break}else(e instanceof Th||e instanceof Ht)&&e.input instanceof $i&&e.input.name===\"zoom\"&&(t=e);return t instanceof _r||e.eachChild(r=>{let i=Os(r);i instanceof _r?t=i:!t&&i?t=new _r(\"\",'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.'):t&&i&&t!==i&&(t=new _r(\"\",'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.'))}),t}function Xn(e,t=new Set){return e instanceof Dh&&t.add(e.key),e.eachChild(r=>{Xn(r,t)}),t}function Wb(e){let t={color:nr,string:Q,number:O,enum:Q,boolean:ie,formatted:Gn,padding:yo,numberArray:_o,colorArray:bn,projectionDefinition:mo,resolvedImage:qn,variableAnchorOffsetCollection:xo};return e.type===\"array\"?vt(t[e.value]||ee,e.length):t[e.type]}function tg(e){if(e.type===\"color\"&&Eo(e.default))return new J(0,0,0,0);switch(e.type){case\"color\":return J.parse(e.default)||null;case\"padding\":return Sr.parse(e.default)||null;case\"numberArray\":return Er.parse(e.default)||null;case\"colorArray\":return Xt.parse(e.default)||null;case\"variableAnchorOffsetCollection\":return gi.parse(e.default)||null;case\"projectionDefinition\":return jr.parse(e.default)||null;default:return e.default===void 0?null:e.default}}function ba(e,t){let{zoom:r,heatmapDensity:i,elevation:a,lineProgress:n,isSupportedScript:s,accumulated:o,pitch:l,rasterValue:u}=e??{};return{zoom:r,heatmapDensity:i,elevation:a,lineProgress:n,isSupportedScript:s,accumulated:o,pitch:l,rasterValue:u,globalState:t}}function Xb(e){let t=!1;for(let r of e){let i=rg(r);if(i===\"expression\")return\"expression\";i===\"legacy\"&&(t=!0)}return t?\"legacy\":\"neutral\"}function rg(e){if(typeof e==\"boolean\")return\"neutral\";if(!Array.isArray(e)||e.length===0)return\"legacy\";switch(e[0]){case\"has\":return e.length<2||e[1]===\"$id\"||e[1]===\"$type\"?\"legacy\":e.length===2?\"neutral\":\"expression\";case\"in\":return e.length>=3&&(typeof e[1]!=\"string\"||Array.isArray(e[2]))?\"expression\":\"legacy\";case\"!in\":case\"!has\":return\"legacy\";case\"==\":case\"!=\":case\">\":case\">=\":case\"<\":case\"<=\":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2])?\"expression\":\"legacy\";case\"none\":return\"legacy\";case\"any\":case\"all\":return Xb(e.slice(1));default:return\"expression\"}}function Rh(e){return rg(e)!==\"legacy\"}function Ed(e){return e===\"$type\"?[\"geometry-type\"]:e===\"$id\"?[\"id\"]:[\"get\",e]}function Hb(e){switch(e[0]){case\"==\":case\"!=\":case\"<\":case\"<=\":case\">\":case\">=\":return e.length!==3||typeof e[1]!=\"string\"?null:[e[0],Ed(e[1]),e[2]];case\"in\":case\"!in\":{if(e.length<2||typeof e[1]!=\"string\")return null;let t=[\"in\",Ed(e[1]),[\"literal\",e.slice(2)]];return e[0]===\"!in\"?[\"!\",t]:t}case\"has\":case\"!has\":{if(e.length!==2||typeof e[1]!=\"string\"||e[1]===\"$type\"||e[1]===\"$id\")return null;let t=[\"has\",e[1]];return e[0]===\"!has\"?[\"!\",t]:t}default:return null}}function ig(e){if((e[0]===\"<\"||e[0]===\"<=\"||e[0]===\">\"||e[0]===\">=\")&&e[1]===\"$type\")return`\"$type\" cannot be use with operator \"${e[0]}\"`;let t=Hb(e);return t?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(e)} with ${JSON.stringify(t)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(e)} to expression syntax.`}function ql(e,t,r){let i=r[e];return Array.isArray(i)?Rh(i)?Lh(i,t.concat(e)):{path:t.concat(e),legacyFilter:i}:null}function Lh(e,t=[]){if(!Array.isArray(e)||e.length<1)return null;switch(e[0]){case\"all\":case\"any\":case\"none\":for(let r=1;r<e.length;r++){let i=ql(r,t,e);if(i)return i}break;case\"!\":{let r=ql(1,t,e);if(r)return r;break}case\"case\":for(let r=1;r<e.length-1;r+=2){let i=ql(r,t,e);if(i)return i}}return null}function Yb(e,t){let r=Lh(e);if(!r||typeof console>\"u\")return;let i=r.path.map(a=>`[${a}]`).join(\"\");console.warn(`${t}${i}: ${ig(r.legacyFilter)}`)}var Kb={type:\"boolean\",default:!1,transition:!1,\"property-type\":\"data-driven\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]}};function wa(e,t,r){if(e==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Rh(e)?Yb(e,t):e=Zs(e);let i=Ao(e,t,Kb,r);if(i.result===\"error\")throw Error(i.value.map(a=>`${a.key}: ${a.message}`).join(\", \"));return{filter:(a,n,s)=>i.value.evaluate(a,n,{},s),needGeometry:ag(e),getGlobalStateRefs:()=>Xn(i.value.expression)}}function Jb(e,t){return e<t?-1:+(e>t)}function ag(e){if(!Array.isArray(e))return!1;if(e[0]===\"within\"||e[0]===\"distance\")return!0;for(let t=1;t<e.length;t++)if(ag(e[t]))return!0;return!1}function Zs(e){if(!e)return!0;let t=e[0];return e.length<=1?t!==\"any\":t===\"==\"?Zl(e[1],e[2],\"==\"):t===\"!=\"?Ms(Zl(e[1],e[2],\"==\")):t===\"<\"||t===\">\"||t===\"<=\"||t===\">=\"?Zl(e[1],e[2],t):t===\"any\"?Qb(e.slice(1)):t===\"all\"?[\"all\"].concat(e.slice(1).map(Zs)):t===\"none\"?[\"all\"].concat(e.slice(1).map(Zs).map(Ms)):t===\"in\"?Id(e[1],e.slice(2)):t===\"!in\"?Ms(Id(e[1],e.slice(2))):t===\"has\"?Ad(e[1]):t!==\"!has\"||Ms(Ad(e[1]))}function Zl(e,t,r){switch(e){case\"$type\":return[`filter-type-${r}`,t];case\"$id\":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function Qb(e){return[\"any\"].concat(e.map(Zs))}function Id(e,t){if(t.length===0)return!1;switch(e){case\"$type\":return[\"filter-type-in\",[\"literal\",t]];case\"$id\":return[\"filter-id-in\",[\"literal\",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?[\"filter-in-large\",e,[\"literal\",t.sort(Jb)]]:[\"filter-in-small\",e,[\"literal\",t]]}}function Ad(e){switch(e){case\"$type\":return!0;case\"$id\":return[\"filter-has-id\"];default:return[\"filter-has\",e]}}function Ms(e){return[\"!\",e]}function ng(e){let t=e.key,r=e.value;return r?[new L(t,r,\"constants have been deprecated as of v8\")]:[]}function Be(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Bi(e){if(Array.isArray(e))return e.map(Bi);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=Bi(e[r]);return t}return Be(e)}function Bt(e){let t=e.key,r=e.value,i=e.valueSpec||{},a=e.objectElementValidators||{},n=e.style,s=e.styleSpec,o=e.validateSpec,l=[],u=ae(r);if(u!==\"object\")return[new L(t,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(\".\")[0],p=fn(i,c)||i[\"*\"],d;if(fn(a,c))d=a[c];else if(fn(i,c)){if(r[h]===void 0)continue;d=o}else if(a[\"*\"])d=a[\"*\"];else if(i[\"*\"])d=o;else{l.push(new L(t,r[h],`unknown property \"${h}\"`));continue}l=l.concat(d({key:(t&&`${t}.`)+h,value:r[h],valueSpec:p,style:n,styleSpec:s,object:r,objectKey:h,validateSpec:o},r))}for(let h in i)a[h]||i[h].required&&i[h].default===void 0&&r[h]===void 0&&l.push(new L(t,r,`missing required property \"${h}\"`));return l}function Bh(e){let t=e.value,r=e.valueSpec,i=e.validateSpec,a=e.style,n=e.styleSpec,s=e.key,o=e.arrayElementValidator||i;if(ae(t)!==\"array\")return[new L(s,t,`array expected, ${ae(t)} found`)];if(r.length&&t.length!==r.length)return[new L(s,t,`array length ${r.length} expected, length ${t.length} found`)];let l={type:r.value,values:r.values};n.$version<7&&(l.function=r.function),ae(r.value)===\"object\"&&(l=r.value);let u=[];for(let h=0;h<t.length;h++)u=u.concat(o({array:t,arrayIndex:h,value:t[h],valueSpec:l,validateSpec:e.validateSpec,style:a,styleSpec:n,key:`${s}[${h}]`}));return u}function Mo(e){let t=e.key,r=e.value,i=e.valueSpec,a=ae(r);return a===\"number\"&&r!==r&&(a=\"NaN\"),a===\"number\"?\"minimum\"in i&&r<i.minimum?[new L(t,r,`${r} is less than the minimum value ${i.minimum}`)]:\"maximum\"in i&&r>i.maximum?[new L(t,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new L(t,r,`number expected, ${a} found`)]}function sg(e){let t=e.valueSpec,r=Be(e.value.type),i,a={},n,s,o=r!==\"categorical\"&&e.value.property===void 0,l=!o,u=ae(e.value.stops)===\"array\"&&ae(e.value.stops[0])===\"array\"&&ae(e.value.stops[0][0])===\"object\",h=Bt({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:c,default:f}});return r===\"identity\"&&o&&h.push(new L(e.key,e.value,'missing required property \"property\"')),r!==\"identity\"&&!e.value.stops&&h.push(new L(e.key,e.value,'missing required property \"stops\"')),r===\"exponential\"&&e.valueSpec.expression&&!Fh(e.valueSpec)&&h.push(new L(e.key,e.value,\"exponential functions not supported\")),e.styleSpec.$version>=8&&(l&&!va(e.valueSpec)?h.push(new L(e.key,e.value,\"property functions not supported\")):o&&!Wm(e.valueSpec)&&h.push(new L(e.key,e.value,\"zoom functions not supported\"))),(r===\"categorical\"||u)&&e.value.property===void 0&&h.push(new L(e.key,e.value,'\"property\" property is required')),h;function c(m){if(r===\"identity\")return[new L(m.key,m.value,'identity function may not have a \"stops\" property')];let g=[],y=m.value;return g=g.concat(Bh({key:m.key,value:y,valueSpec:m.valueSpec,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec,arrayElementValidator:p})),ae(y)===\"array\"&&y.length===0&&g.push(new L(m.key,y,\"array must have at least one stop\")),g}function p(m){let g=[],y=m.value,_=m.key;if(ae(y)!==\"array\")return[new L(_,y,`array expected, ${ae(y)} found`)];if(y.length!==2)return[new L(_,y,`array length 2 expected, length ${y.length} found`)];if(u){if(ae(y[0])!==\"object\")return[new L(_,y,`object expected, ${ae(y[0])} found`)];if(y[0].zoom===void 0)return[new L(_,y,\"object stop key must have zoom\")];if(y[0].value===void 0)return[new L(_,y,\"object stop key must have value\")];if(s&&s>Be(y[0].zoom))return[new L(_,y[0].zoom,\"stop zoom values must appear in ascending order\")];Be(y[0].zoom)!==s&&(s=Be(y[0].zoom),n=void 0,a={}),g=g.concat(Bt({key:`${_}[0]`,value:y[0],valueSpec:{zoom:{}},validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec,objectElementValidators:{zoom:Mo,value:d}}))}else g=g.concat(d({key:`${_}[0]`,value:y[0],valueSpec:{},validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec},y));return Io(Bi(y[1]))?g.concat([new L(`${_}[1]`,y[1],\"expressions are not allowed in function stops.\")]):g.concat(m.validateSpec({key:`${_}[1]`,value:y[1],valueSpec:t,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec}))}function d(m,g){let y=ae(m.value),_=Be(m.value),x=m.value===null?g:m.value;if(!i)i=y;else if(y!==i)return[new L(m.key,x,`${y} stop domain type must match previous stop domain type ${i}`)];if(y!==\"number\"&&y!==\"string\"&&y!==\"boolean\")return[new L(m.key,x,\"stop domain value must be a number, string, or boolean\")];if(y!==\"number\"&&r!==\"categorical\"){let v=`number expected, ${y} found`;return va(t)&&r===void 0&&(v+='\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.'),[new L(m.key,x,v)]}return r===\"categorical\"&&y===\"number\"&&(!isFinite(_)||Math.floor(_)!==_)?[new L(m.key,x,`integer expected, found ${_}`)]:r!==\"categorical\"&&y===\"number\"&&n!==void 0&&_<n?[new L(m.key,x,\"stop domain values must appear in ascending order\")]:(n=_,r===\"categorical\"&&_ in a?[new L(m.key,x,\"stop domain values must be unique\")]:(a[_]=!0,[]))}function f(m){return m.validateSpec({key:m.key,value:m.value,valueSpec:t,validateSpec:m.validateSpec,style:m.style,styleSpec:m.styleSpec})}}function Ta(e){let t=(e.expressionContext===\"property\"?Jm:Ao)(Bi(e.value),e.key,e.valueSpec);if(t.result===\"error\")return t.value.map(i=>new L(`${e.key}${i.key}`,e.value,i.message));let r=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext===\"property\"&&e.propertyKey===\"text-font\"&&!r.outputDefined())return[new L(e.key,e.value,`Invalid data expression for \"${e.propertyKey}\". Output values must be contained as literals within the expression.`)];if(e.expressionContext===\"property\"&&e.propertyType===\"layout\"&&!Sn(r))return[new L(e.key,e.value,'\"feature-state\" data expressions are not supported with layout properties.')];if(e.expressionContext===\"filter\"&&!Sn(r))return[new L(e.key,e.value,'\"feature-state\" data expressions are not supported with filters.')];if(e.expressionContext&&e.expressionContext.indexOf(\"cluster\")===0){if(!So(r,[\"zoom\",\"feature-state\"]))return[new L(e.key,e.value,'\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.')];if(e.expressionContext===\"cluster-initial\"&&!To(r))return[new L(e.key,e.value,\"Feature data expressions are not supported with initial expression part of cluster properties.\")]}return[]}function ew(e){let t=e.value,r=e.key,i=ae(t);return i===\"boolean\"?[]:[new L(r,t,`boolean expected, ${i} found`)]}function hu(e){let t=e.key,r=e.value,i=ae(r);return i===\"string\"?J.parse(String(r))?[]:[new L(t,r,`color expected, \"${r}\" found`)]:[new L(t,r,`color expected, ${i} found`)]}function An(e){let t=e.key,r=e.value,i=e.valueSpec,a=[];return Array.isArray(i.values)?i.values.indexOf(Be(r))===-1&&a.push(new L(t,r,`expected one of [${i.values.join(\", \")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(Be(r))===-1&&a.push(new L(t,r,`expected one of [${Object.keys(i.values).join(\", \")}], ${JSON.stringify(r)} found`)),a}function tw(e,t){let r=e;for(let i of t)r=r[i];return r}function rw(e,t){let r=Lh(t);return r?[new L(`${e.key}${r.path.map(i=>`[${i}]`).join(\"\")}`,tw(e.value,r.path),ig(r.legacyFilter),null,\"warning\")]:[]}function Oh(e){let t=Bi(e.value);return Rh(t)?[...rw(e,t),...Ta(En({},e,{expressionContext:\"filter\",valueSpec:{value:\"boolean\"}}))]:og(e)}function og(e){let t=e.value,r=e.key;if(ae(t)!==\"array\")return[new L(r,t,`array expected, ${ae(t)} found`)];let i=e.styleSpec,a,n=[];if(t.length<1)return[new L(r,t,\"filter array must have at least 1 element\")];switch(n=n.concat(An({key:`${r}[0]`,value:t[0],valueSpec:i.filter_operator,style:e.style,styleSpec:e.styleSpec})),Be(t[0])){case\"<\":case\"<=\":case\">\":case\">=\":t.length>=2&&Be(t[1])===\"$type\"&&n.push(new L(r,t,`\"$type\" cannot be use with operator \"${t[0]}\"`));case\"==\":case\"!=\":t.length!==3&&n.push(new L(r,t,`filter array for operator \"${t[0]}\" must have 3 elements`));case\"in\":case\"!in\":t.length>=2&&(a=ae(t[1]),a!==\"string\"&&n.push(new L(`${r}[1]`,t[1],`string expected, ${a} found`)));for(let s=2;s<t.length;s++)a=ae(t[s]),Be(t[1])===\"$type\"?n=n.concat(An({key:`${r}[${s}]`,value:t[s],valueSpec:i.geometry_type,style:e.style,styleSpec:e.styleSpec})):a!==\"string\"&&a!==\"number\"&&a!==\"boolean\"&&n.push(new L(`${r}[${s}]`,t[s],`string, number, or boolean expected, ${a} found`));break;case\"any\":case\"all\":case\"none\":for(let s=1;s<t.length;s++)n=n.concat(og({key:`${r}[${s}]`,value:t[s],style:e.style,styleSpec:e.styleSpec}));break;case\"has\":case\"!has\":a=ae(t[1]),t.length===2?a!==\"string\"&&n.push(new L(`${r}[1]`,t[1],`string expected, ${a} found`)):n.push(new L(r,t,`filter array for \"${t[0]}\" operator must have 2 elements`))}return n}function lg(e,t){let r=e.key,i=e.validateSpec,a=e.style,n=e.styleSpec,s=e.value,o=e.objectKey,l=n[`${t}_${e.layerType}`];if(!l)return[];let u=o.match(/^(.*)-transition$/);if(t===\"paint\"&&u&&l[u[1]]&&l[u[1]].transition)return i({key:r,value:s,valueSpec:n.transition,style:a,styleSpec:n});let h=e.valueSpec||l[o];if(!h)return[new L(r,s,`unknown property \"${o}\"`)];let c;if(ae(s)===\"string\"&&va(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new L(r,s,`\"${o}\" does not support interpolation syntax\nUse an identity property function instead: \\`{ \"type\": \"identity\", \"property\": ${JSON.stringify(c[1])} }\\`.`)];let p=[];return e.layerType===\"symbol\"&&o===\"text-font\"&&Eo(Bi(s))&&Be(s.type)===\"identity\"&&p.push(new L(r,s,'\"text-font\" does not support identity functions')),p.concat(i({key:e.key,value:s,valueSpec:h,style:a,styleSpec:n,expressionContext:\"property\",propertyType:t,propertyKey:o}))}function ug(e){return lg(e,\"paint\")}function hg(e){return lg(e,\"layout\")}function cg(e){let t=[],r=e.value,i=e.key,a=e.style,n=e.styleSpec;if(ae(r)!==\"object\")return[new L(i,r,`object expected, ${ae(r)} found`)];!r.type&&!r.ref&&t.push(new L(i,r,'either \"type\" or \"ref\" is required'));let s=Be(r.type),o=Be(r.ref);if(r.id){let l=Be(r.id);for(let u=0;u<e.arrayIndex;u++){let h=a.layers[u];Be(h.id)===l&&t.push(new L(i,r.id,`duplicate layer id \"${r.id}\", previously used at line ${h.id.__line__}`))}}if(\"ref\"in r){[\"type\",\"source\",\"source-layer\",\"filter\",\"layout\"].forEach(u=>{u in r&&t.push(new L(i,r[u],`\"${u}\" is prohibited for ref layers`))});let l;a.layers.forEach(u=>{Be(u.id)===o&&(l=u)}),l?l.ref?t.push(new L(i,r.ref,\"ref cannot reference another ref layer\")):s=Be(l.type):t.push(new L(i,r.ref,`ref layer \"${o}\" not found`))}else if(s!==\"background\")if(!r.source)t.push(new L(i,r,'missing required property \"source\"'));else{let l=a.sources&&a.sources[r.source],u=l&&Be(l.type);l?u===\"vector\"&&s===\"raster\"?t.push(new L(i,r.source,`layer \"${r.id}\" requires a raster source`)):u!==\"raster-dem\"&&s===\"hillshade\"||u!==\"raster-dem\"&&s===\"color-relief\"?t.push(new L(i,r.source,`layer \"${r.id}\" requires a raster-dem source`)):u===\"raster\"&&s!==\"raster\"?t.push(new L(i,r.source,`layer \"${r.id}\" requires a vector source`)):u===\"vector\"&&!r[\"source-layer\"]?t.push(new L(i,r,`layer \"${r.id}\" must specify a \"source-layer\"`)):u===\"raster-dem\"&&s!==\"hillshade\"&&s!==\"color-relief\"?t.push(new L(i,r.source,\"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.\")):s===\"line\"&&r.paint&&r.paint[\"line-gradient\"]&&(u!==\"geojson\"||!l.lineMetrics)&&t.push(new L(i,r,`layer \"${r.id}\" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):t.push(new L(i,r.source,`source \"${r.source}\" not found`))}return s===\"raster\"&&r.paint?.resampling&&r.paint?.[\"raster-resampling\"]&&t.push(new L(i,r.paint,`layer \"${r.id}\" redundantly specifies \"resampling\" and \"raster-resampling\" paint properties, but only one is allowed. It is advised to use \"resampling\".`)),t=t.concat(Bt({key:i,value:r,valueSpec:n.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{\"*\"(){return[]},type(){return e.validateSpec({key:`${i}.type`,value:r.type,valueSpec:n.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:\"type\"})},filter:Oh,layout(l){return Bt({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{\"*\"(u){return hg(En({layerType:s},u))}}})},paint(l){return Bt({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{\"*\"(u){return ug(En({layerType:s},u))}}})}}})),t}function pi(e){let t=e.value,r=e.key,i=ae(t);return i===\"string\"?[]:[new L(r,t,`string expected, ${i} found`)]}function iw(e){let t=e.sourceName??\"\",r=e.value,i=e.styleSpec,a=i.source_raster_dem,n=e.style,s=[],o=ae(r);if(r===void 0)return s;if(o!==\"object\")return s.push(new L(\"source_raster_dem\",r,`object expected, ${o} found`)),s;let l=Be(r.encoding)===\"custom\",u=[\"redFactor\",\"greenFactor\",\"blueFactor\",\"baseShift\"],h=e.value.encoding?`\"${e.value.encoding}\"`:\"Default\";for(let c in r)!l&&u.includes(c)?s.push(new L(c,r[c],`In \"${t}\": \"${c}\" is only valid when \"encoding\" is set to \"custom\". ${h} encoding found`)):a[c]?s=s.concat(e.validateSpec({key:c,value:r[c],valueSpec:a[c],validateSpec:e.validateSpec,style:n,styleSpec:i})):s.push(new L(c,r[c],`unknown property \"${c}\"`));return s}var Md={promoteId:aw};function pg(e){let t=e.value,r=e.key,i=e.styleSpec,a=e.style,n=e.validateSpec;if(!t.type)return[new L(r,t,'\"type\" is required')];let s=Be(t.type),o;switch(s){case\"vector\":case\"raster\":return o=Bt({key:r,value:t,valueSpec:i[`source_${s.replace(\"-\",\"_\")}`],style:e.style,styleSpec:i,objectElementValidators:Md,validateSpec:n}),o;case\"raster-dem\":return o=iw({sourceName:r,value:t,style:e.style,styleSpec:i,validateSpec:n}),o;case\"geojson\":if(o=Bt({key:r,value:t,valueSpec:i.source_geojson,style:a,styleSpec:i,validateSpec:n,objectElementValidators:Md}),t.cluster)for(let l in t.clusterProperties){let[u,h]=t.clusterProperties[l],c=typeof u==\"string\"?[u,[\"accumulated\"],[\"get\",l]]:u;o.push(...Ta({key:`${r}.${l}.map`,value:h,validateSpec:n,expressionContext:\"cluster-map\"})),o.push(...Ta({key:`${r}.${l}.reduce`,value:c,validateSpec:n,expressionContext:\"cluster-reduce\"}))}return o;case\"video\":return Bt({key:r,value:t,valueSpec:i.source_video,style:a,validateSpec:n,styleSpec:i});case\"image\":return Bt({key:r,value:t,valueSpec:i.source_image,style:a,validateSpec:n,styleSpec:i});case\"canvas\":return[new L(r,null,\"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.\",\"source.canvas\")];default:return An({key:`${r}.type`,value:t.type,valueSpec:{values:[\"vector\",\"raster\",\"raster-dem\",\"geojson\",\"video\",\"image\"]},style:a,validateSpec:n,styleSpec:i})}}function aw({key:e,value:t}){if(ae(t)===\"string\")return pi({key:e,value:t});{let r=[];for(let i in t)r.push(...pi({key:`${e}.${i}`,value:t[i]}));return r}}function dg(e){let t=e.value,r=e.styleSpec,i=r.light,a=e.style,n=[],s=ae(t);if(t===void 0)return n;if(s!==\"object\")return n=n.concat([new L(\"light\",t,`object expected, ${s} found`)]),n;for(let o in t){let l=o.match(/^(.*)-transition$/);n=l&&i[l[1]]&&i[l[1]].transition?n.concat(e.validateSpec({key:o,value:t[o],valueSpec:r.transition,validateSpec:e.validateSpec,style:a,styleSpec:r})):i[o]?n.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],validateSpec:e.validateSpec,style:a,styleSpec:r})):n.concat([new L(o,t[o],`unknown property \"${o}\"`)])}return n}function fg(e){let t=e.value,r=e.styleSpec,i=r.sky,a=e.style,n=ae(t);if(t===void 0)return[];if(n!==\"object\")return[new L(\"sky\",t,`object expected, ${n} found`)];let s=[];for(let o in t)s=i[o]?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],style:a,styleSpec:r})):s.concat([new L(o,t[o],`unknown property \"${o}\"`)]);return s}function mg(e){let t=e.value,r=e.styleSpec,i=r.terrain,a=e.style,n=[],s=ae(t);if(t===void 0)return n;if(s!==\"object\")return n=n.concat([new L(\"terrain\",t,`object expected, ${s} found`)]),n;for(let o in t)n=i[o]?n.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],validateSpec:e.validateSpec,style:a,styleSpec:r})):n.concat([new L(o,t[o],`unknown property \"${o}\"`)]);return n}function nw(e){return pi(e).length===0?[]:Ta(e)}function sw(e){return pi(e).length===0?[]:Ta(e)}function ow(e){let t=e.key,r=e.value;if(ae(r)===\"array\"){if(r.length<1||r.length>4)return[new L(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:\"number\"},a=[];for(let n=0;n<r.length;n++)a=a.concat(e.validateSpec({key:`${t}[${n}]`,value:r[n],validateSpec:e.validateSpec,valueSpec:i}));return a}return Mo({key:t,value:r,valueSpec:{}})}function lw(e){let t=e.key,r=e.value;if(ae(r)===\"array\"){let i={type:\"number\"};if(r.length<1)return[new L(t,r,\"array length at least 1 expected, length 0 found\")];let a=[];for(let n=0;n<r.length;n++)a=a.concat(e.validateSpec({key:`${t}[${n}]`,value:r[n],validateSpec:e.validateSpec,valueSpec:i}));return a}return Mo({key:t,value:r,valueSpec:{}})}function uw(e){let t=e.key,r=e.value;if(ae(r)===\"array\"){if(r.length<1)return[new L(t,r,\"array length at least 1 expected, length 0 found\")];let i=[];for(let a=0;a<r.length;a++)i=i.concat(hu({key:`${t}[${a}]`,value:r[a],valueSpec:{}}));return i}return hu({key:t,value:r,valueSpec:{}})}function hw(e){let t=e.key,r=e.value,i=ae(r),a=e.styleSpec;if(i!==\"array\"||r.length<1||r.length%2!=0)return[new L(t,r,\"variableAnchorOffsetCollection requires a non-empty array of even length\")];let n=[];for(let s=0;s<r.length;s+=2)n=n.concat(An({key:`${t}[${s}]`,value:r[s],valueSpec:a.layout_symbol[\"text-anchor\"]})),n=n.concat(Bh({key:`${t}[${s+1}]`,value:r[s+1],valueSpec:{length:2,value:\"number\"},validateSpec:e.validateSpec,style:e.style,styleSpec:a}));return n}function gg(e){let t=[],r=e.value,i=e.key;if(Array.isArray(r)){let a=[],n=[];for(let s in r)r[s].id&&a.includes(r[s].id)&&t.push(new L(i,r,`all the sprites' ids must be unique, but ${r[s].id} is duplicated`)),a.push(r[s].id),r[s].url&&n.includes(r[s].url)&&t.push(new L(i,r,`all the sprites' URLs must be unique, but ${r[s].url} is duplicated`)),n.push(r[s].url),t=t.concat(Bt({key:`${i}[${s}]`,value:r[s],valueSpec:{id:{type:\"string\",required:!0},url:{type:\"string\",required:!0}},validateSpec:e.validateSpec}));return t}return pi({key:i,value:r})}function cw(e){let t=e.value,r=e.styleSpec,i=r.projection,a=e.style,n=ae(t);if(t===void 0)return[];if(n!==\"object\")return[new L(\"projection\",t,`object expected, ${n} found`)];let s=[];for(let o in t)s=i[o]?s.concat(e.validateSpec({key:o,value:t[o],valueSpec:i[o],style:a,styleSpec:r})):s.concat([new L(o,t[o],`unknown property \"${o}\"`)]);return s}function pw(e){let t=e.key,r=e.value;r=r instanceof String?r.valueOf():r;let i=ae(r);return i===\"array\"&&!fw(r)&&!dw(r)?[new L(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:[\"array\",\"string\"].includes(i)?[]:[new L(t,r,`projection expected, invalid type \"${i}\" found`)]}function dw(e){return!![\"interpolate\",\"step\",\"literal\"].includes(e[0])}function fw(e){return Array.isArray(e)&&e.length===3&&typeof e[0]==\"string\"&&typeof e[1]==\"string\"&&typeof e[2]==\"number\"}function cu(e){return!!e&&e.constructor===Object}function yg(e){return cu(e.value)?[]:[new L(e.key,e.value,`object expected, ${ae(e.value)} found`)]}var Pd=1114111,mw=/^u\\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\\?{1,6}))$/i;function gw(e,t){if(ae(t)!==\"string\")return[];let r=`${t}`,i=()=>[new L(e,t,'invalid unicode range, expected a value such as \"U+26\", \"U+0-10FFFF\" or \"U+4??\"')],a=r.match(mw);if(!a)return i();let[,n,s,o]=a;if(o!==void 0)return o.length>6?i():[];let l=parseInt(n,16),u=s===void 0?l:parseInt(s,16);return l>Pd||u>Pd?[new L(e,t,\"unicode range is out of bounds, the maximum code point is U+10FFFF\")]:l>u?[new L(e,t,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function _g(e){let t=e.key??\"font-faces\",r=e.value,i=e.validateSpec,a=e.styleSpec??tm,n=e.style;if(!cu(r))return[new L(t,r,`object expected, ${ae(r)} found`)];let s=[];for(let o in r){let l=r[o],u=ae(l);if(u===\"string\")s.push(...pi({key:`${t}.${o}`,value:l}));else if(u===\"array\"){let h={url:{type:\"string\",required:!0},\"unicode-range\":{type:\"array\",value:\"string\"}};for(let[c,p]of l.entries()){let d=`${t}.${o}[${c}]`;s.push(...Bt({key:d,value:p,valueSpec:h,styleSpec:a,style:n,validateSpec:i}));let f=cu(p)?p[\"unicode-range\"]:void 0;if(ae(f)===\"array\")for(let[m,g]of f.entries())s.push(...gw(`${d}.unicode-range[${m}]`,g))}}else s.push(new L(`${t}.${o}`,l,`string or array expected, ${u} found`))}return s}var Cd={\"*\"(){return[]},array:Bh,boolean:ew,number:Mo,color:hu,constants:ng,enum:An,filter:Oh,function:sg,layer:cg,object:Bt,source:pg,light:dg,sky:fg,terrain:mg,projection:cw,projectionDefinition:pw,string:pi,formatted:nw,resolvedImage:sw,padding:ow,numberArray:lw,colorArray:uw,variableAnchorOffsetCollection:hw,sprite:gg,state:yg,fontFaces:_g};function gn(e){let t=e.value,r=e.valueSpec,i=e.styleSpec;return e.validateSpec=gn,r.expression&&Eo(Be(t))?sg(e):r.expression&&Io(Bi(t))?Ta(e):r.type&&Cd[r.type]?Cd[r.type](e):Bt(En({},e,{valueSpec:r.type?i[r.type]:r}))}function xg(e){let t=e.value,r=e.key,i=pi(e);return i.length||(t.indexOf(\"{fontstack}\")===-1&&i.push(new L(r,t,'\"glyphs\" url must include a \"{fontstack}\" token')),t.indexOf(\"{range}\")===-1&&i.push(new L(r,t,'\"glyphs\" url must include a \"{range}\" token'))),i}function Lt(e,t=P){let r=[];return r=r.concat(gn({key:\"\",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:gn,objectElementValidators:{glyphs:xg,\"*\"(){return[]}}})),e.constants&&(r=r.concat(ng({key:\"constants\",value:e.constants,style:e,styleSpec:t,validateSpec:gn}))),vg(r)}Lt.source=Gt(jt(pg)),Lt.sprite=Gt(jt(gg)),Lt.glyphs=Gt(jt(xg)),Lt.fontFaces=Gt(jt(_g)),Lt.light=Gt(jt(dg)),Lt.sky=Gt(jt(fg)),Lt.terrain=Gt(jt(mg)),Lt.state=Gt(jt(yg)),Lt.layer=Gt(jt(cg)),Lt.filter=Gt(jt(Oh)),Lt.paintProperty=Gt(jt(ug)),Lt.layoutProperty=Gt(jt(hg));function jt(e){return function(t){return e(Object.assign({},t,{validateSpec:gn}))}}function vg(e){return[].concat(e).sort((t,r)=>t.line-r.line)}function Gt(e){return function(...t){return vg(e.apply(this,t))}}var yw={type:\"enum\",\"property-type\":\"data-constant\",expression:{interpolated:!1,parameters:[\"global-state\"]},values:{visible:{},none:{}},transition:!1,default:\"visible\"},_w=class{constructor(e,t,r){this._rootKey=t,this._globalState=r,this.setValue(e)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(e){if(e==null||e===\"visible\"||e===\"none\"){this._literalValue=e===\"none\"?\"none\":\"visible\",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let t=Ao(e,this._rootKey,yw,this._globalState);if(t.result===\"error\")throw this._literalValue=\"visible\",this._compiledValue=void 0,Error(t.value.map(r=>`${r.key}: ${r.message}`).join(\", \"));this._literalValue=void 0,this._compiledValue=t.value,this._globalStateRefs=Xn(t.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function xw(e,t,r){return new _w(e,t,r)}var It=Lt,Vh=new Set(Object.keys(P).filter(e=>e.startsWith(\"source_\")).map(e=>e.slice(7).replaceAll(\"_\",\"-\")));function vw(e){return Object.entries(e.sources??{}).filter(([,t])=>!Vh.has(t.type)).map(([t])=>`sources.${t}`)}function Nh(e,t){let r=vw(t);return Po(e,It(t).filter(({message:i})=>!r.some(a=>i.startsWith(`${a}:`)||i.startsWith(`${a}.`))))}function Po(e,t){let r=!1;for(let i of t){if(i.severity===\"warning\"){pe(i.message);continue}e.fire(new X(Error(i.message))),r=!0}return r}function Ba(e,t,r,i){return i?.validate!==!1&&Po(e,t({styleSpec:P,...r}))}var pu=class bg{constructor(t,r,i){let a=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let s=new Int32Array(this.arrayBuffer);t=s[0],r=s[1],i=s[2],this.d=r+2*i;for(let u=0;u<this.d*this.d;u++){let h=s[3+u],c=s[3+u+1];a.push(h===c?null:s.subarray(h,c))}let o=s[3+a.length],l=s[3+a.length+1];this.keys=s.subarray(o,l),this.bboxes=s.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*i;for(let s=0;s<this.d*this.d;s++)a.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=i,this.scale=r/t,this.uid=0;let n=i/r*t;this.min=-n,this.max=t+n}insert(t,r,i,a,n){this._forEachCell(r,i,a,n,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(a),this.bboxes.push(n)}_insertReadonly(){throw Error(\"Cannot insert into a GridIndex created from an ArrayBuffer.\")}_insertCell(t,r,i,a,n,s){this.cells[n].push(s)}query(t,r,i,a,n){let s=this.min,o=this.max;if(t<=s&&r<=s&&o<=i&&o<=a&&!n)return[...this.keys];{let l=[];return this._forEachCell(t,r,i,a,this._queryCell,l,{},n),l}}_queryCell(t,r,i,a,n,s,o,l){let u=this.cells[n];if(u!==null){let h=this.keys,c=this.bboxes;for(let p of u)if(o[p]===void 0){let d=p*4;(l?l(c[d+0],c[d+1],c[d+2],c[d+3]):t<=c[d+2]&&r<=c[d+3]&&i>=c[d+0]&&a>=c[d+1])?(o[p]=!0,s.push(h[p])):o[p]=!1}}}_forEachCell(t,r,i,a,n,s,o,l){let u=this._convertToCellCoord(t),h=this._convertToCellCoord(r),c=this._convertToCellCoord(i),p=this._convertToCellCoord(a);for(let d=u;d<=c;d++)for(let f=h;f<=p;f++){let m=this.d*f+d;if(!(l&&!l(this._convertFromCellCoord(d),this._convertFromCellCoord(f),this._convertFromCellCoord(d+1),this._convertFromCellCoord(f+1)))&&n.call(this,t,r,i,a,m,s,o,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,r=3+this.cells.length+1+1,i=0;for(let s of this.cells)i+=s.length;let a=new Int32Array(r+i+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;let n=r;for(let s=0;s<t.length;s++){let o=t[s];a[3+s]=n,a.set(o,n),n+=o.length}return a[3+t.length]=n,a.set(this.keys,n),n+=this.keys.length,a[3+t.length+1]=n,a.set(this.bboxes,n),n+=this.bboxes.length,a.buffer}static serialize(t,r){let i=t.toArrayBuffer();return r&&r.push(i),{buffer:i}}static deserialize(t){return new bg(t.buffer)}},Fr={};function N(e,t,r={}){if(Fr[e])throw Error(`${e} is already registered.`);Object.defineProperty(t,\"_classRegistryKey\",{value:e,writeable:!1}),Fr[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}N(\"Object\",Object),N(\"Set\",Set),N(\"TransferableGridIndex\",pu),N(\"Color\",J),N(\"Error\",Error),N(\"AJAXError\",vn),N(\"ResolvedImage\",br),N(\"StylePropertyFunction\",Qm),N(\"StyleExpression\",zh,{omit:[\"_evaluator\"]}),N(\"ZoomDependentExpression\",qs),N(\"ZoomConstantExpression\",In),N(\"CompoundExpression\",$i,{omit:[\"_evaluate\"]});for(let e in pa)pa[e]._classRegistryKey||N(`Expression_${e}`,pa[e]);function wg(e){return e&&typeof ArrayBuffer<\"u\"&&(e instanceof ArrayBuffer||e.constructor?.name===\"ArrayBuffer\")}function Uh(e){let t=e.constructor;return e.$name||t._classRegistryKey}function bw(e){if(typeof e!=\"object\"||!e)return!1;let t=Uh(e);return t&&t!==\"Object\"}function Tg(e){return!bw(e)&&(e==null||typeof e==\"boolean\"||typeof e==\"number\"||typeof e==\"string\"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||e instanceof Error||wg(e)||mi(e)||ArrayBuffer.isView(e)||e instanceof ImageData)}function yn(e,t){if(Tg(e))return(wg(e)||mi(e))&&t&&t.push(e),ArrayBuffer.isView(e)&&t&&t.push(e.buffer),e instanceof ImageData&&t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let n=[];for(let s of e)n.push(yn(s,t));return n}if(typeof e!=\"object\")throw Error(`can't serialize object of type ${typeof e}`);let r=Uh(e);if(!r)throw Error(`can't serialize object of unregistered class ${e.constructor.name}`);if(!Fr[r])throw Error(`${r} is not registered.`);let{klass:i}=Fr[r],a=i.serialize?i.serialize(e,t):{};if(i.serialize){if(a===t?.[t.length-1])throw Error(\"statically serialized object won't survive transfer of $name property\")}else{for(let n in e){if(!e.hasOwnProperty(n)||Fr[r].omit.includes(n))continue;let s=e[n];s!==void 0&&(a[n]=Fr[r].shallow.includes(n)?s:yn(s,t))}e instanceof Error&&(a.message=e.message)}if(a.$name)throw Error(\"$name property is reserved for worker serialization logic.\");return r!==\"Object\"&&(a.$name=r),a}function _n(e){if(Tg(e))return e;if(Array.isArray(e))return e.map(_n);if(typeof e!=\"object\")throw Error(`can't deserialize object of type ${typeof e}`);let t=Uh(e)||\"Object\";if(!Fr[t])throw Error(`can't deserialize unregistered class ${t}`);let{klass:r}=Fr[t];if(!r)throw Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(e);let i=Object.create(r.prototype);for(let a of Object.keys(e)){if(a===\"$name\")continue;let n=e[a];i[a]=Fr[t].shallow.includes(a)?n:_n(n)}return i}var Ws=class{constructor(){this.first=!0}update(e,t){let r=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=t):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=t),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=r,!0))}};function Sg(e){return/[\\u02EA\\u02EB\\u1100-\\u11FF\\u2E80-\\u2FDF\\u3000-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u4DBF\\u4E00-\\uA48C\\uA490-\\uA4C6\\uA960-\\uA97C\\uAC00-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFE10-\\uFE1F\\uFE30-\\uFE4F\\uFF00-\\uFFEF]|\\uD81B[\\uDFE0-\\uDFFF]|[\\uD81C-\\uD822\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFB]|\\uD83C[\\uDE00-\\uDEFF]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/gim.test(String.fromCodePoint(e))}function ww(e){return/[\\u02EA\\u02EB\\u1100-\\u11FF\\u1400-\\u167F\\u18B0-\\u18F5\\u2E80-\\u2E99\\u2E9B-\\u2EF3\\u2F00-\\u2FD5\\u2FF0-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u303F\\u3041-\\u3096\\u309D-\\u30FB\\u30FD-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u3190-\\uA48C\\uA490-\\uA4C6\\uA960-\\uA97C\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFE10-\\uFE1F\\uFE30-\\uFE48\\uFE50-\\uFE57\\uFE5F-\\uFE62\\uFE67-\\uFE6F\\uFF00-\\uFF07\\uFF0A-\\uFF0C\\uFF0E-\\uFF19\\uFF1F-\\uFF3A\\uFF3C\\uFF3E\\uFF40-\\uFF5A\\uFFE0-\\uFFE2\\uFFE4-\\uFFE7]|\\uD802[\\uDD80-\\uDD9F]|\\uD805[\\uDD80-\\uDDFF]|\\uD806[\\uDE00-\\uDEBF]|\\uD811[\\uDC00-\\uDE7F]|\\uD81B[\\uDFE0-\\uDFE4\\uDFF0-\\uDFF6]|[\\uD81C-\\uD822\\uD83D\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFF3\\uDFF5-\\uDFFB\\uDFFD\\uDFFE]|\\uD82C[\\uDC00-\\uDD22\\uDD30-\\uDEFB]|\\uD833[\\uDEC0-\\uDFCF]|\\uD834[\\uDC00-\\uDDFF\\uDEE0-\\uDF7F]|\\uD836[\\uDC00-\\uDEAF]|\\uD83C[\\uDC00-\\uDE00\\uDF00-\\uDFFF]|\\uD83E[\\uDD00-\\uDEFF]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/gim.test(String.fromCodePoint(e))}function Tw(e){return/[\\u0900-\\u0DFF\\u0F00-\\u109F\\u1780-\\u17FF]/gim.test(String.fromCodePoint(e))}function Sw(e){for(let t of e)if(ww(t.codePointAt(0)))return!0;return!1}function Eg(e){let t=e.map(r=>{try{return RegExp(`\\\\p{sc=${r}}`,\"u\").source}catch{return null}}).filter(r=>r);return new RegExp(t.join(\"|\"),\"u\")}var YD=Eg([\"Arab\",\"Dupl\",\"Mong\",\"Ougr\",\"Syrc\"]);var Ew=Eg(\"Adlm.Arab.Armi.Avst.Chrs.Cprt.Egyp.Elym.Gara.Hatr.Hebr.Hung.Khar.Lydi.Mand.Mani.Mend.Merc.Mero.Narb.Nbat.Nkoo.Orkh.Palm.Phli.Phlp.Phnx.Prti.Rohg.Samr.Sarb.Sogo.Syrc.Thaa.Todr.Yezi\".split(\".\"));function Ig(e){return Ew.test(String.fromCodePoint(e))}function Iw(e,t){return!t&&Ig(e)?!1:!Tw(e)}function Aw(e){for(let t of e)if(Ig(t.codePointAt(0)))return!0;return!1}function Mw(e,t){for(let r of e)if(!Iw(r.codePointAt(0),t))return!1;return!0}var Sa=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus=\"unavailable\",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(e){this.pluginStatus=e.pluginStatus,this.pluginURL=e.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(e){if(Sa.isParsed())throw Error(\"RTL text plugin already registered.\");this.applyArabicShaping=e.applyArabicShaping,this.processBidirectionalText=e.processBidirectionalText,this.processStyledBidirectionalText=e.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(e,t){if(this.isParsed())return this.getState();if(e.pluginStatus!==\"loading\")return this.setState(e),e;let r=e.pluginURL,i=new Promise(n=>{this.loadScriptResolve=n}),a=new Promise(n=>setTimeout(()=>n(),this.TIMEOUT));if(await t(r),await Promise.race([i,a]),this.isParsed()){let n={pluginStatus:\"loaded\",pluginURL:r};return this.setState(n),n}throw this.setState({pluginStatus:\"error\",pluginURL:\"\"}),Error(`RTL Text Plugin failed to import scripts from ${r}`)}},Te=class{constructor(e,t){this.isSupportedScript=Pw,this.zoom=e,t?(this.now=t.now||0,this.fadeDuration=t.fadeDuration||0,this.zoomHistory=t.zoomHistory||new Ws,this.transition=t.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ws,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let e=this.zoom,t=e-Math.floor(e),r=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:t+(1-t)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*t}}};function Pw(e){return Mw(e,Sa.getRTLTextPluginStatus()===\"loaded\")}var Co=\"-transition\",ko=class{constructor(e,t,r,i){this.property=e,this.value=t,this.expression=Zb(t===void 0?e.specification.default:t,r,e.specification,i)}isDataDriven(){return this.expression.kind===\"source\"||this.expression.kind===\"composite\"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,t,r){return this.property.possiblyEvaluate(this,e,t,r)}},du=class{constructor(e,t,r){this.property=e,this.value=new ko(e,void 0,t,r)}transitioned(e,t){return new kd(this.property,this.value,t,j({},e.transition,this.transition),e.now)}untransitioned(){return new kd(this.property,this.value,null,{},0)}},Hn=class{constructor(e,t,r){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=t}_propertyRootKey(e){return`${this._rootKey}.${String(e)}`}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return St(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new du(this._values[e].property,this._propertyRootKey(e),this._globalState)),this._values[e].value=new ko(this._values[e].property,t===null?void 0:St(t),this._propertyRootKey(e),this._globalState)}getTransition(e){return St(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new du(this._values[e].property,this._propertyRootKey(e),this._globalState)),this._values[e].transition=St(t)||void 0}serialize(){let e={};for(let t of Object.keys(this._values)){let r=this.getValue(t);r!==void 0&&(e[t]=r);let i=this.getTransition(t);i!==void 0&&(e[`${t}${Co}`]=i)}return e}transitioned(e,t){let r=new Dd(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(e,t._values[i]);return r}untransitioned(){let e=new Dd(this._properties);for(let t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}},kd=class{constructor(e,t,r,i,a){this.property=e,this.value=t,this.begin=a+i.delay||0,this.end=this.begin+i.duration||0,e.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(e,t,r){let i=e.now||0,a=this.value.possiblyEvaluate(e,t,r),n=this.prior;if(!n)return a;if(i>this.end||this.value.isDataDriven())return this.prior=null,a;if(i<this.begin)return n.possiblyEvaluate(e,t,r);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(n.possiblyEvaluate(e,t,r),a,fv(s))}}},Dd=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,r){let i=new Do(this._properties);for(let a of Object.keys(this._values))i._values[a]=this._values[a].possiblyEvaluate(e,t,r);return i}hasTransition(){for(let e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}},Cw=class{constructor(e,t,r){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=r,this._rootKey=t}_propertyRootKey(e){return`${this._rootKey}.${String(e)}`}hasValue(e){return this._values[e].value!==void 0}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return St(this._values[e].value)}setValue(e,t){this._values[e]=new ko(this._values[e].property,t===null?void 0:St(t),this._propertyRootKey(e),this._globalState)}serialize(){let e={};for(let t of Object.keys(this._values)){let r=this.getValue(t);r!==void 0&&(e[t]=r)}return e}possiblyEvaluate(e,t,r){let i=new Do(this._properties);for(let a of Object.keys(this._values))i._values[a]=this._values[a].possiblyEvaluate(e,t,r);return i}},Wt=class{constructor(e,t,r){this.property=e,this.value=t,this.parameters=r}isConstant(){return this.value.kind===\"constant\"}constantOr(e){return this.value.kind===\"constant\"?this.value.value:e}evaluate(e,t,r,i){return this.property.evaluate(this.value,this.parameters,e,t,r,i)}},Do=class{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}};function Fd(e){if(Array.isArray(e))return e.length;let t=e?.values;return Array.isArray(t)?t.length:void 0}function Ag(e,t){let r=Fd(e),i=Fd(t);return r!==void 0&&i!==void 0&&r!==i}var V=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t){if(e.isDataDriven())throw Error(\"Value should not be data driven\");return e.expression.evaluate(t)}interpolate(e,t,r){if(Ag(e,t))return pe(`Property \"${this.name}\" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),t;let i=this.specification.type,a=Ve[i];return a?a(e,t,r):e}},q=class{constructor(e,t,r){this.specification=e,this.name=t,this.overrides=r}possiblyEvaluate(e,t,r,i){return e.expression.kind===\"constant\"||e.expression.kind===\"camera\"?new Wt(this,{kind:\"constant\",value:e.expression.evaluate(t,null,{},r,i)},t):new Wt(this,e.expression,t)}interpolate(e,t,r){if(e.value.kind!==\"constant\"||t.value.kind!==\"constant\")return e;if(e.value.value===void 0||t.value.value===void 0)return new Wt(this,{kind:\"constant\",value:void 0},e.parameters);if(Ag(e.value.value,t.value.value))return pe(`Property \"${this.name}\" is trying to interpolate arrays of different lengths. Rendering may 'jump'.`),t;let i=this.specification.type,a=Ve[i];if(a){let n=a(e.value.value,t.value.value,r);return new Wt(this,{kind:\"constant\",value:n},e.parameters)}return e}evaluate(e,t,r,i,a,n){return e.kind===\"constant\"?e.value:e.evaluate(t,r,i,a,n)}},Mn=class extends q{possiblyEvaluate(e,t,r,i){if(e.value===void 0)return new Wt(this,{kind:\"constant\",value:void 0},t);if(e.expression.kind===\"constant\"){let a=e.expression.evaluate(t,null,{},r,i),n=e.property.specification.type===\"resolvedImage\"&&typeof a!=\"string\"?a.name:a,s=this._calculate(n,n,n,t);return new Wt(this,{kind:\"constant\",value:s},t)}if(e.expression.kind===\"camera\"){let a=this._calculate(e.expression.evaluate({zoom:t.zoom-1}),e.expression.evaluate({zoom:t.zoom}),e.expression.evaluate({zoom:t.zoom+1}),t);return new Wt(this,{kind:\"constant\",value:a},t)}return new Wt(this,e.expression,t)}evaluate(e,t,r,i,a,n){if(e.kind===\"source\"){let s=e.evaluate(t,r,i,a,n);return this._calculate(s,s,s,t)}return e.kind===\"composite\"?this._calculate(e.evaluate({zoom:Math.floor(t.zoom)-1},r,i),e.evaluate({zoom:Math.floor(t.zoom)},r,i),e.evaluate({zoom:Math.floor(t.zoom)+1},r,i),t):e.value}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}},Mg=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t,r,i){if(e.value!==void 0){if(e.expression.kind===\"constant\"){let a=e.expression.evaluate(t,null,{},r,i);return this._calculate(a,a,a,t)}return this._calculate(e.expression.evaluate(new Te(Math.floor(t.zoom-1),t)),e.expression.evaluate(new Te(Math.floor(t.zoom),t)),e.expression.evaluate(new Te(Math.floor(t.zoom+1),t)),t)}}_calculate(e,t,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:e,to:t}:{from:r,to:t}}interpolate(e){return e}},Yn=class{constructor(e,t){this.specification=e,this.name=t}possiblyEvaluate(e,t,r,i){return!!e.expression.evaluate(t,null,{},r,i)}interpolate(){return!1}},Qe=class{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let t in e){let r=e[t];r.specification.overridable&&this.overridableProperties.push(t);let i=this.defaultPropertyValues[t]=new ko(r,void 0,r.name,void 0),a=this.defaultTransitionablePropertyValues[t]=new du(r,r.name,void 0);this.defaultTransitioningPropertyValues[t]=a.untransitioned(),this.defaultPossiblyEvaluatedValues[t]=i.possiblyEvaluate({})}}};N(\"DataDrivenProperty\",q),N(\"DataConstantProperty\",V),N(\"CrossFadedDataDrivenProperty\",Mn),N(\"CrossFadedProperty\",Mg),N(\"ColorRampProperty\",Yn);var zd=\" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?\",Wl=\" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?\",cr=class extends wt{constructor(e,t,r){if(super(),this.id=e.id,this.type=e.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=xw(this.visibility,`layers[${this.id}].layout.visibility`,r),e.type!==\"custom\"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!==\"background\"&&(this.source=e.source,this.sourceLayer=e[\"source-layer\"],this.filter=e.filter,this._featureFilter=wa(e.filter,`layers[${this.id}].filter`,r)),t.layout&&(this._unevaluatedLayout=new Cw(t.layout,`layers[${this.id}].layout`,r)),t.paint)){this._transitionablePaint=new Hn(t.paint,`layers[${this.id}].paint`,r);for(let i in e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(let i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Do(t.paint)}}setFilter(e){this.filter=e,this._featureFilter=wa(e,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){if(e===\"visibility\")return this.visibility;if(this._transitionablePaint?.hasProperty(e))throw Error(e+zd);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property \"${e}\" on layer type \"${this.type}\" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){let e=new Set;for(let t of this._visibilityExpression.getGlobalStateRefs())e.add(t);if(this._unevaluatedLayout)for(let t in this._unevaluatedLayout._values){let r=this._unevaluatedLayout._values[t];for(let i of r.getGlobalStateRefs())e.add(i)}for(let t of this._featureFilter.getGlobalStateRefs())e.add(t);return e}getPaintAffectingGlobalStateRefs(){let e=new globalThis.Map;if(this._transitionablePaint)for(let t in this._transitionablePaint._values){let r=this._transitionablePaint._values[t].value;for(let i of r.getGlobalStateRefs()){let a=e.get(i)??[];a.push({name:t,value:r.value}),e.set(i,a)}}return e}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,t,r={}){if(e===\"visibility\"){this.visibility=t,this._visibilityExpression.setValue(t),this.recalculateVisibility();return}if(this._transitionablePaint?.hasProperty(e)){this.fire(new X(Error(e+zd)));return}t!=null&&this._validate(It.layoutProperty,`layers.${this.id}.layout.${e}`,e,t,r)||this._unevaluatedLayout.setValue(e,t)}getPaintProperty(e){if(e.endsWith(\"-transition\")){let t=e.slice(0,-11);if(t===\"visibility\"||this._unevaluatedLayout?.hasProperty(t))throw Error(e+Wl);return this._transitionablePaint.getTransition(t)}if(e===\"visibility\"||this._unevaluatedLayout?.hasProperty(e))throw Error(e+Wl);return this._transitionablePaint.getValue(e)}setPaintProperty(e,t,r={}){if(e===\"visibility\"||this._unevaluatedLayout?.hasProperty(e))return this.fire(new X(Error(e+Wl))),!1;if(t!=null&&this._validate(It.paintProperty,`layers.${this.id}.paint.${e}`,e,t,r))return!1;if(e.endsWith(\"-transition\"))return this._transitionablePaint.setTransition(e.slice(0,-11),t||void 0),!1;{let i=this._transitionablePaint._values[e],a=i.property.specification[\"property-type\"]===\"cross-faded-data-driven\",n=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(e,t),this._handleSpecialPaintPropertyUpdate(e);let o=this._transitionablePaint._values[e].value;return o.isDataDriven()||n||a||this._handleOverridablePaintPropertyUpdate(e,s,o)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,t,r){return!1}isHidden(e=this.minzoom,t=!1){return this.minzoom&&e<(t?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&e>=this.maxzoom?!0:this._evaluatedVisibility===\"none\"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(e,t){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){let e={id:this.id,type:this.type,source:this.source,\"source-layer\":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout?.serialize(),paint:this._transitionablePaint?.serialize()};return this.visibility&&(e.layout||(e.layout={}),e.layout.visibility=this.visibility),gh(e,(t,r)=>t!==void 0&&!(r===\"layout\"&&!Object.keys(t).length)&&!(r===\"paint\"&&!Object.keys(t).length))}_validate(e,t,r,i,a={}){return Ba(this,e,{key:t,layerType:this.type,objectKey:r,value:i},a)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let t=this.paint.get(e);if(!(!(t instanceof Wt)||!va(t.property.specification))&&(t.value.kind===\"source\"||t.value.kind===\"composite\")&&t.value.isStateDependent)return!0}return!1}},kw,Dw=()=>kw||(kw=new Qe({\"raster-opacity\":new V(P.paint_raster[\"raster-opacity\"],\"raster-opacity\"),\"raster-hue-rotate\":new V(P.paint_raster[\"raster-hue-rotate\"],\"raster-hue-rotate\"),\"raster-brightness-min\":new V(P.paint_raster[\"raster-brightness-min\"],\"raster-brightness-min\"),\"raster-brightness-max\":new V(P.paint_raster[\"raster-brightness-max\"],\"raster-brightness-max\"),\"raster-saturation\":new V(P.paint_raster[\"raster-saturation\"],\"raster-saturation\"),\"raster-contrast\":new V(P.paint_raster[\"raster-contrast\"],\"raster-contrast\"),resampling:new V(P.paint_raster.resampling,\"resampling\"),\"raster-resampling\":new V(P.paint_raster[\"raster-resampling\"],\"raster-resampling\"),\"raster-fade-duration\":new V(P.paint_raster[\"raster-fade-duration\"],\"raster-fade-duration\"),\"raster-color\":new Yn(P.paint_raster[\"raster-color\"],\"raster-color\"),\"raster-color-mix\":new V(P.paint_raster[\"raster-color-mix\"],\"raster-color-mix\"),\"raster-color-range\":new V(P.paint_raster[\"raster-color-range\"],\"raster-color-range\")})),Fw={get paint(){return Dw()}};function $h(e,{width:t,height:r},i,a){if(!a)a=new Uint8Array(t*r*i);else if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==t*r*i)throw RangeError(`mismatched image size. expected: ${a.length} but got: ${t*r*i}`);return e.width=t,e.height=r,e.data=a,e}function Pg(e,{width:t,height:r},i){if(t===e.width&&r===e.height)return;let a=$h({},{width:t,height:r},i);jh(e,a,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},i),e.width=t,e.height=r,e.data=a.data}function jh(e,t,r,i,a,n){if(a.width===0||a.height===0)return t;if(a.width>e.width||a.height>e.height||r.x>e.width-a.width||r.y>e.height-a.height)throw RangeError(\"out of range source coordinates for image copy\");if(a.width>t.width||a.height>t.height||i.x>t.width-a.width||i.y>t.height-a.height)throw RangeError(\"out of range destination coordinates for image copy\");let s=e.data,o=t.data;if(s===o)throw Error(\"srcData equals dstData, so image is already copied\");for(let l=0;l<a.height;l++){let u=((r.y+l)*e.width+r.x)*n,h=((i.y+l)*t.width+i.x)*n;for(let c=0;c<a.width*n;c++)o[h+c]=s[u+c]}return t}var Fo=class Cg{constructor(t,r){$h(this,t,1,r)}resize(t){Pg(this,t,1)}clone(){return new Cg({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,i,a,n){jh(t,r,i,a,n,1)}},xe=class kg{constructor(t,r){$h(this,t,4,r)}resize(t){Pg(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new kg({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,i,a,n){jh(t,r,i,a,n,4)}setPixel(t,r,i){let a=(t*this.width+r)*4;this.data[a+0]=Math.round(i.r*255/i.a),this.data[a+1]=Math.round(i.g*255/i.a),this.data[a+2]=Math.round(i.b*255/i.a),this.data[a+3]=Math.round(i.a*255)}};function Xl(e){let t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=4){let i=e[r+3];t[r+0]=Math.round(e[r+0]*i/255),t[r+1]=Math.round(e[r+1]*i/255),t[r+2]=Math.round(e[r+2]*i/255),t[r+3]=i}return t}N(\"AlphaImage\",Fo),N(\"RGBAImage\",xe);function zo(e){let t={},r=e.resolution||256,i=e.clips?e.clips.length:1,a=e.image||new xe({width:r,height:i});if(!gv(r))throw Error(`width is not a power of 2 - ${r}`);let n=(s,o,l)=>{t[e.evaluationKey]=l;let u=e.expression.evaluate(t);a.setPixel(s/4/r,o/4,u)};if(e.clips)for(let s=0,o=0;s<i;++s,o+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let h=l/(r-1),{start:c,end:p}=e.clips[s],d=c*(1-h)+p*h;n(o,u,d)}else for(let s=0,o=0;s<r;s++,o+=4){let l=s/(r-1);n(0,o,l)}return a}var Ro=e=>e.type===\"raster\",zw=class extends cr{constructor(e,t){super(e,Fw,t),this._updateColorRamp()}hasColorMap(){return!!this._transitionablePaint._values[\"raster-color\"].value.value}_handleSpecialPaintPropertyUpdate(e){(e===\"raster-color\"||e===\"raster-color-range\")&&this._updateColorRamp()}_updateColorRamp(){if(!this.hasColorMap())return;let e=this._transitionablePaint._values[\"raster-color\"].value.expression,[t,r]=this._transitionablePaint._values[\"raster-color-range\"].value.expression.evaluate({zoom:0});this.colorRamp=zo({expression:e,evaluationKey:\"rasterValue\",image:this.colorRamp,clips:[{start:t,end:r}]}),this.colorRampTexture=null}},Rw={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Kn=class{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},Ce=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,t){return e._trim(),t&&(e.isTransferred=!0,t.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){let t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement,t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(this.capacity*5),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}_refreshViews(){throw Error(\"_refreshViews() must be implemented by each concrete StructArray layout\")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function Ae(e,t=1){let r=0,i=0;return{members:e.map(a=>{let n=Lw(a.type),s=r=Rd(r,Math.max(t,n)),o=a.components||1;return i=Math.max(i,n),r+=n*o,{name:a.name,type:a.type,components:o,offset:s}}),size:Rd(r,Math.max(i,t)),alignment:t}}function Lw(e){return Rw[e].BYTES_PER_ELEMENT}function Rd(e,t){return Math.ceil(e/t)*t}var Pn=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=e*2;return this.int16[i+0]=t,this.int16[i+1]=r,e}};Pn.prototype.bytesPerElement=4,N(\"StructArrayLayout2i4\",Pn);var Xs=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=e*3;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=i,e}};Xs.prototype.bytesPerElement=6,N(\"StructArrayLayout3i6\",Xs);var fu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i)}emplace(e,t,r,i,a){let n=e*4;return this.int16[n+0]=t,this.int16[n+1]=r,this.int16[n+2]=i,this.int16[n+3]=a,e}};fu.prototype.bytesPerElement=8,N(\"StructArrayLayout4i8\",fu);var mu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,a,n)}emplace(e,t,r,i,a,n,s){let o=e*6;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=a,this.int16[o+4]=n,this.int16[o+5]=s,e}};mu.prototype.bytesPerElement=12,N(\"StructArrayLayout2i4i12\",mu);var gu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,a,n)}emplace(e,t,r,i,a,n,s){let o=e*4,l=e*8;return this.int16[o+0]=t,this.int16[o+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=a,this.uint8[l+6]=n,this.uint8[l+7]=s,e}};gu.prototype.bytesPerElement=8,N(\"StructArrayLayout2i4ub8\",gu);var Cn=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=e*2;return this.float32[i+0]=t,this.float32[i+1]=r,e}};Cn.prototype.bytesPerElement=8,N(\"StructArrayLayout2f8\",Cn);var yu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,e,t,r,i,a,n,s,o,l,u)}emplace(e,t,r,i,a,n,s,o,l,u,h){let c=e*10;return this.uint16[c+0]=t,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=a,this.uint16[c+4]=n,this.uint16[c+5]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,e}};yu.prototype.bytesPerElement=20,N(\"StructArrayLayout10ui20\",yu);var _u=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o){let l=this.length;return this.resize(l+1),this.emplace(l,e,t,r,i,a,n,s,o)}emplace(e,t,r,i,a,n,s,o,l){let u=e*8;return this.uint16[u+0]=t,this.uint16[u+1]=r,this.uint16[u+2]=i,this.uint16[u+3]=a,this.uint16[u+4]=n,this.uint16[u+5]=s,this.uint16[u+6]=o,this.uint16[u+7]=l,e}};_u.prototype.bytesPerElement=16,N(\"StructArrayLayout8ui16\",_u);var xu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l,u,h,c,p){let d=this.length;return this.resize(d+1),this.emplace(d,e,t,r,i,a,n,s,o,l,u,h,c,p)}emplace(e,t,r,i,a,n,s,o,l,u,h,c,p,d){let f=e*14,m=e*7;return this.int16[f+0]=t,this.int16[f+1]=r,this.int16[f+2]=i,this.int16[f+3]=a,this.uint16[f+4]=n,this.uint16[f+5]=s,this.uint16[f+6]=o,this.uint16[f+7]=l,this.int16[f+8]=u,this.int16[f+9]=h,this.int16[f+10]=c,this.int16[f+11]=p,this.float32[m+6]=d,e}};xu.prototype.bytesPerElement=28,N(\"StructArrayLayout4i4ui4i1f28\",xu);var vu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=e*3;return this.float32[a+0]=t,this.float32[a+1]=r,this.float32[a+2]=i,e}};vu.prototype.bytesPerElement=12,N(\"StructArrayLayout3f12\",vu);var bu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=e*1;return this.uint32[r+0]=t,e}};bu.prototype.bytesPerElement=4,N(\"StructArrayLayout1ul4\",bu);var wu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,e,t,r,i,a,n,s,o,l)}emplace(e,t,r,i,a,n,s,o,l,u){let h=e*10,c=e*5;return this.int16[h+0]=t,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=a,this.int16[h+4]=n,this.int16[h+5]=s,this.uint32[c+3]=o,this.uint16[h+8]=l,this.uint16[h+9]=u,e}};wu.prototype.bytesPerElement=20,N(\"StructArrayLayout6i1ul2ui20\",wu);var Tu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,a,n)}emplace(e,t,r,i,a,n,s){let o=e*6;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=a,this.int16[o+4]=n,this.int16[o+5]=s,e}};Tu.prototype.bytesPerElement=12,N(\"StructArrayLayout2i2i2i12\",Tu);var Su=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a){let n=this.length;return this.resize(n+1),this.emplace(n,e,t,r,i,a)}emplace(e,t,r,i,a,n){let s=e*4,o=e*8;return this.float32[s+0]=t,this.float32[s+1]=r,this.float32[s+2]=i,this.int16[o+6]=a,this.int16[o+7]=n,e}};Su.prototype.bytesPerElement=16,N(\"StructArrayLayout2f1f2i16\",Su);var Eu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n){let s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,i,a,n)}emplace(e,t,r,i,a,n,s){let o=e*16,l=e*4,u=e*8;return this.uint8[o+0]=t,this.uint8[o+1]=r,this.float32[l+1]=i,this.float32[l+2]=a,this.int16[u+6]=n,this.int16[u+7]=s,e}};Eu.prototype.bytesPerElement=16,N(\"StructArrayLayout2ub2f2i16\",Eu);var Hs=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=e*3;return this.uint16[a+0]=t,this.uint16[a+1]=r,this.uint16[a+2]=i,e}};Hs.prototype.bytesPerElement=6,N(\"StructArrayLayout3ui6\",Hs);var Iu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,g,y){let _=this.length;return this.resize(_+1),this.emplace(_,e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,g,y)}emplace(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,g,y,_){let x=e*26,v=e*13,w=e*52;return this.int16[x+0]=t,this.int16[x+1]=r,this.uint16[x+2]=i,this.uint16[x+3]=a,this.uint32[v+2]=n,this.uint32[v+3]=s,this.uint32[v+4]=o,this.uint16[x+10]=l,this.uint16[x+11]=u,this.uint16[x+12]=h,this.float32[v+7]=c,this.float32[v+8]=p,this.uint8[w+36]=d,this.uint8[w+37]=f,this.uint8[w+38]=m,this.uint32[v+10]=g,this.int16[x+22]=y,this.float32[v+12]=_,e}};Iu.prototype.bytesPerElement=52,N(\"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52\",Iu);var Au=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,g,y,_,x,v,w,b,T,I,S,D,R,F){let E=this.length;return this.resize(E+1),this.emplace(E,e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,g,y,_,x,v,w,b,T,I,S,D,R,F)}emplace(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,g,y,_,x,v,w,b,T,I,S,D,R,F,E){let M=e*34,A=e*17;return this.int16[M+0]=t,this.int16[M+1]=r,this.int16[M+2]=i,this.int16[M+3]=a,this.int16[M+4]=n,this.int16[M+5]=s,this.int16[M+6]=o,this.int16[M+7]=l,this.uint16[M+8]=u,this.uint16[M+9]=h,this.uint16[M+10]=c,this.uint16[M+11]=p,this.uint16[M+12]=d,this.uint16[M+13]=f,this.uint16[M+14]=m,this.uint16[M+15]=g,this.uint16[M+16]=y,this.uint16[M+17]=_,this.uint16[M+18]=x,this.uint16[M+19]=v,this.uint16[M+20]=w,this.uint16[M+21]=b,this.uint16[M+22]=T,this.uint32[A+12]=I,this.float32[A+13]=S,this.float32[A+14]=D,this.uint16[M+30]=R,this.uint16[M+31]=F,this.float32[A+16]=E,e}};Au.prototype.bytesPerElement=68,N(\"StructArrayLayout8i15ui1ul2f2ui1f68\",Au);var Ys=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=e*1;return this.float32[r+0]=t,e}};Ys.prototype.bytesPerElement=4,N(\"StructArrayLayout1f4\",Ys);var Mu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=e*6,n=e*3;return this.uint16[a+0]=t,this.float32[n+1]=r,this.float32[n+2]=i,e}};Mu.prototype.bytesPerElement=12,N(\"StructArrayLayout1ui2f12\",Mu);var Pu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,t,r)}emplace(e,t,r,i){let a=e*2,n=e*4;return this.uint32[a+0]=t,this.uint16[n+2]=r,this.uint16[n+3]=i,e}};Pu.prototype.bytesPerElement=8,N(\"StructArrayLayout1ul2ui8\",Pu);var Cu=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){let r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){let i=e*2;return this.uint16[i+0]=t,this.uint16[i+1]=r,e}};Cu.prototype.bytesPerElement=4,N(\"StructArrayLayout2ui4\",Cu);var ku=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){let r=e*1;return this.uint16[r+0]=t,e}};ku.prototype.bytesPerElement=2,N(\"StructArrayLayout1ui2\",ku);var Du=class extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,i){let a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,i)}emplace(e,t,r,i,a){let n=e*4;return this.float32[n+0]=t,this.float32[n+1]=r,this.float32[n+2]=i,this.float32[n+3]=a,e}};Du.prototype.bytesPerElement=16,N(\"StructArrayLayout4f16\",Du);var Dg=class extends Kn{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new C(this.anchorPointX,this.anchorPointY)}};Dg.prototype.size=20;var Gh=class extends wu{get(e){return new Dg(this,e)}};N(\"CollisionBoxArray\",Gh);var Fg=class extends Kn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Fg.prototype.size=52;var zg=class extends Iu{get(e){return new Fg(this,e)}};N(\"PlacedSymbolArray\",zg);var Rg=class extends Kn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};Rg.prototype.size=68;var Lg=class extends Au{get(e){return new Rg(this,e)}};N(\"SymbolInstanceArray\",Lg);var Bg=class extends Ys{getoffsetX(e){return this.float32[e*1+0]}};N(\"GlyphOffsetArray\",Bg);var Og=class extends Xs{getx(e){return this.int16[e*3+0]}gety(e){return this.int16[e*3+1]}gettileUnitDistanceFromAnchor(e){return this.int16[e*3+2]}};N(\"SymbolLineVertexArray\",Og);var Vg=class extends Kn{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};Vg.prototype.size=12;var Ng=class extends Mu{get(e){return new Vg(this,e)}};N(\"TextAnchorOffsetArray\",Ng);var Ug=class extends Kn{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]}};Ug.prototype.size=8;var $g=class extends Pu{get(e){return new Ug(this,e)}};N(\"FeatureIndexArray\",$g);var Gr=class extends Pn{},jg=class extends Xs{},Gg=class extends fu{},Bw=class extends Pn{},Ow=class extends Pn{},Vw=class extends mu{},Nw=class extends gu{},Uw=class extends Cn{},aa=class extends yu{},Ld=class extends _u{},$w=class extends xu{},jw=class extends vu{},Gw=class extends bu{},Bd=class extends Tu{},qg=class extends Su{},qw=class extends Eu{},Zg=class extends Hs{},pr=class extends Hs{},Fu=class extends Cu{},Wg=class extends ku{},zu=Ae([{name:\"a_pos\",components:2,type:\"Int16\"}],4),Zw=zu.members;zu.size,zu.alignment;var Ee=class ua{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,r,i,a){let n=this.segments[this.segments.length-1];return t>ua.MAX_VERTEX_ARRAY_LENGTH&&pe(`Max vertices per segment is ${ua.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${ua.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!n||n.vertexLength+t>ua.MAX_VERTEX_ARRAY_LENGTH||n.sortKey!==a?this.createNewSegment(r,i,a):n}createNewSegment(t,r,i){let a={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return i!==void 0&&(a.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(a),a}getOrCreateLatestSegment(t,r,i){return this.prepareSegment(0,t,r,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,i,a){return new ua([{vertexOffset:t,primitiveOffset:r,vertexLength:i,primitiveLength:a,vaos:{},sortKey:0}])}};Ee.MAX_VERTEX_ARRAY_LENGTH=2**16-1,N(\"SegmentVector\",Ee);function Od(e,t){return e=te(Math.floor(e),0,255),t=te(Math.floor(t),0,255),256*e+t}var Ww=Ae([{name:\"a_pattern_from\",components:4,type:\"Uint16\"},{name:\"a_pattern_to\",components:4,type:\"Uint16\"},{name:\"a_pixel_ratio_from\",components:1,type:\"Uint16\"},{name:\"a_pixel_ratio_to\",components:1,type:\"Uint16\"}]),Xw=Ae([{name:\"a_dasharray_from\",components:4,type:\"Uint16\"},{name:\"a_dasharray_to\",components:4,type:\"Uint16\"}]),Hw=sh(((e,t)=>{function r(i,a){for(var n=i.length&3,s=i.length-n,o=a,l,u=3432918353,h=461845907,c,p=0;p<s;)c=i.charCodeAt(p)&255|(i.charCodeAt(++p)&255)<<8|(i.charCodeAt(++p)&255)<<16|(i.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c,o=o<<13|o>>>19,l=(o&65535)*5+(((o>>>16)*5&65535)<<16)&4294967295,o=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(c=0,n){case 3:c^=(i.charCodeAt(p+2)&255)<<16;case 2:c^=(i.charCodeAt(p+1)&255)<<8;case 1:c^=i.charCodeAt(p)&255,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c}return o^=i.length,o^=o>>>16,o=(o&65535)*2246822507+(((o>>>16)*2246822507&65535)<<16)&4294967295,o^=o>>>13,o=(o&65535)*3266489909+(((o>>>16)*3266489909&65535)<<16)&4294967295,o^=o>>>16,o>>>0}t!==void 0&&(t.exports=r)})),Yw=sh(((e,t)=>{function r(i,a){for(var n=i.length,s=a^n,o=0,l;n>=4;)l=i.charCodeAt(o)&255|(i.charCodeAt(++o)&255)<<8|(i.charCodeAt(++o)&255)<<16|(i.charCodeAt(++o)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^l,n-=4,++o;switch(n){case 3:s^=(i.charCodeAt(o+2)&255)<<16;case 2:s^=(i.charCodeAt(o+1)&255)<<8;case 1:s^=i.charCodeAt(o)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}t.exports=r})),Kw=Qx(sh(((e,t)=>{var r=Hw(),i=Yw();t.exports=r,t.exports.murmur3=r,t.exports.murmur2=i}))(),1),Xg=class Hg{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,i,a){this.ids.push(Vd(t)),this.positions.push(r,i,a)}getPositions(t){if(!this.indexed)throw Error(\"Trying to get index, but feature positions are not indexed\");let r=Vd(t),i=0,a=this.ids.length-1;for(;i<a;){let s=i+a>>1;this.ids[s]>=r?a=s:i=s+1}let n=[];for(;this.ids[i]===r;){let s=this.positions[3*i],o=this.positions[3*i+1],l=this.positions[3*i+2];n.push({index:s,start:o,end:l}),i++}return n}static serialize(t,r){let i=new Float64Array(t.ids),a=new Uint32Array(t.positions);return Ru(i,a,0,i.length-1),r&&r.push(i.buffer,a.buffer),{ids:i,positions:a}}static deserialize(t){let r=new Hg;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}};function Vd(e){let t=+e;return!isNaN(t)&&t<=2**53-1?t:(0,Kw.default)(String(e))}function Ru(e,t,r,i){for(;r<i;){let a=e[r+i>>1],n=r-1,s=i+1;for(;;){do n++;while(e[n]<a);do s--;while(e[s]>a);if(n>=s)break;Ps(e,n,s),Ps(t,3*n,3*s),Ps(t,3*n+1,3*s+1),Ps(t,3*n+2,3*s+2)}s-r<i-s?(Ru(e,t,r,s),r=s+1):(Ru(e,t,s+1,i),i=s)}}function Ps(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}N(\"FeaturePositionMap\",Xg);var qr=class{constructor(e,t){this.gl=e.gl,this.location=t}},G=class extends qr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1i(this.location,e))}},B=class extends qr{constructor(e,t){super(e,t),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}},Z=class extends qr{constructor(e,t){super(e,t),this.current=[0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1])&&(this.current=e,this.gl.uniform2f(this.location,e[0],e[1]))}},Mt=class extends qr{constructor(e,t){super(e,t),this.current=[0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2])&&(this.current=e,this.gl.uniform3f(this.location,e[0],e[1],e[2]))}},Ir=class extends qr{constructor(e,t){super(e,t),this.current=[0,0,0,0]}set(e){(e[0]!==this.current[0]||e[1]!==this.current[1]||e[2]!==this.current[2]||e[3]!==this.current[3])&&(this.current=e,this.gl.uniform4f(this.location,e[0],e[1],e[2],e[3]))}},Zr=class extends qr{constructor(e,t){super(e,t),this.current=J.transparent}set(e){(e.r!==this.current.r||e.g!==this.current.g||e.b!==this.current.b||e.a!==this.current.a)&&(this.current=e,this.gl.uniform4f(this.location,e.r,e.g,e.b,e.a))}},qh=class extends qr{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e.length*4);for(let r=0;r<e.length;r++)t[4*r]=e[r].r,t[4*r+1]=e[r].g,t[4*r+2]=e[r].b,t[4*r+3]=e[r].a;this.gl.uniform4fv(this.location,t)}}},Zh=class extends qr{constructor(e,t){super(e,t),this.current=[]}set(e){if(e!=this.current){this.current=e;let t=new Float32Array(e);this.gl.uniform1fv(this.location,t)}}},Jw=new Float32Array(16),Ft=class extends qr{constructor(e,t){super(e,t),this.current=Jw}set(e){if(e[12]!==this.current[12]||e[0]!==this.current[0]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);return}for(let t=1;t<16;t++)if(e[t]!==this.current[t]){this.current=e,this.gl.uniformMatrix4fv(this.location,!1,e);break}}};function Lu(e){return[Od(255*e.r,255*e.g),Od(255*e.b,255*e.a)]}var hn=class{constructor(e,t,r){this.value=e,this.uniformNames=t.map(i=>`u_${i}`),this.type=r}setUniform(e,t,r){e.set(r.constantOr(this.value))}getBinding(e,t,r){return this.type===\"color\"?new Zr(e,t):new B(e,t)}},Mi=class{constructor(e,t){this.uniformNames=t.map(r=>`u_${r}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,t){this.pixelRatioFrom=t.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=t.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,t){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,t.y,t.height,t.width]}setUniform(e,t,r,i){let a=null;i===\"u_pattern_to\"?a=this.patternTo:i===\"u_pattern_from\"?a=this.patternFrom:i===\"u_dasharray_to\"?a=this.dashTo:i===\"u_dasharray_from\"?a=this.dashFrom:i===\"u_pixel_ratio_to\"?a=this.pixelRatioTo:i===\"u_pixel_ratio_from\"&&(a=this.pixelRatioFrom),a!==null&&e.set(a)}getBinding(e,t,r){return r.startsWith(\"u_pattern\")||r.startsWith(\"u_dasharray_\")?new Ir(e,t):new B(e,t)}},kr=class{constructor(e,t,r,i){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=t.map(a=>({name:`a_${a}`,type:\"Float32\",components:r===\"color\"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(e,t,r){let i=this.paintVertexArray.length,a=this.expression.evaluate(new Te(0,r),t,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(i,e,a)}updatePaintArray(e,t,r,i,a){let n=this.expression.evaluate(new Te(0,a),r,i);this._setPaintValue(e,t,n)}_setPaintValue(e,t,r){if(this.type===\"color\"){let i=Lu(r);for(let a=e;a<t;a++)this.paintVertexArray.emplace(a,i[0],i[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(e){this.paintVertexArray?.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},ar=class{constructor(e,t,r,i,a,n){this.expression=e,this.uniformNames=t.map(s=>`u_${s}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=a,this.maxValue=0,this.paintVertexAttributes=t.map(s=>({name:`a_${s}`,type:\"Float32\",components:r===\"color\"?4:2,offset:0})),this.paintVertexArray=new n}populatePaintArray(e,t,r){let i=this.expression.evaluate(new Te(this.zoom,r),t,{},r.canonical,[],r.formattedSection),a=this.expression.evaluate(new Te(this.zoom+1,r),t,{},r.canonical,[],r.formattedSection),n=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(n,e,i,a)}updatePaintArray(e,t,r,i,a){let n=this.expression.evaluate(new Te(this.zoom,a),r,i),s=this.expression.evaluate(new Te(this.zoom+1,a),r,i);this._setPaintValue(e,t,n,s)}_setPaintValue(e,t,r,i){if(this.type===\"color\"){let a=Lu(r),n=Lu(i);for(let s=e;s<t;s++)this.paintVertexArray.emplace(s,a[0],a[1],n[0],n[1])}else{for(let a=e;a<t;a++)this.paintVertexArray.emplace(a,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(e){this.paintVertexArray?.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t){let r=this.useIntegerZoom?Math.floor(t.zoom):t.zoom,i=te(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);e.set(i)}getBinding(e,t,r){return new B(e,t)}},ai=class{constructor(e,t,r,i,a,n){this.expression=e,this.type=t,this.useIntegerZoom=r,this.zoom=i,this.layerId=n,this.zoomInPaintVertexArray=new a,this.zoomOutPaintVertexArray=new a}populatePaintArray(e,t,r){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(i,e,this.getPositionIds(t),r)}updatePaintArray(e,t,r,i,a){this._setPaintValues(e,t,this.getPositionIds(r),a)}_setPaintValues(e,t,r,i){let a=this.getPositions(i);if(!a||!r)return;let n=a[r.min],s=a[r.mid],o=a[r.max];if(!(!n||!s||!o))for(let l=e;l<t;l++)this.emplace(this.zoomInPaintVertexArray,l,n,s),this.emplace(this.zoomOutPaintVertexArray,l,o,s)}upload(e){if(this.zoomInPaintVertexArray?.arrayBuffer.byteLength&&this.zoomOutPaintVertexArray?.arrayBuffer.byteLength){let t=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,t,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,t,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},Yg=class extends ai{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns?.[this.layerId]}getVertexAttributes(){return Ww.members}emplace(e,t,r,i){e.emplace(t,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.pixelRatio,i.pixelRatio)}},Kg=class extends ai{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes?.[this.layerId]}getVertexAttributes(){return Xw.members}emplace(e,t,r,i){e.emplace(t,0,r.y,r.height,r.width,0,i.y,i.height,i.width)}},Jg=class{constructor(e,t,r){this.binders={},this._buffers=[];let i=[];for(let a in e.paint._values){if(!r(a))continue;let n=e.paint.get(a);if(!(n instanceof Wt)||!va(n.property.specification))continue;let s=Qw(a,e.type),o=n.value,l=n.property.specification.type,u=n.property.useIntegerZoom,h=n.property.specification[\"property-type\"],c=h===\"cross-faded\"||h===\"cross-faded-data-driven\";if(o.kind===\"constant\")this.binders[a]=c?new Mi(o.value,s):new hn(o.value,s,l),i.push(`/u_${a}`);else if(o.kind===\"source\"||c){let p=Nd(a,l,\"source\");this.binders[a]=c?a===\"line-dasharray\"?new Kg(o,l,u,t,p,e.id):new Yg(o,l,u,t,p,e.id):new kr(o,s,l,p),i.push(`/a_${a}`)}else{let p=Nd(a,l,\"composite\");this.binders[a]=new ar(o,s,l,u,t,p),i.push(`/z_${a}`)}}this.cacheKey=i.sort().join(\"\")}getMaxValue(e){let t=this.binders[e];return t instanceof kr||t instanceof ar?t.maxValue:0}populatePaintArrays(e,t,r){for(let i in this.binders){let a=this.binders[i];(a instanceof kr||a instanceof ar||a instanceof ai)&&a.populatePaintArray(e,t,r)}}setConstantPatternPositions(e,t){for(let r in this.binders){let i=this.binders[r];i instanceof Mi&&i.setConstantPatternPositions(e,t)}}setConstantDashPositions(e,t){for(let r in this.binders){let i=this.binders[r];i instanceof Mi&&i.setConstantDashPositions(e,t)}}updatePaintArrays(e,t,r,i,a){let n=!1;for(let s of e){let o=t.getPositions(s.id);for(let l of o){if(l.index>=r.length)continue;let u=r.feature(l.index);for(let h in this.binders){let c=this.binders[h];(c instanceof kr||c instanceof ar||c instanceof ai)&&c.expression.isStateDependent===!0&&(c.expression=i.paint.get(h).value,c.updatePaintArray(l.start,l.end,u,s.state,a),n=!0)}}}return n}defines(){let e=[];for(let t in this.binders){let r=this.binders[t];(r instanceof hn||r instanceof Mi)&&e.push(...r.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return e}getBinderAttributes(){let e=[];for(let t in this.binders){let r=this.binders[t];if(r instanceof kr||r instanceof ar)for(let i of r.paintVertexAttributes)e.push(i.name);else if(r instanceof ai){let i=r.getVertexAttributes();for(let a of i)e.push(a.name)}}return e}getBinderUniforms(){let e=[];for(let t in this.binders){let r=this.binders[t];if(r instanceof hn||r instanceof Mi||r instanceof ar)for(let i of r.uniformNames)e.push(i)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,t){let r=[];for(let i in this.binders){let a=this.binders[i];if(a instanceof hn||a instanceof Mi||a instanceof ar){for(let n of a.uniformNames)if(t[n]){let s=a.getBinding(e,t[n],n);r.push({name:n,property:i,binding:s})}}}return r}setUniforms(e,t,r,i){for(let{name:a,property:n,binding:s}of t)this.binders[n].setUniform(s,i,r.get(n),a)}updatePaintBuffers(e){this._buffers=[];for(let t in this.binders){let r=this.binders[t];if(e&&r instanceof ai){let i=e.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof kr||r instanceof ar)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(e){for(let t in this.binders){let r=this.binders[t];(r instanceof kr||r instanceof ar||r instanceof ai)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(let e in this.binders){let t=this.binders[e];(t instanceof kr||t instanceof ar||t instanceof ai)&&t.destroy()}}},Oi=class{constructor(e,t,r=()=>!0){this.programConfigurations={};for(let i of e)this.programConfigurations[i.id]=new Jg(i,t,r);this.needsUpload=!1,this._featureMap=new Xg,this._bufferOffset=0}populatePaintArrays(e,t,r,i){for(let a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(e,t,i);t.id!==void 0&&this._featureMap.add(t.id,r,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,r,i){for(let a of r)this.needsUpload=this.programConfigurations[a.id].updatePaintArrays(e,this._featureMap,t,a,i)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(let t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(let e in this.programConfigurations)this.programConfigurations[e].destroy()}};function Qw(e,t){return{\"text-opacity\":[\"opacity\"],\"icon-opacity\":[\"opacity\"],\"text-color\":[\"fill_color\"],\"icon-color\":[\"fill_color\"],\"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\"],\"line-gap-width\":[\"gapwidth\"],\"line-dasharray\":[\"dasharray_to\",\"dasharray_from\"],\"line-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"],\"fill-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"],\"fill-extrusion-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"]}[e]||[e.replace(`${t}-`,\"\").replace(/-/g,\"_\")]}function e2(e){return{\"line-pattern\":{source:aa,composite:aa},\"fill-pattern\":{source:aa,composite:aa},\"fill-extrusion-pattern\":{source:aa,composite:aa},\"line-dasharray\":{source:Ld,composite:Ld}}[e]}function Nd(e,t,r){let i={color:{source:Cn,composite:Du},number:{source:Ys,composite:Cn}};return e2(e)?.[r]||i[t][r]}N(\"ConstantBinder\",hn),N(\"CrossFadedConstantBinder\",Mi),N(\"SourceExpressionBinder\",kr),N(\"CrossFadedPatternBinder\",Yg),N(\"CrossFadedDasharrayBinder\",Kg),N(\"CompositeExpressionBinder\",ar),N(\"ProgramConfiguration\",Jg,{omit:[\"_buffers\"]}),N(\"ProgramConfigurationSet\",Oi);var Bu=2**14-1,Ud=-Bu-1;function ji(e){let t=z/e.extent,r=e.loadGeometry();for(let i of r)for(let a of i){let n=Math.round(a.x*t),s=Math.round(a.y*t);a.x=te(n,Ud,Bu),a.y=te(s,Ud,Bu),(n<a.x||n>a.x+1||s<a.y||s>a.y+1)&&pe(\"Geometry exceeds allowed extent, reduce your vector tile buffer size\")}return r}function yi(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?ji(e):[]}}var $d=-32768;function t2(e,t,r,i,a){e.emplaceBack($d+t*8+i,$d+r*8+a)}var Wh=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Bw,this.indexArray=new pr,this.segments=new Ee,this.programConfigurations=new Oi(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,r){let i=this.layers[0],a=[],n=null,s=!1,o=i.type===\"heatmap\";if(i.type===\"circle\"){let c=i;n=c.layout.get(\"circle-sort-key\"),s=!n.isConstant(),o||(o=c.paint.get(\"circle-pitch-alignment\")===\"map\")}let l=o?t.subdivisionGranularity.circle:1,u=new Te(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:c,id:p,index:d,sourceLayerIndex:f}of e){let m=yi(c,h);if(!this.layers[0]._featureFilter.filter(u,m,r))continue;let g=s?n.evaluate(m,{},r):void 0,y={id:p,properties:c.properties,type:c.type,sourceLayerIndex:f,index:d,geometry:h?m.geometry:ji(c),patterns:{},sortKey:g};a.push(y)}s&&a.sort((c,p)=>c.sortKey-p.sortKey);for(let c of a){let{geometry:p,index:d,sourceLayerIndex:f}=c,m=e[d].feature;this.addFeature(c,p,d,r,l),t.featureIndex.insert(m,p,d,f,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Zw),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,r,i,a=1){let n;switch(a){case 1:n=[0,7];break;case 3:n=[0,2,5,7];break;case 5:n=[0,1,3,4,6,7];break;case 7:n=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${a}; valid values are 1, 3, 5, 7.`)}let s=n.length;for(let o of t)for(let l of o){let u=l.x,h=l.y;if(u<0||u>=8192||h<0||h>=8192)continue;let c=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,e.sortKey),p=c.vertexLength;for(let d=0;d<s;d++)for(let f=0;f<s;f++)t2(this.layoutVertexArray,u,h,n[f],n[d]);for(let d=0;d<s-1;d++)for(let f=0;f<s-1;f++){let m=p+d*s+f,g=p+(d+1)*s+f;this.indexArray.emplaceBack(m,g+1,m+1),this.indexArray.emplaceBack(m,g,g+1)}c.vertexLength+=s*s,c.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:{},canonical:i})}};N(\"CircleBucket\",Wh,{omit:[\"layers\"]});function Xh(e,t){for(let r of e)if(Ea(t,r))return!0;for(let r of t)if(Ea(e,r))return!0;return Hh(e,t)}function Lo(e,t,r){return Ea(e,t)?!0:Ou(t,e,r)}function Qg(e,t){if(e.length===1)return jd(t,e[0]);for(let r of t)for(let i of r)if(Ea(e,i))return!0;for(let r of e)if(jd(t,r))return!0;for(let r of t)if(Hh(e,r))return!0;return!1}function r2(e,t,r){for(let i of t){if(e.length>=3){for(let a of i)if(Ea(e,a))return!0}if(i2(e,i,r))return!0}return!1}function i2(e,t,r){if(e.length>1){if(Hh(e,t))return!0;for(let i of t)if(Ou(i,e,r))return!0}for(let i of e)if(Ou(i,t,r))return!0;return!1}function Hh(e,t){if(e.length===0||t.length===0)return!1;for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1];for(let n=0;n<t.length-1;n++){let s=t[n],o=t[n+1];if(a2(i,a,s,o))return!0}}return!1}function a2(e,t,r,i){return oi(e,r,i)!==oi(t,r,i)&&oi(e,t,r)!==oi(e,t,i)}function Ou(e,t,r){let i=r*r;if(t.length===1)return e.distSqr(t[0])<i;for(let a=1;a<t.length;a++){let n=t[a-1],s=t[a];if(n2(e,n,s)<i)return!0}return!1}function n2(e,t,r){let i=t.distSqr(r);if(i===0)return e.distSqr(t);let a=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/i;return a<0?e.distSqr(t):a>1?e.distSqr(r):e.distSqr(r.sub(t)._mult(a)._add(t))}function jd(e,t){let r=!1,i,a,n;for(let s of e){i=s;for(let o=0,l=i.length-1;o<i.length;l=o++)a=i[o],n=i[l],a.y>t.y!=n.y>t.y&&t.x<(n.x-a.x)*(t.y-a.y)/(n.y-a.y)+a.x&&(r=!r)}return r}function Ea(e,t){let r=!1;for(let i=0,a=e.length-1;i<e.length;a=i++){let n=e[i],s=e[a];n.y>t.y!=s.y>t.y&&t.x<(s.x-n.x)*(t.y-n.y)/(s.y-n.y)+n.x&&(r=!r)}return r}function s2(e,t,r,i,a){for(let s of e)if(t<=s.x&&r<=s.y&&i>=s.x&&a>=s.y)return!0;let n=[new C(t,r),new C(t,a),new C(i,a),new C(i,r)];if(e.length>2){for(let s of n)if(Ea(e,s))return!0}for(let s=0;s<e.length-1;s++){let o=e[s],l=e[s+1];if(o2(o,l,n))return!0}return!1}function o2(e,t,r){let i=r[0],a=r[2];if(e.x<i.x&&t.x<i.x||e.x>a.x&&t.x>a.x||e.y<i.y&&t.y<i.y||e.y>a.y&&t.y>a.y)return!1;let n=oi(e,t,r[0]);return n!==oi(e,t,r[1])||n!==oi(e,t,r[2])||n!==oi(e,t,r[3])}function da(e,t,r){let i=t.paint.get(e).value;return i.kind===\"constant\"?i.value:r.programConfigurations.get(t.id).getMaxValue(e)}function Bo(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Oo(e,t,r,i,a){if(!t[0]&&!t[1])return e;let n=C.convert(t)._mult(a);r===\"viewport\"&&n._rotate(-i);let s=[];for(let o of e)s.push(o.sub(n));return s}function l2(e){let t=[];for(let r=0;r<e.length;r++){let i=e[r],a=t.at(-1);(r===0||a&&!i.equals(a))&&t.push(i)}return t}function u2(e,t){let r=[];for(let i of e){let a=l2(i),n=[];for(let s=0;s<a.length;s++){let o=a[s],l=a[s-1],u=a[s+1],h=s===0?new C(0,0):o.sub(l)._unit()._perp(),c=s===a.length-1?new C(0,0):u.sub(o)._unit()._perp(),p=h._add(c)._unit(),d=p.x*c.x+p.y*c.y;d!==0&&p._mult(1/d),n.push(p._mult(t)._add(o))}r.push(n)}return r}function h2({queryGeometry:e,size:t},r){return Lo(e,r,t)}function c2({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:a},n){return Lo(e,n,t*(r.projectTileCoordinates(n.x,n.y,i,a?.(n.x,n.y)).signedDistanceFromCamera/r.cameraToCenterDistance))}function p2({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:a},n){let s=r.projectTileCoordinates(n.x,n.y,i,a?.(n.x,n.y)).signedDistanceFromCamera,o=t*(r.cameraToCenterDistance/s);return Lo(e,Yh(n,r,i,a),o)}function d2({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:a},n){return Lo(e,Yh(n,r,i,a),t)}function ey({queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:a,pitchAlignment:n=\"map\",pitchScale:s=\"map\"},o){let l=n===\"map\"?s===\"map\"?h2:c2:s===\"map\"?p2:d2,u={queryGeometry:e,size:t,transform:r,unwrappedTileID:i,getElevation:a};for(let h of o)for(let c of h)if(l(u,c))return!0;return!1}function Yh(e,t,r,i){let a=t.projectTileCoordinates(e.x,e.y,r,i?.(e.x,e.y)).point;return new C((a.x*.5+.5)*t.width,(-a.y*.5+.5)*t.height)}function f2(e,t,r,i){return e.map(a=>Yh(a,t,r,i))}var m2,g2=()=>m2||(m2=new Qe({\"circle-sort-key\":new q(P.layout_circle[\"circle-sort-key\"],\"circle-sort-key\")})),y2,_2=()=>y2||(y2=new Qe({\"circle-radius\":new q(P.paint_circle[\"circle-radius\"],\"circle-radius\"),\"circle-color\":new q(P.paint_circle[\"circle-color\"],\"circle-color\"),\"circle-blur\":new q(P.paint_circle[\"circle-blur\"],\"circle-blur\"),\"circle-opacity\":new q(P.paint_circle[\"circle-opacity\"],\"circle-opacity\"),\"circle-translate\":new V(P.paint_circle[\"circle-translate\"],\"circle-translate\"),\"circle-translate-anchor\":new V(P.paint_circle[\"circle-translate-anchor\"],\"circle-translate-anchor\"),\"circle-pitch-scale\":new V(P.paint_circle[\"circle-pitch-scale\"],\"circle-pitch-scale\"),\"circle-pitch-alignment\":new V(P.paint_circle[\"circle-pitch-alignment\"],\"circle-pitch-alignment\"),\"circle-stroke-width\":new q(P.paint_circle[\"circle-stroke-width\"],\"circle-stroke-width\"),\"circle-stroke-color\":new q(P.paint_circle[\"circle-stroke-color\"],\"circle-stroke-color\"),\"circle-stroke-opacity\":new q(P.paint_circle[\"circle-stroke-opacity\"],\"circle-stroke-opacity\")})),x2={get paint(){return _2()},get layout(){return g2()}},ty=e=>e.type===\"circle\",v2=class extends cr{constructor(e,t){super(e,x2,t)}createBucket(e){return new Wh(e)}queryRadius(e){let t=e;return da(\"circle-radius\",this,t)+da(\"circle-stroke-width\",this,t)+Bo(this.paint.get(\"circle-translate\"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:a,pixelsToTileUnits:n,unwrappedTileID:s,getElevation:o}){let l=Oo(e,this.paint.get(\"circle-translate\"),this.paint.get(\"circle-translate-anchor\"),-a.bearingInRadians,n),u=this.paint.get(\"circle-radius\").evaluate(t,r)+this.paint.get(\"circle-stroke-width\").evaluate(t,r),h=this.paint.get(\"circle-pitch-scale\"),c=this.paint.get(\"circle-pitch-alignment\"),p,d;return c===\"map\"?(p=l,d=u*n):(p=f2(l,a,s,o),d=u),ey({queryGeometry:p,size:d,transform:a,unwrappedTileID:s,getElevation:o,pitchAlignment:c,pitchScale:h},i)}},ry=class extends Wh{};N(\"HeatmapBucket\",ry,{omit:[\"layers\"]});var b2,w2=()=>b2||(b2=new Qe({\"heatmap-radius\":new q(P.paint_heatmap[\"heatmap-radius\"],\"heatmap-radius\"),\"heatmap-weight\":new q(P.paint_heatmap[\"heatmap-weight\"],\"heatmap-weight\"),\"heatmap-intensity\":new V(P.paint_heatmap[\"heatmap-intensity\"],\"heatmap-intensity\"),\"heatmap-color\":new Yn(P.paint_heatmap[\"heatmap-color\"],\"heatmap-color\"),\"heatmap-opacity\":new V(P.paint_heatmap[\"heatmap-opacity\"],\"heatmap-opacity\")})),T2={get paint(){return w2()}},Ia=\"big-fb\",iy=e=>e.type===\"heatmap\",S2=class extends cr{createBucket(e){return new ry(e)}constructor(e,t){super(e,T2,t),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e===\"heatmap-color\"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values[\"heatmap-color\"].value.expression;this.colorRamp=zo({expression:e,evaluationKey:\"heatmapDensity\",image:this.colorRamp}),this.colorRampTexture=null}resize(){let e=this.heatmapFbos.get(Ia);e&&(e.destroy(),this.heatmapFbos.delete(Ia))}queryRadius(e){return da(\"heatmap-radius\",this,e)}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:a,pixelsToTileUnits:n,unwrappedTileID:s,getElevation:o}){return ey({queryGeometry:e,size:this.paint.get(\"heatmap-radius\").evaluate(t,r)*n,transform:a,unwrappedTileID:s,getElevation:o},i)}hasOffscreenPass(){return this.paint.get(\"heatmap-opacity\")!==0&&!this.isHidden()}},E2,I2=()=>E2||(E2=new Qe({\"hillshade-illumination-direction\":new V(P.paint_hillshade[\"hillshade-illumination-direction\"],\"hillshade-illumination-direction\"),\"hillshade-illumination-altitude\":new V(P.paint_hillshade[\"hillshade-illumination-altitude\"],\"hillshade-illumination-altitude\"),\"hillshade-illumination-anchor\":new V(P.paint_hillshade[\"hillshade-illumination-anchor\"],\"hillshade-illumination-anchor\"),\"hillshade-exaggeration\":new V(P.paint_hillshade[\"hillshade-exaggeration\"],\"hillshade-exaggeration\"),\"hillshade-shadow-color\":new V(P.paint_hillshade[\"hillshade-shadow-color\"],\"hillshade-shadow-color\"),\"hillshade-highlight-color\":new V(P.paint_hillshade[\"hillshade-highlight-color\"],\"hillshade-highlight-color\"),\"hillshade-accent-color\":new V(P.paint_hillshade[\"hillshade-accent-color\"],\"hillshade-accent-color\"),\"hillshade-method\":new V(P.paint_hillshade[\"hillshade-method\"],\"hillshade-method\"),resampling:new V(P.paint_hillshade.resampling,\"resampling\")})),A2={get paint(){return I2()}},ay=e=>e.type===\"hillshade\",M2=class extends cr{constructor(e,t){super(e,A2,t),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get(\"hillshade-illumination-direction\").values,t=this.paint.get(\"hillshade-illumination-altitude\").values,r=this.paint.get(\"hillshade-highlight-color\").values,i=this.paint.get(\"hillshade-shadow-color\").values,a=Math.max(e.length,t.length,r.length,i.length);e=e.concat(Array(a-e.length).fill(e.at(-1))),t=t.concat(Array(a-t.length).fill(t.at(-1))),r=r.concat(Array(a-r.length).fill(r.at(-1))),i=i.concat(Array(a-i.length).fill(i.at(-1)));let n=t.map(Fe);return{directionRadians:e.map(Fe),altitudeRadians:n,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return this.paint.get(\"hillshade-exaggeration\")!==0&&!this.isHidden()}},P2,C2=()=>P2||(P2=new Qe({\"color-relief-opacity\":new V(P[\"paint_color-relief\"][\"color-relief-opacity\"],\"color-relief-opacity\"),\"color-relief-color\":new Yn(P[\"paint_color-relief\"][\"color-relief-color\"],\"color-relief-color\"),resampling:new V(P[\"paint_color-relief\"].resampling,\"resampling\")})),k2={get paint(){return C2()}};function Hl(e){return\"data\"in e}var Oe=class{constructor(e,t,r,i){this.context=e,this.format=r,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(t,i)}update(e,t,r){let{width:i,height:a}=e,n=(this.size?.[0]!==i||this.size[1]!==a)&&!r,{context:s}=this,{gl:o}=s;this.useMipmap=!!t?.useMipmap,n&&this.size&&this.format===o.RGBA&&(o.deleteTexture(this.texture),this.texture=o.createTexture(),this._ownedHandle=this.texture,this.filter=void 0,this.wrap=void 0),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1);let l=this.format===o.RGBA&&t?.premultiply!==!1;if(n)if(this.size=[i,a],this.format===o.RGBA&&i>0&&a>0){let u=this.useMipmap?Math.floor(Math.log2(Math.max(i,a)))+1:1;if(o.texStorage2D(o.TEXTURE_2D,u,o.RGBA8,i,a),Hl(e)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:h}=e;l&&h&&(h=Xl(h)),h&&o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,a,o.RGBA,o.UNSIGNED_BYTE,h)}else s.pixelStoreUnpackPremultiplyAlpha.set(l),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,e)}else Hl(e)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,l,i,a,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(e,o));else{let{x:u,y:h}=r||{x:0,y:0};Hl(e)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,l,u,h,i,a,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(e,u,h,o))}this.useMipmap&&o.generateMipmap(o.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,t){t.texImage2D(t.TEXTURE_2D,0,this.format,this.format,t.UNSIGNED_BYTE,e)}_uploadRawData(e,t,r,i,a){let{data:n}=e;t&&n&&(n=Xl(n)),a.texImage2D(a.TEXTURE_2D,0,this.format,r,i,0,this.format,a.UNSIGNED_BYTE,n)}_updateDomImage(e,t,r,i){i.texSubImage2D(i.TEXTURE_2D,0,t,r,i.RGBA,i.UNSIGNED_BYTE,e)}_updateRawData(e,t,r,i,a,n,s){let{data:o}=e;t&&o&&(o=Xl(o)),s.texSubImage2D(s.TEXTURE_2D,0,r,i,a,n,s.RGBA,s.UNSIGNED_BYTE,o)}bind(e,t,r){let{context:i}=this,{gl:a}=i;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),a.bindTexture(a.TEXTURE_2D,this.texture),r===a.LINEAR_MIPMAP_NEAREST&&!this.useMipmap&&(r=a.LINEAR),e!==this.filter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,r||e),this.filter=e),t!==this.wrap&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,t),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,t),this.wrap=t)}destroy(){let{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},Lr,D2=(Lr=class{constructor(t,r,i,a=1,n=1,s=1,o=0){if(this.uid=t,r.height!==r.width)throw RangeError(\"DEM tiles must be square\");if(i&&![\"mapbox\",\"terrarium\",\"custom\"].includes(i)){pe(`\"${i}\" is not a valid encoding type. Valid types include \"mapbox\", \"terrarium\" and \"custom\".`);return}this.stride=r.height;let l=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),Lr.byteViewCache.set(this,new Uint8Array(this.data.buffer)),i){case\"terrarium\":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case\"custom\":this.redFactor=a,this.greenFactor=n,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let h=0;h<l;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(l,h)]=this.data[this._idx(l-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,l)]=this.data[this._idx(h,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)];let u=this._getByteView();this.min=2**53-1,this.max=-(2**53-1);for(let h=0;h<l;h++)for(let c=0;c<l;c++){let p=this._idx(h,c)*4,d=this._unpackAtIndex(u,p);d>this.max&&(this.max=d),d<this.min&&(this.min=d)}}get(t,r){let i=this._getByteView(),a=this._idx(t,r)*4;return this._unpackAtIndex(i,a)}sampleBilinear(t,r){let i=Math.floor(t),a=Math.floor(r);if(i<-1||i>=this.dim||a<-1||a>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${r}, dim: ${this.dim}`);let n=this._getByteView(),s=((a+1)*this.stride+i+1)*4,o=this.stride*4,l=t-i,u=r-a,h=this._unpackAtIndex(n,s),c=this._unpackAtIndex(n,s+4),p=this._unpackAtIndex(n,s+o),d=this._unpackAtIndex(n,s+o+4);return h*(1-l)*(1-u)+c*l*(1-u)+p*(1-l)*u+d*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${t}, y: ${r}, dim: ${this.dim}`);return(r+1)*this.stride+(t+1)}unpack(t,r,i){return t*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(t){return ny(t,this.getUnpackVector())}getPixels(){return new xe({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(t,r,i){if(this.dim!==t.dim)throw Error(\"dem dimension mismatch\");let a=r*this.dim,n=r*this.dim+this.dim,s=i*this.dim,o=i*this.dim+this.dim;switch(r){case-1:a=n-1;break;case 1:n=a+1}switch(i){case-1:s=o-1;break;case 1:o=s+1}let l=-r*this.dim,u=-i*this.dim;for(let h=s;h<o;h++)for(let c=a;c<n;c++)this.data[this._idx(c,h)]=t.data[this._idx(c+l,h+u)]}_getByteView(){let t=Lr.byteViewCache.get(this);return t?.buffer!==this.data.buffer&&(t=new Uint8Array(this.data.buffer),Lr.byteViewCache.set(this,t)),t}_unpackAtIndex(t,r){return this.unpack(t[r],t[r+1],t[r+2])}},Lr.byteViewCache=new WeakMap,Lr);function ny(e,t){let r=t[0],i=t[1],a=t[2],n=t[3],s=Math.min(r,i,a),o=Math.round((e+n)/s);return{r:Math.floor(o*s/r)%256,g:Math.floor(o*s/i)%256,b:Math.floor(o*s/a)%256}}N(\"DEMData\",D2);var sy=e=>e.type===\"color-relief\",F2=class extends cr{constructor(e,t){super(e,k2,t)}_createColorRamp(e){let t={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values[\"color-relief-color\"].value.expression;if(r instanceof In&&r._styleExpression.expression instanceof Ht){this.colorRampExpression=r;let n=r._styleExpression.expression;t.elevationStops=n.labels,t.colorStops=[];for(let s of t.elevationStops)t.colorStops.push(n.evaluate({globals:{elevation:s}}))}if(t.elevationStops.length<1&&(t.elevationStops=[0],t.colorStops=[J.transparent]),t.elevationStops.length<2&&(t.elevationStops.push(t.elevationStops[0]+1),t.colorStops.push(t.colorStops[0])),t.elevationStops.length<=e)return t;let i={elevationStops:[],colorStops:[]},a=(t.elevationStops.length-1)/(e-1);for(let n=0;n<t.elevationStops.length-.5;n+=a)i.elevationStops.push(t.elevationStops[Math.round(n)]),i.colorStops.push(t.colorStops[Math.round(n)]);return pe(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${t.elevationStops.length}`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values[\"color-relief-color\"].value.expression}getColorRampTextures(e,t,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(t),a=new xe({width:i.colorStops.length,height:1}),n=new xe({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let o=ny(i.elevationStops[s],r);n.setPixel(0,s,new J(o.r/255,o.g/255,o.b/255,1)),a.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new Oe(e,n,e.gl.RGBA),colorTexture:new Oe(e,a,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}},Vu=Ae([{name:\"a_pos\",components:2,type:\"Int16\"}],4),z2=Vu.members;Vu.size,Vu.alignment;function Ks(e,t,r){let i=r.patternDependencies,a=!1;for(let n of t){let s=n.paint.get(`${e}-pattern`);s.isConstant()||(a=!0);let o=s.constantOr(null);o&&(a=!0,i[o.to]=!0,i[o.from]=!0)}return a}function Kh(e,t,r,i,a){let{zoom:n}=i,s=a.patternDependencies;for(let o of t){let l=o.paint.get(`${e}-pattern`).value;if(l.kind!==\"constant\"){let u=l.evaluate({zoom:n-1},r,{},a.availableImages),h=l.evaluate({zoom:n},r,{},a.availableImages),c=l.evaluate({zoom:n+1},r,{},a.availableImages);u=u?.name?u.name:u,h=h?.name?h.name:h,c=c?.name?c.name:c,s[u]=!0,s[h]=!0,s[c]=!0,r.patterns[o.id]={min:u,mid:h,max:c}}}return r}var kn=new Set,Nu=!1;function R2(e,t,r=2){let i=t&&t.length,a=i?t[0]*r:e.length;kn.size&&kn.clear();let n=oy(e,0,a,r,!0),s=[];if(!n||n.next===n.prev)return s;let o=0,l=0,u=0;if(i&&(n=N2(e,t,n,r)),e.length>80*r){o=e[0],l=e[1];let h=o,c=l;for(let p=r;p<a;p+=r){let d=e[p],f=e[p+1];d<o&&(o=d),f<l&&(l=f),d>h&&(h=d),f>c&&(c=f)}u=Math.max(h-o,c-l),u=u===0?0:32767/u}return Uu(n,s,o,l,u),s}function oy(e,t,r,i,a){let n=null;if(a===Q2(e,t,r,i)>0)for(let s=t;s<r;s+=i)n=Zd(s/i|0,e[s],e[s+1],n);else for(let s=r-i;s>=t;s-=i)n=Zd(s/i|0,e[s],e[s+1],n);return n&&Dn(n,n.next)&&(zn(n),n=n.next),n}function Vi(e,t=e){let r=t===e,i=e,a;do a=!1,i!==i.next&&(kn.size===0||!kn.has(i))&&(Dn(i,i.next)||qe(i.prev,i,i.next)===0)?((r||i===t)&&(t=i.prev),Nu=!0,zn(i),i=i.prev,a=!0):(r||i!==t)&&(i=i.next,a=!r);while(a||i!==t);return t}function Uu(e,t,r,i,a){a&&W2(e,r,i,a);let n=e,s=!1;for(;e.prev!==e.next;){let o=e.prev,l=e.next;if(qe(o,e,l)<0&&(a?B2(e,r,i,a):L2(e))){t.push(o.i,e.i,l.i),zn(e),e=l,n=l;continue}if(e=l,e===n){if(Nu=!1,e=Vi(e),Nu){n=e;continue}if(!s){e=O2(e,t),n=e,s=!0;continue}V2(e,t,r,i,a);break}}}function L2(e){let t=e.prev,r=e,i=e.next,a=t.x,n=r.x,s=i.x,o=t.y,l=r.y,u=i.y,h=Math.min(a,n,s),c=Math.min(o,l,u),p=Math.max(a,n,s),d=Math.max(o,l,u),f=i.next;for(;f!==t;){if(f.x>=h&&f.x<=p&&f.y>=c&&f.y<=d&&(a!==f.x||o!==f.y)&&Qs(a,o,n,l,s,u,f.x,f.y)&&qe(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function B2(e,t,r,i){let a=e.prev,n=e,s=e.next,o=a.x,l=n.x,u=s.x,h=a.y,c=n.y,p=s.y,d=Math.min(o,l,u),f=Math.min(h,c,p),m=Math.max(o,l,u),g=Math.max(h,c,p),y=qu(d,f,t,r,i),_=qu(m,g,t,r,i),x=e.prevZ;for(;x&&x.z>=y;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=g&&x!==s&&(o!==x.x||h!==x.y)&&Qs(o,h,l,c,u,p,x.x,x.y)&&qe(x.prev,x,x.next)>=0)return!1;x=x.prevZ}let v=e.nextZ;for(;v&&v.z<=_;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=g&&v!==s&&(o!==v.x||h!==v.y)&&Qs(o,h,l,c,u,p,v.x,v.y)&&qe(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function O2(e,t){let r=e,i=!1;do{let a=r.prev,n=r.next.next;uy(a,r,r.next,n,!1)&&Fn(a,n)&&Fn(n,a)&&(t.push(a.i,r.i,n.i),zn(r),zn(r.next),r=e=n,i=!0),r=r.next}while(r!==e);return i?Vi(r):r}function V2(e,t,r,i,a){let n=e;do{let s=n.next.next;for(;s!==n.prev;){if(n.i!==s.i&&Y2(n,s)){let o=hy(n,s);n=Vi(n,n.next),o=Vi(o,o.next),Uu(n,t,r,i,a),Uu(o,t,r,i,a);return}s=s.next}n=n.next}while(n!==e)}var $u=!1;function N2(e,t,r,i){let a=[];for(let n=0,s=t.length;n<s;n++){let o=oy(e,t[n]*i,n<s-1?t[n+1]*i:e.length,i,!1);o===o.next&&kn.add(o),a.push(H2(o))}a.sort(U2),j2(e.length/i,t.length),ly(r,r),$u=!0;for(let n=0;n<a.length;n++)r=$2(a[n],r);return $u=!1,Vi(r)}function U2(e,t){return e.x-t.x||e.y-t.y||(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}function $2(e,t){let r=q2(e,t);if(!r)return t;let i=hy(r,e),a=i.next;return ly(r,a.next),Vi(i,i.next),Vi(r,r.next)}var Le=new Float64Array,Js=0,ju=[],Gu=[];function j2(e,t){let r=Math.ceil((e+2*t)/16)+t+2;Le.length<r*4&&(Le=new Float64Array(r*4)),Js=0}function ly(e,t){let r=e;do{let i=Js++;ju[i]=r;let a=1/0,n=1/0,s=-1/0,o=-1/0,l=0;do{let h=r.next;r.z=i,r.x<a&&(a=r.x),r.x>s&&(s=r.x),r.y<n&&(n=r.y),r.y>o&&(o=r.y),h.x<a&&(a=h.x),h.x>s&&(s=h.x),h.y<n&&(n=h.y),h.y>o&&(o=h.y),r=h}while(++l<16&&r!==t);Gu[i]=r;let u=i*4;Le[u]=a,Le[u+1]=n,Le[u+2]=s,Le[u+3]=o}while(r!==t)}function G2(e,t){let r=e.z*4;t.x<Le[r]&&(Le[r]=t.x),t.y<Le[r+1]&&(Le[r+1]=t.y),t.x>Le[r+2]&&(Le[r+2]=t.x),t.y>Le[r+3]&&(Le[r+3]=t.y)}function Gd(e){let t=Gu[e];for(;t.prev.next!==t;)t=t.next;return Gu[e]=t,t}function qd(e){let t=ju[e];for(;t.prev.next!==t;)t=t.next;return ju[e]=t,t}function q2(e,t){let r=t,i=e.x,a=e.y,n=-1/0,s;if(Dn(e,r))return r;for(let p=0,d=0;p<Js;p++,d+=4){if(a<Le[d+1]||a>Le[d+3]||Le[d]>i||Le[d+2]<=n)continue;let f=Gd(p);r=qd(p);do{if(r.prev.next===r){if(Dn(e,r.next))return r.next;if(a<=r.y&&a>=r.next.y&&r.next.y!==r.y){let m=r.x+(a-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(m<=i&&m>n&&(n=m,s=r.x<r.next.x?r:r.next,m===i))return s}}r=r.next}while(r!==f)}if(!s)return null;let o=s.x,l=s.y,u=Math.min(a,l),h=Math.max(a,l),c=1/0;for(let p=0,d=0;p<Js;p++,d+=4){if(Le[d+2]<o||Le[d]>i||Le[d+3]<u||Le[d+1]>h)continue;let f=Gd(p);r=qd(p);do{if(r.prev.next===r&&i>=r.x&&r.x>=o&&i!==r.x&&Qs(a<l?i:n,a,o,l,a<l?n:i,a,r.x,r.y)){let m=Math.abs(a-r.y)/(i-r.x);(Fn(r,e)||r.y===a&&r.next.y===a&&r.next.x>i)&&(m<c||m===c&&(r.x>s.x||r.x===s.x&&Z2(s,r)))&&(s=r,c=m)}r=r.next}while(r!==f)}return s}function Z2(e,t){return qe(e.prev,e,t.prev)<0&&qe(t.next,e,e.next)<0}var Zt=[],en=[],Ii=new Uint32Array,tn=new Uint32Array,rn=new Uint32Array(256);function W2(e,t,r,i){let a=e,n=0;do a.z=qu(a.x,a.y,t,r,i),Zt[n++]=a,a=a.next;while(a!==e);X2(n);let s=null;for(let o=0;o<n;o++){let l=Zt[o];l.prevZ=s,s&&(s.nextZ=l),s=l}s.nextZ=null}function X2(e){if(e<=32){for(let t=1;t<e;t++){let r=Zt[t],i=r.z,a=t-1;for(;a>=0&&Zt[a].z>i;)Zt[a+1]=Zt[a],a--;Zt[a+1]=r}return}Ii.length<e&&(Ii=new Uint32Array(e),tn=new Uint32Array(e),en=Array(e));for(let t=0;t<e;t++)Ii[t]=Zt[t].z;Cs(e,Zt,Ii,en,tn,0),Cs(e,en,tn,Zt,Ii,8),Cs(e,Zt,Ii,en,tn,16),Cs(e,en,tn,Zt,Ii,24)}function Cs(e,t,r,i,a,n){rn.fill(0);for(let o=0;o<e;o++)rn[r[o]>>>n&255]++;let s=0;for(let o=0;o<256;o++){let l=rn[o];rn[o]=s,s+=l}for(let o=0;o<e;o++){let l=r[o],u=rn[l>>>n&255]++;i[u]=t[o],a[u]=l}}function qu(e,t,r,i,a){return e=(e-r)*a|0,t=(t-i)*a|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function H2(e){let t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function Qs(e,t,r,i,a,n,s,o){return(a-s)*(t-o)>=(e-s)*(n-o)&&(e-s)*(i-o)>=(r-s)*(t-o)&&(r-s)*(n-o)>=(a-s)*(i-o)}function Y2(e,t){let r=Dn(e,t)&&qe(e.prev,e,e.next)>0&&qe(t.prev,t,t.next)>0;return e.next.i!==t.i&&(r||Fn(e,t)&&Fn(t,e)&&(qe(e.prev,e,t.prev)!==0||qe(e,t.prev,t)!==0))&&!K2(e,t)&&(r||J2(e,t))}function qe(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Dn(e,t){return e.x===t.x&&e.y===t.y}function uy(e,t,r,i,a=!0){let n=qe(e,t,r),s=qe(e,t,i),o=qe(r,i,e),l=qe(r,i,t);return(n>0&&s<0||n<0&&s>0)&&(o>0&&l<0||o<0&&l>0)?!0:a?!!(n===0&&ks(e,r,t)||s===0&&ks(e,i,t)||o===0&&ks(r,e,i)||l===0&&ks(r,t,i)):!1}function ks(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function K2(e,t){let r=Math.min(e.x,t.x),i=Math.max(e.x,t.x),a=Math.min(e.y,t.y),n=Math.max(e.y,t.y),s=e;do{let o=s.next;if(s.x>i&&o.x>i||s.x<r&&o.x<r||s.y>n&&o.y>n||s.y<a&&o.y<a){s=o;continue}if(s.i!==e.i&&o.i!==e.i&&s.i!==t.i&&o.i!==t.i&&uy(s,o,e,t))return!0;s=o}while(s!==e);return!1}function Fn(e,t){return qe(e.prev,e,e.next)<0?qe(e,t,e.next)>=0&&qe(e,e.prev,t)>=0:qe(e,t,e.prev)<0||qe(e,e.next,t)<0}function J2(e,t){let r=e,i=!1,a=(e.x+t.x)/2,n=(e.y+t.y)/2;do{let s=r.next;r.y>n!=s.y>n&&a<(s.x-r.x)*(n-r.y)/(s.y-r.y)+r.x&&(i=!i),r=s}while(r!==e);return i}function hy(e,t){let r=Zu(e.i,e.x,e.y),i=Zu(t.i,t.x,t.y),a=e.next,n=t.prev;return e.next=t,t.prev=e,r.next=a,a.prev=r,i.next=r,r.prev=i,n.next=i,i.prev=n,i}function Zd(e,t,r,i){let a=Zu(e,t,r);return i?(a.next=i.next,a.prev=i,i.next.prev=a,i.next=a):(a.prev=a,a.next=a),a}function zn(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ),$u&&G2(e.prev,e.next)}function Zu(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Q2(e,t,r,i){let a=0;for(let n=t,s=r-i;n<r;n+=i)a+=(e[s]-e[n])*(e[n+1]+e[s+1]),s=n;return a}var xr=class{constructor(e,t){if(t>e)throw Error(\"Min granularity must not be greater than base granularity.\");this._baseZoomGranularity=e,this._minGranularity=t}getGranularityForZoomLevel(e){let t=1<<e;return Math.max(Math.floor(this._baseZoomGranularity/t),this._minGranularity,1)}},Ri,Vo=(Ri=class{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}},Ri.noSubdivision=new Ri({fill:new xr(0,0),line:new xr(0,0),tile:new xr(0,0),stencil:new xr(0,0),circle:1}),Ri);N(\"SubdivisionGranularityExpression\",xr),N(\"SubdivisionGranularitySetting\",Vo);var fa=-32768,ma=32767,eT=class{constructor(e,t){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=z/e,this._canonical=t}_getKey(e,t){return e+=32768,t+=32768,e<<16|t<<0}_vertexToIndex(e,t){if(e<-32768||t<-32768||e>32767||t>32767)throw Error(\"Vertex coordinates are out of signed 16 bit integer range.\");let r=Math.round(e)|0,i=Math.round(t)|0,a=this._getKey(r,i);if(this._vertexDictionary.has(a))return this._vertexDictionary.get(a);let n=this._vertexBuffer.length/2;return this._vertexDictionary.set(a,n),this._vertexBuffer.push(r,i),n}_subdivideTrianglesScanline(e){if(this._granularity<2)return rT(this._vertexBuffer,e);let t=[],r=e.length;for(let i=0;i<r;i+=3){let a=[e[i+0],e[i+1],e[i+2]],n=[this._vertexBuffer[e[i+0]*2+0],this._vertexBuffer[e[i+0]*2+1],this._vertexBuffer[e[i+1]*2+0],this._vertexBuffer[e[i+1]*2+1],this._vertexBuffer[e[i+2]*2+0],this._vertexBuffer[e[i+2]*2+1]],s=1/0,o=1/0,l=-1/0,u=-1/0;for(let f=0;f<3;f++){let m=n[f*2],g=n[f*2+1];s=Math.min(s,m),l=Math.max(l,m),o=Math.min(o,g),u=Math.max(u,g)}if(s===l||o===u)continue;let h=Math.floor(s/this._granularityCellSize),c=Math.ceil(l/this._granularityCellSize),p=Math.floor(o/this._granularityCellSize),d=Math.ceil(u/this._granularityCellSize);if(h===c&&p===d){t.push(...a);continue}for(let f=p;f<d;f++){let m=this._scanlineGenerateVertexRingForCellRow(f,n,a);iT(this._vertexBuffer,m,t)}}return t}_scanlineGenerateVertexRingForCellRow(e,t,r){let i=e*this._granularityCellSize,a=i+this._granularityCellSize,n=[];for(let s=0;s<3;s++){let o=t[s*2],l=t[s*2+1],u=t[(s+1)*2%6],h=t[((s+1)*2+1)%6],c=t[(s+2)*2%6],p=t[((s+2)*2+1)%6],d=u-o,f=h-l,m=d===0,g=f===0,y=(i-l)/f,_=(a-l)/f,x=Math.min(y,_),v=Math.max(y,_);if(!g&&(x>=1||v<=0)||g&&(l<i||l>a)){h>=i&&h<=a&&n.push(r[(s+1)%3]);continue}if(!g&&x>0){let T=o+d*x,I=l+f*x;n.push(this._vertexToIndex(T,I))}let w=o+d*Math.max(x,0),b=o+d*Math.min(v,1);if(m||this._generateIntraEdgeVertices(n,o,l,u,h,w,b),!g&&v<1){let T=o+d*v,I=l+f*v;n.push(this._vertexToIndex(T,I))}(g||h>=i&&h<=a)&&n.push(r[(s+1)%3]),!g&&(h<=i||h>=a)&&this._generateInterEdgeVertices(n,o,l,u,h,c,p,b,i,a)}return n}_generateIntraEdgeVertices(e,t,r,i,a,n,s){let o=i-t,l=a-r,u=l===0,h=u?Math.min(t,i):Math.min(n,s),c=u?Math.max(t,i):Math.max(n,s),p=Math.floor(h/this._granularityCellSize)+1,d=Math.ceil(c/this._granularityCellSize)-1;if(u?t<i:n<s)for(let f=p;f<=d;f++){let m=f*this._granularityCellSize,g=r+l*(m-t)/o;e.push(this._vertexToIndex(m,g))}else for(let f=d;f>=p;f--){let m=f*this._granularityCellSize,g=r+l*(m-t)/o;e.push(this._vertexToIndex(m,g))}}_generateInterEdgeVertices(e,t,r,i,a,n,s,o,l,u){let h=a-r,c=n-i,p=s-a,d=(l-a)/p,f=(u-a)/p,m=Math.min(d,f),g=Math.max(d,f),y=i+c*m,_=Math.floor(Math.min(y,o)/this._granularityCellSize)+1,x=Math.ceil(Math.max(y,o)/this._granularityCellSize)-1,v=o<y,w=p===0;if(w&&(s===l||s===u))return;if(w||m>=1||g<=0){let T=t-n,I=r-s,S=(l-s)/I,D=(u-s)/I,R=n+T*Math.min(S,D);_=Math.floor(Math.min(R,o)/this._granularityCellSize)+1,x=Math.ceil(Math.max(R,o)/this._granularityCellSize)-1,v=o<R}let b=h>0?u:l;if(v)for(let T=_;T<=x;T++){let I=T*this._granularityCellSize;e.push(this._vertexToIndex(I,b))}else for(let T=x;T>=_;T--){let I=T*this._granularityCellSize;e.push(this._vertexToIndex(I,b))}}_generateOutline(e){let t=[];for(let r of e){let i=Jh(r,this._granularity,!0),a=this._pointArrayToIndices(i),n=[];for(let s=1;s<a.length;s++)n.push(a[s-1]),n.push(a[s]);t.push(n)}return t}_handlePoles(e){let t=!1,r=!1;this._canonical&&(this._canonical.y===0&&(t=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(t||r)&&this._fillPoles(e,t,r)}_ensureNoPoleVertices(){let e=this._vertexBuffer;for(let t=0;t<e.length;t+=2){let r=e[t+1];r===-32768&&(e[t+1]=-32767),r===32767&&(e[t+1]=32766)}}_generatePoleQuad(e,t,r,i,a,n){i>a==(n===-32768)?(e.push(r),e.push(t),e.push(this._vertexToIndex(i,n)),e.push(this._vertexToIndex(a,n)),e.push(r),e.push(this._vertexToIndex(i,n))):(e.push(t),e.push(r),e.push(this._vertexToIndex(i,n)),e.push(r),e.push(this._vertexToIndex(a,n)),e.push(this._vertexToIndex(i,n)))}_fillPoles(e,t,r){let i=this._vertexBuffer,a=z,n=e.length;for(let s=2;s<n;s+=3){let o=e[s-2],l=e[s-1],u=e[s],h=i[o*2],c=i[o*2+1],p=i[l*2],d=i[l*2+1],f=i[u*2],m=i[u*2+1];t&&(c===0&&d===0&&this._generatePoleQuad(e,o,l,h,p,fa),d===0&&m===0&&this._generatePoleQuad(e,l,u,p,f,fa),m===0&&c===0&&this._generatePoleQuad(e,u,o,f,h,fa)),r&&(c===a&&d===a&&this._generatePoleQuad(e,o,l,h,p,ma),d===a&&m===a&&this._generatePoleQuad(e,l,u,p,f,ma),m===a&&c===a&&this._generatePoleQuad(e,u,o,f,h,ma))}}_initializeVertices(e){for(let t=0;t<e.length;t+=2)this._vertexToIndex(e[t],e[t+1])}subdividePolygonInternal(e,t){if(this._used)throw Error(\"Subdivision: multiple use not allowed.\");this._used=!0;let{flattened:r,holeIndices:i}=tT(e);this._initializeVertices(r);let a;try{let s=R2(r,i),o=this._convertIndices(r,s);a=this._subdivideTrianglesScanline(o)}catch(s){console.error(s)}let n=[];return t&&(n=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(a),this._granularity>=2&&this._canonical?.z===0&&(a=this._removeTrianglesOutsideTileX(a),n=n.map(s=>this._removeLinesOutsideTileX(s))),{verticesFlattened:this._vertexBuffer,indicesTriangles:a,indicesLineList:n}}_vertexOutsideTileX(e){let t=this._vertexBuffer[e*2];return t<0||t>8192}_removeTrianglesOutsideTileX(e){let t=[];for(let r=0;r<e.length;r+=3)this._vertexOutsideTileX(e[r])||this._vertexOutsideTileX(e[r+1])||this._vertexOutsideTileX(e[r+2])||t.push(e[r],e[r+1],e[r+2]);return t}_removeLinesOutsideTileX(e){let t=[];for(let r=0;r<e.length;r+=2)this._vertexOutsideTileX(e[r])||this._vertexOutsideTileX(e[r+1])||t.push(e[r],e[r+1]);return t}_convertIndices(e,t){let r=[];for(let i of t){let a=e[i*2],n=e[i*2+1];r.push(this._vertexToIndex(a,n))}return r}_pointArrayToIndices(e){let t=[];for(let r of e)t.push(this._vertexToIndex(r.x,r.y));return t}};function cy(e,t,r,i=!0){return new eT(r,t).subdividePolygonInternal(e,i)}function Jh(e,t,r=!1){if(!e||e.length<1||e.length<2)return[];let i=e[0],a=e[e.length-1],n=r&&(i.x!==a.x||i.y!==a.y);if(t<2)return n?[...e,e[0]]:[...e];let s=Math.floor(z/t),o=[];o.push(new C(e[0].x,e[0].y));let l=e.length,u=n?l:l-1;for(let h=0;h<u;h++){let c=e[h],p=h<l-1?e[h+1]:e[0],d=c.x,f=c.y,m=p.x,g=p.y,y=d!==m,_=f!==g;if(!y&&!_)continue;let x=m-d,v=g-f,w=Math.abs(x),b=Math.abs(v),T=d,I=f;for(;;){let D=x>0?(Math.floor(T/s)+1)*s:(Math.ceil(T/s)-1)*s,R=v>0?(Math.floor(I/s)+1)*s:(Math.ceil(I/s)-1)*s,F=Math.abs(T-D),E=Math.abs(I-R),M=Math.abs(T-m),A=Math.abs(I-g),k=y?F/w:1/0,H=_?E/b:1/0;if((M<=F||!y)&&(A<=E||!_))break;if(k<H&&y||!_){T=D,I+=v*k;let $=new C(T,Math.round(I));(o[o.length-1].x!==$.x||o[o.length-1].y!==$.y)&&o.push($)}else{T+=x*H,I=R;let $=new C(Math.round(T),I);(o[o.length-1].x!==$.x||o[o.length-1].y!==$.y)&&o.push($)}}let S=new C(m,g);(o[o.length-1].x!==S.x||o[o.length-1].y!==S.y)&&o.push(S)}return o}function tT(e){let t=[],r=[];for(let i of e)if(i.length!==0){i!==e[0]&&t.push(r.length/2);for(let a of i)r.push(a.x),r.push(a.y)}return{flattened:r,holeIndices:t}}function rT(e,t){let r=[];for(let i=0;i<t.length;i+=3){let a=t[i],n=t[i+1],s=t[i+2],o=e[a*2],l=e[a*2+1],u=e[n*2],h=e[n*2+1],c=e[s*2],p=e[s*2+1],d=u-o,f=h-l,m=c-o;d*(p-l)-f*m>0?(r.push(a),r.push(s),r.push(n)):(r.push(a),r.push(n),r.push(s))}return r}function iT(e,t,r){if(t.length===0)throw Error(\"Subdivision vertex ring is empty.\");let i=0,a=e[t[0]*2];for(let l=1;l<t.length;l++){let u=e[t[l]*2];u<a&&(a=u,i=l)}let n=t.length,s=i,o=(s+1)%n;for(;;){let l=s-1>=0?s-1:n-1,u=(o+1)%n,h=e[t[l]*2],c=e[t[l]*2+1],p=e[t[u]*2],d=e[t[u]*2+1],f=e[t[s]*2],m=e[t[s]*2+1],g=e[t[o]*2],y=e[t[o]*2+1],_=!1;if(h<p)_=!0;else if(h>p)_=!1;else{let x=y-m,v=-(g-f),w=m<y?1:-1;((h-f)*x+(c-m)*v)*w>((p-f)*x+(d-m)*v)*w&&(_=!0)}if(_){let x=t[l],v=t[s],w=t[o];x!==v&&x!==w&&v!==w&&r.push(w,v,x),s--,s<0&&(s=n-1)}else{let x=t[u],v=t[s],w=t[o];x!==v&&x!==w&&v!==w&&r.push(w,v,x),o++,o>=n&&(o=0)}if(l===u)break}}function py(e,t,r,i,a,n,s,o,l){let u=a.length/2,h=s&&o&&l;if(u<Ee.MAX_VERTEX_ARRAY_LENGTH){let c=t.prepareSegment(u,r,i),p=c.vertexLength;for(let m=0;m<n.length;m+=3)i.emplaceBack(p+n[m],p+n[m+1],p+n[m+2]);c.vertexLength+=u,c.primitiveLength+=n.length/3;let d,f;h&&(f=s.prepareSegment(u,r,o),d=f.vertexLength,f.vertexLength+=u);for(let m=0;m<a.length;m+=2)e(a[m],a[m+1]);if(h)for(let m of l){for(let g=1;g<m.length;g+=2)o.emplaceBack(d+m[g-1],d+m[g]);f.primitiveLength+=m.length/2}}else aT(t,r,i,a,n,e),h&&nT(s,r,o,a,l,e),t.forceNewSegmentOnNextPrepare(),s?.forceNewSegmentOnNextPrepare()}function xn(e,t,r,i,a,n,s){if(n){let o=i.count;return r(t[a*2],t[a*2+1]),e[a]=i.count,i.count++,s.vertexLength++,o}return e[a]}function aT(e,t,r,i,a,n){let s=[];for(let c=0;c<i.length/2;c++)s.push(-1);let o={count:0},l=0,u=e.getOrCreateLatestSegment(t,r),h=u.vertexLength;for(let c=2;c<a.length;c+=3){let p=a[c-2],d=a[c-1],f=a[c],m=s[p]<l,g=s[d]<l,y=s[f]<l,_=+!!m+ +!!g+ +!!y;u.vertexLength+_>Ee.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,r),l=o.count,m=!0,g=!0,y=!0,h=0);let x=xn(s,i,n,o,p,m,u),v=xn(s,i,n,o,d,g,u),w=xn(s,i,n,o,f,y,u);r.emplaceBack(h+x-l,h+v-l,h+w-l),u.primitiveLength++}}function nT(e,t,r,i,a,n){let s=[];for(let c=0;c<i.length/2;c++)s.push(-1);let o={count:0},l=0,u=e.getOrCreateLatestSegment(t,r),h=u.vertexLength;for(let c of a)for(let p=1;p<c.length;p+=2){let d=c[p-1],f=c[p],m=s[d]<l,g=s[f]<l,y=+!!m+ +!!g;u.vertexLength+y>Ee.MAX_VERTEX_ARRAY_LENGTH&&(u=e.createNewSegment(t,r),l=o.count,m=!0,g=!0,h=0);let _=xn(s,i,n,o,d,m,u),x=xn(s,i,n,o,f,g,u);r.emplaceBack(h+_-l,h+x-l),u.primitiveLength++}}var dy=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new Ow,this.indexArray=new pr,this.indexArray2=new Fu,this.programConfigurations=new Oi(e.layers,e.zoom),this.segments=new Ee,this.segments2=new Ee,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,r){this.hasDependencies=Ks(\"fill\",this.layers,t);let i=this.layers[0].layout.get(\"fill-sort-key\"),a=!i.isConstant(),n=[],s=new Te(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of e){let p=yi(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let d=a?i.evaluate(p,{},r,t.availableImages):void 0,f={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:ji(l),patterns:{},sortKey:d};n.push(f)}a&&n.sort((l,u)=>l.sortKey-u.sortKey);for(let l of n){let{geometry:u,index:h,sourceLayerIndex:c}=l;if(this.hasDependencies){let d=Kh(\"fill\",this.layers,l,{zoom:this.zoom},t);this.patternFeatures.push(d)}else this.addFeature(l,u,h,r,{},t.subdivisionGranularity);let p=e[h].feature;t.featureIndex.insert(p,u,h,c,this.index)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}addFeatures(e,t,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,t,r,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,z2),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,t,r,i,a,n){for(let s of Sh(t,500)){let o=cy(s,i,n.fill.getGranularityForZoomLevel(i.z)),l=this.layoutVertexArray;py((u,h)=>{l.emplaceBack(u,h)},this.segments,this.layoutVertexArray,this.indexArray,o.verticesFlattened,o.indicesTriangles,this.segments2,this.indexArray2,o.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:a,canonical:i})}};N(\"FillBucket\",dy,{omit:[\"layers\",\"patternFeatures\"]});var sT,oT=()=>sT||(sT=new Qe({\"fill-sort-key\":new q(P.layout_fill[\"fill-sort-key\"],\"fill-sort-key\")})),lT,uT=()=>lT||(lT=new Qe({\"fill-antialias\":new V(P.paint_fill[\"fill-antialias\"],\"fill-antialias\"),\"fill-opacity\":new q(P.paint_fill[\"fill-opacity\"],\"fill-opacity\"),\"fill-layer-opacity\":new V(P.paint_fill[\"fill-layer-opacity\"],\"fill-layer-opacity\"),\"fill-color\":new q(P.paint_fill[\"fill-color\"],\"fill-color\"),\"fill-outline-color\":new q(P.paint_fill[\"fill-outline-color\"],\"fill-outline-color\"),\"fill-translate\":new V(P.paint_fill[\"fill-translate\"],\"fill-translate\"),\"fill-translate-anchor\":new V(P.paint_fill[\"fill-translate-anchor\"],\"fill-translate-anchor\"),\"fill-pattern\":new Mn(P.paint_fill[\"fill-pattern\"],\"fill-pattern\")})),hT={get paint(){return uT()},get layout(){return oT()}},fy=e=>e.type===\"fill\",cT=class extends cr{constructor(e,t){super(e,hT,t)}recalculate(e,t){super.recalculate(e,t);let r=this.paint._values[\"fill-outline-color\"];r.value.kind===\"constant\"&&r.value.value===void 0&&(this.paint._values[\"fill-outline-color\"]=this.paint._values[\"fill-color\"])}createBucket(e){return new dy(e)}queryRadius(){return Bo(this.paint.get(\"fill-translate\"))}queryIntersectsFeature({queryGeometry:e,geometry:t,transform:r,pixelsToTileUnits:i}){return Qg(Oo(e,this.paint.get(\"fill-translate\"),this.paint.get(\"fill-translate-anchor\"),-r.bearingInRadians,i),t)}isTileClipped(){return!0}},Wu=Ae([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_normal_ed\",components:4,type:\"Int16\"}],4),pT=Ae([{name:\"a_centroid\",components:2,type:\"Int16\"}],4),dT=Wu.members;Wu.size,Wu.alignment;var or=class Xu{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){let r=new Xu;return r.extend(t(new C(this.minX,this.minY))),r.extend(t(new C(this.maxX,this.minY))),r.extend(t(new C(this.minX,this.maxY))),r.extend(t(new C(this.maxX,this.maxY))),r}static fromPoints(t){let r=new Xu;for(let i of t)r.extend(i);return r}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}},my=or.fromPoints([new C(0,0),new C(z,z)]);function Hu(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function Wd(e){return e.every(t=>t.x<0)||e.every(t=>t.x>8192)||e.every(t=>t.y<0)||e.every(t=>t.y>8192)}var Jn=class{constructor(e,t,r,i,a){for(this.properties=Object.create(null),this.extent=r,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=a;e.pos<t;){let n=e.readVarint();if(n===8)this.id=e.readVarint();else if(n===18){let s=e.readVarint()+e.pos;for(;e.pos<s;){let o=i[e.readVarint()],l=a[e.readVarint()];this.properties[o]=l}}else n===24?this.type=e.readVarint():(n===34&&(this._geometry=e.pos),e.skip(n))}}loadGeometry(){if(this._geometry<0)throw Error(\"feature has no geometry\");let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,r=[],i,a=1,n=0,s=0,o=0;for(;e.pos<t;){if(n<=0){let l=e.readVarint();if(a=l&7,n=l>>3,n===0)continue}if(n--,a===1)s+=e.readSVarint(),o+=e.readSVarint(),i&&r.push(i),i=[new C(s,o)];else if(a===2)s+=e.readSVarint(),o+=e.readSVarint(),i&&i.push(new C(s,o));else if(a===7)i&&i.push(i[0].clone());else throw Error(`unknown command ${a}`)}return i&&r.push(i),r}bbox(){if(this._geometry<0)throw Error(\"feature has no geometry\");let e=this._pbf;e.pos=this._geometry;let t=e.readVarint()+e.pos,r=1,i=0,a=0,n=0,s=1/0,o=-1/0,l=1/0,u=-1/0;for(;e.pos<t;){if(i<=0){let h=e.readVarint();if(r=h&7,i=h>>3,i===0)continue}if(i--,r===1||r===2)a+=e.readSVarint(),n+=e.readSVarint(),a<s&&(s=a),a>o&&(o=a),n<l&&(l=n),n>u&&(u=n);else if(r!==7)throw Error(`unknown command ${r}`)}return[s,l,o,u]}toGeoJSON(e,t,r){let i=this.extent*2**r,a=this.extent*e,n=this.extent*t,s=this.loadGeometry();function o(c){return[(c.x+a)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(c.y+n)*2/i)*Math.PI))-90]}function l(c){return c.map(o)}let u;if(this.type===1){let c=[];for(let d of s)c.push(d[0]);let p=l(c);u=c.length===1?{type:\"Point\",coordinates:p[0]}:{type:\"MultiPoint\",coordinates:p}}else if(this.type===2){let c=s.map(l);u=c.length===1?{type:\"LineString\",coordinates:c[0]}:{type:\"MultiLineString\",coordinates:c}}else if(this.type===3){let c=gy(s),p=[];for(let d of c)p.push(d.map(l));u=p.length===1?{type:\"Polygon\",coordinates:p[0]}:{type:\"MultiPolygon\",coordinates:p}}else throw Error(\"unknown feature type\");let h={type:\"Feature\",geometry:u,properties:this.properties};return this.id!=null&&(h.id=this.id),h}};Jn.types=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"];function gy(e){let t=e.length;if(t<=1)return[e];let r=[],i,a;for(let n=0;n<t;n++){let s=fT(e[n]);s!==0&&(a===void 0&&(a=s<0),a===s<0?(i&&r.push(i),i=[e[n]]):i&&i.push(e[n]))}return i&&r.push(i),r}function fT(e){let t=0;for(let r=0,i=e.length,a=i-1,n,s;r<i;a=r++)n=e[r],s=e[a],t+=(s.x-n.x)*(n.y+s.y);return t}var mT=class{constructor(e,t){for(this.version=1,this.name=\"\",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],t===void 0&&(t=e.length);e.pos<t;){let r=e.readVarint();r===10?this.name=e.readString():r===18?(this._features.push(e.pos),e.skip(r)):r===26?this._keys.push(e.readString()):r===34?this._values.push(gT(e)):r===40?this.extent=e.readVarint():r===120?this.version=e.readVarint():e.skip(r)}this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw Error(\"feature index out of bounds\");this._pbf.pos=this._features[e];let t=this._pbf.readVarint()+this._pbf.pos;return new Jn(this._pbf,t,this.extent,this._keys,this._values)}};function gT(e){let t=null,r=e.readVarint()+e.pos;for(;e.pos<r;){let i=e.readVarint();t=i===10?e.readString():i===21?e.readFloat():i===25?e.readDouble():i===32?e.readVarint(!0):i===40?e.readVarint():i===48?e.readSVarint():i===56?e.readBoolean():(e.skip(i),null)}if(t==null)throw Error(\"unknown feature value\");return t}var yT=class{constructor(e,t=e.length){let r=Object.create(null);for(;e.pos<t;){let i=e.readVarint();if(i===26){let a=new mT(e,e.readVarint()+e.pos);a.length&&(r[a.name]=a)}else e.skip(i)}this.layers=r}},Qt=63710088e-1,K=class cn{constructor(t,r){if(isNaN(t)||isNaN(r))throw Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw Error(\"Invalid LngLat latitude value: must be between -90 and 90\")}wrap(){return new cn(Ut(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){let r=Math.PI/180,i=this.lat*r,a=t.lat*r,n=Math.sin(i)*Math.sin(a)+Math.cos(i)*Math.cos(a)*Math.cos((t.lng-this.lng)*r);return Qt*Math.acos(Math.min(n,1))}static convert(t){if(t instanceof cn)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new cn(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t==\"object\"&&t)return new cn(Number(\"lng\"in t?t.lng:t.lon),Number(t.lat));throw Error(\"`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]\")}},yy=2*Math.PI*Qt;function _y(e){return yy*Math.cos(e*Math.PI/180)}function Gi(e){return(180+e)/360}function qi(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function _i(e,t){return e/_y(t)}function No(e){return e*360-180}function Aa(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function Qh(e,t){return e*_y(Aa(t))}function _T(e){return 1/Math.cos(e*Math.PI/180)}var fe=class xy{constructor(t,r,i=0){this.x=+t,this.y=+r,this.z=+i}static fromLngLat(t,r=0){let i=K.convert(t);return new xy(Gi(i.lng),qi(i.lat),_i(r,i.lat))}toLngLat(){return new K(No(this.x),Aa(this.y))}toAltitude(){return Qh(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/yy*_T(Aa(this.y))}},xi=89.25;function ec(e,t,r){let i=1/(1<<r.z);return new fe(e/z*i+r.x*i,t/z*i+r.y*i)}function xT(e,t,r){return ec(e,t,r).toLngLat()}function dr(e,t){let r=te(t.lat,-85.051129,hr);return new C(Gi(t.lng)*e,qi(r)*e)}function Oa(e,t){return new fe(t.x/e,t.y/e).toLngLat()}function Va(e){return e.cameraToCenterDistance*Math.min(Math.tan(Fe(90-e.pitch))*.85,Math.tan(Fe(xi-e.pitch)))}function Uo(e,t){let r=e.canonical,i=t/bt(r.z),a=r.x+2**r.z*e.wrap,n=new Float64Array(16);return Kt(n),ze(n,n,[a*i,r.y*i,0]),at(n,n,[i/z,i/z,1]),n}function tc(e,t,r,i,a){let n=fe.fromLngLat(e,t),s=a*_i(1,e.lat),{x:o,y:l,z:u}=$o(r,i),h=s*-o,c=s*-l,p=s*u;return new fe(n.x+h,n.y+c,n.z+p)}function rc(e){let t=_i(1,e.center.lat)*e.worldSize;return tc(e.center,e.elevation,e.pitch,e.bearing,e.cameraToCenterDistance/t)}function $o(e,t){let r=Fe(e),i=Fe(t),a=Math.cos(-r),n=Math.sin(r);return{x:n*Math.sin(i),y:-n*Math.cos(i),z:a}}function Xd(e,t,r){if(t<=0||!e||e.length===0)return e;let i=vT(t,r);return e.map(a=>bT(a,i))}function vT(e,t){let r=xT(z/2,z/2,t),i=fe.fromLngLat(r).meterInMercatorCoordinateUnits(),a=(1<<t.z)*z;return e*i*a}function bT(e,t){if(!e||e.length<3)return e;let r=e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y,i=r?e.length-1:e.length;if(i<3)return e;let a=[];for(let s=0;s<i;s++){let o=e[(s-1+i)%i],l=e[s],u=e[(s+1)%i];if(Hu(o,l)||Hu(l,u)){a.push(l.clone());continue}TT(a,o,l,u,t)}let n=wT(a);return n.length<3?e:(r&&n.push(n[0].clone()),n)}function wT(e){let t=[];for(let r of e){let i=r.round(),a=t[t.length-1];(a?.x!==i.x||a?.y!==i.y)&&t.push(i)}for(;t.length>1&&t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y;)t.pop();return t}function TT(e,t,r,i,a){let n=t.sub(r),s=i.sub(r),o=n.mag(),l=s.mag();if(o<1e-6||l<1e-6){e.push(r.clone());return}n._div(o),s._div(l);let u=n.x*s.x+n.y*s.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){e.push(r.clone());return}let h=.2,c=Math.min(a,o*h,l*h),p=r.add(n.mult(c)),d=r.add(s.mult(c)),f=Math.sqrt((1+u)/2),m=r.add(n.add(s)._unit()._mult(c/f)),g=p.sub(m).angleWith(d.sub(m)),y=Math.max(2,Math.ceil(Math.abs(g)/(Math.PI/6)-1e-6));for(let _=0;_<=y;_++)e.push(p.rotateAround(_/y*g,m))}var Yl=8192;function an(e,t,r,i,a,n,s,o){e.emplaceBack(t,r,Math.floor(i*Yl)*2+s,a*Yl*2,n*Yl*2,Math.round(o))}var vy=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Vw,this.centroidVertexArray=new Gr,this.indexArray=new pr,this.programConfigurations=new Oi(e.layers,e.zoom),this.segments=new Ee,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,r){this.features=[],this.hasDependencies=Ks(\"fill-extrusion\",this.layers,t);let i=new Te(this.zoom),a=this.layers[0],n=a.layout.get(\"fill-extrusion-rounded-corner-distance\"),s=a._featureFilter.needGeometry;for(let{feature:o,id:l,index:u,sourceLayerIndex:h}of e){let c=yi(o,s);if(!a._featureFilter.filter(i,c,r))continue;let p=s?c.geometry:ji(o),d={id:l,sourceLayerIndex:h,index:u,geometry:n>0?Xd(p,n,r):p,properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(Kh(\"fill-extrusion\",this.layers,d,{zoom:this.zoom},t)):this.addFeature(d,d.geometry,u,r,{},t.subdivisionGranularity),t.featureIndex.insert(o,d.geometry,u,h,this.index,!0)}}addFeatures(e,t,r){for(let i of this.features){let{geometry:a}=i;this.addFeature(i,a,i.index,t,r,e.subdivisionGranularity)}}update(e,t,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,dT),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,pT.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,t,r,i,a,n){let s=this.layers[0],o=s.layout?s.layout.get(\"fill-extrusion-rounded-corner-distance\"):0,l=o>0?Xd(t,o,i):t;for(let u of Sh(l,500)){let h={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(h,i,e,u,n);let p=this.layoutVertexArray.length-c,d=Math.floor(h.x/h.sampleCount),f=Math.floor(h.y/h.sampleCount);for(let m=0;m<p;m++)this.centroidVertexArray.emplaceBack(d,f)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:a,canonical:i})}processPolygon(e,t,r,i,a){if(i.length<1||Wd(i[0]))return;for(let h of i)h.length!==0&&ST(e,h);let n={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=a.fill.getGranularityForZoomLevel(t.z),o=Jn.types[r.type]===\"Polygon\";for(let h of i){if(h.length===0||Wd(h))continue;let c=Jh(h,s,o);this._generateSideFaces(c,n)}if(!o)return;let l=cy(i,t,s,!1),u=this.layoutVertexArray;py((h,c)=>{an(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(e,t){let r=0;for(let i=1;i<e.length;i++){let a=e[i],n=e[i-1];if(Hu(a,n))continue;t.segment.vertexLength+4>Ee.MAX_VERTEX_ARRAY_LENGTH&&(t.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=a.sub(n)._perp()._unit(),o=n.dist(a);r+o>32768&&(r=0),an(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,r),an(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,r),r+=o,an(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,r),an(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,r);let l=t.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),t.segment.vertexLength+=4,t.segment.primitiveLength+=2}}};function ST(e,t){for(let r=0;r<t.length;r++){let i=t[r];(r!==t.length-1||t[0].x!==i.x||t[0].y!==i.y)&&(e.x+=i.x,e.y+=i.y,e.sampleCount++)}}N(\"FillExtrusionBucket\",vy,{omit:[\"layers\",\"features\"]});var ET,IT=()=>ET||(ET=new Qe({\"fill-extrusion-rounded-corner-distance\":new V(P[\"layout_fill-extrusion\"][\"fill-extrusion-rounded-corner-distance\"],\"fill-extrusion-rounded-corner-distance\")})),AT,MT=()=>AT||(AT=new Qe({\"fill-extrusion-opacity\":new V(P[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"],\"fill-extrusion-opacity\"),\"fill-extrusion-color\":new q(P[\"paint_fill-extrusion\"][\"fill-extrusion-color\"],\"fill-extrusion-color\"),\"fill-extrusion-translate\":new V(P[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"],\"fill-extrusion-translate\"),\"fill-extrusion-translate-anchor\":new V(P[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"],\"fill-extrusion-translate-anchor\"),\"fill-extrusion-pattern\":new Mn(P[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"],\"fill-extrusion-pattern\"),\"fill-extrusion-height\":new q(P[\"paint_fill-extrusion\"][\"fill-extrusion-height\"],\"fill-extrusion-height\"),\"fill-extrusion-base\":new q(P[\"paint_fill-extrusion\"][\"fill-extrusion-base\"],\"fill-extrusion-base\"),\"fill-extrusion-vertical-gradient\":new V(P[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-gradient\"],\"fill-extrusion-vertical-gradient\")})),PT={get paint(){return MT()},get layout(){return IT()}},by=e=>e.type===\"fill-extrusion\",CT=class extends cr{constructor(e,t){super(e,PT,t)}createBucket(e){return new vy(e)}queryRadius(){return Bo(this.paint.get(\"fill-extrusion-translate\"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:a,pixelsToTileUnits:n,pixelPosMatrix:s}){let o=Oo(e,this.paint.get(\"fill-extrusion-translate\"),this.paint.get(\"fill-extrusion-translate-anchor\"),-a.bearingInRadians,n),l=this.paint.get(\"fill-extrusion-height\").evaluate(t,r),u=this.paint.get(\"fill-extrusion-base\").evaluate(t,r),h=FT(o,s,0),c=DT(i,u,l,s),p=c[0],d=c[1];return kT(p,d,h)}};function nn(e,t){return e.x*t.x+e.y*t.y}function Hd(e,t){if(e.length===1){let r=0,i=t[r++],a;for(;!a||i.equals(a);)if(a=t[r++],!a)return 1/0;for(;r<t.length;r++){let n=t[r],s=e[0],o=a.sub(i),l=n.sub(i),u=s.sub(i),h=nn(o,o),c=nn(o,l),p=nn(l,l),d=nn(u,o),f=nn(u,l),m=h*p-c*c,g=(p*d-c*f)/m,y=(h*f-c*d)/m,_=1-g-y,x=i.z*_+a.z*g+n.z*y;if(isFinite(x))return x}return 1/0}{let r=1/0;for(let i of t)r=Math.min(r,i.z);return r}}function kT(e,t,r){let i=1/0;Qg(r,t)&&(i=Hd(r,t[0]));for(let a=0;a<t.length;a++){let n=t[a],s=e[a];for(let o=0;o<n.length-1;o++){let l=n[o],u=n[o+1],h=s[o],c=[l,u,s[o+1],h,l];Xh(r,c)&&(i=Math.min(i,Hd(r,c)))}}return i!==1/0&&i}function DT(e,t,r,i){let a=[],n=[],s=i[8]*t,o=i[9]*t,l=i[10]*t,u=i[11]*t,h=i[8]*r,c=i[9]*r,p=i[10]*r,d=i[11]*r;for(let f of e){let m=[],g=[];for(let y of f){let _=y.x,x=y.y,v=i[0]*_+i[4]*x+i[12],w=i[1]*_+i[5]*x+i[13],b=i[2]*_+i[6]*x+i[14],T=i[3]*_+i[7]*x+i[15],I=v+s,S=w+o,D=b+l,R=T+u,F=v+h,E=w+c,M=b+p,A=T+d,k=new C(I/R,S/R);k.z=D/R,m.push(k);let H=new C(F/A,E/A);H.z=M/A,g.push(H)}a.push(m),n.push(g)}return[a,n]}function FT(e,t,r){let i=[];for(let a of e){let n=[a.x,a.y,r,1];We(n,n,t),i.push(new C(n[0]/n[3],n[1]/n[3]))}return i}var KD=new Uint32Array(96);var zT=\"geojsonvt_clip_start\",RT=\"geojsonvt_clip_end\";var Yu=Ae([{name:\"a_pos_normal\",components:2,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint8\"}],4),LT=Yu.members;Yu.size,Yu.alignment;var Ku=Ae([{name:\"a_uv_x\",components:1,type:\"Float32\"},{name:\"a_split_index\",components:1,type:\"Float32\"}]),BT=Ku.members;Ku.size,Ku.alignment;var OT=Math.cos(75/2*(Math.PI/180)),wy=1/2,Yd=2**14/wy,Ty=class{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.id),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let t of this.layers)this.gradients[t.id]={};this.layoutVertexArray=new Nw,this.layoutVertexArray2=new Uw,this.indexArray=new pr,this.programConfigurations=new Oi(e.layers,e.zoom),this.segments=new Ee,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id)}populate(e,t,r){this.hasDependencies=Ks(\"line\",this.layers,t)||this.hasLineDasharray(this.layers);let i=this.layers[0].layout.get(\"line-sort-key\"),a=!i.isConstant(),n=[],s=new Te(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of e){let p=yi(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let d=a?i.evaluate(p,{},r):void 0,f={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:ji(l),patterns:{},dashes:{},sortKey:d};n.push(f)}a&&n.sort((l,u)=>l.sortKey-u.sortKey);for(let l of n){let{geometry:u,index:h,sourceLayerIndex:c}=l;this.hasDependencies?(Ks(\"line\",this.layers,t)?Kh(\"line\",this.layers,l,{zoom:this.zoom},t):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,t),this.patternFeatures.push(l)):this.addFeature(l,u,h,r,{},{},t.subdivisionGranularity);let p=e[h].feature;t.featureIndex.insert(p,u,h,c,this.index)}}update(e,t,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,t,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures(e,t,r,i){for(let a of this.patternFeatures)this.addFeature(a,a.geometry,a.index,t,r,i,e.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,BT)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,LT),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.hasOwn(e.properties,\"geojsonvt_clip_start\")&&Object.hasOwn(e.properties,\"geojsonvt_clip_end\"))return{start:+e.properties[zT],end:+e.properties[RT]}}addFeature(e,t,r,i,a,n,s){let o=this.layers[0].layout,l=o.get(\"line-join\").evaluate(e,{}),u=o.get(\"line-cap\").evaluate(e,{}),h=o.get(\"line-miter-limit\").evaluate(e,{}),c=o.get(\"line-round-limit\").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(let p of t)this.addLine(p,e,l,u,h,c,i,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{imagePositions:a,dashPositions:n,canonical:i})}addLine(e,t,r,i,a,n,s,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=s?o.line.getGranularityForZoomLevel(s.z):1;if(e=Jh(e,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let x=0;x<e.length-1;x++)this.totalDistance+=e[x].dist(e[x+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let u=Jn.types[t.type]===\"Polygon\",h=e.length;for(;h>=2&&e[h-1].equals(e[h-2]);)h--;let c=0;for(;c<h-1&&e[c].equals(e[c+1]);)c++;if(h-c<(u?3:2))return;r===\"bevel\"&&(a=1.05);let p=this.overscaling<=16?15*z/(512*this.overscaling):0,d=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),f,m,g,y,_;this.e1=this.e2=-1,u&&(f=e[h-2],_=e[c].sub(f)._unit()._perp());for(let x=c;x<h;x++){if(g=x===h-1?u?e[c+1]:void 0:e[x+1],g&&e[x].equals(g))continue;_&&(y=_),f&&(m=f),f=e[x],_=g?g.sub(f)._unit()._perp():y,y||(y=_);let v=y.add(_);(v.x!==0||v.y!==0)&&v._unit();let w=y.x*_.x+y.y*_.y,b=v.x*_.x+v.y*_.y,T=b===0?1/0:1/b,I=2*Math.sqrt(2-2*b),S=b<OT&&m&&g,D=y.x*_.y-y.y*_.x>0;if(S&&x>c){let E=f.dist(m);if(E>2*p){let M=f.sub(f.sub(m)._mult(p/E)._round());this.updateDistance(m,M),this.addCurrentVertex(M,y,0,0,d),m=M}}let R=m&&g,F=R?r:u?\"butt\":i;if(R&&F===\"round\"&&(T<n?F=\"miter\":T<=2&&(F=\"fakeround\")),F===\"miter\"&&T>a&&(F=\"bevel\"),F===\"bevel\"&&(T>2&&(F=\"flipbevel\"),T<a&&(F=\"miter\")),m&&this.updateDistance(m,f),F===\"miter\")v._mult(T),this.addCurrentVertex(f,v,0,0,d);else if(F===\"flipbevel\"){if(T>100)v=_.mult(-1);else{let E=T*y.add(_).mag()/y.sub(_).mag();v._perp()._mult(E*(D?-1:1))}this.addCurrentVertex(f,v,0,0,d),this.addCurrentVertex(f,v.mult(-1),0,0,d)}else if(F===\"bevel\"||F===\"fakeround\"){let E=-Math.sqrt(T*T-1),M=D?E:0,A=D?0:E;if(m&&this.addCurrentVertex(f,y,M,A,d),F===\"fakeround\"){let k=Math.round(I*180/Math.PI/20);for(let H=1;H<k;H++){let $=H/k;if($!==.5){let Y=$-.5,ue=1.0904+w*(-3.2452+w*(3.55645-w*1.43519)),Rt=.848013+w*(-1.06021+w*.215638);$+=$*Y*($-1)*(ue*Y*Y+Rt)}let U=_.sub(y)._mult($)._add(y)._unit()._mult(D?-1:1);this.addHalfVertex(f,U.x,U.y,!1,D,0,d)}}g&&this.addCurrentVertex(f,_,-M,-A,d)}else if(F===\"butt\")this.addCurrentVertex(f,v,0,0,d);else if(F===\"square\"){let E=m?1:-1;this.addCurrentVertex(f,v,E,E,d)}else F===\"round\"&&(m&&(this.addCurrentVertex(f,y,0,0,d),this.addCurrentVertex(f,y,1,1,d,!0)),g&&(this.addCurrentVertex(f,_,-1,-1,d,!0),this.addCurrentVertex(f,_,0,0,d)));if(S&&x<h-1){let E=f.dist(g);if(E>2*p){let M=f.add(g.sub(f)._mult(p/E)._round());this.updateDistance(f,M),this.addCurrentVertex(M,_,0,0,d),f=M}}}}addCurrentVertex(e,t,r,i,a,n=!1){let s=t.x+t.y*r,o=t.y-t.x*r,l=-t.x+t.y*i,u=-t.y-t.x*i;this.addHalfVertex(e,s,o,n,!1,r,a),this.addHalfVertex(e,l,u,n,!0,-i,a),this.distance>Yd/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,t,r,i,a,n))}addHalfVertex({x:e,y:t},r,i,a,n,s,o){let l=(this.lineClips?this.scaledDistance*(Yd-1):this.scaledDistance)*wy;if(this.layoutVertexArray.emplaceBack((e<<1)+ +!!a,(t<<1)+ +!!n,Math.round(63*r)+128,Math.round(63*i)+128,(s===0?0:s<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.primitiveLength++),n?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,t){this.distance+=e.dist(t),this.updateScaledDistance()}hasLineDasharray(e){for(let t of e){let r=t.paint.get(\"line-dasharray\");if(r&&!r.isConstant())return!0}return!1}addLineDashDependencies(e,t,r,i){for(let a of e){let n=a.paint.get(\"line-dasharray\");if(!n||n.value.kind===\"constant\")continue;let s=a.layout.get(\"line-cap\").evaluate(t,{})===\"round\",o={dasharray:n.value.evaluate({zoom:r-1},t,{}),round:s},l={dasharray:n.value.evaluate({zoom:r},t,{}),round:s},u={dasharray:n.value.evaluate({zoom:r+1},t,{}),round:s},h=`${o.dasharray.join(\",\")},${o.round}`,c=`${l.dasharray.join(\",\")},${l.round}`,p=`${u.dasharray.join(\",\")},${u.round}`;i.dashDependencies[h]=o,i.dashDependencies[c]=l,i.dashDependencies[p]=u,t.dashes[a.id]={min:h,mid:c,max:p}}}};N(\"LineBucket\",Ty,{omit:[\"layers\",\"patternFeatures\"]});var VT,NT=()=>VT||(VT=new Qe({\"line-cap\":new q(P.layout_line[\"line-cap\"],\"line-cap\"),\"line-join\":new q(P.layout_line[\"line-join\"],\"line-join\"),\"line-miter-limit\":new q(P.layout_line[\"line-miter-limit\"],\"line-miter-limit\"),\"line-round-limit\":new q(P.layout_line[\"line-round-limit\"],\"line-round-limit\"),\"line-sort-key\":new q(P.layout_line[\"line-sort-key\"],\"line-sort-key\")})),UT,$T=()=>UT||(UT=new Qe({\"line-opacity\":new q(P.paint_line[\"line-opacity\"],\"line-opacity\"),\"line-layer-opacity\":new V(P.paint_line[\"line-layer-opacity\"],\"line-layer-opacity\"),\"line-color\":new q(P.paint_line[\"line-color\"],\"line-color\"),\"line-translate\":new V(P.paint_line[\"line-translate\"],\"line-translate\"),\"line-translate-anchor\":new V(P.paint_line[\"line-translate-anchor\"],\"line-translate-anchor\"),\"line-width\":new q(P.paint_line[\"line-width\"],\"line-width\"),\"line-gap-width\":new q(P.paint_line[\"line-gap-width\"],\"line-gap-width\"),\"line-offset\":new q(P.paint_line[\"line-offset\"],\"line-offset\"),\"line-blur\":new q(P.paint_line[\"line-blur\"],\"line-blur\"),\"line-dasharray\":new Mn(P.paint_line[\"line-dasharray\"],\"line-dasharray\"),\"line-pattern\":new Mn(P.paint_line[\"line-pattern\"],\"line-pattern\"),\"line-gradient\":new Yn(P.paint_line[\"line-gradient\"],\"line-gradient\")})),Kd={get paint(){return $T()},get layout(){return NT()}},jT=class extends q{possiblyEvaluate(e,t){return t=new Te(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,zoomHistory:t.zoomHistory,transition:t.transition}),super.possiblyEvaluate(e,t)}evaluate(e,t,r,i){return t=j({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,r,i)}},Ds,Sy=e=>e.type===\"line\",GT=class extends cr{constructor(e,t){super(e,Kd,t),this.gradientVersion=0,Ds||(Ds=new jT(Kd.paint.properties[\"line-width\"].specification,\"line-floorwidth\"),Ds.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e===\"line-gradient\"){let t=this.gradientExpression();this.stepInterpolant=qb(t)?t._styleExpression.expression instanceof Th:!1,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values[\"line-gradient\"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values[\"line-floorwidth\"]=Ds.possiblyEvaluate(this._transitioningPaint._values[\"line-width\"].value,e)}createBucket(e){return new Ty(e)}queryRadius(e){let t=e,r=Jd(da(\"line-width\",this,t),da(\"line-gap-width\",this,t)),i=da(\"line-offset\",this,t);return r/2+Math.abs(i)+Bo(this.paint.get(\"line-translate\"))}queryIntersectsFeature({queryGeometry:e,feature:t,featureState:r,geometry:i,transform:a,pixelsToTileUnits:n}){let s=Oo(e,this.paint.get(\"line-translate\"),this.paint.get(\"line-translate-anchor\"),-a.bearingInRadians,n),o=n/2*Jd(this.paint.get(\"line-width\").evaluate(t,r),this.paint.get(\"line-gap-width\").evaluate(t,r)),l=this.paint.get(\"line-offset\").evaluate(t,r);return l&&(i=u2(i,l*n)),r2(s,i,o)}isTileClipped(){return!0}};function Jd(e,t){return t>0?t+2*e:e}var qT=Ae([{name:\"a_pos_offset\",components:4,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint16\"},{name:\"a_pixeloffset\",components:4,type:\"Int16\"},{name:\"a_height_offset\",components:1,type:\"Float32\"}],4),ZT=Ae([{name:\"a_projected_pos\",components:3,type:\"Float32\"}],4);Ae([{name:\"a_fade_opacity\",components:1,type:\"Uint32\"}],4);var WT=Ae([{name:\"a_placed\",components:2,type:\"Uint8\"},{name:\"a_shift\",components:2,type:\"Float32\"},{name:\"a_box_real\",components:2,type:\"Int16\"}]);Ae([{type:\"Int16\",name:\"anchorPointX\"},{type:\"Int16\",name:\"anchorPointY\"},{type:\"Int16\",name:\"x1\"},{type:\"Int16\",name:\"y1\"},{type:\"Int16\",name:\"x2\"},{type:\"Int16\",name:\"y2\"},{type:\"Uint32\",name:\"featureIndex\"},{type:\"Uint16\",name:\"sourceLayerIndex\"},{type:\"Uint16\",name:\"bucketIndex\"}]);var Qd=Ae([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_anchor_pos\",components:2,type:\"Int16\"},{name:\"a_extrude\",components:2,type:\"Int16\"}],4),Ey=Ae([{name:\"a_pos\",components:2,type:\"Float32\"},{name:\"a_radius\",components:1,type:\"Float32\"},{name:\"a_flags\",components:2,type:\"Int16\"}],4);Ae([{name:\"triangle\",components:3,type:\"Uint16\"}]),Ae([{type:\"Int16\",name:\"anchorX\"},{type:\"Int16\",name:\"anchorY\"},{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:\"Float32\",name:\"heightOffset\"}]),Ae([{type:\"Int16\",name:\"anchorX\"},{type:\"Int16\",name:\"anchorY\"},{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\",name:\"textBoxScale\"},{type:\"Float32\",name:\"collisionCircleDiameter\"},{type:\"Uint16\",name:\"textAnchorOffsetStartIndex\"},{type:\"Uint16\",name:\"textAnchorOffsetEndIndex\"},{type:\"Float32\",name:\"heightOffset\"}]),Ae([{type:\"Float32\",name:\"offsetX\"}]),Ae([{type:\"Int16\",name:\"x\"},{type:\"Int16\",name:\"y\"},{type:\"Int16\",name:\"tileUnitDistanceFromAnchor\"}]),Ae([{type:\"Uint16\",name:\"textAnchor\"},{type:\"Float32\",components:2,name:\"textOffset\"}]);function XT(e,t,r){let i=t.layout.get(\"text-transform\").evaluate(r,{});return i===\"uppercase\"?e=e.toLocaleUpperCase():i===\"lowercase\"&&(e=e.toLocaleLowerCase()),Sa.applyArabicShaping&&(e=Sa.applyArabicShaping(e)),e}function HT(e,t,r){for(let i of e.sections)i.text=XT(i.text,t,r);return e}function YT(e){let t={},r={},i=[],a=0;function n(u){i.push(e[u]),a++}function s(u,h,c){let p=r[u];return delete r[u],r[h]=p,i[p].geometry[0].pop(),i[p].geometry[0]=i[p].geometry[0].concat(c[0]),p}function o(u,h,c){let p=t[h];return delete t[h],t[u]=p,i[p].geometry[0].shift(),i[p].geometry[0]=c[0].concat(i[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return`${u}:${p.x}:${p.y}`}for(let u=0;u<e.length;u++){let h=e[u],c=h.geometry,p=h.text?h.text.toString():null;if(!p){n(u);continue}let d=l(p,c),f=l(p,c,!0);if(d in r&&f in t&&r[d]!==t[f]){let m=o(d,f,c),g=s(d,f,i[m].geometry);delete t[d],delete r[f],r[l(p,i[g].geometry,!0)]=g,i[m].geometry=null}else d in r?s(d,f,c):f in t?o(d,f,c):(n(u),t[d]=a-1,r[f]=a-1)}return i.filter(u=>u.geometry)}var KT={\"!\":\"\\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\",\"\\u22EF\":\"\\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\"};var Ju=4294967296,JD=1/Ju,ef=typeof TextDecoder>\"u\"?null:new TextDecoder(\"utf-8\"),Iy=class{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,t,r=this.length){let i;for(;i=this.nextField(r);)e(i,t,this);return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){let e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){let e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Ju;return this.pos+=8,e}readSFixed64(){let e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Ju;return this.pos+=8,e}readFloat(){let e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){let e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){let t=this.buf,r=t[this.pos++];if(r<128)return r;let i=r&127,a;return a=t[this.pos++],i|=(a&127)<<7,a<128||(a=t[this.pos++],i|=(a&127)<<14,a<128)||(a=t[this.pos++],i|=(a&127)<<21,a<128)?i:(a=t[this.pos],i|=(a&15)<<28,JT(i,e,this))}readSVarint(){let e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){let e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&ef?ef.decode(this.buf.subarray(t,e)):eS(this.buf,t,e)}readBytes(){let e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){let r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){let t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;let t=this.readVarint();return this.type=t&7,this._valueStart=this.pos,t>>>3}skip(e){let t=e&7;if(t===0)for(;this.buf[this.pos++]>127;);else if(t===2)this.pos=this.readVarint()+this.pos;else if(t===5)this.pos+=4;else if(t===1)this.pos+=8;else throw Error(`Unimplemented type: ${t}`)}};function JT(e,t,r){let i=r.buf,a,n;if(n=i[r.pos++],a=(n&112)>>4,n<128||(n=i[r.pos++],a|=(n&127)<<3,n<128)||(n=i[r.pos++],a|=(n&127)<<10,n<128)||(n=i[r.pos++],a|=(n&127)<<17,n<128)||(n=i[r.pos++],a|=(n&127)<<24,n<128)||(n=i[r.pos++],a|=(n&1)<<31,n<128))return QT(e,a,t);throw Error(\"Expected varint not more than 10 bytes\")}function QT(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function eS(e,t,r){let i=\"\",a=t;for(;a<r;){let n=e[a],s=null,o=n>239?4:n>223?3:n>191?2:1;if(a+o>r)break;let l,u,h;o===1?n<128&&(s=n):o===2?(l=e[a+1],(l&192)==128&&(s=(n&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=e[a+1],u=e[a+2],(l&192)==128&&(u&192)==128&&(s=(n&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=e[a+1],u=e[a+2],h=e[a+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(n&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),a+=o}return i}function tS(e,t,r){e===1&&r.readMessage(rS,t)}function rS(e,t,r){if(e===3){let{id:i,bitmap:a,width:n,height:s,left:o,top:l,advance:u}=r.readMessage(iS,{});t.push({id:i,bitmap:new Fo({width:n+6,height:s+6},a),metrics:{width:n,height:s,left:o,top:l,advance:u}})}}function iS(e,t,r){e===1?t.id=r.readVarint():e===2?t.bitmap=r.readBytes():e===3?t.width=r.readVarint():e===4?t.height=r.readVarint():e===5?t.left=r.readSVarint():e===6?t.top=r.readSVarint():e===7&&(t.advance=r.readVarint())}function Ay(e){return new Iy(e).readFields(tS,[])}function Qn(e){return typeof e?.renderWithWebGL==\"function\"}function My(e){let{userImage:t}=e;return!t?.render||!t.render()?!1:(Qn(t.data)||e.data.replace(new Uint8Array(t.data.buffer)),!0)}function ic(e){let t=0,r=0;for(let s of e)t+=s.w*s.h,r=Math.max(r,s.w);e.sort((s,o)=>o.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],a=0,n=0;for(let s of e)for(let o=i.length-1;o>=0;o--){let l=i[o];if(!(s.w>l.w||s.h>l.h)){if(s.x=l.x,s.y=l.y,n=Math.max(n,s.y+s.h),a=Math.max(a,s.x+s.w),s.w===l.w&&s.h===l.h){let u=i.pop();u&&o<i.length&&(i[o]=u)}else s.h===l.h?(l.x+=s.w,l.w-=s.w):s.w===l.w?(l.y+=s.h,l.h-=s.h):(i.push({x:l.x+s.w,y:l.y,w:l.w-s.w,h:s.h}),l.y+=s.h,l.h-=s.h);break}}return{w:a,h:n,fill:t/(a*n)||0}}var jo=class{constructor(e,{pixelRatio:t,version:r,isWebGLImage:i=!1,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l}){this.paddedRect=e,this.pixelRatio=t,this.stretchX=a,this.stretchY=n,this.content=s,this.version=r,this.needsFirstWebGLRender=i,this.textFitWidth=o,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}},aS=class{constructor(e,t){let r={},i={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let a=[];this.addImages(e,r,a),this.addImages(t,i,a);let{w:n,h:s}=ic(a),o=new xe({width:n||1,height:s||1});for(let l in e){let u=e[l];if(u.isWebGLImage)continue;let h=r[l].paddedRect;xe.copy(u.data,o,{x:0,y:0},{x:h.x+1,y:h.y+1},u.data)}for(let l in t){let u=t[l],h=i[l].paddedRect,c=h.x+1,p=h.y+1,d=u.data.width,f=u.data.height;xe.copy(u.data,o,{x:0,y:0},{x:c,y:p},u.data),xe.copy(u.data,o,{x:0,y:f-1},{x:c,y:p-1},{width:d,height:1}),xe.copy(u.data,o,{x:0,y:0},{x:c,y:p+f},{width:d,height:1}),xe.copy(u.data,o,{x:d-1,y:0},{x:c-1,y:p},{width:1,height:f}),xe.copy(u.data,o,{x:0,y:0},{x:c+d,y:p},{width:1,height:f})}this.image=o,this.iconPositions=r,this.patternPositions=i}addImages(e,t,r){for(let i in e){let a=e[i],n={x:0,y:0,w:a.data.width+2,h:a.data.height+2};r.push(n),t[i]=new jo(n,a),a.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(e,t){if(e.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==e.updateVersion){this.patchedUpdateVersion=e.updateVersion;for(let r in this.iconPositions)this.patchUpdatedImage(this.iconPositions[r],e.getImage(r),t);for(let r in this.patternPositions)this.patchUpdatedImage(this.patternPositions[r],e.getImage(r),t)}}patchUpdatedImage(e,t,r){if(!e||!t||!e.needsFirstWebGLRender&&e.version===t.version)return;e.needsFirstWebGLRender=!1,e.version=t.version;let[i,a]=e.tl,n=t.userImage?.data;if(!Qn(n)){r.update(t.data,void 0,{x:i,y:a});return}let{width:s,height:o}=t.data;r.context.setCustomLayerDefaults(),n.renderWithWebGL({gl:r.context.gl,texture:r.texture,x:i,y:a,width:s,height:o}),r.context.setDirty()}};N(\"ImagePosition\",jo),N(\"ImageAtlas\",aS);var Py=(function(e){return e[e.none=0]=\"none\",e[e.horizontal=1]=\"horizontal\",e[e.vertical=2]=\"vertical\",e[e.horizontalOnly=3]=\"horizontalOnly\",e})(Py||{});function ac(e){let t=.5,r=.5;switch(e){case\"right\":case\"top-right\":case\"bottom-right\":t=1;break;case\"left\":case\"top-left\":case\"bottom-left\":t=0}switch(e){case\"bottom\":case\"bottom-right\":case\"bottom-left\":r=1;break;case\"top\":case\"top-right\":case\"top-left\":r=0}return{horizontalAlign:t,verticalAlign:r}}var tf=32640;function rf(e,t){let{expression:r}=t;if(r.kind===\"constant\")return{kind:\"constant\",layoutSize:r.evaluate(new Te(e+1))};if(r.kind===\"source\")return{kind:\"source\"};if(r.kind===\"composite\"){let{minZoom:i,maxZoom:a}=nS(r.zoomStops,e);return{kind:\"composite\",minZoom:i,maxZoom:a,interpolationType:r.interpolationType}}{let i=sS(r),a=r.evaluate(new Te(e+1));return{kind:\"camera\",zoomStops:r.zoomStops,sizes:i,layoutSize:a,interpolationType:r.interpolationType}}}function nS(e,t){let r=0;for(;r<e.length&&e[r]<=t;)r++;r=Math.max(0,r-1);let i=r;for(;i<e.length&&e[i]<t+1;)i++;return i=Math.min(e.length-1,i),{minZoom:e[r],maxZoom:e[i]}}function sS(e){return e.zoomStops.map(t=>e.evaluate(new Te(t===-1/0?e.zoomStops[1]-1:t)))}function Go(e,{uSize:t,uSizeT:r},{lowerSize:i,upperSize:a}){return e.kind===\"source\"?i/128:e.kind===\"composite\"?Ve.number(i/128,a/128,r):t}function es(e,t){let r=0,i=0;return e.kind===\"constant\"?i=e.layoutSize:e.kind===\"camera\"?i=oS(e,t):e.kind===\"composite\"&&(r=lS(e,t)),{uSizeT:r,uSize:i}}function oS({zoomStops:e,sizes:t,layoutSize:r,interpolationType:i},a){let n=e.length-1;for(;n>0&&e[n]>a;)n--;let s=Math.min(n+1,e.length-1),o=i?te(Ht.interpolationFactor(i,a,e[n],e[s]),0,1):0;return Math.min(Ve.number(t[n],t[s],o),r)}function lS({interpolationType:e,minZoom:t,maxZoom:r},i){return e?te(Ht.interpolationFactor(e,i,t,r),0,1):0}function Rn(e,t,r){let i=\"never\",a=e.get(t);return a?i=a:e.get(r)&&(i=\"always\"),i}var uS=[{name:\"a_fade_opacity\",components:1,type:\"Uint8\",offset:0}];function Fs(e,t,r,i,a,n,s,o,l,u,h,c,p,d){let f=o?Math.min(tf,Math.round(o[0])):0,m=o?Math.min(tf,Math.round(o[1])):0;e.emplaceBack(t,r,Math.round(i*32),Math.round(a*32),n,s,(f<<1)+ +!!l,m,u*16,h*16,c*256,p*256,d)}function Na(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function hS(e){for(let t of e.sections)if(Aw(t.text))return!0;return!1}var Qu=class{constructor(e){this.layoutVertexArray=new $w,this.indexArray=new pr,this.programConfigurations=e,this.segments=new Ee,this.dynamicLayoutVertexArray=new jw,this.opacityVertexArray=new Gw,this.hasVisibleVertices=!1,this.placedSymbolArray=new zg}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,t,r,i){if(!this.isEmpty()){if(r){if(this.opacityVertexArray.length===0){let a=this.layoutVertexArray.length/4;for(let n=0;n<a;n++)this.opacityVertexArray.emplaceBack(0)}this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,qT.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,ZT.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,uS,!0),this.opacityVertexBuffer.itemSize=1}(r||i)&&this.programConfigurations.upload(e)}}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};N(\"SymbolBuffers\",Qu);var eh=class{constructor(e,t,r){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new r,this.segments=new Ee,this.collisionVertexArray=new qw}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,WT.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};N(\"CollisionBuffers\",eh);var Fi=class{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(s=>s.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let t=this.layers[0]._unevaluatedLayout._values;this.textSizeData=rf(this.zoom,t[\"text-size\"]),this.iconSizeData=rf(this.zoom,t[\"icon-size\"]);let r=this.layers[0].layout,i=r.get(\"symbol-sort-key\"),a=r.get(\"symbol-z-order\");this.canOverlap=Rn(r,\"text-overlap\",\"text-allow-overlap\")!==\"never\"||Rn(r,\"icon-overlap\",\"icon-allow-overlap\")!==\"never\"||r.get(\"text-ignore-placement\")||r.get(\"icon-ignore-placement\"),this.sortFeaturesByKey=a!==\"viewport-y\"&&!i.isConstant();let n=a===\"viewport-y\"||a===\"auto\"&&!this.sortFeaturesByKey;this.sortFeaturesByY=n&&this.canOverlap,r.get(\"symbol-placement\")===\"point\"&&(this.writingModes=r.get(\"text-writing-mode\").map(s=>Py[s])),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id),this.sourceID=e.sourceID}createArrays(){this.text=new Qu(new Oi(this.layers,this.zoom,e=>e.startsWith(\"text\"))),this.icon=new Qu(new Oi(this.layers,this.zoom,e=>e.startsWith(\"icon\"))),this.glyphOffsetArray=new Bg,this.lineVertexArray=new Og,this.symbolInstances=new Lg,this.textAnchorOffsets=new Ng}calculateGlyphDependencies(e,t,r,i,a){for(let n of e)if(t[n.codePointAt(0)]=!0,(r||i)&&a){let s=KT[n];s&&(t[s.codePointAt(0)]=!0)}}populate(e,t,r){let i=this.layers[0],a=i.layout,n=a.get(\"text-font\"),s=a.get(\"text-field\"),o=a.get(\"icon-image\"),l=(s.value.kind!==\"constant\"||s.value.value instanceof Br&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(n.value.kind!==\"constant\"||n.value.value.length>0),u=o.value.kind!==\"constant\"||!!o.value.value||Object.keys(o.parameters).length>0,h=a.get(\"symbol-sort-key\");if(this.features=[],!l&&!u)return;let c=t.iconDependencies,p=t.glyphDependencies,d=t.availableImages,f=new Te(this.zoom);for(let{feature:m,id:g,index:y,sourceLayerIndex:_}of e){let x=i._featureFilter.needGeometry,v=yi(m,x);if(!i._featureFilter.filter(f,v,r))continue;x||(v.geometry=ji(m));let w;if(l){let S=i.getValueAndResolveTokens(\"text-field\",v,r,d),D=Br.factory(S);this.hasRTLText||(this.hasRTLText=hS(D)),(!this.hasRTLText||Sa.getRTLTextPluginStatus()===\"unavailable\"||this.hasRTLText&&Sa.isParsed())&&(w=HT(D,i,v))}let b;if(u){let S=i.getValueAndResolveTokens(\"icon-image\",v,r,d);b=S instanceof br?S:br.fromString(S)}if(!w&&!b)continue;let T=this.sortFeaturesByKey?h.evaluate(v,{},r):void 0,I={id:g,text:w,icon:b,index:y,sourceLayerIndex:_,geometry:v.geometry,properties:m.properties,type:Jn.types[m.type],sortKey:T};if(this.features.push(I),b&&(c[b.name]=!0),w){let S=n.evaluate(v,{},r).join(\",\"),D=a.get(\"text-rotation-alignment\")!==\"viewport\"&&a.get(\"symbol-placement\")!==\"point\";this.allowVerticalPlacement=this.writingModes?.includes(2);for(let R of w.sections)if(R.image)c[R.image.name]=!0;else{let F=Sw(w.toString()),E=R.fontStack||S;p[E]||(p[E]={}),this.calculateGlyphDependencies(R.text,p[E],D,this.allowVerticalPlacement,F)}}}a.get(\"symbol-placement\")===\"line\"&&(this.features=YT(this.features)),this.sortFeaturesByKey&&this.features.sort((m,g)=>m.sortKey-g.sortKey)}update(e,t,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(e,t,this.layers,{imagePositions:r}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){let r=this.lineVertexArray.length;if(e.segment!==void 0){let i=e.dist(t[e.segment+1]),a=e.dist(t[e.segment]),n={};for(let s=e.segment+1;s<t.length;s++)n[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:i},s<t.length-1&&(i+=t[s+1].dist(t[s]));for(let s=e.segment||0;s>=0;s--)n[s]={x:t[s].x,y:t[s].y,tileUnitDistanceFromAnchor:a},s>0&&(a+=t[s-1].dist(t[s]));for(let s=0;s<t.length;s++){let o=n[s];this.lineVertexArray.emplaceBack(o.x,o.y,o.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,t,r,i,a,n,s,o,l,u,h,c,p){let d=e.indexArray,f=e.layoutVertexArray,m=e.segments.prepareSegment(4*t.length,f,d,this.canOverlap?n.sortKey:void 0),g=this.glyphOffsetArray.length,y=m.vertexLength,_=this.allowVerticalPlacement&&s===2?Math.PI/2:0,x=n.text&&n.text.sections;for(let v=0;v<t.length;v++){let{tl:w,tr:b,bl:T,br:I,tex:S,pixelOffsetTL:D,pixelOffsetBR:R,minFontScaleX:F,minFontScaleY:E,glyphOffset:M,isSDF:A,sectionIndex:k}=t[v],H=m.vertexLength,$=M[1];Fs(f,o.x,o.y,w.x,$+w.y,S.x,S.y,r,A,D.x,D.y,F,E,p),Fs(f,o.x,o.y,b.x,$+b.y,S.x+S.w,S.y,r,A,R.x,D.y,F,E,p),Fs(f,o.x,o.y,T.x,$+T.y,S.x,S.y+S.h,r,A,D.x,R.y,F,E,p),Fs(f,o.x,o.y,I.x,$+I.y,S.x+S.w,S.y+S.h,r,A,R.x,R.y,F,E,p),Na(e.dynamicLayoutVertexArray,o,_),d.emplaceBack(H,H+2,H+1),d.emplaceBack(H+1,H+2,H+3),m.vertexLength+=4,m.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(M[0]),(v===t.length-1||k!==t[v+1].sectionIndex)&&e.programConfigurations.populatePaintArrays(f.length,n,n.index,{imagePositions:{},canonical:c,formattedSection:x?.[k]})}e.placedSymbolArray.emplaceBack(o.x,o.y,g,this.glyphOffsetArray.length-g,y,l,u,o.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,h,p)}_addCollisionDebugVertex(e,t,r,i,a,n){return t.emplaceBack(0,0),e.emplaceBack(r.x,r.y,i,a,Math.round(n.x),Math.round(n.y))}addCollisionDebugVertices(e,t,r,i,a,n,s){let o=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),l=o.vertexLength,u=a.layoutVertexArray,h=a.collisionVertexArray,c=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,h,n,c,p,new C(e,t)),this._addCollisionDebugVertex(u,h,n,c,p,new C(r,t)),this._addCollisionDebugVertex(u,h,n,c,p,new C(r,i)),this._addCollisionDebugVertex(u,h,n,c,p,new C(e,i)),o.vertexLength+=4;let d=a.indexArray;d.emplaceBack(l,l+1),d.emplaceBack(l+1,l+2),d.emplaceBack(l+2,l+3),d.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(e,t,r,i){for(let a=e;a<t;a++){let n=this.collisionBoxArray.get(a),s=n.x1,o=n.y1,l=n.x2,u=n.y2;this.addCollisionDebugVertices(s,o,l,u,i?this.textCollisionBox:this.iconCollisionBox,n.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new eh(Bd,Qd.members,Fu),this.iconCollisionBox=new eh(Bd,Qd.members,Fu);for(let e=0;e<this.symbolInstances.length;e++){let t=this.symbolInstances.get(e);this.addDebugCollisionBoxes(t.textBoxStartIndex,t.textBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.verticalTextBoxStartIndex,t.verticalTextBoxEndIndex,t,!0),this.addDebugCollisionBoxes(t.iconBoxStartIndex,t.iconBoxEndIndex,t,!1),this.addDebugCollisionBoxes(t.verticalIconBoxStartIndex,t.verticalIconBoxEndIndex,t,!1)}}_deserializeCollisionBoxesForSymbol(e,t,r,i,a,n,s,o,l){let u={};for(let h=t;h<r;h++){let c=e.get(h);u.textBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.textFeatureIndex=c.featureIndex;break}for(let h=i;h<a;h++){let c=e.get(h);u.verticalTextBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalTextFeatureIndex=c.featureIndex;break}for(let h=n;h<s;h++){let c=e.get(h);u.iconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.iconFeatureIndex=c.featureIndex;break}for(let h=o;h<l;h++){let c=e.get(h);u.verticalIconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalIconFeatureIndex=c.featureIndex;break}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,t){let r=e.placedSymbolArray.get(t),i=r.vertexStartIndex+r.numGlyphs*4;for(let a=r.vertexStartIndex;a<i;a+=4)e.indexArray.emplaceBack(a,a+2,a+1),e.indexArray.emplaceBack(a+1,a+2,a+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let t=Math.sin(e),r=Math.cos(e),i=[],a=[],n=[];for(let s=0;s<this.symbolInstances.length;++s){n.push(s);let o=this.symbolInstances.get(s);i.push(Math.round(t*o.anchorX+r*o.anchorY)|0),a.push(o.featureIndex)}return n.sort((s,o)=>i[s]-i[o]||a[o]-a[s]),n}addToSortKeyRanges(e,t){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r?.sortKey===t?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let t of this.symbolInstanceIndexes){let r=this.symbolInstances.get(t);this.featureSortOrder.push(r.featureIndex);let i=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let a=0;a<i.length;a++){let n=i[a];n>=0&&i.indexOf(n)===a&&this.addIndicesForPlacedSymbol(this.text,n)}r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};N(\"SymbolBucket\",Fi,{omit:[\"layers\",\"collisionBoxArray\",\"features\",\"compareText\"]}),Fi.MAX_GLYPHS=65535,Fi.addDynamicAttributes=Na;function cS(e,t){return t.replace(/{([^{}]+)}/g,(r,i)=>e&&i in e?String(e[i]):\"\")}var pS,dS=()=>pS||(pS=new Qe({\"symbol-placement\":new V(P.layout_symbol[\"symbol-placement\"],\"symbol-placement\"),\"symbol-spacing\":new V(P.layout_symbol[\"symbol-spacing\"],\"symbol-spacing\"),\"symbol-avoid-edges\":new V(P.layout_symbol[\"symbol-avoid-edges\"],\"symbol-avoid-edges\"),\"symbol-sort-key\":new q(P.layout_symbol[\"symbol-sort-key\"],\"symbol-sort-key\"),\"symbol-z-order\":new V(P.layout_symbol[\"symbol-z-order\"],\"symbol-z-order\"),\"icon-allow-overlap\":new V(P.layout_symbol[\"icon-allow-overlap\"],\"icon-allow-overlap\"),\"icon-overlap\":new V(P.layout_symbol[\"icon-overlap\"],\"icon-overlap\"),\"icon-ignore-placement\":new V(P.layout_symbol[\"icon-ignore-placement\"],\"icon-ignore-placement\"),\"icon-optional\":new V(P.layout_symbol[\"icon-optional\"],\"icon-optional\"),\"icon-rotation-alignment\":new q(P.layout_symbol[\"icon-rotation-alignment\"],\"icon-rotation-alignment\"),\"icon-size\":new q(P.layout_symbol[\"icon-size\"],\"icon-size\"),\"icon-text-fit\":new V(P.layout_symbol[\"icon-text-fit\"],\"icon-text-fit\"),\"icon-text-fit-padding\":new V(P.layout_symbol[\"icon-text-fit-padding\"],\"icon-text-fit-padding\"),\"icon-image\":new q(P.layout_symbol[\"icon-image\"],\"icon-image\"),\"icon-rotate\":new q(P.layout_symbol[\"icon-rotate\"],\"icon-rotate\"),\"icon-padding\":new q(P.layout_symbol[\"icon-padding\"],\"icon-padding\"),\"icon-keep-upright\":new V(P.layout_symbol[\"icon-keep-upright\"],\"icon-keep-upright\"),\"icon-offset\":new q(P.layout_symbol[\"icon-offset\"],\"icon-offset\"),\"icon-anchor\":new q(P.layout_symbol[\"icon-anchor\"],\"icon-anchor\"),\"icon-pitch-alignment\":new V(P.layout_symbol[\"icon-pitch-alignment\"],\"icon-pitch-alignment\"),\"text-pitch-alignment\":new V(P.layout_symbol[\"text-pitch-alignment\"],\"text-pitch-alignment\"),\"text-rotation-alignment\":new V(P.layout_symbol[\"text-rotation-alignment\"],\"text-rotation-alignment\"),\"text-field\":new q(P.layout_symbol[\"text-field\"],\"text-field\"),\"text-font\":new q(P.layout_symbol[\"text-font\"],\"text-font\"),\"text-size\":new q(P.layout_symbol[\"text-size\"],\"text-size\"),\"text-max-width\":new q(P.layout_symbol[\"text-max-width\"],\"text-max-width\"),\"text-line-height\":new V(P.layout_symbol[\"text-line-height\"],\"text-line-height\"),\"text-letter-spacing\":new q(P.layout_symbol[\"text-letter-spacing\"],\"text-letter-spacing\"),\"text-justify\":new q(P.layout_symbol[\"text-justify\"],\"text-justify\"),\"text-radial-offset\":new q(P.layout_symbol[\"text-radial-offset\"],\"text-radial-offset\"),\"text-variable-anchor\":new V(P.layout_symbol[\"text-variable-anchor\"],\"text-variable-anchor\"),\"text-variable-anchor-offset\":new q(P.layout_symbol[\"text-variable-anchor-offset\"],\"text-variable-anchor-offset\"),\"text-anchor\":new q(P.layout_symbol[\"text-anchor\"],\"text-anchor\"),\"text-max-angle\":new V(P.layout_symbol[\"text-max-angle\"],\"text-max-angle\"),\"text-writing-mode\":new V(P.layout_symbol[\"text-writing-mode\"],\"text-writing-mode\"),\"text-rotate\":new q(P.layout_symbol[\"text-rotate\"],\"text-rotate\"),\"text-padding\":new V(P.layout_symbol[\"text-padding\"],\"text-padding\"),\"text-keep-upright\":new V(P.layout_symbol[\"text-keep-upright\"],\"text-keep-upright\"),\"text-transform\":new q(P.layout_symbol[\"text-transform\"],\"text-transform\"),\"text-offset\":new q(P.layout_symbol[\"text-offset\"],\"text-offset\"),\"text-allow-overlap\":new V(P.layout_symbol[\"text-allow-overlap\"],\"text-allow-overlap\"),\"text-overlap\":new V(P.layout_symbol[\"text-overlap\"],\"text-overlap\"),\"text-ignore-placement\":new V(P.layout_symbol[\"text-ignore-placement\"],\"text-ignore-placement\"),\"text-optional\":new V(P.layout_symbol[\"text-optional\"],\"text-optional\"),\"symbol-height-offset\":new q(P.layout_symbol[\"symbol-height-offset\"],\"symbol-height-offset\"),\"symbol-height-anchor\":new V(P.layout_symbol[\"symbol-height-anchor\"],\"symbol-height-anchor\")})),fS,mS=()=>fS||(fS=new Qe({\"icon-opacity\":new q(P.paint_symbol[\"icon-opacity\"],\"icon-opacity\"),\"icon-color\":new q(P.paint_symbol[\"icon-color\"],\"icon-color\"),\"icon-halo-color\":new q(P.paint_symbol[\"icon-halo-color\"],\"icon-halo-color\"),\"icon-halo-width\":new q(P.paint_symbol[\"icon-halo-width\"],\"icon-halo-width\"),\"icon-halo-blur\":new q(P.paint_symbol[\"icon-halo-blur\"],\"icon-halo-blur\"),\"icon-translate\":new V(P.paint_symbol[\"icon-translate\"],\"icon-translate\"),\"icon-translate-anchor\":new V(P.paint_symbol[\"icon-translate-anchor\"],\"icon-translate-anchor\"),\"text-opacity\":new q(P.paint_symbol[\"text-opacity\"],\"text-opacity\"),\"text-color\":new q(P.paint_symbol[\"text-color\"],\"text-color\",{runtimeType:nr,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),\"text-halo-color\":new q(P.paint_symbol[\"text-halo-color\"],\"text-halo-color\"),\"text-halo-width\":new q(P.paint_symbol[\"text-halo-width\"],\"text-halo-width\"),\"text-halo-blur\":new q(P.paint_symbol[\"text-halo-blur\"],\"text-halo-blur\"),\"text-translate\":new V(P.paint_symbol[\"text-translate\"],\"text-translate\"),\"text-translate-anchor\":new V(P.paint_symbol[\"text-translate-anchor\"],\"text-translate-anchor\")})),Kl={get paint(){return mS()},get layout(){return dS()}},Cy=class{constructor(e){if(e.property.overrides===void 0)throw Error(\"overrides must be provided to instantiate FormatSectionOverride class\");this.type=e.property.overrides?e.property.overrides.runtimeType:za,this.defaultValue=e}evaluate(e){if(e.formattedSection){let t=this.defaultValue.property.overrides;if(t?.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){if(!this.defaultValue.isConstant()){let t=this.defaultValue.value;e(t._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};N(\"FormatSectionOverride\",Cy,{omit:[\"defaultValue\"]});var nc=e=>e.type===\"symbol\",gS=class th extends cr{constructor(t,r){super(t,Kl,r)}recalculate(t,r){super.recalculate(t,r);let i=this.layout.get(\"icon-rotation-alignment\");if((i.value.kind!==\"constant\"||i.value.value===\"auto\")&&(this.layout._values[\"icon-rotation-alignment\"]=new Wt(i.property,{kind:\"constant\",value:this.layout.get(\"symbol-placement\")===\"point\"?\"viewport\":\"map\"},i.parameters)),this.layout.get(\"text-rotation-alignment\")===\"auto\"&&(this.layout.get(\"symbol-placement\")===\"point\"?this.layout._values[\"text-rotation-alignment\"]=\"viewport\":this.layout._values[\"text-rotation-alignment\"]=\"map\"),this.layout.get(\"text-pitch-alignment\")===\"auto\"&&(this.layout._values[\"text-pitch-alignment\"]=this.layout.get(\"text-rotation-alignment\")===\"map\"?\"map\":\"viewport\"),this.layout.get(\"icon-pitch-alignment\")===\"auto\"&&(this.layout._values[\"icon-pitch-alignment\"]=this.layout.get(\"icon-rotation-alignment\").constantOr(\"viewport\")),this.layout.get(\"symbol-placement\")===\"point\"){let a=this.layout.get(\"text-writing-mode\");if(a){let n=[];for(let s of a)n.includes(s)||n.push(s);this.layout._values[\"text-writing-mode\"]=n}else this.layout._values[\"text-writing-mode\"]=[\"horizontal\"]}this._setPaintOverrides()}getValueAndResolveTokens(t,r,i,a){let n=this.layout.get(t).evaluate(r,{},i,a),s=this._unevaluatedLayout._values[t];return!s.isDataDriven()&&!Io(s.value)&&n?cS(r.properties,n):n}createBucket(t){return new Fi(t)}queryRadius(){return 0}queryIntersectsFeature(){throw Error(\"Should take a different path in FeatureIndex\")}_setPaintOverrides(){for(let t of Kl.paint.overridableProperties){if(!th.hasPaintOverride(this.layout,t))continue;let r=this.paint.get(t),i=new zh(new Cy(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),a=null;a=r.value.kind===\"constant\"||r.value.kind===\"source\"?new In(\"source\",i):new qs(\"composite\",i,r.value.zoomStops),this.paint._values[t]=new Wt(r.property,a,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:th.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){let i=t.get(\"text-field\"),a=Kl.paint.properties[r],n=!1,s=o=>{for(let l of o)if(a.overrides?.hasOverride(l)){n=!0;return}};if(i.value.kind===\"constant\"&&i.value.value instanceof Br)s(i.value.value.sections);else if(i.value.kind===\"source\"||i.value.kind===\"composite\"){let o=u=>{if(!n)if(u instanceof xa&&Pe(u.value)===Gn){let h=u.value;s(h.sections)}else u instanceof mm?s(u.sections):u.eachChild(o)},l=i.value;l._styleExpression&&o(l._styleExpression.expression)}return n}};var yS,_S=()=>yS||(yS=new Qe({\"background-color\":new V(P.paint_background[\"background-color\"],\"background-color\"),\"background-pattern\":new Mg(P.paint_background[\"background-pattern\"],\"background-pattern\"),\"background-opacity\":new V(P.paint_background[\"background-opacity\"],\"background-opacity\")})),xS={get paint(){return _S()}},ky=e=>e.type===\"background\",vS=class extends cr{constructor(e,t){super(e,xS,t)}};function Dy(e){let t=[],r=e.id;return r===void 0&&t.push(new L(`layers.${r}`,null,'missing required property \"id\"')),e.render===void 0&&t.push(new L(`layers.${r}`,null,'missing required method \"render\"')),e.renderingMode&&e.renderingMode!==\"2d\"&&e.renderingMode!==\"3d\"&&t.push(new L(`layers.${r}`,null,'property \"renderingMode\" must be either \"2d\" or \"3d\"')),t}var Fy=e=>e.type===\"custom\",bS=class extends cr{constructor(e,t){super(e,{},t),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode===\"3d\"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error(\"Custom layers cannot be serialized\")}};function qo(e,t){if(e.type===\"custom\")return new bS(e,t);switch(e.type){case\"background\":return new vS(e,t);case\"circle\":return new v2(e,t);case\"color-relief\":return new F2(e,t);case\"fill\":return new cT(e,t);case\"fill-extrusion\":return new CT(e,t);case\"heatmap\":return new S2(e,t);case\"hillshade\":return new M2(e,t);case\"line\":return new GT(e,t);case\"raster\":return new zw(e,t);case\"symbol\":return new gS(e,t)}}var wS=class{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){this._triggered||(this._triggered=!0,this._channel?.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}},TS={once:!0},zy=class{constructor(e,t){this.target=e,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new wS(()=>this.process()),this.subscription=Vs(this.target,\"message\",r=>this.receive(r),!1),this.globalScope=Li(self)?e:window}registerMessageHandler(e,t){this.messageHandlers[e]=t}unregisterMessageHandler(e){delete this.messageHandlers[e]}sendAsync(e,t){return new Promise((r,i)=>{let a=Math.round(Math.random()*1e18).toString(36).substring(0,10),n=t?Vs(t.signal,\"abort\",()=>{n?.unsubscribe(),delete this.resolveRejects[a];let l={id:a,type:\"<cancel>\",origin:location.origin,targetMapId:e.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),i(new Da(t.signal.reason))},TS):null;this.resolveRejects[a]={resolve:l=>{n?.unsubscribe(),r(l)},reject:l=>{n?.unsubscribe(),i(l)}};let s=[],o={...e,id:a,sourceMapId:this.mapId,origin:location.origin,data:yn(e.data,s)};this.target.postMessage(o,{transfer:s})})}receive(e){let t=e.data,r=t.id,i=[\"file://\",\"resource://android\",\"null\"],a=[t.origin,location.origin],n=t.origin===location.origin,s=a.some(o=>i.includes(o));if(!(!n&&!s)&&!(t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type===\"<cancel>\"){delete this.tasks[r];let o=this.abortControllers[r];delete this.abortControllers[r],o&&o.abort();return}if(Li(self)||t.mustQueue){this.tasks[r]=t,this.taskQueue.push(r),this.invoker.trigger();return}this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;let e=this.taskQueue.shift(),t=this.tasks[e];delete this.tasks[e],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(e,t)}async processTask(e,t){if(t.type===\"<response>\"){let a=this.resolveRejects[e];if(delete this.resolveRejects[e],!a)return;t.error?a.reject(it(_n(t.error))):a.resolve(_n(t.data));return}if(!this.messageHandlers[t.type]){this.completeTask(e,null,null);return}let r=_n(t.data),i=new AbortController;this.abortControllers[e]=i;try{let a=await this.messageHandlers[t.type](t.sourceMapId,r,i);this.completeTask(e,null,a)}catch(a){this.completeTask(e,it(a))}}completeTask(e,t,r){let i=[];delete this.abortControllers[e];let a={id:e,type:\"<response>\",sourceMapId:this.mapId,origin:location.origin,error:t?yn(t):null,data:yn(r,i)};this.target.postMessage(a,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};var ts=\"_geojsonTileLayer\";var SS=class{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){let r=e[t];this._stringToNumber[r]=t,this._numberToString[t]=r}}encode(e){return this._stringToNumber[e]}get size(){return this._numberToString.length}decode(e){if(e>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}},sc=class{constructor(e,t,r,i,a){this.type=\"Feature\",this._vectorTileFeature=e,this._x=r,this._y=i,this._z=t;for(let n in e.properties)typeof e.properties[n]!=\"string\"||!e.properties[n].startsWith(\"__$json__:\")||(e.properties[n]=JSON.parse(e.properties[n].slice(10)));this.properties=e.properties,this.id=a}projectPoint(e,t,r,i){return[(e.x+t)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(e.y+r)*2/i)*Math.PI))-90]}projectLine(e,t,r,i){return e.map(a=>this.projectPoint(a,t,r,i))}get geometry(){if(this._geometry)return this._geometry;let e=this._vectorTileFeature,t=e.extent*2**this._z,r=e.extent*this._x,i=e.extent*this._y,a=e.loadGeometry();switch(e.type){case 1:{let n=[];for(let o of a)n.push(o[0]);let s=this.projectLine(n,r,i,t);this._geometry=n.length===1?{type:\"Point\",coordinates:s[0]}:{type:\"MultiPoint\",coordinates:s};break}case 2:{let n=a.map(s=>this.projectLine(s,r,i,t));this._geometry=n.length===1?{type:\"LineString\",coordinates:n[0]}:{type:\"MultiLineString\",coordinates:n};break}case 3:{let n=gy(a),s=[];for(let o of n)s.push(o.map(l=>this.projectLine(l,r,i,t)));this._geometry=s.length===1?{type:\"Polygon\",coordinates:s[0]}:{type:\"MultiPolygon\",coordinates:s};break}default:throw Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){let e={geometry:this.geometry};for(let t in this)t!==\"_geometry\"&&t!==\"_vectorTileFeature\"&&t!==\"_x\"&&t!==\"_y\"&&t!==\"_z\"&&(e[t]=this[t]);return e}},Zi=class{constructor(e,t,r){this._name=e,this.dataBuffer=t,typeof r==\"number\"?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(e){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(e)?null:this.getValueFromBuffer(e)}has(e){return this.nullabilityBuffer?.get(e)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},Zo=class extends Zi{},oc=class extends Zo{getValueFromBuffer(e){return this.dataBuffer[e]}},lc=class extends Zo{getValueFromBuffer(e){return this.dataBuffer[e]}},Ry=class extends Zi{constructor(e,t,r,i){super(e,t,i),this.delta=r}},uc=class extends Ry{constructor(e,t,r,i,a){super(e,a?Int32Array.of(t):Uint32Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}},hc=class extends Zi{constructor(e,t,r,i){super(e,i?Int32Array.of(t):Uint32Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}},ES=class{constructor(e,t,r,i,a=4096){if(this._name=e,this._geometryVector=t,this._idVector=r,this._propertyVectors=i,this._extent=a,e.length===0)throw Error(\"Missing layer name\")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors??[]}getPropertyVector(e){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this.propertyVectors.map(t=>[t.name,t]))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let e=[],t=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let i;if(this.idVector){let s=this.idVector.getValue(r);s!==null&&(i=this.containsMaxSafeIntegerValues(this.idVector)?Number(s):s)}let a={coordinates:t[r],type:this.geometryVector.geometryType(r)},n={};for(let s of this.propertyVectors){if(!s)continue;let o=s.name,l=s.getValue(r);l!==null&&(n[o]=l)}e.push({id:i,geometry:a,properties:n})}return e}containsMaxSafeIntegerValues(e){return e instanceof oc||e instanceof hc||e instanceof uc||e instanceof lc}},pn={FEATURE:0,VERTEX:1},le={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},hi={GEOMETRY:0,STRUCT:1,MAP:2},Ly={ID:0},By=class{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}},re;(function(e){e.NONE=\"NONE\",e.DELTA=\"DELTA\",e.COMPONENTWISE_DELTA=\"COMPONENTWISE_DELTA\",e.RLE=\"RLE\",e.MORTON=\"MORTON\",e.PDE=\"PDE\"})(re||(re={}));var Yt;(function(e){e.NONE=\"NONE\",e.FAST_PFOR=\"FAST_PFOR\",e.VARINT=\"VARINT\"})(Yt||(Yt={}));var cc=new Uint32Array(33);cc[0]=0;for(let e=1;e<=32;e++)cc[e]=e===32?4294967295:4294967295>>>32-e;var rh=cc,Oy=65536;function pc(e,t){return e-e%t}function IS(e){return pc(e+31,32)}function AS(e){if(!Number.isFinite(e)||e<=0)return Oy;let t=pc(Math.floor(e),256);return t===0?256:t}function MS(e){let t=e>>>0;return((t&255)<<24|(t&65280)<<8|t>>>8&65280|t>>>24&255)>>>0}function PS(e,t,r,i){let a=i,n=e[t]>>>0,s=e[t+1]>>>0;r[a++]=n>>>0&3,r[a++]=n>>>2&3,r[a++]=n>>>4&3,r[a++]=n>>>6&3,r[a++]=n>>>8&3,r[a++]=n>>>10&3,r[a++]=n>>>12&3,r[a++]=n>>>14&3,r[a++]=n>>>16&3,r[a++]=n>>>18&3,r[a++]=n>>>20&3,r[a++]=n>>>22&3,r[a++]=n>>>24&3,r[a++]=n>>>26&3,r[a++]=n>>>28&3,r[a++]=n>>>30&3,r[a++]=s>>>0&3,r[a++]=s>>>2&3,r[a++]=s>>>4&3,r[a++]=s>>>6&3,r[a++]=s>>>8&3,r[a++]=s>>>10&3,r[a++]=s>>>12&3,r[a++]=s>>>14&3,r[a++]=s>>>16&3,r[a++]=s>>>18&3,r[a++]=s>>>20&3,r[a++]=s>>>22&3,r[a++]=s>>>24&3,r[a++]=s>>>26&3,r[a++]=s>>>28&3,r[a]=s>>>30&3}function CS(e,t,r,i){let a=i,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0;r[a++]=n>>>0&7,r[a++]=n>>>3&7,r[a++]=n>>>6&7,r[a++]=n>>>9&7,r[a++]=n>>>12&7,r[a++]=n>>>15&7,r[a++]=n>>>18&7,r[a++]=n>>>21&7,r[a++]=n>>>24&7,r[a++]=n>>>27&7,r[a++]=(n>>>30|(s&1)<<2)&7,r[a++]=s>>>1&7,r[a++]=s>>>4&7,r[a++]=s>>>7&7,r[a++]=s>>>10&7,r[a++]=s>>>13&7,r[a++]=s>>>16&7,r[a++]=s>>>19&7,r[a++]=s>>>22&7,r[a++]=s>>>25&7,r[a++]=s>>>28&7,r[a++]=(s>>>31|(o&3)<<1)&7,r[a++]=o>>>2&7,r[a++]=o>>>5&7,r[a++]=o>>>8&7,r[a++]=o>>>11&7,r[a++]=o>>>14&7,r[a++]=o>>>17&7,r[a++]=o>>>20&7,r[a++]=o>>>23&7,r[a++]=o>>>26&7,r[a]=o>>>29&7}function kS(e,t,r,i){let a=i,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0;r[a++]=n>>>0&15,r[a++]=n>>>4&15,r[a++]=n>>>8&15,r[a++]=n>>>12&15,r[a++]=n>>>16&15,r[a++]=n>>>20&15,r[a++]=n>>>24&15,r[a++]=n>>>28&15,r[a++]=s>>>0&15,r[a++]=s>>>4&15,r[a++]=s>>>8&15,r[a++]=s>>>12&15,r[a++]=s>>>16&15,r[a++]=s>>>20&15,r[a++]=s>>>24&15,r[a++]=s>>>28&15,r[a++]=o>>>0&15,r[a++]=o>>>4&15,r[a++]=o>>>8&15,r[a++]=o>>>12&15,r[a++]=o>>>16&15,r[a++]=o>>>20&15,r[a++]=o>>>24&15,r[a++]=o>>>28&15,r[a++]=l>>>0&15,r[a++]=l>>>4&15,r[a++]=l>>>8&15,r[a++]=l>>>12&15,r[a++]=l>>>16&15,r[a++]=l>>>20&15,r[a++]=l>>>24&15,r[a]=l>>>28&15}function DS(e,t,r,i){let a=i,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0;r[a++]=n>>>0&31,r[a++]=n>>>5&31,r[a++]=n>>>10&31,r[a++]=n>>>15&31,r[a++]=n>>>20&31,r[a++]=n>>>25&31,r[a++]=(n>>>30|(s&7)<<2)&31,r[a++]=s>>>3&31,r[a++]=s>>>8&31,r[a++]=s>>>13&31,r[a++]=s>>>18&31,r[a++]=s>>>23&31,r[a++]=(s>>>28|(o&1)<<4)&31,r[a++]=o>>>1&31,r[a++]=o>>>6&31,r[a++]=o>>>11&31,r[a++]=o>>>16&31,r[a++]=o>>>21&31,r[a++]=o>>>26&31,r[a++]=(o>>>31|(l&15)<<1)&31,r[a++]=l>>>4&31,r[a++]=l>>>9&31,r[a++]=l>>>14&31,r[a++]=l>>>19&31,r[a++]=l>>>24&31,r[a++]=(l>>>29|(u&3)<<3)&31,r[a++]=u>>>2&31,r[a++]=u>>>7&31,r[a++]=u>>>12&31,r[a++]=u>>>17&31,r[a++]=u>>>22&31,r[a]=u>>>27&31}function FS(e,t,r,i){let a=i,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0;r[a++]=n>>>0&63,r[a++]=n>>>6&63,r[a++]=n>>>12&63,r[a++]=n>>>18&63,r[a++]=n>>>24&63,r[a++]=(n>>>30|(s&15)<<2)&63,r[a++]=s>>>4&63,r[a++]=s>>>10&63,r[a++]=s>>>16&63,r[a++]=s>>>22&63,r[a++]=(s>>>28|(o&3)<<4)&63,r[a++]=o>>>2&63,r[a++]=o>>>8&63,r[a++]=o>>>14&63,r[a++]=o>>>20&63,r[a++]=o>>>26&63,r[a++]=l>>>0&63,r[a++]=l>>>6&63,r[a++]=l>>>12&63,r[a++]=l>>>18&63,r[a++]=l>>>24&63,r[a++]=(l>>>30|(u&15)<<2)&63,r[a++]=u>>>4&63,r[a++]=u>>>10&63,r[a++]=u>>>16&63,r[a++]=u>>>22&63,r[a++]=(u>>>28|(h&3)<<4)&63,r[a++]=h>>>2&63,r[a++]=h>>>8&63,r[a++]=h>>>14&63,r[a++]=h>>>20&63,r[a]=h>>>26&63}function zS(e,t,r,i){let a=i,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0;r[a++]=n>>>0&127,r[a++]=n>>>7&127,r[a++]=n>>>14&127,r[a++]=n>>>21&127,r[a++]=(n>>>28|(s&7)<<4)&127,r[a++]=s>>>3&127,r[a++]=s>>>10&127,r[a++]=s>>>17&127,r[a++]=s>>>24&127,r[a++]=(s>>>31|(o&63)<<1)&127,r[a++]=o>>>6&127,r[a++]=o>>>13&127,r[a++]=o>>>20&127,r[a++]=(o>>>27|(l&3)<<5)&127,r[a++]=l>>>2&127,r[a++]=l>>>9&127,r[a++]=l>>>16&127,r[a++]=l>>>23&127,r[a++]=(l>>>30|(u&31)<<2)&127,r[a++]=u>>>5&127,r[a++]=u>>>12&127,r[a++]=u>>>19&127,r[a++]=(u>>>26|(h&1)<<6)&127,r[a++]=h>>>1&127,r[a++]=h>>>8&127,r[a++]=h>>>15&127,r[a++]=h>>>22&127,r[a++]=(h>>>29|(c&15)<<3)&127,r[a++]=c>>>4&127,r[a++]=c>>>11&127,r[a++]=c>>>18&127,r[a]=c>>>25&127}function RS(e,t,r,i){let a=i,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0;r[a++]=n>>>0&255,r[a++]=n>>>8&255,r[a++]=n>>>16&255,r[a++]=n>>>24&255,r[a++]=s>>>0&255,r[a++]=s>>>8&255,r[a++]=s>>>16&255,r[a++]=s>>>24&255,r[a++]=o>>>0&255,r[a++]=o>>>8&255,r[a++]=o>>>16&255,r[a++]=o>>>24&255,r[a++]=l>>>0&255,r[a++]=l>>>8&255,r[a++]=l>>>16&255,r[a++]=l>>>24&255,r[a++]=u>>>0&255,r[a++]=u>>>8&255,r[a++]=u>>>16&255,r[a++]=u>>>24&255,r[a++]=h>>>0&255,r[a++]=h>>>8&255,r[a++]=h>>>16&255,r[a++]=h>>>24&255,r[a++]=c>>>0&255,r[a++]=c>>>8&255,r[a++]=c>>>16&255,r[a++]=c>>>24&255,r[a++]=p>>>0&255,r[a++]=p>>>8&255,r[a++]=p>>>16&255,r[a]=p>>>24&255}function LS(e,t,r,i){let a=i,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,d=e[t+8]>>>0;r[a++]=n>>>0&511,r[a++]=n>>>9&511,r[a++]=n>>>18&511,r[a++]=(n>>>27|(s&15)<<5)&511,r[a++]=s>>>4&511,r[a++]=s>>>13&511,r[a++]=s>>>22&511,r[a++]=(s>>>31|(o&255)<<1)&511,r[a++]=o>>>8&511,r[a++]=o>>>17&511,r[a++]=(o>>>26|(l&7)<<6)&511,r[a++]=l>>>3&511,r[a++]=l>>>12&511,r[a++]=l>>>21&511,r[a++]=(l>>>30|(u&127)<<2)&511,r[a++]=u>>>7&511,r[a++]=u>>>16&511,r[a++]=(u>>>25|(h&3)<<7)&511,r[a++]=h>>>2&511,r[a++]=h>>>11&511,r[a++]=h>>>20&511,r[a++]=(h>>>29|(c&63)<<3)&511,r[a++]=c>>>6&511,r[a++]=c>>>15&511,r[a++]=(c>>>24|(p&1)<<8)&511,r[a++]=p>>>1&511,r[a++]=p>>>10&511,r[a++]=p>>>19&511,r[a++]=(p>>>28|(d&31)<<4)&511,r[a++]=d>>>5&511,r[a++]=d>>>14&511,r[a]=d>>>23&511}function BS(e,t,r,i){let a=i,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,d=e[t+8]>>>0,f=e[t+9]>>>0;r[a++]=n>>>0&1023,r[a++]=n>>>10&1023,r[a++]=n>>>20&1023,r[a++]=(n>>>30|(s&255)<<2)&1023,r[a++]=s>>>8&1023,r[a++]=s>>>18&1023,r[a++]=(s>>>28|(o&63)<<4)&1023,r[a++]=o>>>6&1023,r[a++]=o>>>16&1023,r[a++]=(o>>>26|(l&15)<<6)&1023,r[a++]=l>>>4&1023,r[a++]=l>>>14&1023,r[a++]=(l>>>24|(u&3)<<8)&1023,r[a++]=u>>>2&1023,r[a++]=u>>>12&1023,r[a++]=u>>>22&1023,r[a++]=h>>>0&1023,r[a++]=h>>>10&1023,r[a++]=h>>>20&1023,r[a++]=(h>>>30|(c&255)<<2)&1023,r[a++]=c>>>8&1023,r[a++]=c>>>18&1023,r[a++]=(c>>>28|(p&63)<<4)&1023,r[a++]=p>>>6&1023,r[a++]=p>>>16&1023,r[a++]=(p>>>26|(d&15)<<6)&1023,r[a++]=d>>>4&1023,r[a++]=d>>>14&1023,r[a++]=(d>>>24|(f&3)<<8)&1023,r[a++]=f>>>2&1023,r[a++]=f>>>12&1023,r[a]=f>>>22&1023}function OS(e,t,r,i){let a=i,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,d=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0;r[a++]=n>>>0&2047,r[a++]=n>>>11&2047,r[a++]=(n>>>22|(s&1)<<10)&2047,r[a++]=s>>>1&2047,r[a++]=s>>>12&2047,r[a++]=(s>>>23|(o&3)<<9)&2047,r[a++]=o>>>2&2047,r[a++]=o>>>13&2047,r[a++]=(o>>>24|(l&7)<<8)&2047,r[a++]=l>>>3&2047,r[a++]=l>>>14&2047,r[a++]=(l>>>25|(u&15)<<7)&2047,r[a++]=u>>>4&2047,r[a++]=u>>>15&2047,r[a++]=(u>>>26|(h&31)<<6)&2047,r[a++]=h>>>5&2047,r[a++]=h>>>16&2047,r[a++]=(h>>>27|(c&63)<<5)&2047,r[a++]=c>>>6&2047,r[a++]=c>>>17&2047,r[a++]=(c>>>28|(p&127)<<4)&2047,r[a++]=p>>>7&2047,r[a++]=p>>>18&2047,r[a++]=(p>>>29|(d&255)<<3)&2047,r[a++]=d>>>8&2047,r[a++]=d>>>19&2047,r[a++]=(d>>>30|(f&511)<<2)&2047,r[a++]=f>>>9&2047,r[a++]=f>>>20&2047,r[a++]=(f>>>31|(m&1023)<<1)&2047,r[a++]=m>>>10&2047,r[a]=m>>>21&2047}function VS(e,t,r,i){let a=i,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,d=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0;r[a++]=n>>>0&4095,r[a++]=n>>>12&4095,r[a++]=(n>>>24|(s&15)<<8)&4095,r[a++]=s>>>4&4095,r[a++]=s>>>16&4095,r[a++]=(s>>>28|(o&255)<<4)&4095,r[a++]=o>>>8&4095,r[a++]=o>>>20&4095,r[a++]=l>>>0&4095,r[a++]=l>>>12&4095,r[a++]=(l>>>24|(u&15)<<8)&4095,r[a++]=u>>>4&4095,r[a++]=u>>>16&4095,r[a++]=(u>>>28|(h&255)<<4)&4095,r[a++]=h>>>8&4095,r[a++]=h>>>20&4095,r[a++]=c>>>0&4095,r[a++]=c>>>12&4095,r[a++]=(c>>>24|(p&15)<<8)&4095,r[a++]=p>>>4&4095,r[a++]=p>>>16&4095,r[a++]=(p>>>28|(d&255)<<4)&4095,r[a++]=d>>>8&4095,r[a++]=d>>>20&4095,r[a++]=f>>>0&4095,r[a++]=f>>>12&4095,r[a++]=(f>>>24|(m&15)<<8)&4095,r[a++]=m>>>4&4095,r[a++]=m>>>16&4095,r[a++]=(m>>>28|(g&255)<<4)&4095,r[a++]=g>>>8&4095,r[a]=g>>>20&4095}function NS(e,t,r,i){let a=i,n=e[t]>>>0,s=e[t+1]>>>0,o=e[t+2]>>>0,l=e[t+3]>>>0,u=e[t+4]>>>0,h=e[t+5]>>>0,c=e[t+6]>>>0,p=e[t+7]>>>0,d=e[t+8]>>>0,f=e[t+9]>>>0,m=e[t+10]>>>0,g=e[t+11]>>>0,y=e[t+12]>>>0,_=e[t+13]>>>0,x=e[t+14]>>>0,v=e[t+15]>>>0;r[a++]=n>>>0&65535,r[a++]=n>>>16&65535,r[a++]=s>>>0&65535,r[a++]=s>>>16&65535,r[a++]=o>>>0&65535,r[a++]=o>>>16&65535,r[a++]=l>>>0&65535,r[a++]=l>>>16&65535,r[a++]=u>>>0&65535,r[a++]=u>>>16&65535,r[a++]=h>>>0&65535,r[a++]=h>>>16&65535,r[a++]=c>>>0&65535,r[a++]=c>>>16&65535,r[a++]=p>>>0&65535,r[a++]=p>>>16&65535,r[a++]=d>>>0&65535,r[a++]=d>>>16&65535,r[a++]=f>>>0&65535,r[a++]=f>>>16&65535,r[a++]=m>>>0&65535,r[a++]=m>>>16&65535,r[a++]=g>>>0&65535,r[a++]=g>>>16&65535,r[a++]=y>>>0&65535,r[a++]=y>>>16&65535,r[a++]=_>>>0&65535,r[a++]=_>>>16&65535,r[a++]=x>>>0&65535,r[a++]=x>>>16&65535,r[a++]=v>>>0&65535,r[a]=v>>>16&65535}function US(e,t,r,i){let a=i,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0;r[a++]=o>>>0&1,r[a++]=o>>>1&1,r[a++]=o>>>2&1,r[a++]=o>>>3&1,r[a++]=o>>>4&1,r[a++]=o>>>5&1,r[a++]=o>>>6&1,r[a++]=o>>>7&1,r[a++]=o>>>8&1,r[a++]=o>>>9&1,r[a++]=o>>>10&1,r[a++]=o>>>11&1,r[a++]=o>>>12&1,r[a++]=o>>>13&1,r[a++]=o>>>14&1,r[a++]=o>>>15&1,r[a++]=o>>>16&1,r[a++]=o>>>17&1,r[a++]=o>>>18&1,r[a++]=o>>>19&1,r[a++]=o>>>20&1,r[a++]=o>>>21&1,r[a++]=o>>>22&1,r[a++]=o>>>23&1,r[a++]=o>>>24&1,r[a++]=o>>>25&1,r[a++]=o>>>26&1,r[a++]=o>>>27&1,r[a++]=o>>>28&1,r[a++]=o>>>29&1,r[a++]=o>>>30&1,r[a++]=o>>>31&1}}function $S(e,t,r,i){let a=i,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0;r[a++]=o>>>0&3,r[a++]=o>>>2&3,r[a++]=o>>>4&3,r[a++]=o>>>6&3,r[a++]=o>>>8&3,r[a++]=o>>>10&3,r[a++]=o>>>12&3,r[a++]=o>>>14&3,r[a++]=o>>>16&3,r[a++]=o>>>18&3,r[a++]=o>>>20&3,r[a++]=o>>>22&3,r[a++]=o>>>24&3,r[a++]=o>>>26&3,r[a++]=o>>>28&3,r[a++]=o>>>30&3,r[a++]=l>>>0&3,r[a++]=l>>>2&3,r[a++]=l>>>4&3,r[a++]=l>>>6&3,r[a++]=l>>>8&3,r[a++]=l>>>10&3,r[a++]=l>>>12&3,r[a++]=l>>>14&3,r[a++]=l>>>16&3,r[a++]=l>>>18&3,r[a++]=l>>>20&3,r[a++]=l>>>22&3,r[a++]=l>>>24&3,r[a++]=l>>>26&3,r[a++]=l>>>28&3,r[a++]=l>>>30&3}}function jS(e,t,r,i){let a=i,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0,u=e[n++]>>>0;r[a++]=o>>>0&7,r[a++]=o>>>3&7,r[a++]=o>>>6&7,r[a++]=o>>>9&7,r[a++]=o>>>12&7,r[a++]=o>>>15&7,r[a++]=o>>>18&7,r[a++]=o>>>21&7,r[a++]=o>>>24&7,r[a++]=o>>>27&7,r[a++]=(o>>>30|(l&1)<<2)&7,r[a++]=l>>>1&7,r[a++]=l>>>4&7,r[a++]=l>>>7&7,r[a++]=l>>>10&7,r[a++]=l>>>13&7,r[a++]=l>>>16&7,r[a++]=l>>>19&7,r[a++]=l>>>22&7,r[a++]=l>>>25&7,r[a++]=l>>>28&7,r[a++]=(l>>>31|(u&3)<<1)&7,r[a++]=u>>>2&7,r[a++]=u>>>5&7,r[a++]=u>>>8&7,r[a++]=u>>>11&7,r[a++]=u>>>14&7,r[a++]=u>>>17&7,r[a++]=u>>>20&7,r[a++]=u>>>23&7,r[a++]=u>>>26&7,r[a++]=u>>>29&7}}function GS(e,t,r,i){let a=i,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0,u=e[n++]>>>0,h=e[n++]>>>0;r[a++]=o>>>0&15,r[a++]=o>>>4&15,r[a++]=o>>>8&15,r[a++]=o>>>12&15,r[a++]=o>>>16&15,r[a++]=o>>>20&15,r[a++]=o>>>24&15,r[a++]=o>>>28&15,r[a++]=l>>>0&15,r[a++]=l>>>4&15,r[a++]=l>>>8&15,r[a++]=l>>>12&15,r[a++]=l>>>16&15,r[a++]=l>>>20&15,r[a++]=l>>>24&15,r[a++]=l>>>28&15,r[a++]=u>>>0&15,r[a++]=u>>>4&15,r[a++]=u>>>8&15,r[a++]=u>>>12&15,r[a++]=u>>>16&15,r[a++]=u>>>20&15,r[a++]=u>>>24&15,r[a++]=u>>>28&15,r[a++]=h>>>0&15,r[a++]=h>>>4&15,r[a++]=h>>>8&15,r[a++]=h>>>12&15,r[a++]=h>>>16&15,r[a++]=h>>>20&15,r[a++]=h>>>24&15,r[a++]=h>>>28&15}}function qS(e,t,r,i){let a=i,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0,u=e[n++]>>>0,h=e[n++]>>>0,c=e[n++]>>>0;r[a++]=o>>>0&31,r[a++]=o>>>5&31,r[a++]=o>>>10&31,r[a++]=o>>>15&31,r[a++]=o>>>20&31,r[a++]=o>>>25&31,r[a++]=(o>>>30|(l&7)<<2)&31,r[a++]=l>>>3&31,r[a++]=l>>>8&31,r[a++]=l>>>13&31,r[a++]=l>>>18&31,r[a++]=l>>>23&31,r[a++]=(l>>>28|(u&1)<<4)&31,r[a++]=u>>>1&31,r[a++]=u>>>6&31,r[a++]=u>>>11&31,r[a++]=u>>>16&31,r[a++]=u>>>21&31,r[a++]=u>>>26&31,r[a++]=(u>>>31|(h&15)<<1)&31,r[a++]=h>>>4&31,r[a++]=h>>>9&31,r[a++]=h>>>14&31,r[a++]=h>>>19&31,r[a++]=h>>>24&31,r[a++]=(h>>>29|(c&3)<<3)&31,r[a++]=c>>>2&31,r[a++]=c>>>7&31,r[a++]=c>>>12&31,r[a++]=c>>>17&31,r[a++]=c>>>22&31,r[a++]=c>>>27&31}}function ZS(e,t,r,i){let a=i,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0,u=e[n++]>>>0,h=e[n++]>>>0,c=e[n++]>>>0,p=e[n++]>>>0;r[a++]=o>>>0&63,r[a++]=o>>>6&63,r[a++]=o>>>12&63,r[a++]=o>>>18&63,r[a++]=o>>>24&63,r[a++]=(o>>>30|(l&15)<<2)&63,r[a++]=l>>>4&63,r[a++]=l>>>10&63,r[a++]=l>>>16&63,r[a++]=l>>>22&63,r[a++]=(l>>>28|(u&3)<<4)&63,r[a++]=u>>>2&63,r[a++]=u>>>8&63,r[a++]=u>>>14&63,r[a++]=u>>>20&63,r[a++]=u>>>26&63,r[a++]=h>>>0&63,r[a++]=h>>>6&63,r[a++]=h>>>12&63,r[a++]=h>>>18&63,r[a++]=h>>>24&63,r[a++]=(h>>>30|(c&15)<<2)&63,r[a++]=c>>>4&63,r[a++]=c>>>10&63,r[a++]=c>>>16&63,r[a++]=c>>>22&63,r[a++]=(c>>>28|(p&3)<<4)&63,r[a++]=p>>>2&63,r[a++]=p>>>8&63,r[a++]=p>>>14&63,r[a++]=p>>>20&63,r[a++]=p>>>26&63}}function WS(e,t,r,i){let a=i,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0,u=e[n++]>>>0,h=e[n++]>>>0,c=e[n++]>>>0,p=e[n++]>>>0,d=e[n++]>>>0;r[a++]=o>>>0&127,r[a++]=o>>>7&127,r[a++]=o>>>14&127,r[a++]=o>>>21&127,r[a++]=(o>>>28|(l&7)<<4)&127,r[a++]=l>>>3&127,r[a++]=l>>>10&127,r[a++]=l>>>17&127,r[a++]=l>>>24&127,r[a++]=(l>>>31|(u&63)<<1)&127,r[a++]=u>>>6&127,r[a++]=u>>>13&127,r[a++]=u>>>20&127,r[a++]=(u>>>27|(h&3)<<5)&127,r[a++]=h>>>2&127,r[a++]=h>>>9&127,r[a++]=h>>>16&127,r[a++]=h>>>23&127,r[a++]=(h>>>30|(c&31)<<2)&127,r[a++]=c>>>5&127,r[a++]=c>>>12&127,r[a++]=c>>>19&127,r[a++]=(c>>>26|(p&1)<<6)&127,r[a++]=p>>>1&127,r[a++]=p>>>8&127,r[a++]=p>>>15&127,r[a++]=p>>>22&127,r[a++]=(p>>>29|(d&15)<<3)&127,r[a++]=d>>>4&127,r[a++]=d>>>11&127,r[a++]=d>>>18&127,r[a++]=d>>>25&127}}function XS(e,t,r,i){let a=i,n=t;for(let s=0;s<8;s++){let o=e[n++]>>>0,l=e[n++]>>>0,u=e[n++]>>>0,h=e[n++]>>>0,c=e[n++]>>>0,p=e[n++]>>>0,d=e[n++]>>>0,f=e[n++]>>>0;r[a++]=o>>>0&255,r[a++]=o>>>8&255,r[a++]=o>>>16&255,r[a++]=o>>>24&255,r[a++]=l>>>0&255,r[a++]=l>>>8&255,r[a++]=l>>>16&255,r[a++]=l>>>24&255,r[a++]=u>>>0&255,r[a++]=u>>>8&255,r[a++]=u>>>16&255,r[a++]=u>>>24&255,r[a++]=h>>>0&255,r[a++]=h>>>8&255,r[a++]=h>>>16&255,r[a++]=h>>>24&255,r[a++]=c>>>0&255,r[a++]=c>>>8&255,r[a++]=c>>>16&255,r[a++]=c>>>24&255,r[a++]=p>>>0&255,r[a++]=p>>>8&255,r[a++]=p>>>16&255,r[a++]=p>>>24&255,r[a++]=d>>>0&255,r[a++]=d>>>8&255,r[a++]=d>>>16&255,r[a++]=d>>>24&255,r[a++]=f>>>0&255,r[a++]=f>>>8&255,r[a++]=f>>>16&255,r[a++]=f>>>24&255}}function HS(e,t,r,i){let a=i,n=t;for(let s=0;s<128;s++){let o=e[n++]>>>0;r[a++]=o&65535,r[a++]=o>>>16&65535}}function YS(e,t,r,i,a){let n=rh[a]>>>0,s=t,o=0,l=e[s]>>>0,u=i;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+a<=32){let p=l>>>o&n;r[u+c]=p|0,o+=a,o===32&&(o=0,s++,c!==31&&(l=e[s]>>>0))}else{let p=32-o,d=l>>>o;s++,l=e[s]>>>0;let f=a-p,m=-1>>>32-f>>>0,g=(d|(l&m)<<p)&n;r[u+c]=g|0,o=f}u+=32,o=0,h<7&&(l=e[s]>>>0)}}var ih=AS(Oy),KS=3*ih/256+ih|0;function Vy(){let e=new Uint8Array(KS);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:e,byteContainerI32:new Int32Array(e.buffer,e.byteOffset,e.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function JS(e=16){if(e<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${e}`);let t=Math.max(16,e|0);return{encodedWords:new Uint32Array(t),decoderWorkspace:Vy()}}function QS(e,t){if(t<=e.encodedWords.length)return e.encodedWords;let r=new Uint32Array(Math.max(16,t*2));return e.encodedWords=r,r}function eE(e,t,r,i){i.byteContainer.length<r&&(i.byteContainer=new Uint8Array(r*2),i.byteContainerI32=void 0);let a=i.byteContainer,n=r>>>2;if(a.byteOffset&3)for(let o=0;o<n;o=o+1|0){let l=e[t+o|0]|0,u=o<<2;a[u]=l&255,a[u+1|0]=l>>>8&255,a[u+2|0]=l>>>16&255,a[u+3|0]=l>>>24&255}else{let o=i.byteContainerI32;(!o||o.buffer!==a.buffer||o.byteOffset!==a.byteOffset||o.length<n)&&(o=i.byteContainerI32=new Int32Array(a.buffer,a.byteOffset,a.byteLength>>>2)),o.set(e.subarray(t,t+n))}let s=r&3;if(s>0){let o=e[t+n|0]|0,l=n<<2;for(let u=0;u<s;u=u+1|0)a[l+u|0]=o>>>(u<<3)&255}return a}function tE(e,t,r){let i=e[t++]|0,a=r.dataToBePacked;for(let n=2;n<=32;n=n+1|0){if(!(i>>>n-1&1))continue;if(t>=e.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${n}, streamWordIndex=${t}, needWords=1, availableWords=${e.length-t}, encodedWords=${e.length})`);let s=e[t++]>>>0,o=IS(s),l=s*n+31>>>5;if(t+l>e.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${n}, size=${s}, streamWordIndex=${t}, needWords=${l}, availableWords=${e.length-t}, encodedWords=${e.length})`);let u=a[n];(!u||u.length<o)&&(u=a[n]=new Uint32Array(o));let h=0;for(;h<s;h=h+32|0)cE(e,t,u,h,n),t=t+n|0;let c=h-s|0;t=t-(c*n>>>5)|0,r.exceptionSizes[n]=s}return t}function rE(e,t,r,i,a){switch(a){case 1:US(e,t,r,i);break;case 2:$S(e,t,r,i);break;case 3:jS(e,t,r,i);break;case 4:GS(e,t,r,i);break;case 5:qS(e,t,r,i);break;case 6:ZS(e,t,r,i);break;case 7:WS(e,t,r,i);break;case 8:XS(e,t,r,i);break;case 16:HS(e,t,r,i);break;default:YS(e,t,r,i,a)}return t+(a<<3)|0}function iE(e,t,r,i){if(r+2>t)throw Error(`FastPFOR decode: byteContainer underflow at block=${i} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${t})`);let a=e[r++],n=e[r++];if(a>32)throw Error(`FastPFOR decode: invalid bitWidth=${a} at block=${i} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:a,exceptionCount:n,bytePosIn:r}}function aE(e,t,r,i,a,n){if(r+1>t)throw Error(`FastPFOR decode: exception header underflow at block=${n} (need 1 byte for maxBits, bytePos=${r}, byteSize=${t})`);let s=e[r++];if(s<i||s>32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${n} (bitWidth=${i}, expected ${i}..32)`);let o=s-i|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${n} (bitWidth=${i}, maxBits=${s})`);if(r+a>t)throw Error(`FastPFOR decode: exception positions underflow at block=${n} (need=${a}, have=${t-r})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:r}}function nE(e,t,r,i,a,n,s,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=aE(a,n,s,r,i,l);if(s=c,h===1){let g=1<<r;for(let y=0;y<i;y=y+1|0){let _=a[s++];e[_+t|0]|=g}return s}let p=o.dataToBePacked[h];if(!p)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${r}, maxBits=${u}) at block ${l}`);let d=o.dataPointers,f=d[h]|0,m=o.exceptionSizes[h]|0;if(f+i>m)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${f}, need ${i}, size=${m}) at block ${l}`);for(let g=0;g<i;g=g+1|0){let y=a[s++],_=p[f++]|0;e[y+t|0]|=_<<r}return d[h]=f,s}function sE(e,t,r,i,a,n,s,o,l,u){let h=r|0,c=0;for(let p=0;p<s;p=p+1|0){let d=iE(o,l,c,p);c=d.bytePosIn;let f=d.bitWidth,m=d.exceptionCount,g=n+p*256|0;switch(f){case 0:a.fill(0,g,g+256);break;case 32:for(let y=0;y<256;y=y+1|0)a[g+y|0]=e[h+y|0]|0;h=h+256|0;break;default:h=rE(e,h,a,g,f)}m>0&&(c=nE(a,g,f,m,o,l,c,u,p))}if(h!==i)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${t}, packedStart=${r}, consumedPackedEnd=${h}, expectedPackedEnd=${i}, packedWords=${i-r}, encoded.length=${e.length})`)}function oE(e,t,r,i,a,n){let s=r|0,o=e[s]|0;if(o<=0||s+o>e.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${e.length})`);let l=s+1|0,u=s+o|0,h=e[u]>>>0,c=h+3>>>2,p=u+1,d=p+c;if(d>=e.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${s}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${d} out of bounds (encoded.length=${e.length})`);let f=eE(e,p,h,n),m=h,g=tE(e,d,n);return n.dataPointers.fill(0),sE(e,s,l,u,t,i|0,a/256|0,f,m,n),g}function lE(e,t,r,i,a,n){let s=i+pc(a,256),o=i,l=r;for(;o!==s;){let u=Math.min(ih,s-o);l=oE(e,t,l,o,u,n),o=o+u|0}return l}function uE(e,t,r,i,a,n){if(n===0)return t;let s=0,o=t,l=t+r,u=a,h=a,c=a+n,p=0,d=0;for(;o<l&&h<c;){let f=e[o]>>>s&255;if(s+=8,o+=s>>>5,s&=31,p|=(f&127)<<d,f&128)i[h++]=p|0,p=0,d=0;else if(d+=7,d>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${d}, partial=${p}, decoded=${h-u}/${n}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${n}, consumedWords=${o-t}/${r}, vbyteStart=${t}, vbyteEnd=${l})`);return o}function hE(e,t,r){let i=0,a=0,n=new Uint32Array(t),s=r??Vy();if(e.length>0){let u=e[i]|0;if(i=i+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(a+u>n.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${a}, alignedLength=${u}, out.length=${n.length})`);i=lE(e,n,i,a,u,s),a=a+u|0}let o=e.length-i|0,l=t-a|0;return uE(e,i,o,n,a,l),n}function cE(e,t,r,i,a){switch(a){case 2:PS(e,t,r,i);return;case 3:CS(e,t,r,i);return;case 4:kS(e,t,r,i);return;case 5:DS(e,t,r,i);return;case 6:FS(e,t,r,i);return;case 7:zS(e,t,r,i);return;case 8:RS(e,t,r,i);return;case 9:LS(e,t,r,i);return;case 10:BS(e,t,r,i);return;case 11:OS(e,t,r,i);return;case 12:VS(e,t,r,i);return;case 16:NS(e,t,r,i);return;case 32:for(let u=0;u<32;u=u+1|0)r[i+u|0]=e[t+u|0]|0;return}let n=rh[a]>>>0,s=t,o=0,l=e[s]>>>0;for(let u=0;u<32;u++)if(o+a<=32){let h=l>>>o&n;r[i+u]=h|0,o+=a,o===32&&(o=0,s++,u!==31&&(l=e[s]>>>0))}else{let h=32-o,c=l>>>o;s++,l=e[s]>>>0;let p=rh[a-h]>>>0,d=(c|(l&p)<<h)&n;r[i+u]=d|0,o=a-h}}function pE(e,t,r,i){if(t<0||r<0||t+r>e.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${t}, byteLength=${r}, bytes.length=${e.length})`);let a=Math.floor(r/4),n=r%4!=0,s=n?a+1:a;if(i.length<s)throw RangeError(`decodeBigEndianInt32sInto: out.length=${i.length} < ${s}`);if(a>0){let o=e.byteOffset+t;if(o&3)for(let l=0;l<a;l++){let u=t+l*4;i[l]=e[u]<<24|e[u+1]<<16|e[u+2]<<8|e[u+3]|0}else{let l=new Uint32Array(e.buffer,o,a);for(let u=0;u<a;u++)i[u]=MS(l[u])|0}}if(n){let o=t+a*4,l=r-a*4,u=0;for(let h=0;h<l;h++)u|=e[o+h]<<24-h*8;i[a]=u|0}return s}function pt(e,t,r){let i=new Uint32Array(r),a=0,n=t.get();for(let s=0;s<i.length;s++){let o=e[n++],l=o&127;if(o<128){i[a++]=l;continue}if(o=e[n++],l|=(o&127)<<7,o<128){i[a++]=l;continue}if(o=e[n++],l|=(o&127)<<14,o<128){i[a++]=l;continue}if(o=e[n++],l|=(o&127)<<21,o<128){i[a++]=l;continue}o=e[n++],l|=(o&15)<<28,i[a++]=l}return t.set(n),i}function dc(e,t,r){let i=new BigUint64Array(r);for(let a=0;a<i.length;a++)i[a]=dE(e,t);return i}function dE(e,t){let r=0n,i=0,a=t.get();for(;a<e.length;){let n=e[a++];if(r|=BigInt(n&127)<<BigInt(i),!(n&128))break;if(i+=7,i>=64)throw Error(\"Varint too long\")}return t.set(a),r}function fE(e,t,r){let i=new Float64Array(r);for(let a=0;a<r;a++)i[a]=mE(e,t);return i}function mE(e,t){let r,i;return i=e[t.get()],t.increment(),r=i&127,i<128||(i=e[t.get()],t.increment(),r|=(i&127)<<7,i<128)||(i=e[t.get()],t.increment(),r|=(i&127)<<14,i<128)||(i=e[t.get()],t.increment(),r|=(i&127)<<21,i<128)?r:(i=e[t.get()],r|=(i&15)<<28,gE(r,e,t))}function gE(e,t,r){let i,a;if(a=t[r.get()],r.increment(),i=(a&112)>>4,a<128||(a=t[r.get()],r.increment(),i|=(a&127)<<3,a<128)||(a=t[r.get()],r.increment(),i|=(a&127)<<10,a<128)||(a=t[r.get()],r.increment(),i|=(a&127)<<17,a<128)||(a=t[r.get()],r.increment(),i|=(a&127)<<24,a<128)||(a=t[r.get()],r.increment(),i|=(a&1)<<31,a<128))return i*4294967296+(e>>>0);throw Error(\"Expected varint not more than 10 bytes\")}function yE(e,t,r,i){return _E(e,t,r,i,JS(r>>>2))}function _E(e,t,r,i,a){let n=i.get();if(r&3)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${n} (encodedBytes.length=${e.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=r>>>2,o=QS(a,s);pE(e,n,r,o);let l=hE(o.subarray(0,s),t,a.decoderWorkspace);return i.add(r),l}function se(e){return e>>>1^-(e&1)}function ht(e){return e>>1n^-(e&1n)}function ni(e){return e%2==1?(e+1)/-2:e/2}function xE(e){let t=new Int32Array(e.length);for(let r=0;r<e.length;r++)t[r]=se(e[r]);return t}function vE(e){let t=new BigInt64Array(e.length);for(let r=0;r<e.length;r++)t[r]=ht(e[r]);return t}function bE(e){for(let t=0;t<e.length;t++)e[t]=ni(e[t])}function ah(e,t,r){if(r===void 0){r=0;for(let n=0;n<t;n++)r+=e[n]}let i=new Uint32Array(r),a=0;for(let n=0;n<t;n++){let s=e[n],o=e[n+t];i.fill(o,a,a+s),a+=s}return i}function nh(e,t,r){if(r===void 0){r=0;for(let n=0;n<t;n++)r+=Number(e[n])}let i=new BigUint64Array(r),a=0;for(let n=0;n<t;n++){let s=Number(e[n]),o=e[n+t];i.fill(o,a,a+s),a+=s}return i}function Ny(e,t,r){let i=new Float64Array(r),a=0;for(let n=0;n<t;n++){let s=e[n],o=e[n+t];i.fill(o,a,a+s),a+=s}return i}function af(e){let t=new Int32Array(e.length);t[0]=se(e[0]);let r=e.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let a=e[i],n=e[i+1],s=e[i+2],o=e[i+3];t[i]=se(a)+t[i-1],t[i+1]=se(n)+t[i],t[i+2]=se(s)+t[i+1],t[i+3]=se(o)+t[i+2]}for(;i!==e.length;++i)t[i]=se(e[i])+t[i-1];return t}function nf(e){let t=new BigInt64Array(e.length);t[0]=ht(e[0]);let r=e.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let a=e[i],n=e[i+1],s=e[i+2],o=e[i+3];t[i]=ht(a)+t[i-1],t[i+1]=ht(n)+t[i],t[i+2]=ht(s)+t[i+1],t[i+3]=ht(o)+t[i+2]}for(;i!==t.length;++i)t[i]=ht(e[i])+t[i-1];return t}function wE(e){e[0]=ni(e[0]);let t=e.length/4*4,r=1;if(t>=4)for(;r<t-4;r+=4){let i=e[r],a=e[r+1],n=e[r+2],s=e[r+3];e[r]=ni(i)+e[r-1],e[r+1]=ni(a)+e[r],e[r+2]=ni(n)+e[r+1],e[r+3]=ni(s)+e[r+2]}for(;r!==e.length;++r)e[r]=ni(e[r])+e[r-1]}function TE(e,t,r){if(r===void 0){r=0;for(let n=0;n<t;n++)r+=e[n]}let i=new Int32Array(r),a=0;for(let n=0;n<t;n++){let s=e[n],o=e[n+t];o=se(o),i.fill(o,a,a+s),a+=s}return i}function SE(e,t,r){if(r===void 0){r=0;for(let n=0;n<t;n++)r+=Number(e[n])}let i=new BigInt64Array(r),a=0;for(let n=0;n<t;n++){let s=Number(e[n]),o=e[n+t];o=ht(o),i.fill(o,a,a+s),a+=s}return i}function EE(e,t,r){let i=new Float64Array(r),a=0;for(let n=0;n<t;n++){let s=e[n],o=e[n+t];o=ni(o),i.fill(o,a,a+s),a+=s}return i}function fc(e){let t=e.length/4*4,r=1;if(t>=4)for(let i=e[0];r<t-4;r+=4)i=e[r]+=i,i=e[r+1]+=i,i=e[r+2]+=i,i=e[r+3]+=i;for(;r!==e.length;)e[r]+=e[r-1],++r}function IE(e){let t=0;for(let r=0;r<e.length;r++)e[r]+=t,t=e[r]}function AE(e){if(e.length<2)return new Int32Array(e);let t=new Int32Array(e.length);t[0]=se(e[0]),t[1]=se(e[1]);let r=e.length/4*4,i=2;if(r>=4)for(;i<r-4;i+=4){let a=e[i],n=e[i+1],s=e[i+2],o=e[i+3];t[i]=se(a)+t[i-2],t[i+1]=se(n)+t[i-1],t[i+2]=se(s)+t[i],t[i+3]=se(o)+t[i+1]}for(;i!==e.length;i+=2)t[i]=se(e[i])+t[i-2],t[i+1]=se(e[i+1])+t[i-1];return t}function Uy(e,t,r,i){if(e.length<2)return new Int32Array(e);let a=new Int32Array(e.length),n=se(e[0]),s=se(e[1]);a[0]=ii(Math.round(n*t),r,i),a[1]=ii(Math.round(s*t),r,i);let o=e.length/16,l=2;if(o>=4)for(;l<o-4;l+=4){let u=e[l],h=e[l+1],c=se(u)+n,p=se(h)+s;a[l]=ii(Math.round(c*t),r,i),a[l+1]=ii(Math.round(p*t),r,i);let d=e[l+2],f=e[l+3];n=se(d)+c,s=se(f)+p,a[l+2]=ii(Math.round(n*t),r,i),a[l+3]=ii(Math.round(s*t),r,i)}for(;l!==e.length;l+=2)n+=se(e[l]),s+=se(e[l+1]),a[l]=ii(Math.round(n*t),r,i),a[l+1]=ii(Math.round(s*t),r,i);return a}function ii(e,t,r){return Math.min(r,Math.max(t,e))}function ME(e){let t=new Int32Array(e.length+1);t[0]=0,t[1]=se(e[0]);let r=t[1];for(let i=2;i!==t.length;++i){let a=e[i-1],n=se(a);r+=n,t[i]=t[i-1]+r}return new Uint32Array(t)}function PE(e,t,r){let i=new Int32Array(r+1);i[0]=0;let a=1,n=i[0];for(let s=0;s<t;s++){let o=e[s],l=e[s+t];l=se(l);for(let u=a;u<a+o;u++)i[u]=l+n,n=i[u];a+=o}return i}function CE(e,t,r){let i=new Uint32Array(r+1);i[0]=0;let a=1,n=i[0];for(let s=0;s<t;s++){let o=e[s],l=e[s+t];for(let u=a;u<a+o;u++)i[u]=l+n,n=i[u];a+=o}return i}function kE(e,t,r){let i=new Int32Array(r),a=0,n=0;for(let s=0;s<t;s++){let o=e[s],l=e[s+t],u=se(l);for(let h=0;h<o;h++)n+=u,i[a++]=n}return i}function DE(e,t,r){let i=new BigInt64Array(r),a=0,n=0n;for(let s=0;s<t;s++){let o=Number(e[s]),l=e[s+t],u=ht(l);for(let h=0;h<o;h++)n+=u,i[a++]=n}return i}function sf(e){let t=new Uint32Array(e.length);t[0]=se(e[0])>>>0;for(let r=1;r<e.length;r++)t[r]=t[r-1]+se(e[r])>>>0;return t}function of(e){let t=new BigUint64Array(e.length);t[0]=BigInt.asUintN(64,ht(e[0]));for(let r=1;r<e.length;r++)t[r]=BigInt.asUintN(64,t[r-1]+ht(e[r]));return t}function FE(e){if(e.length<2)return new Uint32Array(e);let t=new Uint32Array(e.length);t[0]=se(e[0])>>>0,t[1]=se(e[1])>>>0;for(let r=2;r<e.length;r+=2)t[r]=t[r-2]+se(e[r])>>>0,t[r+1]=t[r-1]+se(e[r+1])>>>0;return t}function zE(e,t,r,i){let a=Uy(e,t,r,i);return new Uint32Array(a)}function RE(e){return e[1]}function LE(e){return se(e[1])}function BE(e){if(e.length===2){let t=se(e[1]);return[t,t]}return[se(e[2]),se(e[3])]}function OE(e){return e[1]}function VE(e){return ht(e[1])}function NE(e){if(e.length===2){let t=ht(e[1]);return[t,t]}return[ht(e[2]),ht(e[3])]}var $e;(function(e){e.PRESENT=\"PRESENT\",e.DATA=\"DATA\",e.OFFSET=\"OFFSET\",e.LENGTH=\"LENGTH\"})($e||($e={}));var Tt;(function(e){e.NONE=\"NONE\",e.SINGLE=\"SINGLE\",e.SHARED=\"SHARED\",e.VERTEX=\"VERTEX\",e.MORTON=\"MORTON\",e.FSST=\"FSST\"})(Tt||(Tt={}));var zr;(function(e){e.VERTEX=\"VERTEX\",e.INDEX=\"INDEX\",e.STRING=\"STRING\",e.KEY=\"KEY\"})(zr||(zr={}));var Je;(function(e){e.VAR_BINARY=\"VAR_BINARY\",e.GEOMETRIES=\"GEOMETRIES\",e.PARTS=\"PARTS\",e.RINGS=\"RINGS\",e.TRIANGLES=\"TRIANGLES\",e.SYMBOL=\"SYMBOL\",e.DICTIONARY=\"DICTIONARY\"})(Je||(Je={}));var UE=[$e.PRESENT,$e.DATA,$e.OFFSET,$e.LENGTH],lf=[re.NONE,re.DELTA,re.COMPONENTWISE_DELTA,re.RLE,re.MORTON,re.PDE],$E=[Yt.NONE,Yt.FAST_PFOR,Yt.VARINT],jE=[Tt.NONE,Tt.SINGLE,Tt.SHARED,Tt.VERTEX,Tt.MORTON,Tt.FSST],GE=[zr.VERTEX,zr.INDEX,zr.STRING,zr.KEY],qE=[Je.VAR_BINARY,Je.GEOMETRIES,Je.PARTS,Je.RINGS,Je.TRIANGLES,Je.SYMBOL,Je.DICTIONARY];function Se(e,t){let r=XE(e,t);return r.logicalLevelTechnique1===re.MORTON?ZE(r,e,t):(re.RLE===r.logicalLevelTechnique1||re.RLE===r.logicalLevelTechnique2)&&Yt.NONE!==r.physicalLevelTechnique?WE(r,e,t):r}function ZE(e,t,r){let i=pt(t,r,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:e.decompressedCount,numBits:i[0],coordinateShift:i[1]}}function WE(e,t,r){let i=pt(t,r,2);return{physicalStreamType:e.physicalStreamType,logicalStreamType:e.logicalStreamType,logicalLevelTechnique1:e.logicalLevelTechnique1,logicalLevelTechnique2:e.logicalLevelTechnique2,physicalLevelTechnique:e.physicalLevelTechnique,numValues:e.numValues,byteLength:e.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}function XE(e,t){let r=e[t.get()],i=UE[r>>4],a={};switch(i){case $e.DATA:a={dictionaryType:jE[r&15]};break;case $e.OFFSET:a={offsetType:GE[r&15]};break;case $e.LENGTH:a={lengthType:qE[r&15]}}t.increment();let n=e[t.get()],s=lf[n>>5],o=lf[n>>2&7],l=$E[n&3];t.increment();let u=pt(e,t,2),h=u[0],c=u[1];return{physicalStreamType:i,logicalStreamType:a,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var be;(function(e){e[e.FLAT=0]=\"FLAT\",e[e.CONST=1]=\"CONST\",e[e.SEQUENCE=2]=\"SEQUENCE\",e[e.DICTIONARY=3]=\"DICTIONARY\",e[e.FSST_DICTIONARY=4]=\"FSST_DICTIONARY\"})(be||(be={}));var lr=class{constructor(e,t){this.values=e,this._size=t}get(e){let t=Math.floor(e/8),r=e%8;return(this.values[t]>>r&1)==1}set(e,t){let r=Math.floor(e/8),i=e%8;this.values[r]=this.values[r]|+!!t<<i}getInt(e){let t=Math.floor(e/8),r=e%8;return this.values[t]>>r&1}size(){return this._size}getBuffer(){return this.values}};function Wi(e,t,r){if(!t)return e;let i=t.size(),a=e.constructor,n=new a(i),s=0;for(let o=0;o<i;o++)n[o]=t.get(o)?e[s++]:r;return n}function HE(e,t,r){if(!r)return e;let i=r.size(),a=new lr(e,t),n=new lr(new Uint8Array(Math.ceil(i/8)),i),s=0;for(let o=0;o<i;o++){let l=r.get(o)?a.get(s++):!1;n.set(o,l)}return n.getBuffer()}function $y(e,t,r){for(let i=0;i<e;i++){let a=Se(t,r);r.add(a.byteLength)}}function Ua(e,t,r,i,a){let n=YE(e,Math.ceil(t/8),r,i);return a?HE(n,t,a):n}function YE(e,t,r,i){let a=new Uint8Array(t),n=0,s=i.get()+r;for(;n<t&&!(i.get()>=s);){let o=e[i.increment()];if(o<=127){let l=o+3,u=e[i.increment()],h=Math.min(n+l,t);a.fill(u,n,h),n=h}else{let l=256-o;for(let u=0;u<l&&n<t;u++)a[n++]=e[i.increment()]}}return i.set(s),a}function jy(e,t,r,i){let a=t.get(),n=a+r*Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(e.subarray(a,n)).buffer,o=new Float32Array(s);return t.set(n),i?Wi(o,i,0):o}function Gy(e,t,r,i){let a=t.get(),n=a+r*Float64Array.BYTES_PER_ELEMENT,s=new Uint8Array(e.subarray(a,n)).buffer,o=new Float64Array(s);return t.set(n),i?Wi(o,i,0):o}function KE(e,t,r){let i=t.get(),a=r*Uint32Array.BYTES_PER_ELEMENT,n=new DataView(e.buffer,e.byteOffset,e.byteLength),s=new Uint32Array(r);for(let o=0;o<r;o++)s[o]=n.getUint32(i+o*Uint32Array.BYTES_PER_ELEMENT,!0);return t.add(a),s}function JE(e,t,r){let i=t.get(),a=r*BigUint64Array.BYTES_PER_ELEMENT,n=new DataView(e.buffer,e.byteOffset,e.byteLength),s=new BigUint64Array(r);for(let o=0;o<r;o++)s[o]=n.getBigUint64(i+o*BigUint64Array.BYTES_PER_ELEMENT,!0);return t.add(a),s}var QE=new TextDecoder;function mc(e,t,r){return r-t>=12?QE.decode(e.subarray(t,r)):eI(e,t,r)}function eI(e,t,r){let i=\"\",a=t;for(;a<r;){let n=e[a],s=null,o=n>239?4:n>223?3:n>191?2:1;if(a+o>r)break;let l,u,h;o===1?n<128&&(s=n):o===2?(l=e[a+1],(l&192)==128&&(s=(n&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=e[a+1],u=e[a+2],(l&192)==128&&(u&192)==128&&(s=(n&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=e[a+1],u=e[a+2],h=e[a+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(n&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),a+=o}return i}function eo(e,t,r,i,a){return nI($a(e,t,r),r,i,a)}function ut(e,t,r,i,a){return sI($a(e,t,r),r,i,a)}function si(e,t,r){return lI($a(e,t,r),r)}function $a(e,t,r){let i=r.physicalLevelTechnique;switch(i){case Yt.FAST_PFOR:return yE(e,r.numValues,r.byteLength,t);case Yt.VARINT:return pt(e,t,r.numValues);case Yt.NONE:return KE(e,t,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function rs(e,t,r){let i=r.physicalLevelTechnique;switch(i){case Yt.VARINT:return dc(e,t,r.numValues);case Yt.NONE:return JE(e,t,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function tI(e,t,r){let i=$a(e,t,r);return i.length===1?se(i[0]):LE(i)}function gc(e,t,r){let i=$a(e,t,r);return i.length===1?r.logicalLevelTechnique1===re.DELTA?se(i[0]):i[0]:RE(i)}function qy(e,t,r){return BE($a(e,t,r))}function Zy(e,t,r){return NE(dc(e,t,r.numValues))}function Wy(e,t,r,i){return Hy(rs(e,t,r),r,i)}function yc(e,t,r,i){return Yy(rs(e,t,r),r,i)}function rI(e,t,r,i){let a=iI(e,t,r,!1);return i?Wi(a,i,0):a}function iI(e,t,r,i){if(r.physicalLevelTechnique===Yt.VARINT)return oI(fE(e,t,r.numValues),r,i);let a=rs(e,t,r),n=i?Hy(a,r):Yy(a,r);return Float64Array.from(n,Number)}function aI(e,t,r){let i=rs(e,t,r);return i.length===1?ht(i[0]):VE(i)}function Xy(e,t,r){let i=rs(e,t,r);return i.length===1?r.logicalLevelTechnique1===re.DELTA?ht(i[0]):i[0]:OE(i)}function nI(e,t,r,i){let a;switch(t.logicalLevelTechnique1){case re.DELTA:if(t.logicalLevelTechnique2===re.RLE){let n=t;if(!i)return kE(e,n.runs,n.numRleValues);e=ah(e,n.runs,n.numRleValues),a=af(e)}else a=af(e);break;case re.RLE:a=TE(e,t.runs,t.numRleValues);break;case re.MORTON:fc(e),a=new Int32Array(e);break;case re.COMPONENTWISE_DELTA:if(r&&!i)return Uy(e,r.scale,r.min,r.max);a=AE(e);break;case re.NONE:a=xE(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?Wi(a,i,0):a}function sI(e,t,r,i){let a;switch(t.logicalLevelTechnique1){case re.DELTA:if(t.logicalLevelTechnique2===re.RLE){let n=t;a=sf(ah(e,n.runs,n.numRleValues))}else a=sf(e);break;case re.RLE:a=ah(e,t.runs,t.numRleValues);break;case re.MORTON:fc(e),a=e;break;case re.COMPONENTWISE_DELTA:a=r&&!i?zE(e,r.scale,r.min,r.max):FE(e);break;case re.NONE:a=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return i?Wi(a,i,0):a}function Hy(e,t,r){let i;switch(t.logicalLevelTechnique1){case re.DELTA:if(t.logicalLevelTechnique2===re.RLE){let a=t;if(!r)return DE(e,a.runs,a.numRleValues);e=nh(e,a.runs,a.numRleValues),i=nf(e)}else i=nf(e);break;case re.RLE:i=SE(e,t.runs,t.numRleValues);break;case re.NONE:i=vE(e);break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Wi(i,r,0n):i}function Yy(e,t,r){let i;switch(t.logicalLevelTechnique1){case re.DELTA:if(t.logicalLevelTechnique2===re.RLE){let a=t;i=of(nh(e,a.runs,a.numRleValues))}else i=of(e);break;case re.RLE:i=nh(e,t.runs,t.numRleValues);break;case re.NONE:i=e;break;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}return r?Wi(i,r,0n):i}function oI(e,t,r){switch(t.logicalLevelTechnique1){case re.DELTA:if(t.logicalLevelTechnique2===re.RLE){let i=t;e=Ny(e,i.runs,i.numRleValues)}return wE(e),e;case re.RLE:return hI(e,t,r);case re.NONE:return r&&bE(e),e;default:throw Error(`The specified Logical level technique is not supported: ${t.logicalLevelTechnique1}`)}}function lI(e,t){if(t.logicalLevelTechnique1===re.DELTA&&t.logicalLevelTechnique2===re.NONE)return ME(e);if(t.logicalLevelTechnique1===re.RLE&&t.logicalLevelTechnique2===re.NONE){let r=t;return CE(e,r.runs,r.numRleValues)}if(t.logicalLevelTechnique1===re.NONE&&t.logicalLevelTechnique2===re.NONE){IE(e);let r=new Uint32Array(t.numValues+1);return r[0]=0,r.set(e,1),r}if(t.logicalLevelTechnique1===re.DELTA&&t.logicalLevelTechnique2===re.RLE){let r=t,i=PE(e,r.runs,r.numRleValues);return fc(i),new Uint32Array(i)}throw Error(\"Only delta encoding is supported for transforming length to offset streams yet.\")}function Wo(e,t,r,i,a=\"int32\"){let n=e.logicalLevelTechnique1;if(n===re.RLE)return e.runs===1?be.CONST:be.FLAT;if(n!==re.DELTA||e.logicalLevelTechnique2!==re.RLE)return e.numValues===1?be.CONST:be.FLAT;let s=t instanceof lr?t.size():t,o=e;if(o.numRleValues!==s)return be.FLAT;if(o.runs===1)return be.SEQUENCE;if(o.runs!==2)return e.numValues===1?be.CONST:be.FLAT;let l=i.get();if(e.physicalLevelTechnique===Yt.VARINT)return uI(r,i,a)?be.SEQUENCE:e.numValues===1?be.CONST:be.FLAT;let u=i.get(),h=new Int32Array(r.buffer,r.byteOffset+u,4);return i.set(l),h[2]===2&&h[3]===2?be.SEQUENCE:e.numValues===1?be.CONST:be.FLAT}function uI(e,t,r){let i=new By(t.get());if(r===\"int64\"){let n=dc(e,i,4);return n[2]===2n&&n[3]===2n}let a=pt(e,i,4);return a[2]===2&&a[3]===2}function hI(e,t,r){return r?EE(e,t.runs,t.numRleValues):Ny(e,t.runs,t.numRleValues)}var Ky=class extends Zo{getValueFromBuffer(e){return this.dataBuffer[e]}},Jy=class extends Ry{constructor(e,t,r,i,a){super(e,a?BigInt64Array.of(t):BigUint64Array.of(t),r,i)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}};function _c(e,t,r){return{x:uf(e,t)-r,y:uf(e>>1,t)-r}}function uf(e,t){let r=0;for(let i=0;i<t;i++)r|=(e&1<<2*i)>>i;return r}var ct;(function(e){e[e.POINT=0]=\"POINT\",e[e.LINESTRING=1]=\"LINESTRING\",e[e.POLYGON=2]=\"POLYGON\",e[e.MULTIPOINT=3]=\"MULTIPOINT\",e[e.MULTILINESTRING=4]=\"MULTILINESTRING\",e[e.MULTIPOLYGON=5]=\"MULTIPOLYGON\"})(ct||(ct={}));var cI;(function(e){e[e.POINT=0]=\"POINT\",e[e.LINESTRING=1]=\"LINESTRING\",e[e.POLYGON=2]=\"POLYGON\"})(cI||(cI={}));var Xi;(function(e){e[e.MORTON=0]=\"MORTON\",e[e.VEC_2=1]=\"VEC_2\",e[e.VEC_3=2]=\"VEC_3\"})(Xi||(Xi={}));function pI(e){let t=Array(e.numGeometries),r=1,i=1,a=1,n=0,s=0,o=0,l=e.mortonSettings,u=e.topologyVector,h=u.geometryOffsets,c=u.partOffsets,p=u.ringOffsets,d=e.vertexOffsets,f=!d||d.length===0,m=e.containsPolygonGeometry(),g=e.vertexBuffer;for(let y=0;y<e.numGeometries;y++){let _=e.geometryType(y);switch(_){case ct.POINT:{let x,v;if(f)x=g[s++],v=g[s++];else if(e.vertexBufferType===Xi.MORTON){let w=g[d[o++]],b=_c(w,l.numBits,l.coordinateShift);x=b.x,v=b.y}else{let w=d[o++]*2;x=g[w],v=g[w+1]}t[n++]=[[new C(x,v)]],h&&a++,c&&r++,p&&i++}break;case ct.MULTIPOINT:{let x=h[a]-h[a-1];a++;let v;if(f){v=Array(x);for(let w=0;w<x;w++){let b=g[s++],T=g[s++];v[w]=new C(b,T)}}else v=Ai(e.vertexBufferType,g,d,o,x,!1,l),o+=x;t[n++]=v.map(w=>[w]),r+=x,i+=x}break;case ct.LINESTRING:{let x;m?(x=p[i]-p[i-1],i++):x=c[r]-c[r-1],r++;let v;f?(v=na(g,s,x,!1),s+=x*2):(v=Ai(e.vertexBufferType,g,d,o,x,!1,l),o+=x),t[n++]=[v],h&&a++}break;case ct.POLYGON:{let x=c[r]-c[r-1];r++;let v=Array(x-1),w,b=p[i]-p[i-1];if(i++,f){w=na(g,s,b,!0),s+=b*2;for(let T=0;T<v.length;T++)b=p[i]-p[i-1],i++,v[T]=na(g,s,b,!0),s+=b*2}else{w=Ai(e.vertexBufferType,g,d,o,b,!0,l),o+=b;for(let T=0;T<v.length;T++)b=p[i]-p[i-1],i++,v[T]=Ai(e.vertexBufferType,g,d,o,b,!0,l),o+=b}t[n++]=[w].concat(v),h&&a++}break;case ct.MULTILINESTRING:{let x=h[a]-h[a-1];a++;let v=Array(x);for(let w=0;w<x;w++){let b;if(m?(b=p[i]-p[i-1],i++):b=c[r]-c[r-1],r++,f)v[w]=na(g,s,b,!1),s+=b*2;else{let T=Ai(e.vertexBufferType,g,d,o,b,!1,l);v[w]=T,o+=b}}t[n++]=v}break;case ct.MULTIPOLYGON:{let x=h[a]-h[a-1];a++;let v=Array(x);for(let w=0;w<x;w++){let b=c[r]-c[r-1];r++;let T,I=Array(b-1),S=p[i]-p[i-1];i++,f?(T=na(g,s,S,!0),s+=S*2):(T=Ai(e.vertexBufferType,g,d,o,S,!0,l),o+=S);for(let D=0;D<I.length;D++){let R=p[i]-p[i-1];i++,f?(I[D]=na(g,s,R,!0),s+=R*2):(I[D]=Ai(e.vertexBufferType,g,d,o,R,!0,l),o+=R)}v[w]=[T].concat(I)}t[n++]=v.flat()}break;default:throw Error(`The specified geometry type (${_}) is currently not supported.`)}}return t}function Ai(e,t,r,i,a,n,s){return e===Xi.MORTON?fI(t,r,i,a,n,s):dI(t,r,i,a,n)}function na(e,t,r,i){let a=Array(i?r+1:r);for(let n=0;n<r*2;n+=2){let s=e[t+n],o=e[t+n+1];a[n/2]=new C(s,o)}return i&&(a[a.length-1]=a[0]),a}function dI(e,t,r,i,a){let n=Array(a?i+1:i);for(let s=0;s<i*2;s+=2){let o=t[r+s/2]*2,l=e[o],u=e[o+1];n[s/2]=new C(l,u)}return a&&(n[n.length-1]=n[0]),n}function fI(e,t,r,i,a,n){let s=Array(a?i+1:i);for(let o=0;o<i;o++){let l=e[t[r+o]],u=_c(l,n.numBits,n.coordinateShift);s[o]=new C(u.x,u.y)}return a&&(s[s.length-1]=s[0]),s}var Qy=class{constructor(e,t,r,i,a){this._vertexBufferType=e,this._topologyVector=t,this._vertexOffsets=r,this._vertexBuffer=i,this._mortonSettings=a}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){let t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){let r=this.vertexOffsets[e],i=this.vertexBuffer[r],a=_c(i,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[a.x,a.y]}let t=this.vertexOffsets?this.vertexOffsets[e]*2:e*2;return[this.vertexBuffer[t],this.vertexBuffer[t+1]]}getGeometries(){return pI(this)}get mortonSettings(){return this._mortonSettings}};function mI(e,t,r,i,a){return new e_(e,t,Xi.VEC_2,r,i,a)}function gI(e,t,r,i,a,n){return new e_(e,t,Xi.MORTON,r,i,a,n)}var e_=class extends Qy{constructor(e,t,r,i,a,n,s){super(r,i,a,n,s),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===ct.POLYGON||this._geometryType===ct.MULTIPOLYGON}containsSingleGeometryType(){return!0}};function t_(e,t,r,i){return new r_(Xi.VEC_2,e,t,r,i)}function yI(e,t,r,i,a){return new r_(Xi.MORTON,e,t,r,i,a)}var r_=class extends Qy{constructor(e,t,r,i,a,n){super(e,r,i,a,n),this._geometryTypes=t}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let e=0;e<this.numGeometries;e++)if(this.geometryType(e)===ct.POLYGON||this.geometryType(e)===ct.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},i_=class{constructor(e,t,r,i){this._triangleOffsets=e,this._indexBuffer=t,this._vertexBuffer=r,this._topologyVector=i}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error(\"Cannot convert GpuVector to coordinates without topology information\");let e=new Uint32Array(this.numGeometries);for(let t=0;t<this.numGeometries;t++)e[t]=this.geometryType(t);return t_(e,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};function hf(e,t,r,i,a,n){return new _I(e,t,r,i,a,n)}var _I=class extends i_{constructor(e,t,r,i,a,n){super(r,i,a,n),this._numGeometries=e,this._geometryType=t}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};function cf(e,t,r,i,a){return new xI(e,t,r,i,a)}var xI=class extends i_{constructor(e,t,r,i,a){super(t,r,i,a),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function vI(e,t,r,i,a){let n=Se(e,r),s=Wo(n,i,e,r),o,l,u,h;if(s===be.CONST){let x=gc(e,r,n),v,w,b,T;for(let I=0;I<t-1;I++){let S=Se(e,r);switch(S.physicalStreamType){case $e.LENGTH:switch(S.logicalStreamType.lengthType){case Je.GEOMETRIES:v=si(e,r,S);break;case Je.PARTS:w=si(e,r,S);break;case Je.RINGS:b=si(e,r,S);break;case Je.TRIANGLES:T=si(e,r,S)}break;case $e.OFFSET:switch(S.logicalStreamType.offsetType){case zr.VERTEX:o=ut(e,r,S);break;case zr.INDEX:h=ut(e,r,S)}break;case $e.DATA:if(Tt.VERTEX===S.logicalStreamType.dictionaryType)l=eo(e,r,S,a);else{let D=S;u={numBits:D.numBits,coordinateShift:D.coordinateShift},l=ut(e,r,S,a)}}}return h?v!==void 0||w!==void 0?hf(i,x,T,h,l,{geometryOffsets:v,partOffsets:w,ringOffsets:b}):hf(i,x,T,h,l):u===void 0?mI(i,x,{geometryOffsets:v,partOffsets:w,ringOffsets:b},o,l):gI(i,x,{geometryOffsets:v,partOffsets:w,ringOffsets:b},o,l,u)}let c=ut(e,r,n),p,d,f,m;for(let x=0;x<t-1;x++){let v=Se(e,r);switch(v.physicalStreamType){case $e.LENGTH:switch(v.logicalStreamType.lengthType){case Je.GEOMETRIES:p=ut(e,r,v);break;case Je.PARTS:d=ut(e,r,v);break;case Je.RINGS:f=ut(e,r,v);break;case Je.TRIANGLES:m=si(e,r,v)}break;case $e.OFFSET:switch(v.logicalStreamType.offsetType){case zr.VERTEX:o=ut(e,r,v);break;case zr.INDEX:h=ut(e,r,v)}break;case $e.DATA:if(Tt.VERTEX===v.logicalStreamType.dictionaryType)l=eo(e,r,v,a);else{let w=v;u={numBits:w.numBits,coordinateShift:w.coordinateShift},l=ut(e,r,v,a)}}}let g,y,_;return p?(g=Jl(c,p,2),d&&f?(y=pf(c,g,d,!1),_=wI(c,g,y,f)):d&&(y=bI(c,g,d))):d&&f?(y=Jl(c,d,1),_=pf(c,y,f,!0)):d&&(y=Jl(c,d,0)),h&&!y?cf(c,m,h,l):h?cf(c,m,h,l,{geometryOffsets:g,partOffsets:y,ringOffsets:_}):u===void 0?t_(c,{geometryOffsets:g,partOffsets:y,ringOffsets:_},o,l):yI(c,{geometryOffsets:g,partOffsets:y,ringOffsets:_},o,l,u)}function Jl(e,t,r){let i=new Uint32Array(e.length+1),a=0;i[0]=a;let n=0;for(let s=0;s<e.length;s++)a=i[s+1]=a+(e[s]>r?t[n++]:1);return i}function pf(e,t,r,i){let a=new Uint32Array(t[t.length-1]+1),n=0;a[0]=n;let s=1,o=0;for(let l=0;l<e.length;l++){let u=e[l],h=t[l+1]-t[l];if(u===5||u===2||i&&(u===4||u===1))for(let c=0;c<h;c++)n=a[s++]=n+r[o++];else for(let c=0;c<h;c++)a[s++]=++n}return a}function bI(e,t,r){let i=new Uint32Array(t[t.length-1]+1),a=0;i[0]=a;let n=1,s=0;for(let o=0;o<e.length;o++){let l=e[o],u=t[o+1]-t[o];if(l===4||l===1)for(let h=0;h<u;h++)a=i[n++]=a+r[s++];else for(let h=0;h<u;h++)i[n++]=++a}return i}function wI(e,t,r,i){let a=new Uint32Array(r[r.length-1]+1),n=0;a[0]=n;let s=1,o=1,l=0;for(let u=0;u<e.length;u++){let h=e[u],c=t[u+1]-t[u];if(h!==0&&h!==3)for(let p=0;p<c;p++){let d=r[s]-r[s-1];s++;for(let f=0;f<d;f++)n=a[o++]=n+i[l++]}else for(let p=0;p<c;p++)a[o++]=++n,s++}return a}var TI=class extends Zi{constructor(e,t,r){super(e,t.getBuffer(),r),this.dataVector=t}getValueFromBuffer(e){return this.dataVector.get(e)}},SI=class extends Zo{getValueFromBuffer(e){return this.dataBuffer[e]}},a_=class extends Zi{constructor(e,t,r,i){super(e,i?BigInt64Array.of(t):BigUint64Array.of(t),r)}getValueFromBuffer(e){return this.dataBuffer[0]}},xc=class extends Zi{constructor(e,t,r,i){super(e,r,i),this.offsetBuffer=t}},df=class extends xc{constructor(e,t,r,i){super(e,t,r,i??t.length-1)}getValueFromBuffer(e){let t=this.offsetBuffer[e],r=this.offsetBuffer[e+1];return mc(this.dataBuffer,t,r)}},ga=class extends xc{constructor(e,t,r,i,a){super(e,r,i,a??t.length),this.indexBuffer=t,this.indexBuffer=t}getValueFromBuffer(e){let t=this.indexBuffer[e],r=this.offsetBuffer[t],i=this.offsetBuffer[t+1];return mc(this.dataBuffer,r,i)}};function EI(e,t){let r=0;for(let i=0;i<t.length;i++){let a=t[i];a===255?(r++,i++):r+=e[a]}return r}function II(e,t,r){let i=new Uint32Array(t.length);for(let s=1;s<t.length;s++)i[s]=i[s-1]+t[s-1];let a=new Uint8Array(EI(t,r)),n=0;for(let s=0;s<r.length;s++){let o=r[s];if(o===255)s++,a[n++]=r[s];else{let l=t[o],u=i[o];for(;l-- >0;)a[n++]=e[u++]}}return a}var n_=class extends xc{constructor(e,t,r,i,a,n,s,o){super(e,r,i,s??t.length),this.indexBuffer=t,this.symbolOffsetBuffer=a,this.symbolTableBuffer=n,this.sharedDictionaryCache=o}getValueFromBuffer(e){this.decodedDictionary??(this.decodedDictionary=this.sharedDictionaryCache?.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let t=this.indexBuffer[e],r=this.offsetBuffer[t],i=this.offsetBuffer[t+1];return mc(this.decodedDictionary,r,i)}decodeDictionary(){return this.symbolLengthBuffer??(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),II(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(e){let t=new Uint32Array(e.length-1),r=e[0];for(let i=1;i<e.length;i++){let a=e[i];t[i-1]=a-r,r=a}return t}};function s_(e,t,r,i,a){let n,s,o,l,u,h=a,c,p;for(let d=0;d<i;d++){let f=Se(t,r);switch(f.physicalStreamType){case $e.PRESENT:{let m=new lr(Ua(t,f.numValues,f.byteLength,r),f.numValues);h=a??m;break}case $e.OFFSET:s=ut(t,r,f,void 0,h);break;case $e.LENGTH:{let m=si(t,r,f);Je.DICTIONARY===f.logicalStreamType.lengthType?n=m:Je.SYMBOL===f.logicalStreamType.lengthType?l=m:c=m;break}case $e.DATA:{let m=t.subarray(r.get(),r.get()+f.byteLength);r.add(f.byteLength);let g=f.logicalStreamType.dictionaryType;Tt.FSST===g?u=m:Tt.SINGLE===g||Tt.SHARED===g?o=m:Tt.NONE===g&&(p=m);break}}}return AI(e,u,s,n,o,l,h)??MI(e,o,s,n,h)??PI(e,c,p,s,h)}function AI(e,t,r,i,a,n,s){if(t){if(!r||!i||!a||!n)throw Error(`Incomplete FSST dictionary string column \"${e}\"`);return new n_(e,r,i,a,n,t,s)}}function MI(e,t,r,i,a){if(t){if(!r||!i)throw Error(`Incomplete dictionary string column \"${e}\"`);return a?new ga(e,r,i,t,a):new ga(e,r,i,t)}}function PI(e,t,r,i,a){if(!(!t||!r)){if(i)return a?new ga(e,i,t,r,a):new ga(e,i,t,r);if(a&&a.size()!==t.length-1){let n=new Uint32Array(a.size()),s=0;for(let o=0;o<a.size();o++)a.get(o)?n[o]=s++:n[o]=0;return new ga(e,n,t,r,a)}return a?new df(e,t,r,a):new df(e,t,r)}}function CI(e,t,r,i){let a,n,s,o,l=!1;for(;!l;){let d=Se(e,t);switch(d.physicalStreamType){case $e.LENGTH:Je.DICTIONARY===d.logicalStreamType.lengthType?a=si(e,t,d):s=si(e,t,d);break;case $e.DATA:Tt.SINGLE===d.logicalStreamType.dictionaryType||Tt.SHARED===d.logicalStreamType.dictionaryType?(n=e.subarray(t.get(),t.get()+d.byteLength),l=!0):o=e.subarray(t.get(),t.get()+d.byteLength),t.add(d.byteLength)}}if(r.type!==\"complexType\")throw Error(`Shared dictionary column ${r.name} must be a complex (struct) column.`);if(!a||!n)throw Error(`Incomplete shared dictionary for column \"${r.name}\"`);let u=r.complexType.children,h=[],c=o?{}:void 0,p=0;for(let d of u){let f=pt(e,t,1)[0];if(f===0)continue;let m=d.name?`${r.name}${d.name}`:r.name;if(i&&!i.has(m)){$y(f,e,t);continue}if(d.type!==\"scalarField\"||d.scalarField.physicalType!==le.STRING)throw Error(\"Currently only scalar string fields are implemented for a struct.\");if(f>1&&!d.nullable||f===1&&d.nullable)throw Error(`The number of streams for the child field ${d.name} does not match its nullability. nullibilty: ${d.nullable}, numStreams: ${f}`);let g;if(d.nullable){let _=Se(e,t);g=new lr(Ua(e,_.numValues,_.byteLength,t),_.numValues)}let y=ut(e,t,Se(e,t),void 0,g);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column \"${m}\"`);h[p++]=new n_(m,y,a,n,s,o,g,c)}else h[p++]=new ga(m,y,a,n,g)}return h}var ff=class extends Zi{constructor(e,t,r){super(e,new Uint8Array,r??t.length),this.values=t}getValueFromBuffer(e){return this.values[e]}},Rr;(function(e){e[e.STRING=1]=\"STRING\",e[e.INT32=2]=\"INT32\",e[e.UINT32=4]=\"UINT32\",e[e.INT64=8]=\"INT64\",e[e.UINT64=16]=\"UINT64\",e[e.FLOAT=32]=\"FLOAT\",e[e.DOUBLE=64]=\"DOUBLE\",e[e.PRESENCE=128]=\"PRESENCE\"})(Rr||(Rr={}));var ki;(function(e){e[e.FALSE=0]=\"FALSE\",e[e.TRUE=1]=\"TRUE\",e[e.START_MAP=2]=\"START_MAP\",e[e.START_LIST=3]=\"START_LIST\",e[e.COUNT=4]=\"COUNT\"})(ki||(ki={}));function kI(e,t,r,i){let a=DI(r);if(i===0)return a.map(h=>new ff(h,[]));let n=FI(e,t,i),s=(n.presentStream?n.presentCount:n.lengthStream.length)/a.length,o=[],l=0,u=0;for(let h=0;h<a.length;h++){let c=OI(n,h,s,l,u);o.push(new ff(a[h],c.value,c.nullabilityBuffer)),l=c.countsEnd,u=c.valuesEnd}return o}function DI(e){let t=e.type===\"complexType\"?e.complexType.children:void 0;return!t||t.length===0?[e.name]:t.map(r=>e.name+(r.name??\"\"))}function FI(e,t,r){let i=e[t.get()];t.add(1);let a=ut(e,t,Se(e,t)),n=r-1,s=[];i&Rr.STRING&&(n-=zI(e,t,s)),n-=RI(e,t,i,s),n-=LI(e,t,i,s);let o,l=0;if(i&Rr.PRESENCE){let h=BI(e,t);o=h.value,l=h.count,n--}let u=new Uint32Array;if(n>0&&(u=ut(e,t,Se(e,t)),n--),n!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${n}`);return{lengthStream:a,dictionary:s,presentStream:o,presentCount:l,flattenedValues:u}}function zI(e,t,r){let i=e[t.get()];t.add(1);let a=s_(\"\",e,t,i);if(a)for(let n=0;n<a.size;n++)r.push(a.getValue(n));return i}function RI(e,t,r,i){let a=0;return r&Rr.INT32?(ca(i,eo(e,t,Se(e,t))),a++):r&Rr.INT64&&(ca(i,Wy(e,t,Se(e,t))),a++),r&Rr.UINT32?(ca(i,ut(e,t,Se(e,t))),a++):r&Rr.UINT64&&(ca(i,yc(e,t,Se(e,t))),a++),a}function LI(e,t,r,i){let a=0;return r&Rr.FLOAT&&(ca(i,jy(e,t,Se(e,t).numValues)),a++),r&Rr.DOUBLE&&(ca(i,Gy(e,t,Se(e,t).numValues)),a++),a}function BI(e,t){let r=Se(e,t);if(r.physicalStreamType!==$e.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${r.physicalStreamType}`);let i=r.numValues,a=t.get(),n=new lr(Ua(e,i,r.byteLength,t),i);return t.set(a+r.byteLength),{value:n,count:i}}function OI(e,t,r,i,a){let{lengthStream:n,flattenedValues:s,presentStream:o,dictionary:l}=e,u=t*r,h=r,c;if(o){c=new lr(new Uint8Array(Math.ceil(r/8)),r),h=0;for(let _=0;_<r;_++)o.get(u+_)&&(c.set(_,!0),h++)}let p=i+h;if(p>n.length)throw Error(\"Merged map counts underflow while decoding child streams\");let d=Array(r),f=i,m=a;for(let _=0;_<r;_++){if(o&&!o.get(u+_)){d[_]=null;continue}let x=m+n[f++];if(x>s.length)throw Error(\"Map value stream underflow while decoding feature payload\");let v=VI(s,m,x,l);d[_]=v.value,m=v.nextIndex}let g=0;for(let _=i;_<p;_++)g+=n[_];let y=a+g;if(m!==y)throw Error(\"Unused flattened map values remain after decode\");return{value:d,nullabilityBuffer:c,countsEnd:p,valuesEnd:y}}function VI(e,t,r,i){return r-t===1||e[t]===ki.START_LIST?vc(e,t,r,i):o_(e,t,r,i)}function o_(e,t,r,i){let a=Object.create(null),n=t;for(;n<r;){let s=l_(e[n++],i);if(typeof s!=\"string\")throw Error(`Map key dictionary index does not resolve to a string: ${s}`);let o=vc(e,n,r,i);a[s]=o.value,n=o.nextIndex}return{value:a,nextIndex:n}}function vc(e,t,r,i){if(t>=r)throw Error(\"Unexpected end of map value stream\");let a=e[t];if(a===ki.FALSE)return{value:!1,nextIndex:t+1};if(a===ki.TRUE)return{value:!0,nextIndex:t+1};if(a===ki.START_MAP){let n=mf(e,t,r);return{value:o_(e,t+2,n,i).value,nextIndex:n}}if(a===ki.START_LIST){let n=mf(e,t,r),s=[],o=t+2;for(;o<n;){let l=vc(e,o,n,i);s.push(l.value),o=l.nextIndex}return{value:s,nextIndex:n}}return{value:l_(a,i),nextIndex:t+1}}function mf(e,t,r){if(t+1>=r)throw Error(\"Missing length for nested map/list payload\");let i=e[t+1];if(i<2)throw Error(`Invalid nested payload length: ${i}`);let a=t+i;if(a>r)throw Error(\"Nested payload exceeds containing payload bounds\");return a}function l_(e,t){let r=e-ki.COUNT;if(r<0||r>=t.length)throw Error(`Scalar dictionary index out of range: ${e}`);return t[r]}function ca(e,t){for(let r of t)e.push(r)}function NI(e,t,r,i,a,n){return r.type===\"scalarType\"?n&&!n.has(r.name)?($y(i,e,t),null):UI(i,e,t,a,r.scalarType,r):r.complexType?.physicalType===hi.MAP?kI(e,t,r,i):i===0?null:CI(e,t,r,n)}function UI(e,t,r,i,a,n){let s;if(e===0)return null;if(n.nullable){let l=Se(t,r),u=l.numValues,h=r.get(),c=Ua(t,u,l.byteLength,r);r.set(h+l.byteLength),s=new lr(c,l.numValues)}let o=s??i;switch(a.physicalType){case le.UINT_32:case le.INT_32:return ZI(t,r,n,a,o);case le.STRING:{let l=n.nullable?e-1:e;return s_(n.name,t,r,l,s)??null}case le.BOOLEAN:return $I(t,r,n,i,o);case le.UINT_64:case le.INT_64:return qI(t,r,n,o,a);case le.FLOAT:return jI(t,r,n,o);case le.DOUBLE:return GI(t,r,n,o);default:throw Error(`The specified data type for the field is currently not supported: ${a}`)}}function $I(e,t,r,i,a){let n=Se(e,t),s=n.numValues,o=t.get(),l=is(a)?a:void 0,u=Ua(e,s,n.byteLength,t,l);t.set(o+n.byteLength);let h=new lr(u,s);return new TI(r.name,h,a)}function jI(e,t,r,i){let a=Se(e,t),n=is(i)?i:void 0,s=jy(e,t,a.numValues,n);return new SI(r.name,s,i)}function GI(e,t,r,i){let a=Se(e,t),n=is(i)?i:void 0,s=Gy(e,t,a.numValues,n);return new lc(r.name,s,i)}function qI(e,t,r,i,a){let n=Se(e,t),s=Wo(n,i,e,t,\"int64\"),o=a.physicalType===le.INT_64;if(s===be.FLAT){let u=is(i)?i:void 0,h=o?Wy(e,t,n,u):yc(e,t,n,u);return new Ky(r.name,h,i)}if(s===be.SEQUENCE){let u=Zy(e,t,n);return new Jy(r.name,u[0],u[1],n.numRleValues,o)}let l=o?aI(e,t,n):Xy(e,t,n);return new a_(r.name,l,i,o)}function ZI(e,t,r,i,a){let n=Se(e,t),s=Wo(n,a,e,t),o=i.physicalType===le.INT_32;if(s===be.FLAT){let u=is(a)?a:void 0,h=o?eo(e,t,n,void 0,u):ut(e,t,n,void 0,u);return new oc(r.name,h,a)}if(s===be.SEQUENCE){let u=qy(e,t,n);return new uc(r.name,u[0],u[1],n.numRleValues,o)}let l=o?tI(e,t,n):gc(e,t,n);return new hc(r.name,l,a,o)}function is(e){return e instanceof lr}var Ke={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function u_(e){switch(e){case Ke.ID:case Ke.ID|Ke.ID_NULLABLE:case Ke.ID|Ke.ID_LONG:case Ke.ID|Ke.ID_LONG|Ke.ID_NULLABLE:return{nullable:(e&Ke.ID_NULLABLE)!==0,columnScope:pn.FEATURE,type:\"scalarType\",scalarType:{longID:(e&Ke.ID_LONG)!==0,type:\"logicalType\",logicalType:Ly.ID}};case Ke.GEOMETRY:return{nullable:!1,columnScope:pn.FEATURE,type:\"complexType\",complexType:{type:\"physicalType\",physicalType:hi.GEOMETRY,children:[]}};case Ke.STRUCT:return{nullable:!1,columnScope:pn.FEATURE,type:\"complexType\",complexType:{type:\"physicalType\",physicalType:hi.STRUCT,children:[]}};case Ke.MAP:return{nullable:!0,columnScope:pn.FEATURE,type:\"complexType\",complexType:{type:\"physicalType\",physicalType:hi.MAP,children:[]}};default:return KI(e)}}function WI(e){return e>=Ke.SCALAR_BASE}function h_(e){return e===Ke.STRUCT||e===Ke.MAP}function XI(e){if(e.type===\"scalarType\"){let t=e.scalarType;if(t.type===\"physicalType\")switch(t.physicalType){case le.BOOLEAN:case le.INT_8:case le.UINT_8:case le.INT_32:case le.UINT_32:case le.INT_64:case le.UINT_64:case le.FLOAT:case le.DOUBLE:return!1;case le.STRING:return!0;default:return!1}if(t.type===\"logicalType\")return!1}else if(e.type===\"complexType\"){let t=e.complexType;if(t.type===\"physicalType\")switch(t.physicalType){case hi.GEOMETRY:case hi.STRUCT:case hi.MAP:return!0;default:return!1}}return console.warn(\"Unexpected column type in hasStreamCount\",e),!1}function HI(e){return e.type===\"scalarType\"&&e.scalarType?.type===\"logicalType\"&&e.scalarType.logicalType===Ly.ID}function YI(e){return e.type===\"complexType\"&&e.complexType?.type===\"physicalType\"&&e.complexType.physicalType===hi.GEOMETRY}function KI(e){let t;switch(e){case 10:case 11:t=le.BOOLEAN;break;case 12:case 13:t=le.INT_8;break;case 14:case 15:t=le.UINT_8;break;case 16:case 17:t=le.INT_32;break;case 18:case 19:t=le.UINT_32;break;case 20:case 21:t=le.INT_64;break;case 22:case 23:t=le.UINT_64;break;case 24:case 25:t=le.FLOAT;break;case 26:case 27:t=le.DOUBLE;break;case 28:case 29:t=le.STRING;break;default:return null}return{nullable:!!(e&1),columnScope:pn.FEATURE,type:\"scalarType\",scalarType:{longID:!1,type:\"physicalType\",physicalType:t}}}var JI=new TextDecoder,gf=\"0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)\";function bc(e,t){let r=pt(e,t,1)[0];if(r===0)return\"\";let i=t.get(),a=i+r,n=e.subarray(i,a);return t.add(r),JI.decode(n)}function QI(e){let t=e.name,r=e.nullable;return e.type===\"scalarType\"?{type:\"scalarField\",scalarField:e.scalarType,name:t,nullable:r}:{type:\"complexField\",complexField:e.complexType,name:t,nullable:r}}function c_(e,t){let r=pt(e,t,1)[0]>>>0,i=r>=Ke.SCALAR_BASE?u_(r):null;if(!i)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let a={...i,name:bc(e,t)};if(a.type===\"complexType\"&&h_(r)){let n=a.complexType,s=pt(e,t,1)[0]>>>0;n.children=Array(s);for(let o=0;o<s;o++)n.children[o]=c_(e,t)}return QI(a)}function eA(e,t){let r=pt(e,t,1)[0]>>>0,i=u_(r);if(!i)throw Error(`Unsupported column type code ${r}. Supported: ${gf}`);let a;if(WI(r))a=bc(e,t);else if(r<Ke.GEOMETRY)a=\"id\";else if(r===Ke.GEOMETRY)a=\"geometry\";else throw Error(`Unsupported column type code ${r}. Supported: ${gf}`);let n={...i,name:a};if(n.type===\"complexType\"&&h_(r)){let s=pt(e,t,1)[0]>>>0,o=n.complexType;o.children=Array(s);for(let l=0;l<s;l++)o.children[l]=c_(e,t)}return n}function tA(e,t){let r={};r.featureTables=[];let i={};if(i.name=bc(e,t),i.name.length===0)throw Error(\"Missing layer name\");let a=pt(e,t,1)[0]>>>0,n=pt(e,t,1)[0]>>>0;i.columns=Array(n);for(let s=0;s<n;s++)i.columns[s]=eA(e,t);return r.featureTables.push(i),[r,a]}function rA(e,t,r=!0){let i=new By(0),a=[];for(;i.get()<e.length;){let n=pt(e,i,1)[0]>>>0,s=i.get()+n;if(s>e.length)throw Error(`Block overruns tile: ${s} > ${e.length}`);let o=pt(e,i,1)[0]>>>0;if(o!==1&&o!==2){i.set(s);continue}let[l,u]=tA(e,i),h=l.featureTables[0],c=null,p=null,d=[],f=0;for(let g of h.columns){let y=g.name;if(HI(g)){let _=null;if(g.nullable){let v=Se(e,i),w=i.get(),b=Ua(e,v.numValues,v.byteLength,i);i.set(w+v.byteLength),_=new lr(b,v.numValues)}let x=Se(e,i);f=_?_.size():x.decompressedCount,c=iA(e,g,i,y,x,_??f,r)}else if(YI(g)){let _=pt(e,i,1)[0];if(f===0){let x=i.get();f=Se(e,i).decompressedCount,i.set(x)}t&&(t.scale=t.extent/u),p=vI(e,_,i,f,t)}else{let _=XI(g)?pt(e,i,1)[0]:1;if(_===0)continue;let x=NI(e,i,g,_,f,void 0);if(x)if(Array.isArray(x))for(let v of x)d.push(v);else d.push(x)}}let m=new ES(h.name,p,c,d,u);a.push(m),i.set(s)}return a}function iA(e,t,r,i,a,n,s=!1){let o=t.scalarType?.longID?le.UINT_64:le.UINT_32,l=typeof n==\"number\"?void 0:n,u=Wo(a,n,e,r,o===le.UINT_64?\"int64\":\"int32\");if(o===le.UINT_32)switch(u){case be.FLAT:return new oc(i,ut(e,r,a,void 0,l),n);case be.SEQUENCE:{let h=qy(e,r,a);return new uc(i,h[0],h[1],a.numRleValues,!1)}case be.CONST:return new hc(i,gc(e,r,a),n,!1)}switch(u){case be.FLAT:return s?new lc(i,rI(e,r,a,l),n):new Ky(i,yc(e,r,a,l),n);case be.SEQUENCE:{let h=Zy(e,r,a);return new Jy(i,h[0],h[1],a.numRleValues,!1)}case be.CONST:return new a_(i,Xy(e,r,a),n,!1)}throw Error(\"Vector type not supported for id column.\")}var aA=class{constructor(e,t){switch(this._featureData=e,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case ct.POINT:case ct.MULTIPOINT:this.type=1;break;case ct.LINESTRING:case ct.MULTILINESTRING:this.type=2;break;case ct.POLYGON:case ct.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=t,this.id=Number(this._featureData.id)}loadGeometry(){let e=[];for(let t of this._featureData.geometry.coordinates){let r=[];for(let i of t)r.push(new C(i.x,i.y));e.push(r)}return e}},nA=class{constructor(e){this.features=[],this.featureTable=e,this.name=e.name,this.extent=e.extent,this.version=2,this.features=e.getFeatures(),this.length=this.features.length}feature(e){return new aA(this.features[e],this.extent)}},sA=class{constructor(e){this.layers={};let t=rA(new Uint8Array(e));this.layers=t.reduce((r,i)=>({...r,[i.name]:new nA(i)}),{})}},oA=class{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new pu(z,16,0),this.grid3D=new pu(z,16,0),this.featureIndexArray=new $g,this.promoteId=t}insert(e,t,r,i,a,n){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,a);let o=n?this.grid3D:this.grid;for(let l of t){let u=[1/0,1/0,-1/0,-1/0];for(let h of l)u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&o.insert(s,u[0],u[1],u[2],u[3])}}loadVTLayers(){if(!this.vtLayers){switch(this.encoding){case\"mlt\":this.vtLayers=new sA(this.rawTileData).layers;break;default:this.vtLayers=new yT(new Iy(this.rawTileData)).layers}this.sourceLayerCoder=new SS(this.vtLayers?Object.keys(this.vtLayers).sort():[ts])}return this.vtLayers}query(e,t,r,i){this.loadVTLayers();let a=e.params,n=z/e.tileSize/e.scale,s=wa(a.filter,\"queryRenderedFeatures filter\",a.globalState),o=e.queryGeometry,l=e.queryPadding*n,u=or.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=or.fromPoints(e.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(m,g,y,_)=>s2(e.cameraQueryGeometry,m-l,g-l,y+l,_+l));for(let m of p)h.push(m);h.sort(lA);let d={},f;for(let m of h){if(m===f)continue;f=m;let g=this.featureIndexArray.get(m),y=null;this.loadMatchingFeature(d,g.bucketIndex,g.sourceLayerIndex,g.featureIndex,s,a.layers,a.availableImages,t,r,i,(_,x,v)=>(y||(y=ji(_)),x.queryIntersectsFeature({queryGeometry:o,feature:_,featureState:v,geometry:y,zoom:this.z,transform:e.transform,pixelsToTileUnits:n,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation})))}return d}loadMatchingFeature(e,t,r,i,a,n,s,o,l,u,h){let c=this.bucketLayerIDs[t];if(n&&!c.some(g=>n.has(g))||r>=this.sourceLayerCoder.size)return;let p=this.sourceLayerCoder.decode(r),d=this.vtLayers[p];if(!d||i>=d.length)return;let f=d.feature(i);if(a.needGeometry){let g=yi(f,!0);if(!a.filter(new Te(this.tileID.overscaledZ),g,this.tileID.canonical))return}else if(!a.filter(new Te(this.tileID.overscaledZ),f))return;let m=this.getId(f,p);for(let g of c){if(n&&!n.has(g))continue;let y=o[g];if(!y)continue;let _={};m&&u&&(_=u.getState(y.sourceLayer||\"_geojsonTileLayer\",m));let x=j({},l[g]);x.paint=yf(x.paint,y.paint,f,_,s),x.layout=yf(x.layout,y.layout,f,_,s);let v=!h||h(f,y,_);if(!v)continue;let w=new sc(f,this.z,this.x,this.y,m);w.layer=x;let b=e[g];b===void 0&&(b=e[g]=[]),b.push({featureIndex:i,feature:w,intersectionZ:v})}}lookupSymbolFeatures(e,t,r,i,a,n,s,o){let l={};this.loadVTLayers();let u=wa(a.filterSpec,\"queryRenderedFeatures symbol filter\",a.globalState);for(let h of e)this.loadMatchingFeature(l,r,i,h,u,n,s,o,t);return l}hasLayer(e){for(let t of this.bucketLayerIDs)for(let r of t)if(e===r)return!0;return!1}getId(e,t){let r=e.id;if(this.promoteId){let i=typeof this.promoteId==\"string\"?this.promoteId:this.promoteId[t];r=e.properties[i],typeof r==\"boolean\"&&(r=Number(r)),r===void 0&&e.properties?.cluster&&this.promoteId&&(r=Number(e.properties.cluster_id))}return r}};N(\"FeatureIndex\",oA,{omit:[\"rawTileData\",\"sourceLayerCoder\"]});function yf(e,t,r,i,a){return co(e,(n,s)=>{let o=t instanceof Do?t.get(s):null;return o?.evaluate?o.evaluate(r,i,a):o})}function lA(e,t){return t-e}function uA(e,t,r){return!(e<0||e>25||r<0||r>=2**e||t<0||t>=2**e)}function wc(e,t){let{x:r,y:i}=fe.fromLngLat(t);return!(e<0||e>25||i<0||i>=1||r<0||r>=1)}var as=class{constructor(e,t,r){if(!uA(e,t,r))throw Error(`x=${t}, y=${r}, z=${e} outside of bounds. 0<=x<${2**e}, 0<=y<${2**e} 0<=z<=25 `);this.z=e,this.x=t,this.y=r,this.key=zi(0,e,e,t,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,t,r){let i=hA(this.x,this.y,this.z),a=cA(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(r===\"tms\"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,t>1?\"@2x\":\"\").replace(/{quadkey}/g,a).replace(/{bbox-epsg-3857}/g,i)}isChildOf(e){let t=this.z-e.z;return t>0&&e.x===this.x>>t&&e.y===this.y>>t}getTilePoint(e){let t=2**this.z;return new C((e.x*t-this.x)*z,(e.y*t-this.y)*z)}toString(){return`${this.z}/${this.x}/${this.y}`}},ns=class{constructor(e,t){this.wrap=e,this.canonical=t,this.key=zi(e,t.z,t.z,t.x,t.y)}},nt=class qt{constructor(t,r,i,a,n){if(this.terrainRttPosMatrix32f=null,t<i)throw Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${i}`);this.overscaledZ=t,this.wrap=r,this.canonical=new as(i,+a,+n),this.key=zi(r,t,i,a,n)}clone(){return new qt(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-t;return t>this.canonical.z?new qt(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new qt(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(t,r){if(t>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-t;return t>this.canonical.z?zi(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):zi(this.wrap*+r,t,t,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(t){if(t.wrap!==this.wrap||this.overscaledZ-t.overscaledZ<=0)return!1;if(t.overscaledZ===0)return this.overscaledZ>0;let r=this.canonical.z-t.canonical.z;return r<0?!1:t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new qt(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=this.canonical.x*2,a=this.canonical.y*2;return[new qt(r,this.wrap,r,i,a),new qt(r,this.wrap,r,i+1,a),new qt(r,this.wrap,r,i,a+1),new qt(r,this.wrap,r,i+1,a+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new qt(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new qt(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new ns(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new fe(t.x-this.wrap,t.y))}normalizeCoordinates(t,r,i=z){if(t>=0&&t<i&&r>=0&&r<i)return{tileID:this,x:t,y:r};let a=Math.floor(t/i),n=Math.floor(r/i),s=t-a*i,o=r-n*i,l=this.canonical.z,u=1<<l,h=this.canonical.y+n;if(h<0||h>=u)return null;let c=this.canonical.x+a,p=this.wrap;return c<0?(p-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(p+=Math.floor(c/u),c%=u),{tileID:new qt(this.overscaledZ,p,l,c,h),x:s,y:o}}};function zi(e,t,r,i,a){e*=2,e<0&&(e=e*-1-1);let n=1<<r;return(n*n*e+n*a+i).toString(36)+r.toString(36)+t.toString(36)}var Ql=Math.PI*6378137;function hA(e,t,r){t=2**r-t-1;let i=_f(e*256,t*256,r),a=_f((e+1)*256,(t+1)*256,r);return`${i[0]},${i[1]},${a[0]},${a[1]}`}function _f(e,t,r){let i=2*Ql/256/2**r;return[e*i-Ql,t*i-Ql]}function cA(e,t,r){let i=\"\";for(let a=e;a>0;a--){let n=1<<a-1;i+=(t&n?1:0)+(r&n?2:0)}return i}function Tc(e,t){let r=Math.abs(e.wrap*2)-+(e.wrap<0),i=Math.abs(t.wrap*2)-+(t.wrap<0);return e.overscaledZ-t.overscaledZ||i-r||t.canonical.y-e.canonical.y||t.canonical.x-e.canonical.x}N(\"CanonicalTileID\",as),N(\"OverscaledTileID\",nt,{omit:[\"terrainRttPosMatrix32f\"]});var p_=class{constructor(e,t){this.max=e,this.onRemove=t,this.reset()}reset(){for(let e in this.data)for(let t of this.data[e])t.timeout&&clearTimeout(t.timeout),this.onRemove(t.value);return this.data={},this.order=[],this}add(e,t,r){let i=e.wrapped().key;this.data[i]===void 0&&(this.data[i]=[]);let a={value:t,timeout:void 0};if(r!==void 0&&(a.timeout=setTimeout(()=>{this.remove(e,a)},r)),this.data[i].push(a),this.order.push(i),this.order.length>this.max){let n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){let t=this.data[e].shift();return t.timeout&&clearTimeout(t.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),t.value}getByKey(e){let t=this.data[e];return t?t[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,t){if(!this.has(e))return this;let r=e.wrapped().key,i=t===void 0?0:this.data[r].indexOf(t),a=this.data[r][i];return this.data[r].splice(i,1),a.timeout&&clearTimeout(a.timeout),this.data[r].length===0&&delete this.data[r],this.onRemove(a.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){let t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t)}return this}filter(e){let t=[];for(let r in this.data)for(let i of this.data[r])e(i.value)||t.push(i);for(let r of t)this.remove(r.value.tileID,r)}};function d_(e,t,r,i,a){let n=[];for(let s of e){let o;for(let l=0;l<s.length-1;l++){let u=s[l],h=s[l+1];u.x<t&&h.x<t||(u.x<t?u=new C(t,u.y+(h.y-u.y)*((t-u.x)/(h.x-u.x)))._round():h.x<t&&(h=new C(t,u.y+(h.y-u.y)*((t-u.x)/(h.x-u.x)))._round()),!(u.y<r&&h.y<r)&&(u.y<r?u=new C(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round():h.y<r&&(h=new C(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round()),!(u.x>=i&&h.x>=i)&&(u.x>=i?u=new C(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round():h.x>=i&&(h=new C(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round()),!(u.y>=a&&h.y>=a)&&(u.y>=a?u=new C(u.x+(h.x-u.x)*((a-u.y)/(h.y-u.y)),a)._round():h.y>=a&&(h=new C(u.x+(h.x-u.x)*((a-u.y)/(h.y-u.y)),a)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],n.push(o)),o.push(h)))))}}return n}var pA=class f_ extends C{constructor(t,r,i,a){super(t,r),this.angle=i,a!==void 0&&(this.segment=a)}clone(){return new f_(this.x,this.y,this.angle,this.segment)}};N(\"Anchor\",pA);var Sc=(function(e){return e[e.center=1]=\"center\",e[e.left=2]=\"left\",e[e.right=3]=\"right\",e[e.top=4]=\"top\",e[e.bottom=5]=\"bottom\",e[e[\"top-left\"]=6]=\"top-left\",e[e[\"top-right\"]=7]=\"top-right\",e[e[\"bottom-left\"]=8]=\"bottom-left\",e[e[\"bottom-right\"]=9]=\"bottom-right\",e})({});function m_(e){switch(e){case\"right\":case\"top-right\":case\"bottom-right\":return\"right\";case\"left\":case\"top-left\":case\"bottom-left\":return\"left\"}return\"center\"}var T0=\"6.6.0\";function S0(){var e=new Ze(4);return Ze!=Float32Array&&(e[1]=0,e[2]=0),e[0]=1,e[3]=1,e}function dA(e,t){var r=t[0],i=t[1],a=t[2],n=t[3],s=r*n-a*i;return s?(s=1/s,e[0]=n*s,e[1]=-i*s,e[2]=-a*s,e[3]=r*s,e):null}function fA(e){return e[0]*e[3]-e[2]*e[1]}function mA(e,t,r){var i=t[0],a=t[1],n=t[2],s=t[3],o=Math.sin(r),l=Math.cos(r);return e[0]=i*l+n*o,e[1]=a*l+s*o,e[2]=i*-o+n*l,e[3]=a*-o+s*l,e}var Ec,g_,Ic,zt={frame(e,t,r,i){let a=i||window,n=a.requestAnimationFrame(o=>{s(),t(o)}),{unsubscribe:s}=Vs(e.signal,\"abort\",()=>{s(),a.cancelAnimationFrame(n),r(new Da(e.signal.reason))},!1)},frameAsync(e,t){return new Promise((r,i)=>{this.frame(e,r,i,t)})},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement(\"canvas\"),r=t.getContext(\"2d\",{willReadFrequently:!0});if(!r)throw Error(\"failed to create canvas 2d context\");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0,e.width,e.height),r},resolveURL(e){return Ec||(Ec=document.createElement(\"a\")),Ec.href=e,Ec.href},get hardwareConcurrency(){return typeof navigator<\"u\"&&navigator.hardwareConcurrency||4},get prefersReducedMotion(){return Ic===void 0?matchMedia?(g_??(g_=matchMedia(\"(prefers-reduced-motion: reduce)\")),g_.matches):!1:Ic},set prefersReducedMotion(e){Ic=e}},gA=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt===null?performance.now():this._frozenAt}setNow(e){this._frozenAt=e}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function ye(){return gA.getCurrentTime()}var me,Ne=(me=class{static create(t,r,i){let a=window.document.createElement(t);return r!==void 0&&(a.className=r),i&&i.appendChild(a),a}static createNS(t,r){return window.document.createElementNS(t,r)}static disableDrag(){me.docStyle&&me.selectProp&&(me.userSelect=me.docStyle[me.selectProp],me.docStyle[me.selectProp]=\"none\")}static enableDrag(){me.docStyle&&me.selectProp&&(me.docStyle[me.selectProp]=me.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener(\"click\",me.suppressClickInternal,!0)}static suppressClick(){window.addEventListener(\"click\",me.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener(\"click\",me.suppressClickInternal,!0)},0)}static getScale(t){let r=t.getBoundingClientRect();return{x:r.width/t.offsetWidth||1,y:r.height/t.offsetHeight||1,boundingClientRect:r}}static getPoint(t,r,i){let a=r.boundingClientRect;return new C((i.clientX-a.left)/r.x-t.clientLeft,(i.clientY-a.top)/r.y-t.clientTop)}static mousePos(t,r){let i=me.getScale(t);return me.getPoint(t,i,r)}static touchPos(t,r){let i=[],a=me.getScale(t);for(let n of r)i.push(me.getPoint(t,a,n));return i}static sanitize(t){let r=new DOMParser().parseFromString(t,\"text/html\").body||document.createElement(\"body\"),i=r.querySelectorAll(\"script\");for(let a of i)a.remove();return me.clean(r),r.innerHTML}static isPossiblyDangerous(t,r){let i=r.replace(/\\s+/g,\"\").toLowerCase();if([\"src\",\"href\",\"xlink:href\"].includes(t)&&(i.includes(\"javascript:\")||i.includes(\"data:\"))||t.startsWith(\"on\"))return!0}static clean(t){let r=t.children;for(let i of r)me.removeAttributes(i),me.clean(i)}static removeAttributes(t){for(let{name:r,value:i}of Array.from(t.attributes))me.isPossiblyDangerous(r,i)&&t.removeAttribute(r)}},me.docStyle=typeof window<\"u\"&&window.document?.documentElement.style,me.selectProp=!me.docStyle||\"userSelect\"in me.docStyle?\"userSelect\":\"webkitUserSelect\",me),Mr;(function(e){let t,r,i,a;e.resetRequestQueue=()=>{t=[],r=0,i=0,a={}},e.addThrottleControl=c=>{let p=i++;return a[p]=c,p},e.removeThrottleControl=c=>{delete a[c],u()};let n=()=>{for(let c of Object.keys(a))if(a[c]())return!0;return!1};async function s(c,p,d,f,m=!0,g){let y=await c.transformRequest(p,d);return po(f.signal),Mr.getImage(y,f,m,g)}e.transformAndGetImage=s,e.getImage=(c,p,d=!0,f)=>new Promise((m,g)=>{c.headers||(c.headers={}),c.headers.accept=\"image/webp,*/*\",j(c,{type:\"image\"});let y={abortController:p,requestParameters:c,supportImageRefresh:d,imageBitmapOptions:f,state:\"queued\",onError:_=>{g(_)},onSuccess:_=>{m(_)}};t.push(y),u()});let o=(c,p)=>typeof createImageBitmap==\"function\"?jf(c,p):Gf(c),l=async c=>{c.state=\"running\";let{requestParameters:p,supportImageRefresh:d,imageBitmapOptions:f,onError:m,onSuccess:g,abortController:y}=c,_=d===!1&&!f&&!Li(self)&&!xh(p.url)&&(!p.headers||Object.keys(p.headers).reduce((v,w)=>v&&w===\"accept\",!0));r++;let x=_?h(p,y):$n(p,y);try{let v=await x;delete c.abortController,c.state=\"completed\",v.data instanceof HTMLImageElement||mi(v.data)?g(v):v.data&&g({data:await o(v.data,f),cacheControl:v.cacheControl,expires:v.expires})}catch(v){delete c.abortController,m(it(v))}finally{r--,u()}},u=()=>{let c=n()?Tr.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:Tr.MAX_PARALLEL_IMAGE_REQUESTS;for(let p=r;p<c&&t.length>0;p++){let d=t.shift();if(d.abortController.signal.aborted){p--;continue}l(d)}},h=(c,p)=>new Promise((d,f)=>{let m=new Image,g=c.url,y=c.credentials;y&&y===\"include\"?m.crossOrigin=\"use-credentials\":(y&&y===\"same-origin\"||!bh(g))&&(m.crossOrigin=\"anonymous\"),p.signal.addEventListener(\"abort\",()=>{m.src=\"\",f(new Da(p.signal.reason))}),m.fetchPriority=\"high\",m.onload=()=>{m.onerror=m.onload=null,d({data:m})},m.onerror=()=>{m.onerror=m.onload=null,!p.signal.aborted&&f(Error(\"Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.\"))},m.src=g})})(Mr||(Mr={})),Mr.resetRequestQueue();var yA=class{constructor(e){this._transformRequestFn=e??null}transformRequest(e,t){return this._transformRequestFn&&this._transformRequestFn(e,t)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}},lt=class extends Fa{},W=class extends lt{},y_=class extends lt{constructor(e={}){super(\"style.load\",e)}},fr=class extends lt{constructor(e,t={}){super(e,t),this.dataType=\"style\"}},Ie=class extends lt{constructor(e,t={}){super(e,t),this.dataType=\"source\"}},tr=class extends lt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r,i={}){r=r instanceof MouseEvent?r:new MouseEvent(e,r);let a=Ne.mousePos(t.getCanvas(),r),n=t.unproject(a);super(e,j({point:a,lngLat:n,originalEvent:r},i)),this._defaultPrevented=!1,this.target=t}},Xo=class extends lt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t,r){let i=e===\"touchend\"?r.changedTouches:r.touches,a=Ne.touchPos(t.getCanvasContainer(),i),n=a.map(l=>t.unproject(l)),s=a.reduce((l,u,h,c)=>l.add(u.div(c.length)),new C(0,0)),o=t.unproject(s);super(e,{points:a,point:s,lngLats:n,lngLat:o,originalEvent:r}),this._defaultPrevented=!1}},_A=class extends lt{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,t){super(\"wheel\",{originalEvent:t}),this._defaultPrevented=!1}},__=class extends lt{},xA=class extends lt{constructor(e={}){super(\"terrain\",e)}},vA=class extends lt{constructor(e={}){super(\"projectiontransition\",e)}},Ac=class extends lt{},bA=class extends lt{constructor(e={}){super(\"styleimagemissing\",e)}};function wA(e,t){let r={};for(let i in e)i!==\"ref\"&&(r[i]=e[i]);return rm.forEach(i=>{i in t&&(r[i]=t[i])}),r}function x_(e){e=e.slice();let t=Object.create(null);for(let r=0;r<e.length;r++)t[e[r].id]=e[r];for(let r=0;r<e.length;r++)\"ref\"in e[r]&&(e[r]=wA(e[r],t[e[r].ref]));return e}function ge(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!ge(e[r],t[r]))return!1;return!0}if(typeof e==\"object\"&&e&&t!==null){if(typeof t!=\"object\"||Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(!ge(e[r],t[r]))return!1;return!0}return e===t}function er(e,t){e.push(t)}function E0(e,t,r){er(r,{command:\"addSource\",args:[e,t[e]]})}function I0(e,t,r){er(t,{command:\"removeSource\",args:[e]}),r[e]=!0}function TA(e,t,r,i){I0(e,r,i),E0(e,t,r)}function SA(e,t,r){let i;for(i in e[r])if(Object.prototype.hasOwnProperty.call(e[r],i)&&i!==\"data\"&&!ge(e[r][i],t[r][i]))return!1;for(i in t[r])if(Object.prototype.hasOwnProperty.call(t[r],i)&&i!==\"data\"&&!ge(e[r][i],t[r][i]))return!1;return!0}function EA(e,t,r,i){e||(e={}),t||(t={});let a;for(a in e)Object.prototype.hasOwnProperty.call(e,a)&&(Object.prototype.hasOwnProperty.call(t,a)||I0(a,r,i));for(a in t)Object.prototype.hasOwnProperty.call(t,a)&&(Object.prototype.hasOwnProperty.call(e,a)?ge(e[a],t[a])||(e[a].type===\"geojson\"&&t[a].type===\"geojson\"&&SA(e,t,a)?er(r,{command:\"setGeoJSONSourceData\",args:[a,t[a].data]}):TA(a,t,r,i)):E0(a,t,r))}function Ho(e,t,r,i,a,n){e||(e={}),t||(t={});for(let s in e)Object.prototype.hasOwnProperty.call(e,s)&&(ge(e[s],t[s])||r.push({command:n,args:[i,s,t[s],a]}));for(let s in t)!Object.prototype.hasOwnProperty.call(t,s)||Object.prototype.hasOwnProperty.call(e,s)||ge(e[s],t[s])||r.push({command:n,args:[i,s,t[s],a]})}function v_(e){return e.id}function b_(e,t){return e[t.id]=t,e}function IA(e,t,r){e||(e=[]),t||(t=[]);let i=e.map(v_),a=t.map(v_),n=e.reduce(b_,{}),s=t.reduce(b_,{}),o=i.slice(),l=Object.create(null),u,h,c,p,d;for(let f=0,m=0;f<i.length;f++)u=i[f],Object.prototype.hasOwnProperty.call(s,u)?m++:(er(r,{command:\"removeLayer\",args:[u]}),o.splice(o.indexOf(u,m),1));for(let f=0,m=0;f<a.length;f++)u=a[a.length-1-f],o[o.length-1-f]!==u&&(Object.prototype.hasOwnProperty.call(n,u)?(er(r,{command:\"removeLayer\",args:[u]}),o.splice(o.lastIndexOf(u,o.length-m),1)):m++,p=o[o.length-f],er(r,{command:\"addLayer\",args:[s[u],p]}),o.splice(o.length-f,0,u),l[u]=!0);for(let f=0;f<a.length;f++)if(u=a[f],h=n[u],c=s[u],!(l[u]||ge(h,c))){if(!ge(h.source,c.source)||!ge(h[\"source-layer\"],c[\"source-layer\"])||!ge(h.type,c.type)){er(r,{command:\"removeLayer\",args:[u]}),p=o[o.lastIndexOf(u)+1],er(r,{command:\"addLayer\",args:[c,p]});continue}for(d in Ho(h.layout,c.layout,r,u,null,\"setLayoutProperty\"),Ho(h.paint,c.paint,r,u,null,\"setPaintProperty\"),ge(h.filter,c.filter)||er(r,{command:\"setFilter\",args:[u,c.filter]}),(!ge(h.minzoom,c.minzoom)||!ge(h.maxzoom,c.maxzoom))&&er(r,{command:\"setLayerZoomRange\",args:[u,c.minzoom,c.maxzoom]}),h)Object.prototype.hasOwnProperty.call(h,d)&&d!==\"layout\"&&d!==\"paint\"&&d!==\"filter\"&&d!==\"metadata\"&&d!==\"minzoom\"&&d!==\"maxzoom\"&&(d.indexOf(\"paint.\")===0?Ho(h[d],c[d],r,u,d.slice(6),\"setPaintProperty\"):ge(h[d],c[d])||er(r,{command:\"setLayerProperty\",args:[u,d,c[d]]}));for(d in c)!Object.prototype.hasOwnProperty.call(c,d)||Object.prototype.hasOwnProperty.call(h,d)||d!==\"layout\"&&d!==\"paint\"&&d!==\"filter\"&&d!==\"metadata\"&&d!==\"minzoom\"&&d!==\"maxzoom\"&&(d.indexOf(\"paint.\")===0?Ho(h[d],c[d],r,u,d.slice(6),\"setPaintProperty\"):ge(h[d],c[d])||er(r,{command:\"setLayerProperty\",args:[u,d,c[d]]}))}}function AA(e,t){if(!e)return[{command:\"setStyle\",args:[t]}];let r=[];try{if(!ge(e.version,t.version))return[{command:\"setStyle\",args:[t]}];ge(e.center,t.center)||r.push({command:\"setCenter\",args:[t.center]}),ge(e.state,t.state)||r.push({command:\"setGlobalState\",args:[t.state]}),ge(e.centerAltitude,t.centerAltitude)||r.push({command:\"setCenterAltitude\",args:[t.centerAltitude]}),ge(e.zoom,t.zoom)||r.push({command:\"setZoom\",args:[t.zoom]}),ge(e.bearing,t.bearing)||r.push({command:\"setBearing\",args:[t.bearing]}),ge(e.pitch,t.pitch)||r.push({command:\"setPitch\",args:[t.pitch]}),ge(e.roll,t.roll)||r.push({command:\"setRoll\",args:[t.roll]}),ge(e.sprite,t.sprite)||r.push({command:\"setSprite\",args:[t.sprite]}),ge(e.glyphs,t.glyphs)||r.push({command:\"setGlyphs\",args:[t.glyphs]}),ge(e[\"font-faces\"],t[\"font-faces\"])||r.push({command:\"setFontFaces\",args:[t[\"font-faces\"]]}),ge(e.transition,t.transition)||r.push({command:\"setTransition\",args:[t.transition]}),ge(e.light,t.light)||r.push({command:\"setLight\",args:[t.light]}),ge(e.terrain,t.terrain)||r.push({command:\"setTerrain\",args:[t.terrain]}),ge(e.sky,t.sky)||r.push({command:\"setSky\",args:[t.sky]}),ge(e.projection,t.projection)||r.push({command:\"setProjection\",args:[t.projection]});let i={},a=[];EA(e.sources,t.sources,a,i);let n=[];e.layers&&e.layers.forEach(s=>{\"source\"in s&&i[s.source]?r.push({command:\"removeLayer\",args:[s.id]}):n.push(s)}),r=r.concat(a),IA(n,t.layers,r)}catch(i){console.warn(\"Unable to compute style diff:\",i),r=[{command:\"setStyle\",args:[t]}]}return r}function MA(){let e={},t=P.$version;for(let r in P.$root){let i=P.$root[r];if(i.required){let a=null;a=r===\"version\"?t:i.type===\"array\"?[]:{},a!=null&&(e[r]=a)}}return e}function ol(e){let t=[];if(typeof e==\"string\")t.push({id:\"default\",url:e});else if(e&&e.length>0){let r=[];for(let{id:i,url:a}of e){let n=`${i}${a}`;r.includes(n)||(r.push(n),t.push({id:i,url:a}))}}return t}function w_(e,t,r){try{let i=new URL(e);return i.pathname+=`${t}${r}`,i.toString()}catch{throw Error(`Invalid sprite URL \"${e}\", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}async function PA(e,t,r,i){let a=ol(e),n=r>1?\"@2x\":\"\",s={},o={};for(let{id:l,url:u}of a){let h=await t.transformRequest(w_(u,n,\".json\"),\"SpriteJSON\");s[l]=jn(h,i);let c=await t.transformRequest(w_(u,n,\".png\"),\"SpriteImage\");o[l]=Mr.getImage(c,i)}return await Promise.all([...Object.values(s),...Object.values(o)]),CA(s,o)}async function CA(e,t){let r={};for(let i in e){r[i]={};let a=zt.getImageCanvasContext((await t[i]).data),n=(await e[i]).data;for(let s in n){let{width:o,height:l,x:u,y:h,sdf:c,pixelRatio:p,stretchX:d,stretchY:f,content:m,textFitWidth:g,textFitHeight:y}=n[s],_={width:o,height:l,x:u,y:h,context:a};r[i][s]={data:null,pixelRatio:p,sdf:c,stretchX:d,stretchY:f,content:m,textFitWidth:g,textFitHeight:y,spriteData:_}}}return r}var kA=class extends wt{constructor(){super(),this.images={},this.updateVersion=0,this.loaded=!1,this.requestors=[],this.missingImageResolver=null,this._spriteImagesIds={},this._imagesIds=null,this._renderCallbacksDispatchedThisFrame={}}destroy(){for(let e of Object.keys(this.images))this.removeImage(e);this._spriteImagesIds={}}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:t,promiseResolve:r}of this.requestors)r(this._getImagesForIds(t));this.requestors=[]}}getImage(e){let t=this.images[e];if(t&&!t.data&&t.spriteData){let r=t.spriteData;t.data=new xe({width:r.width,height:r.height},r.context.getImageData(r.x,r.y,r.width,r.height).data),t.spriteData=null}return t}addImage(e,t){if(this.images[e])throw Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,t)&&(this.images[e]=t,this._imagesIds=null,t.isWebGLImage&&this.updateImage(e,t,!1))}_validate(e,t){let r=!0,i=t.data||t.spriteData;return this._validateStretch(t.stretchX,i?.width)||(this.fire(new X(Error(`Image \"${e}\" has invalid \"stretchX\" value`))),r=!1),this._validateStretch(t.stretchY,i?.height)||(this.fire(new X(Error(`Image \"${e}\" has invalid \"stretchY\" value`))),r=!1),this._validateContent(t.content,t)||(this.fire(new X(Error(`Image \"${e}\" has invalid \"content\" value`))),r=!1),r}_validateStretch(e,t){if(!e)return!0;let r=0;for(let i of e){if(i[0]<r||i[1]<i[0]||t<i[1])return!1;r=i[1]}return!0}_validateContent(e,t){if(!e)return!0;if(e.length!==4)return!1;let r=t.spriteData,i=r?.width||t.data.width,a=r?.height||t.data.height;return e[0]<0||i<e[0]||e[1]<0||a<e[1]||e[2]<0||i<e[2]||e[3]<0||a<e[3]||e[2]<e[0]?!1:e[3]>=e[1]}updateImage(e,t,r=!0){let i=this.images[e];if(r){let a=i.data||i.spriteData;if(a.width!==t.data.width||a.height!==t.data.height)throw Error(`size mismatch between old image (${a.width}x${a.height}) and new image (${t.data.width}x${t.data.height}).`)}t.version=(i.version??0)+1,this.images[e]=t,this.updateVersion++}removeImage(e){let t=this.images[e];t&&(delete this.images[e],this._imagesIds=null,t.userImage?.onRemove&&t.userImage.onRemove())}listImages(){return this._imagesIds??(this._imagesIds=Object.keys(this.images)),this._imagesIds}_getSpriteImageId(e,t){return e===\"default\"?t:`${e}:${t}`}setSpriteImages(e,t){let r=this._spriteImagesIds[e]??[],i=[];for(let s in t){let o=this._getSpriteImageId(e,s);i.push(o),o in this.images?this.updateImage(o,t[s],!1):this.addImage(o,t[s])}let a=new Set(i),n=r.filter(s=>!a.has(s));for(let s of n)this.removeImage(s);return this._spriteImagesIds[e]=i,{loaded:i,removed:n}}removeSpriteImages(e){let t=this._spriteImagesIds[e]??[];for(let r of t)this.removeImage(r);return delete this._spriteImagesIds[e],t}removeAllSpriteImages(){let e=Object.values(this._spriteImagesIds).flat();for(let t of e)this.removeImage(t);return this._spriteImagesIds={},e}setMissingImageResolver(e){this.missingImageResolver=e}getImages(e){return new Promise((t,r)=>{let i=!0;if(!this.isLoaded())for(let a of e)this.images[a]||(i=!1);this.isLoaded()||i?t(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:t})})}async _getImagesForIds(e){let t=new Set(e.filter(a=>!this.getImage(a))),r=this.missingImageResolver;r&&await Promise.allSettled(Array.from(t,a=>r(a)));let i={};for(let a of e){let n=this.getImage(a);n&&(t.delete(a),i[a]={data:n.data.clone(),pixelRatio:n.pixelRatio,sdf:n.sdf,version:n.version,stretchX:n.stretchX,stretchY:n.stretchY,content:n.content,textFitWidth:n.textFitWidth,textFitHeight:n.textFitHeight,hasRenderCallback:!!n.userImage?.render,isWebGLImage:n.isWebGLImage})}for(let a of t)this.fire(new bA({id:a})),pe(`Image \"${a}\" could not be loaded. Please make sure you have added the image before it is needed with map.addImage(), resolved it with map.setMissingStyleImageResolver(), or included it in a \"sprite\" property in your style.`);return i}beginFrame(){this._renderCallbacksDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let t of e){if(this._renderCallbacksDispatchedThisFrame[t])continue;this._renderCallbacksDispatchedThisFrame[t]=!0;let r=this.getImage(t);r||pe(`Image with ID: \"${t}\" was not found`),My(r)&&this.updateImage(t,r)}}cloneImages(){let e={};for(let t in this.images){let r=this.images[t];e[t]={...r,data:r.data?r.data.clone():null}}return e}},DA=class{constructor(e){this._imageManager=e,this._entries={},this._image=new xe({width:1,height:1}),this._dirty=!0}destroy(){this._texture&&(this._texture=(this._texture.destroy(),null)),this._entries={},this._image=new xe({width:1,height:1}),this._dirty=!0}getPixelSize(){let{width:e,height:t}=this._image;return{width:e,height:t}}getPattern(e){let t=this._imageManager.getImage(e);if(!t)return null;let r=this._entries[e];if(r?.image!==t){let i={w:t.data.width+2,h:t.data.height+2,x:0,y:0};this._entries[e]={bin:i,position:new jo(i,t),image:t}}else if(r.position.version!==t.version)r.position.version=t.version;else return r.position;return this._update(),this._entries[e].position}bind(e){let t=e.gl;this._texture?this._dirty&&(this._dirty=(this._texture.update(this._image),!1)):(this._texture=new Oe(e,this._image,t.RGBA),this._dirty=!1),this._texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)}_update(){for(let a in this._entries)this._imageManager.getImage(a)||delete this._entries[a];let e=[];for(let a in this._entries)e.push(this._entries[a].bin);let{w:t,h:r}=ic(e),i=this._image;i.resize({width:t||1,height:r||1});for(let a in this._entries){let{bin:n}=this._entries[a],s=n.x+1,o=n.y+1,l=this._entries[a].image.data,u=l.width,h=l.height;xe.copy(l,i,{x:0,y:0},{x:s,y:o},{width:u,height:h}),xe.copy(l,i,{x:0,y:h-1},{x:s,y:o-1},{width:u,height:1}),xe.copy(l,i,{x:0,y:0},{x:s,y:o+h},{width:u,height:1}),xe.copy(l,i,{x:u-1,y:0},{x:s-1,y:o},{width:1,height:h}),xe.copy(l,i,{x:0,y:0},{x:s+u,y:o},{width:1,height:h})}this._dirty=!0}};async function FA(e,t,r,i){let a=t*256,n=a+255,s=await i.transformRequest(r.replace(\"{fontstack}\",e).replace(\"{range}\",`${a}-${n}`),\"Glyphs\"),o=await Qf(s,new AbortController);if(!o?.data)throw Error(`Could not load glyph range. range: ${t}, ${a}-${n}`);let l={};for(let u of Ay(o.data))l[u.id]=u;return l}var jc=1e20,tp=new Float64Array(256);for(let e=0;e<256;e++){let t=.5-(e/255)**.45454545454545453;tp[e]=t*Math.abs(t)}tp[255]=-1e20;var zA=class{constructor({fontSize:e=24,buffer:t=3,radius:r=8,cutoff:i=.25,fontFamily:a=\"sans-serif\",fontWeight:n=\"normal\",fontStyle:s=\"normal\",lang:o=null}={}){this.buffer=t,this.radius=r,this.cutoff=i,this.lang=o;let l=this.size=e+t*4,u=this._createCanvas(l),h=this.ctx=u.getContext(\"2d\",{willReadFrequently:!0});h.font=`${s} ${n} ${e}px ${a}`,h.textBaseline=\"alphabetic\",h.textAlign=\"left\",h.fillStyle=\"black\",this.gridOuter=new Float64Array(l*l),this.gridInner=new Float64Array(l*l),this.f=new Float64Array(l),this.z=new Float64Array(l+1),this.v=new Uint16Array(l)}_createCanvas(e){if(typeof OffscreenCanvas<\"u\")return new OffscreenCanvas(e,e);let t=document.createElement(\"canvas\");return t.width=t.height=e,t}draw(e){let{width:t,actualBoundingBoxAscent:r,actualBoundingBoxDescent:i,actualBoundingBoxLeft:a,actualBoundingBoxRight:n}=this.ctx.measureText(e),s=Math.ceil(r),o=Math.floor(-a),l=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(n)-o)),u=Math.max(0,Math.min(this.size-this.buffer,s+Math.ceil(i))),h=l+2*this.buffer,c=u+2*this.buffer,p=Math.max(h*c,0),d=new Uint8ClampedArray(p),f={data:d,width:h,height:c,glyphWidth:l,glyphHeight:u,glyphTop:s,glyphLeft:o,glyphAdvance:t};if(l===0||u===0)return f;let{ctx:m,buffer:g,gridInner:y,gridOuter:_}=this;this.lang&&(m.lang=this.lang),m.clearRect(g,g,l,u),m.fillText(e,g-o,g+s);let x=m.getImageData(g,g,l,u);_.fill(jc,0,p),y.fill(0,0,p);let v=3;for(let I=0;I<u;I++){let S=(I+g)*h+g;for(let D=0;D<l;D++,v+=4,S++){let R=x.data[v];if(R===0)continue;let F=tp[R];_[S]=Math.max(0,F),y[S]=Math.max(0,-F)}}T_(_,0,0,h,c,h,this.f,this.v,this.z);let w=Math.min(g,1);T_(y,g-w,g-w,l+2*w,u+2*w,h,this.f,this.v,this.z);let b=255/this.radius,T=255*(1-this.cutoff);for(let I=0;I<p;I++){let S=Math.sqrt(_[I])-Math.sqrt(y[I]);d[I]=Math.round(T-b*S)}return f}};function T_(e,t,r,i,a,n,s,o,l){for(let u=t;u<t+i;u++)S_(e,r*n+u,n,a,s,o,l);for(let u=r;u<r+a;u++)S_(e,u*n+t,1,i,s,o,l)}function S_(e,t,r,i,a,n,s){n[0]=0,s[0]=-1e20,s[1]=jc,a[0]=e[t];for(let o=1,l=0,u=0;o<i;o++){a[o]=e[t+o*r];let h=o*o;do{let c=n[l];u=(a[o]-a[c]+h-c*c)/(o-c)/2}while(u<=s[l]&&--l>-1);l++,n[l]=o,s[l]=u,s[l+1]=jc}for(let o=0,l=0;o<i;o++){for(;s[l+1]<o;)l++;let u=n[l],h=o-u;e[t+o*r]=a[u]+h*h}}var RA=P.layout_symbol[\"text-font\"].default.join(\",\"),Hr,LA=(Hr=class{constructor(t,r,i){this.requestManager=t,this.localIdeographFontFamily=r,this.entries={},this.lang=i}setURL(t){this.url=t}async getGlyphs(t){let r=[];for(let n in t)for(let s of t[n])r.push(this._getAndCacheGlyphsPromise(n,s));let i=await Promise.all(r),a={};for(let{stack:n,id:s,glyph:o}of i)a[n]||(a[n]={}),a[n][s]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics};return a}async _getAndCacheGlyphsPromise(t,r){var n;(n=this.entries)[t]??(n[t]={glyphs:{},requests:{},ranges:{}});let i=this.entries[t],a=i.glyphs[r];return a===void 0?!this.url||this._charUsesLocalIdeographFontFamily(r)?(a=i.glyphs[r]=await this._drawGlyph(i,t,r),{stack:t,id:r,glyph:a}):await this._downloadAndCacheRangePromise(t,r):{stack:t,id:r,glyph:a}}async _downloadAndCacheRangePromise(t,r){var n;let i=this.entries[t],a=Math.floor(r/256);if(i.ranges[a])return{stack:t,id:r,glyph:null};(n=i.requests)[a]||(n[a]=Hr.loadGlyphRange(t,a,this.url,this.requestManager));try{let s=await i.requests[a];for(let o in s)i.glyphs[+o]=s[+o];return i.ranges[a]=!0,{stack:t,id:r,glyph:s[r]||null}}catch(s){let o=i.glyphs[r]=await this._drawGlyph(i,t,r);return this._warnOnMissingGlyphRange(o,a,r,it(s)),{stack:t,id:r,glyph:o}}}_warnOnMissingGlyphRange(t,r,i,a){let n=r*256,s=n+255,o=i.toString(16).padStart(4,\"0\").toUpperCase();pe(`Unable to load glyph range ${r}, ${n}-${s}. Rendering codepoint U+${o} locally instead. ${a}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&Sg(t)}async _drawGlyph(t,r,i){let a=r===RA&&this.localIdeographFontFamily!==\"\"&&this._charUsesLocalIdeographFontFamily(i),n=a?\"ideographTinySDF\":\"tinySDF\";t[n]||(t[n]=this._createTinySDF(a?this.localIdeographFontFamily:r));let s=(await t[n]).draw(String.fromCodePoint(i)),o=/^\\p{gc=Cf}+$/u.test(String.fromCodePoint(i));return{id:i,bitmap:new Fo({width:s.width||60,height:s.height||60},s.data),metrics:{width:o?0:s.glyphWidth/2||24,height:s.glyphHeight/2||24,left:s.glyphLeft/2+.5||0,top:s.glyphTop/2-27.5||-8,advance:o?0:s.glyphAdvance/2||24,isDoubleResolution:!0}}}async _createTinySDF(t){let r=t?t.split(\",\"):[];r.push(\"sans-serif\");let i=r.map(s=>/[-\\w]+/.test(s)?s:`'${CSS.escape(s)}'`).join(\",\"),a=this._fontWeight(r[0]),n=this._fontStyle(r[0]);if(typeof document<\"u\"&&document.fonts?.load)try{await document.fonts.load(`${n} ${a||\"normal\"} 48px ${i}`)}catch(s){pe(`Failed to load font \"${i}\": ${it(s).message}`)}return new Hr.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:i,fontWeight:a,fontStyle:n,lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?\"italic\":/oblique/i.test(t)?\"oblique\":\"normal\"}_fontWeight(t){let r={thin:100,hairline:100,\"extra light\":200,\"ultra light\":200,light:300,normal:400,regular:400,medium:500,semibold:600,demibold:600,bold:700,\"extra bold\":800,\"ultra bold\":800,black:900,heavy:900,\"extra black\":950,\"ultra black\":950},i;for(let[a,n]of Object.entries(r))RegExp(`\\\\b${a}\\\\b`,\"i\").test(t)&&(i=`${n}`);return i}destroy(){for(let t in this.entries){let r=this.entries[t];r.tinySDF=null,r.ideographTinySDF=null,r.glyphs={},r.requests={},r.ranges={}}this.entries={}}},Hr.loadGlyphRange=FA,Hr.TinySDF=zA,Hr),BA,OA=()=>BA||(BA=new Qe({anchor:new V(P.light.anchor,\"anchor\"),position:new V(P.light.position,\"position\"),color:new V(P.light.color,\"color\"),intensity:new V(P.light.intensity,\"intensity\")})),VA=class extends wt{constructor(e,t){super(),this._transitionable=new Hn(OA(),\"light\",t),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}getCartesianPosition(){return Nf(this.properties.get(\"position\"))}setLight(e,t={}){if(!this._validate(It.light,e,t))for(let r in e){let i=e[r];r.endsWith(\"-transition\")?this._transitionable.setTransition(r.slice(0,-Co.length),i):this._transitionable.setValue(r,i)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,r){return Ba(this,e,{value:t},r)}},NA,UA=()=>NA||(NA=new Qe({\"sky-color\":new V(P.sky[\"sky-color\"],\"sky-color\"),\"horizon-color\":new V(P.sky[\"horizon-color\"],\"horizon-color\"),\"fog-color\":new V(P.sky[\"fog-color\"],\"fog-color\"),\"fog-ground-blend\":new V(P.sky[\"fog-ground-blend\"],\"fog-ground-blend\"),\"horizon-fog-blend\":new V(P.sky[\"horizon-fog-blend\"],\"horizon-fog-blend\"),\"sky-horizon-blend\":new V(P.sky[\"sky-horizon-blend\"],\"sky-horizon-blend\"),\"atmosphere-blend\":new V(P.sky[\"atmosphere-blend\"],\"atmosphere-blend\")})),$A=class extends wt{constructor(e,t){super(),this._transitionable=new Hn(UA(),\"sky\",t),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Te(0))}setSky(e,t={}){if(!this._validate(It.sky,e,t)){e||(e={\"sky-color\":\"transparent\",\"horizon-color\":\"transparent\",\"fog-color\":\"transparent\",\"fog-ground-blend\":1,\"atmosphere-blend\":0});for(let r in e){let i=e[r];r.endsWith(\"-transition\")?this._transitionable.setTransition(r.slice(0,-Co.length),i):this._transitionable.setValue(r,i)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,t,r={}){return Ba(this,e,{value:t},r)}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}},jA=class{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,t){var i;let r=e.join(\",\")+String(t);return(i=this.dashEntry)[r]||(i[r]=this.addDash(e,t)),this.dashEntry[r]}getDashRanges(e,t,r){let i=e.length%2==1,a=[],n=i?-e[e.length-1]*r:0,s=e[0]*r,o=!0;a.push({left:n,right:s,isDash:o,zeroLength:e[0]===0});let l=e[0];for(let u=1;u<e.length;u++){o=!o;let h=e[u];n=l*r,l+=h,s=l*r,a.push({left:n,right:s,isDash:o,zeroLength:h===0})}return a}addRoundDash(e,t,r){let i=t/2;for(let a=-r;a<=r;a++){let n=this.nextRow+r+a,s=this.width*n,o=0,l=e[o];for(let u=0;u<this.width;u++){u/l.right>1&&(l=e[++o]);let h=Math.abs(u-l.left),c=Math.abs(u-l.right),p=Math.min(h,c),d,f=a/r*(i+1);if(l.isDash){let m=i-Math.abs(f);d=Math.sqrt(p*p+m*m)}else d=i-Math.sqrt(p*p+f*f);this.data[s+u]=Math.max(0,Math.min(255,d+128))}}}addRegularDash(e){for(let s=e.length-1;s>=0;--s){let o=e[s],l=e[s+1];o.zeroLength?e.splice(s,1):l?.isDash===o.isDash&&(l.left=o.left,e.splice(s,1))}let t=e[0],r=e[e.length-1];t.isDash===r.isDash&&(t.left=r.left-this.width,r.right=t.right+this.width);let i=this.width*this.nextRow,a=0,n=e[a];for(let s=0;s<this.width;s++){s/n.right>1&&(n=e[++a]);let o=Math.abs(s-n.left),l=Math.abs(s-n.right),u=Math.min(o,l),h=n.isDash?u:-u;this.data[i+s]=Math.max(0,Math.min(255,h+128))}}addDash(e,t){let r=t?7:0,i=2*r+1;if(this.nextRow+i>this.height)return pe(\"LineAtlas out of space\"),null;let a=0;for(let s of e)a+=s;if(a!==0){let s=this.width/a,o=this.getDashRanges(e,this.width,s);t?this.addRoundDash(o,s,r):this.addRegularDash(o)}let n={y:this.nextRow+r,height:2*r,width:a};return this.nextRow+=i,this.dirty=!0,n}bind(e){let t=e.gl;this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,this.data))}};function GA(e){if(!e)return!1;let t=globalThis.location;if(!t)return!1;try{return new URL(e,t.href).origin!==t.origin}catch{return!1}}function qA(){let e=import.meta.url;if(!/^https?:/.test(e))return\"\";let t=e.endsWith(\"-dev.mjs\")?\"maplibre-gl-worker-dev.mjs\":\"maplibre-gl-worker.mjs\";return new URL(`./${t}`,e).href}function Mc(e,t){if(t)try{return new Worker(e,{type:\"module\"})}catch(r){console.warn(\"Module worker not supported, falling back to classic worker\",r)}return new Worker(e)}async function ZA(e){let t=await fetch(e);if(!t.ok)throw Error(`Failed to fetch worker script (${t.status}): ${e}`);let r=await t.text(),i=new Blob([r],{type:\"text/javascript\"});return URL.createObjectURL(i)}function WA(e){let t=new Blob([`import ${JSON.stringify(new URL(e,import.meta.url).href)}`],{type:\"text/javascript\"});return URL.createObjectURL(t)}async function XA(){let e=Tr.WORKER_URL||qA(),t=!e?.endsWith(\".cjs\");if(!GA(e))return Mc(e,t);if(t){let i=WA(e);try{return Mc(i,t)}finally{URL.revokeObjectURL(i)}}let r=await ZA(e);try{return Mc(r,t)}finally{URL.revokeObjectURL(r)}}var HA=\"maplibre_preloaded_worker_pool\",A0=class M0{constructor(){this.active={},this.workersPromise=null}async acquire(t){if(this.active[t]=!0,!this.workersPromise){let r=[];for(;r.length<M0.workerCount;)r.push(XA());this.workersPromise=Promise.all(r)}return(await this.workersPromise).slice()}release(t){if(delete this.active[t],this.numActive()===0&&this.workersPromise){let r=this.workersPromise;this.workersPromise=null,r.then(i=>{for(let a of i)a.terminate()})}}isPreloaded(){return!!this.active[HA]}numActive(){return Object.keys(this.active).length}},YA=Math.floor(zt.hardwareConcurrency/2);A0.workerCount=$f(globalThis)?Math.max(Math.min(YA,3),1):1;var E_;function P0(){return E_||(E_=new A0),E_}var C0=class{constructor(e,t){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=t,this.removed=!1,this.actorsPromise=this.initActors(t)}async initActors(e){let t=await this.workerPool.acquire(e);if(this.removed)return[];if(this.actors=t.map((r,i)=>{let a=new zy(r,e);return a.name=`Worker ${i}`,a}),!this.actors.length)throw Error(\"No actors found\");return this.actors}async broadcast(e,t){let r=await this.actorsPromise;return Promise.all(r.map(i=>i.sendAsync({type:e,data:t})))}async getActor(){let e=await this.actorsPromise;return this.currentActor=(this.currentActor+1)%e.length,e[this.currentActor]}async waitForInitComplete(){this.actors.length===0&&await this.actorsPromise}getReadyActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.removed=!0;for(let t of this.actors)t.remove();this.actors=[],e&&this.workerPool.release(this.id)}async registerMessageHandler(e,t){let r=await this.actorsPromise;for(let i of r)i.registerMessageHandler(e,t)}async unregisterMessageHandler(e){let t=await this.actorsPromise;for(let r of t)r.unregisterMessageHandler(e)}},Yo;function KA(){return Yo||(Yo=new C0(P0(),Ns),Yo.registerMessageHandler(\"GR\",(e,t,r)=>$n(t,r))),Yo}function JA(e,t){let r=Vr();return ze(r,r,[1,1,0]),at(r,r,[e.width*.5,e.height*.5,1]),e.calculatePosMatrix?Jt(r,r,e.calculatePosMatrix(t.toUnwrapped())):r}function QA(e,t,r){if(e)for(let i of e){let a=t[i];if(a?.source===r&&a.type===\"fill-extrusion\")return!0}else for(let i in t){let a=t[i];if(a.source===r&&a.type===\"fill-extrusion\")return!0}return!1}function eM(e,t,r,i,a,n,s){let o=QA(a?.layers??null,t,e.id),l=n.maxPitchScaleFactor(),u=e.tilesIn(i,l,o);u.sort(k0);let h=[];for(let c of u)h.push({wrappedTileID:c.tileID.wrapped().key,queryResults:c.tile.queryRenderedFeatures(t,r,e.getState(),c.queryGeometry,c.cameraQueryGeometry,c.scale,a,n,l,JA(n,c.tileID),s?(p,d)=>s(c.tileID,p,d):void 0)});return aM(iM(h),e)}function tM(e,t,r,i,a,n,s){let o={},l=n.queryRenderedSymbols(i),u=[];for(let h of Object.keys(l).map(Number))u.push(s[h]);u.sort(k0);for(let h of u){let c=h.featureIndex.lookupSymbolFeatures(l[h.bucketInstanceId],t,h.bucketIndex,h.sourceLayerIndex,{filterSpec:a.filter,globalState:a.globalState},a.layers,a.availableImages,e);for(let p in c){o[p]||(o[p]=[]);let d=c[p];d.sort((f,m)=>{let g=h.featureSortOrder;if(g){let y=g.indexOf(f.featureIndex);return g.indexOf(m.featureIndex)-y}return m.featureIndex-f.featureIndex});for(let f of d)o[p].push(f)}}return nM(o,e,r)}function rM(e,t){let r=e.getRenderableIds().map(n=>e.getTileByID(n)),i=[],a={};for(let n of r){let s=n.tileID.canonical.key;a[s]||(a[s]=!0,n.querySourceFeatures(i,t))}return i}function k0(e,t){let r=e.tileID,i=t.tileID;return r.overscaledZ-i.overscaledZ||r.canonical.y-i.canonical.y||r.wrap-i.wrap||r.canonical.x-i.canonical.x}function iM(e){let t={},r={};for(let{queryResults:i,wrappedTileID:a}of e){r[a]||(r[a]={});let n=r[a];for(let s in i){let o=i[s];n[s]||(n[s]={});let l=n[s];t[s]||(t[s]=[]);for(let u of o)l[u.featureIndex]||(l[u.featureIndex]=!0,t[s].push(u))}}return t}function aM(e,t){for(let r in e)for(let i of e[r])D0(i,t);return e}function nM(e,t,r){for(let i in e)for(let a of e[i]){let n=r[t[i].source];D0(a,n)}return e}function D0(e,t){let r=e.feature,i=t.getFeatureState(r.layer[\"source-layer\"],r.id);r.source=r.layer.source,r.layer[\"source-layer\"]&&(r.sourceLayer=r.layer[\"source-layer\"]),r.state=i}async function F0(e,t,r,i){let a=e;if(e.url?a=(await jn(await t.transformRequest(e.url,\"Source\"),r)).data:await zt.frameAsync(r,i),!a)return null;let n=ka(j(a,e),[\"tiles\",\"minzoom\",\"maxzoom\",\"attribution\",\"bounds\",\"scheme\",\"tileSize\",\"encoding\"]);return\"vector_layers\"in a&&a.vector_layers&&(n.vectorLayerIds=a.vector_layers.map(s=>s.id)),n}var Kr=class Wr{constructor(t,r){t&&(r?this.setSouthWest(t).setNorthEast(r):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof K?new K(t.lng,t.lat):K.convert(t),this}setSouthWest(t){return this._sw=t instanceof K?new K(t.lng,t.lat):K.convert(t),this}extend(t){let r=this._sw,i=this._ne,a,n;if(t instanceof K)a=t,n=t;else if(t instanceof Wr){if(a=t._sw,n=t._ne,!a||!n)return this}else{if(Array.isArray(t)){if(t.length===4||t.every(Array.isArray)){let s=t;return this.extend(Wr.convert(s))}{let s=t;return this.extend(K.convert(s))}}return t&&(\"lng\"in t||\"lon\"in t)&&\"lat\"in t?this.extend(K.convert(t)):this}return!r&&!i?(this._sw=new K(a.lng,a.lat),this._ne=new K(n.lng,n.lat)):(r.lng=Math.min(a.lng,r.lng),r.lat=Math.min(a.lat,r.lat),i.lng=Math.max(n.lng,i.lng),i.lat=Math.max(n.lat,i.lat)),this}getCenter(){return new K((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 K(this.getWest(),this.getNorth())}getSouthEast(){return new K(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(t){let{lng:r,lat:i}=K.convert(t),a=this._sw.lat<=i&&i<=this._ne.lat,n=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=r&&r>=this._ne.lng),a&&n}intersects(t){if(t=Wr.convert(t),!(t.getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;let r=Math.abs(this.getEast()-this.getWest()),i=Math.abs(t.getEast()-t.getWest());if(r>=360||i>=360)return!0;let a=Ut(this.getWest(),-180,180),n=Ut(this.getEast(),-180,180),s=Ut(t.getWest(),-180,180),o=Ut(t.getEast(),-180,180),l=a>n,u=s>o;return l&&u?!0:l?o>=a||s<=n:u?n>=s||a<=o:s<=n&&o>=a}static convert(t){return t instanceof Wr||!t?t:new Wr(t)}static fromLngLat(t,r=0){let i=360*r/40075017,a=i/Math.cos(Math.PI/180*t.lat);return new Wr(new K(t.lng-a,t.lat-i),new K(t.lng+a,t.lat+i))}adjustAntiMeridian(){let t=new K(this._sw.lng,this._sw.lat),r=new K(this._ne.lng,this._ne.lat);return t.lng>r.lng?new Wr(t,new K(r.lng+360,r.lat)):new Wr(t,r)}},z0=class{constructor(e,t,r){this.bounds=Kr.convert(this.validateBounds(e)),this.minzoom=t||0,this.maxzoom=r||24}validateBounds(e){return!Array.isArray(e)||e.length!==4?[-180,-90,180,90]:[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]}contains(e){let t=2**e.z,r={minX:Math.floor(Gi(this.bounds.getWest())*t),minY:Math.floor(qi(this.bounds.getNorth())*t),maxX:Math.ceil(Gi(this.bounds.getEast())*t),maxY:Math.ceil(qi(this.bounds.getSouth())*t)};return e.x>=r.minX&&e.x<r.maxX&&e.y>=r.minY&&e.y<r.maxY}};function sM(e,t){let r={};if(!t)return r;for(let i of e){let a=i.layerIds.map(n=>t.getLayer(n)).filter(Boolean);if(a.length!==0){i.layers=a,i.stateDependentLayerIds&&(i.stateDependentLayers=i.stateDependentLayerIds.map(n=>a.filter(s=>s.id===n)[0]));for(let n of a)r[n.id]=i}}return r}var Gc=\"RTLPluginLoaded\",oM=class extends wt{constructor(...e){super(...e),this.status=\"unavailable\",this.url=null,this.dispatcher=KA()}_syncState(e){return this.status=e,this.dispatcher.broadcast(\"SRPS\",{pluginStatus:e,pluginURL:this.url}).catch(t=>{throw this.status=\"error\",t})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status=\"unavailable\",this.url=null}async setRTLTextPlugin(e,t=!1){if(this.url)throw Error(\"setRTLTextPlugin cannot be called multiple times.\");if(this.url=zt.resolveURL(e),!this.url)throw Error(`requested url ${e} is invalid`);if(this.status===\"unavailable\")if(t)this.status=\"deferred\",this._syncState(this.status);else return this._requestImport();else if(this.status===\"requested\")return this._requestImport()}async _requestImport(){await this._syncState(\"loading\"),this.status=\"loaded\",this.fire(new Fa(Gc))}lazyLoad(){this.status===\"unavailable\"?this.status=\"requested\":this.status===\"deferred\"&&this._requestImport()}},I_=null;function qc(){return I_||(I_=new oM),I_}var R0=class{constructor(e,t){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=e,this.uid=mh(),this.uses=0,this.tileSize=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rttObjects=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state=\"loading\",this.featureStateRevision=-1}isRenderable(e){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(e||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:e,fadingDirection:t,fadingParentID:r,fadeEndTime:i}){this.resetFadeLogic(),this.fadingRole=e,this.fadingDirection=t,this.fadingParentID=r,this.fadeEndTime=i}setSelfFadeLogic(e){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=e}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=ye(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state===\"errored\"||this.state===\"loaded\"||this.state===\"reloading\"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}getRTT(e){return this.rttObjects[e]}acquireRTT(e,t,r){return this.rttObjects[t]=e.acquireRTT(r)}releaseRTT(e){if(this.rttObjects.length!==0){for(let t of this.rttObjects)t&&e.releaseRTT(t);this.rttObjects.length=0}}loadVectorData(e,t,r){if(e?.etagUnmodified===!0){this.state=\"loaded\";return}if(this.hasData()&&this.unloadVectorData(),this.state=\"loaded\",!e){this.collisionBoxArray=new Gh;return}e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestEncoding=e.encoding,this.latestFeatureIndex.rawTileData=e.rawTileData,this.latestFeatureIndex.encoding=e.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=sM(e.buckets,t?.style),this.hasSymbolBuckets=!1;for(let i in this.buckets){let a=this.buckets[i];if(a instanceof Fi)if(this.hasSymbolBuckets=!0,r)a.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let a=this.buckets[i];if(a instanceof Fi&&a.hasRTLText){this.hasRTLText=!0,qc().lazyLoad();break}}this.queryPadding=0;for(let i in this.buckets){let a=this.buckets[i];this.queryPadding=Math.max(this.queryPadding,t.style.getLayer(i).queryRadius(a))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),this.dashPositions=e.dashPositions}unloadVectorData(){for(let e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.imageAtlas=null,this.dashPositions=null,this.latestFeatureIndex=null,this.state=\"unloaded\"}getBucket(e){return this.buckets[e.id]}upload(e){for(let r in this.buckets){let i=this.buckets[r];i.uploadPending()&&i.upload(e)}let t=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Oe(e,this.imageAtlas.image,t.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasImage=(this.glyphAtlasTexture=new Oe(e,this.glyphAtlasImage,t.ALPHA),null))}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,t,r,i,a,n,s,o,l,u,h){return this.latestFeatureIndex?.rawTileData?this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:a,scale:n,tileSize:this.tileSize,pixelPosMatrix:u,transform:o,params:s,queryPadding:this.queryPadding*l,getElevation:h},e,t,r):{}}querySourceFeatures(e,t){let r=this.latestFeatureIndex;if(!r?.rawTileData)return;let i=r.loadVTLayers(),a=t?.sourceLayer?t.sourceLayer:\"\",n=i._geojsonTileLayer||i[a];if(!n)return;let s=wa(t?.filter,`querySourceFeatures[${a}].filter`,t?.globalState),{z:o,x:l,y:u}=this.tileID.canonical,h={z:o,x:l,y:u};for(let c=0;c<n.length;c++){let p=n.feature(c);if(s.needGeometry){let m=yi(p,!0);if(!s.filter(new Te(this.tileID.overscaledZ),m,this.tileID.canonical))continue}else if(!s.filter(new Te(this.tileID.overscaledZ),p))continue;let d=r.getId(p,a),f=new sc(p,o,l,u,d);f.tile=h,e.push(f)}}hasData(){return this.state===\"loaded\"||this.state===\"reloading\"||this.state===\"expired\"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){let t=this.expirationTime;if(e.cacheControl){let r=Uf(e.cacheControl);r[\"max-age\"]&&(this.expirationTime=Date.now()+r[\"max-age\"]*1e3)}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){let r=Date.now(),i=!1;if(this.expirationTime>r)i=!1;else if(!t)i=!0;else if(this.expirationTime<t)i=!0;else{let a=this.expirationTime-t;a?this.expirationTime=r+Math.max(a,3e4):i=!0}i?(this.expiredRequestCount++,this.state=\"expired\"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),2**31-1)}setFeatureState(e,t,r){if(!this.latestFeatureIndex?.rawTileData||Object.keys(e).length===0||this.featureStateRevision===r)return;this.featureStateRevision=r;let i=this.latestFeatureIndex.loadVTLayers();for(let a in this.buckets){if(!t.style.hasLayer(a))continue;let n=this.buckets[a],s=n.layers[0].sourceLayer||\"_geojsonTileLayer\",o=i[s],l=e[s];if(!o||!l||l.length===0)continue;n.update(l,o,this.imageAtlas?.patternPositions||{},this.dashPositions||{});let u=t?.style?.getLayer(a);u&&(this.queryPadding=Math.max(this.queryPadding,u.queryRadius(n)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ye()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(e){this.symbolFadeHoldUntil=ye()+e}setDependencies(e,t){let r={};for(let i of t)r[i]=!0;this.dependencies[e]=r}hasDependency(e,t){for(let r of e){let i=this.dependencies[r];if(i){for(let a of t)if(i[a])return!0}}return!1}};function L0(e){return new Promise((t,r)=>{let i=e.reloadPromise;e.reloadPromise=i?{resolve:a=>{i.resolve(a),t(a)},reject:a=>{i.reject(a),r(a)}}:{resolve:t,reject:r}})}function bi(e){let t=e.reloadPromise;return e.reloadPromise=null,t}var lM=class extends wt{constructor(e,t,r,i){if(super(),this.id=e,this.dispatcher=r,this.type=\"vector\",this.minzoom=0,this.maxzoom=22,this.scheme=\"xyz\",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,j(this,ka(t,[\"url\",\"scheme\",\"tileSize\",\"promoteId\",\"encoding\"])),this._options=j({type:\"vector\"},t),this._collectResourceTiming=t.collectResourceTiming,this.tileSize!==512)throw Error(\"vector tile sources must have a tileSize of 512\");this.setEventedParent(i)}async load(e=!1){this._loaded=!1,this.fire(new Ie(\"dataloading\")),this._tileJSONRequest=new AbortController;try{let t=await F0(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(j(this,t),t.bounds&&(this.tileBounds=new z0(t.bounds,this.minzoom,this.maxzoom)),this.fire(new Ie(\"data\",{sourceDataType:\"metadata\"})),this.fire(new Ie(\"data\",{sourceDataType:\"content\",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,$r(t)||this.fire(new X(it(t)))}}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest=(this._tileJSONRequest.abort(),null))}serialize(){return j({},this._options)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r={request:await this.map._requestManager.transformRequest(t,\"Tile\"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:await this._getOverzoomParameters(e),etag:e.etag};if(r.request.collectResourceTiming=this._collectResourceTiming,await this.dispatcher.waitForInitComplete(),e.actor&&(e.state===\"loading\"||e.abortController))return e.state===\"expired\"&&(e.refreshQueued=!0),L0(e);let i=\"RT\";(!e.actor||e.state===\"expired\")&&(e.actor=this.dispatcher.getReadyActor(),e.refreshQueued=!1,i=\"LT\"),e.abortController=new AbortController;try{let a=await e.actor.sendAsync({type:i,data:r},e.abortController);if(delete e.abortController,e.aborted){bi(e)?.resolve();return}this._afterTileLoadWorkerResponse(e,a);let n={};return a?.etagUnmodified&&(n.unmodified=!0),n}catch(a){if(delete e.abortController,e.aborted||$r(a)){bi(e)?.resolve();return}if(a&&a.status!==404)throw bi(e)?.reject(a),a;this._afterTileLoadWorkerResponse(e,null)}}async _getOverzoomParameters(e){if(e.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;let t=e.tileID.scaledTo(this.maxzoom).canonical,r=t.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:t,overzoomRequest:await this.map._requestManager.transformRequest(r,\"Tile\")}}_afterTileLoadWorkerResponse(e,t){t?.resourceTiming&&(e.resourceTiming=t.resourceTiming),t&&this.map._refreshExpiredTiles&&e.setExpiryData(t),e.etag=t?.etag,e.loadVectorData(t,this.map.painter);let r=bi(e);r&&(e.refreshQueued&&(e.state=\"expired\"),this.loadTile(e).then(r.resolve).catch(r.reject))}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&await e.actor.sendAsync({type:\"AT\",data:{uid:e.uid,type:this.type,source:this.id}})}async unloadTile(e){e.unloadVectorData(),e.actor&&await e.actor.sendAsync({type:\"RMT\",data:{uid:e.uid,type:this.type,source:this.id}})}hasTransition(){return!1}},B0=class extends wt{constructor(e,t,r,i){super(),this.id=e,this.dispatcher=r,this.setEventedParent(i),this.type=\"raster\",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme=\"xyz\",this.tileSize=512,this._loaded=!1,this._premultiplyAlpha=!0,this._options=j({type:\"raster\"},t),j(this,ka(t,[\"url\",\"scheme\",\"tileSize\"]))}async load(e=!1){this._loaded=!1,this.fire(new Ie(\"dataloading\")),this._tileJSONRequest=new AbortController;try{let t=await F0(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,t&&(j(this,t),t.bounds&&(this.tileBounds=new z0(t.bounds,this.minzoom,this.maxzoom)),this.fire(new Ie(\"data\",{sourceDataType:\"metadata\"})),this.fire(new Ie(\"data\",{sourceDataType:\"content\",sourceDataChanged:e})))}catch(t){this._tileJSONRequest=null,this._loaded=!0,$r(t)||this.fire(new X(it(t)))}}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest=(this._tileJSONRequest.abort(),null))}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest=(this._tileJSONRequest.abort(),null)),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return j({},this._options)}setPremultiplyAlpha(e){return this._premultiplyAlpha===e||this.setSourceProperty(()=>{this._premultiplyAlpha=e}),this}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),r=this._premultiplyAlpha,i=r?void 0:{premultiplyAlpha:\"none\"},a=new AbortController;e.abortController=a;try{let n=await Mr.transformAndGetImage(this.map._requestManager,t,\"Tile\",a,this.map._refreshExpiredTiles,i);if(e.abortController!==a)return;if(delete e.abortController,e.aborted){e.state=\"unloaded\";return}if(n?.data){this.map._refreshExpiredTiles&&(n.cacheControl||n.expires)&&e.setExpiryData({cacheControl:n.cacheControl,expires:n.expires});let s=this.map.painter.context,o=s.gl,l=n.data;e.texture=this.map.painter.getTileTexture(l.width),e.texture?e.texture.update(l,{useMipmap:!0,premultiply:r}):(e.texture=new Oe(s,l,o.RGBA,{useMipmap:!0,premultiply:r}),e.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST)),e.state=\"loaded\"}}catch(n){if(e.abortController===a&&delete e.abortController,e.aborted)e.state=\"unloaded\";else if(n)throw e.state=\"errored\",n}}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController)}async unloadTile(e){e.texture&&this.map.painter.saveTileTexture(e.texture)}hasTransition(){return!1}},uM=class extends B0{constructor(e,t,r,i){super(e,t,r,i),this.type=\"raster-dem\",this.maxzoom=22,this._options=j({type:\"raster-dem\"},t),this.encoding=t.encoding||\"mapbox\",this.redFactor=t.redFactor,this.greenFactor=t.greenFactor,this.blueFactor=t.blueFactor,this.baseShift=t.baseShift}async loadTile(e){let t=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{let r=await Mr.transformAndGetImage(this.map._requestManager,t,\"Tile\",e.abortController,this.map._refreshExpiredTiles,{colorSpaceConversion:\"none\"});if(delete e.abortController,e.aborted){e.state=\"unloaded\";return}if(r?.data){let i=r.data;this.map._refreshExpiredTiles&&(r.cacheControl||r.expires)&&e.setExpiryData({cacheControl:r.cacheControl,expires:r.expires});let a=mi(i)&&oh()?i:await this.readImageNow(i),n={type:this.type,uid:e.uid,source:this.id,rawImageData:a,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(e.actor&&e.state!==\"expired\"&&e.state!==\"reloading\")return;await this.dispatcher.waitForInitComplete(),(!e.actor||e.state===\"expired\")&&(e.actor=this.dispatcher.getReadyActor()),e.dem=await e.actor.sendAsync({type:\"LDT\",data:n}),e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0,e.state=\"loaded\"}}catch(r){if(delete e.abortController,e.aborted)e.state=\"unloaded\";else if(r)throw e.state=\"errored\",r}}async readImageNow(e){if(typeof VideoFrame<\"u\"&&bf()){let t=e.width+2,r=e.height+2;try{return new xe({width:t,height:r},await qf(e,-1,-1,t,r))}catch{}}return zt.getImageData(e,1)}_getNeighboringTiles(e){let t=e.canonical,r=2**t.z,i=(t.x-1+r)%r,a=t.x===0?e.wrap-1:e.wrap,n=(t.x+1+r)%r,s=t.x+1===r?e.wrap+1:e.wrap,o={};return o[new nt(e.overscaledZ,a,t.z,i,t.y).key]={backfilled:!1},o[new nt(e.overscaledZ,s,t.z,n,t.y).key]={backfilled:!1},t.y>0&&(o[new nt(e.overscaledZ,a,t.z,i,t.y-1).key]={backfilled:!1},o[new nt(e.overscaledZ,e.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},o[new nt(e.overscaledZ,s,t.z,n,t.y-1).key]={backfilled:!1}),t.y+1<r&&(o[new nt(e.overscaledZ,a,t.z,i,t.y+1).key]={backfilled:!1},o[new nt(e.overscaledZ,e.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},o[new nt(e.overscaledZ,s,t.z,n,t.y+1).key]={backfilled:!1}),o}async unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state=\"unloaded\",e.actor&&await e.actor.sendAsync({type:\"RDT\",data:{type:this.type,uid:e.uid,source:this.id}})}};function ps(e,t){return t?e.properties[t]:e.id}function hM(e,t){let r=new Map;if(e==null||e.type==null)return r;if(e.type===\"Feature\"){let i=ps(e,t);return i==null?void 0:(r.set(i,e),r)}if(e.type===\"FeatureCollection\"){let i=new Set;for(let a of e.features){let n=ps(a,t);if(n==null||i.has(n))return;i.add(n),r.set(n,a)}return r}}function cM(e,t,r){let i=[];if(t.removeAll)e.clear();else if(t.remove)for(let a of t.remove){let n=e.get(a);n&&(i.push(n.geometry),e.delete(a))}if(t.add)for(let a of t.add){let n=ps(a,r);if(n==null)continue;let s=e.get(n);s&&i.push(s.geometry),i.push(a.geometry),e.set(n,a)}if(t.update)for(let a of t.update){let n=e.get(a.id);if(!n)continue;let s=!!a.newGeometry,o=a.removeAllProperties||a.removeProperties?.length>0||a.addOrUpdateProperties?.length>0;if(!s&&!o)continue;i.push(n.geometry);let l={...n};if(e.set(a.id,l),s&&(i.push(a.newGeometry),l.geometry=a.newGeometry),o){if(l.properties=a.removeAllProperties?{}:{...l.properties||{}},a.removeProperties)for(let u of a.removeProperties)delete l.properties[u];if(a.addOrUpdateProperties)for(let{key:u,value:h}of a.addOrUpdateProperties)l.properties[u]=h}}return i}function pM(e,t,r){if(!e)return t||{};if(!t)return e||{};r&&(A_(e.add,r),A_(t.add,r));let i=M_(e),a=M_(t);dM(i,a);let n={};if((i.removeAll||a.removeAll)&&(n.removeAll=!0),n.remove=new Set([...i.remove,...a.remove]),n.add=new Map([...i.add,...a.add]),n.update=new Map([...i.update,...a.update]),n.remove.size&&n.add.size)for(let o of n.add.keys())n.remove.delete(o);let s=gM(n);return r&&mM(s.add,r),s}function dM(e,t){t.removeAll&&(e.add.clear(),e.update.clear(),e.remove.clear(),t.remove.clear());for(let r of t.remove)e.add.delete(r),e.update.delete(r);for(let[r,i]of t.update){let a=e.update.get(r);a&&(t.update.set(r,fM(a,i)),e.update.delete(r))}}function fM(e,t){let r={id:e.id};if(t.removeAllProperties&&(delete e.removeProperties,delete e.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(let i of t.removeProperties){let a=e.addOrUpdateProperties.findIndex(n=>n.key===i);a>-1&&e.addOrUpdateProperties.splice(a,1)}return(e.removeAllProperties||t.removeAllProperties)&&(r.removeAllProperties=!0),(e.removeProperties||t.removeProperties)&&(r.removeProperties=[...e.removeProperties||[],...t.removeProperties||[]]),(e.addOrUpdateProperties||t.addOrUpdateProperties)&&(r.addOrUpdateProperties=[...e.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(e.newGeometry||t.newGeometry)&&(r.newGeometry=t.newGeometry||e.newGeometry),r}function A_(e,t){if(e)for(let r of e){let i=ps(r,t);i!=null&&(r.id=i)}}function mM(e,t){if(e)for(let r of e)ps(r,t)!=null&&delete r.id}function M_(e){if(!e)return{};let t={};return t.removeAll=e.removeAll,t.remove=new Set(e.remove||[]),t.add=new Map(e.add?.map(r=>[r.id,r])),t.update=new Map(e.update?.map(r=>[r.id,r])),t}function gM(e){let t={};return e.removeAll&&(t.removeAll=e.removeAll),e.remove&&(t.remove=Array.from(e.remove)),e.add&&(t.add=Array.from(e.add.values())),e.update&&(t.update=Array.from(e.update.values())),t}function O0(e){return!e||e.length===0?[]:typeof e[0]==\"number\"?[e]:e.flatMap(t=>O0(t))}function ll(e){return e.type===\"GeometryCollection\"?e.geometries.flatMap(t=>ll(t)):O0(e.coordinates)}function P_(e){let t=new Kr,r;switch(e.type){case\"FeatureCollection\":r=e.features.flatMap(i=>ll(i.geometry));break;case\"Feature\":r=ll(e.geometry);break;default:r=ll(e)}if(r.length===0)return t;for(let i of r){let[a,n]=i;t.extend([a,n])}return t}function yM({x:e,y:t,z:r},i=0){let a=No((e-i)/2**r),n=Aa((t+1+i)/2**r),s=No((e+1+i)/2**r),o=Aa((t-i)/2**r);return new Kr([a,n],[s,o])}var _M=class extends wt{constructor(e,t,r,i){super(),this.id=e,this.type=\"geojson\",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._isUpdatingWorker=!1,this._pendingWorkerUpdate={data:t.data},this.actorPromise=r.getActor(),this.setEventedParent(i),this._data=typeof t.data==\"string\"?{url:t.data}:{geojson:t.data},this._options=j({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId,t.clusterMaxZoom!==void 0&&this.maxzoom<=t.clusterMaxZoom&&pe(`The maxzoom value \"${this.maxzoom}\" is expected to be greater than the clusterMaxZoom value \"${t.clusterMaxZoom}\".`),this.workerOptions=j({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(t.buffer===void 0?128:t.buffer),tolerance:this._pixelsToTileUnits(t.tolerance===void 0?.375:t.tolerance),extent:z,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1,promoteId:typeof t.promoteId==\"string\"?t.promoteId:void 0,cluster:t.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(t.clusterMaxZoom),minPoints:Math.max(2,t.clusterMinPoints||2),extent:z,radius:this._pixelsToTileUnits(t.clusterRadius||50),log:!1,generateId:t.generateId||!1}},clusterProperties:t.clusterProperties,filter:t.filter},t.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(e){return e*(z/this.tileSize)}_tileUnitsToPixels(e){return e/(z/this.tileSize)}_getClusterMaxZoom(e){let t=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||pe(`Integer expected for option 'clusterMaxZoom': provided value \"${e}\" rounded to \"${t}\"`),t}async load(){await this._updateWorkerData()}onAdd(e){this.map=e,this.load()}setData(e){return this._data=typeof e==\"string\"?{url:e}:{geojson:e},this._pendingWorkerUpdate={data:e},this._updateWorkerData()}updateData(e){return this._pendingWorkerUpdate.diff=pM(this._pendingWorkerUpdate.diff,e),this._updateWorkerData()}async getData(){return this._data.url&&await this.once(\"data\"),this._data.geojson?this._data.geojson:{type:\"FeatureCollection\",features:Array.from(this._data.updateable.values())}}async getBounds(){return P_(await this.getData())}setClusterOptions(e){return this.workerOptions.geojsonVtOptions.cluster=e.cluster,e.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(e.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData()}getClusterOptions(){let{cluster:e,clusterOptions:t}=this.workerOptions.geojsonVtOptions;return{cluster:e,clusterMaxZoom:t.maxZoom,clusterRadius:this._tileUnitsToPixels(t.radius)}}async getClusterExpansionZoom(e){return(await this.actorPromise).sendAsync({type:\"GCEZ\",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterChildren(e){return(await this.actorPromise).sendAsync({type:\"GCC\",data:{type:this.type,clusterId:e,source:this.id}})}async getClusterLeaves(e,t,r){return(await this.actorPromise).sendAsync({type:\"GCL\",data:{type:this.type,source:this.id,clusterId:e,limit:t,offset:r}})}async _updateWorkerData(){if(this._isUpdatingWorker)return this._updatePromise;if(!this._hasPendingWorkerUpdate()){pe(`No pending worker updates for GeoJSONSource ${this.id}.`);return}let{data:e,diff:t,updateCluster:r}=this._pendingWorkerUpdate,i=this._getLoadGeoJSONParameters(e,t,r);e===void 0?t?this._pendingWorkerUpdate.diff=void 0:r&&(this._pendingWorkerUpdate.updateCluster=void 0):this._pendingWorkerUpdate.data=void 0,this._updatePromise=this._dispatchWorkerUpdate(i),await this._updatePromise}async _getLoadGeoJSONParameters(e,t,r){let i=j({type:this.type,source:this.id},this.workerOptions);if(typeof e==\"string\")return i.request=await this.map._requestManager.transformRequest(zt.resolveURL(e),\"Source\"),i.request.collectResourceTiming=this._collectResourceTiming,i;if(e!==void 0)return i.data=e,i;if(t)return i.dataDiff=t,i;if(r)return i.updateCluster=!0,i}async _dispatchWorkerUpdate(e){this._isUpdatingWorker=!0,this.fire(new Ie(\"dataloading\"));try{let t=await e,r=await(await this.actorPromise).sendAsync({type:\"LD\",data:t});if(this._isUpdatingWorker=!1,this._removed||r.abandoned){this.fire(new Ie(\"dataabort\"));return}r.data&&(this._data={geojson:r.data});let i=this._applyDiffToSource(t.dataDiff),a=this._getShouldReloadTileOptions(i),n={};this._applyResourceTiming(n,r),this.fire(new Ie(\"data\",{...n,sourceDataType:\"metadata\"})),this.fire(new Ie(\"data\",{...n,sourceDataType:\"content\",shouldReloadTileOptions:a}))}catch(t){if(this._isUpdatingWorker=!1,this._removed){this.fire(new Ie(\"dataabort\"));return}this.fire(new X(it(t)))}finally{this._hasPendingWorkerUpdate()&&await this._updateWorkerData()}}_applyResourceTiming(e,t){if(!this._collectResourceTiming)return;let r=t.resourceTiming?.[this.id];if(!r)return;let i=r.slice(0);i?.length&&j(e,{resourceTiming:i})}_applyDiffToSource(e){if(!e)return;let t=typeof this.promoteId==\"string\"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){let i=hM(this._data.geojson,t);if(!i)throw Error(`GeoJSONSource \"${this.id}\": GeoJSON data is not compatible with updateData`);this._data={updateable:i}}if(!this._data.updateable)return;let r=cM(this._data.updateable,e,t);if(!(e.removeAll||this._options.cluster))return r}_getShouldReloadTileOptions(e){if(e)return{affectedBounds:e.filter(Boolean).map(t=>P_(t))}}shouldReloadTile(e,{affectedBounds:t}){if(e.state===\"loading\")return!0;if(e.state===\"unloaded\")return!1;let{buffer:r,extent:i}=this.workerOptions.geojsonVtOptions,a=yM(e.tileID.canonical,r/i);for(let n of t)if(a.intersects(n))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}async loadTile(e){let t=e.actor?\"RT\":\"LT\",r=await this.actorPromise;if(e.actor&&(e.state===\"loading\"||e.abortController))return L0(e);e.actor=r;let i={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;let a;try{a=await r.sendAsync({type:t,data:i},e.abortController),delete e.abortController}catch(s){if(delete e.abortController,e.aborted||$r(s)){bi(e)?.resolve();return}throw bi(e)?.reject(s),s}if(e.unloadVectorData(),e.aborted){bi(e)?.resolve();return}e.loadVectorData(a,this.map.painter,t===\"RT\");let n=bi(e);n&&this.loadTile(e).then(n.resolve).catch(n.reject)}async abortTile(e){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0}async unloadTile(e){e.unloadVectorData(),await(await this.actorPromise).sendAsync({type:\"RMT\",data:{uid:e.uid,type:this.type,source:this.id}})}onRemove(){this._removed=!0,this.actorPromise.then(e=>e.sendAsync({type:\"RS\",data:{type:this.type,source:this.id}}))}serialize(){return j({},this._options,{type:this.type,data:this._data.updateable?{type:\"FeatureCollection\",features:Array.from(this._data.updateable.values())}:this._data.url||this._data.geojson})}hasTransition(){return!1}},Ga=[0,0,1],xM=(e,t)=>({u_tl_parent:new Z(e,t.u_tl_parent),u_scale_parent:new B(e,t.u_scale_parent),u_buffer_scale:new B(e,t.u_buffer_scale),u_image_warp:new Mt(e,t.u_image_warp),u_fade_t:new B(e,t.u_fade_t),u_opacity:new B(e,t.u_opacity),u_image0:new G(e,t.u_image0),u_image1:new G(e,t.u_image1),u_brightness_low:new B(e,t.u_brightness_low),u_brightness_high:new B(e,t.u_brightness_high),u_saturation_factor:new B(e,t.u_saturation_factor),u_contrast_factor:new B(e,t.u_contrast_factor),u_spin_weights:new Mt(e,t.u_spin_weights),u_coords_top:new Ir(e,t.u_coords_top),u_coords_bottom:new Ir(e,t.u_coords_bottom),u_colorization_mix:new Ir(e,t.u_colorization_mix),u_colorization_scale:new Z(e,t.u_colorization_scale),u_color_ramp:new G(e,t.u_color_ramp)}),vM=(e,t,r,i,a,n,s,o,l)=>({u_tl_parent:e,u_scale_parent:t,u_buffer_scale:1,u_image_warp:n,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get(\"raster-opacity\"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get(\"raster-brightness-min\"),u_brightness_high:i.paint.get(\"raster-brightness-max\"),u_saturation_factor:SM(i.paint.get(\"raster-saturation\")),u_contrast_factor:TM(i.paint.get(\"raster-contrast\")),u_spin_weights:wM(i.paint.get(\"raster-hue-rotate\")),u_coords_top:[a[0].x,a[0].y,a[1].x,a[1].y],u_coords_bottom:[a[3].x,a[3].y,a[2].x,a[2].y],u_colorization_mix:o,u_colorization_scale:bM(l||[0,1]),u_color_ramp:s});function bM([e,t]){return e===t?[e,t]:[-e/(t-e),1/(t-e)]}function wM(e){e*=Math.PI/180;let t=Math.sin(e),r=Math.cos(e);return[(2*r+1)/3,(-Math.sqrt(3)*t-r+1)/3,(Math.sqrt(3)*t-r+1)/3]}function TM(e){return e>0?1/(1-e):1+e}function SM(e){return e>0?1-1/(1.001-e):-e}var ds=class{constructor(e,t,r){this.vertexBuffer=e,this.indexBuffer=t,this.segments=r}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}},Hi=Ae([{name:\"a_pos\",type:\"Int16\",components:2}]),Ko=z/128;function V0(e,t){let r=EM(t,\"16bit\"),i=Gr.deserialize({arrayBuffer:r.vertices,length:r.vertices.byteLength/2/2}),a=pr.deserialize({arrayBuffer:r.indices,length:r.indices.byteLength/2/3});return new ds(e.createVertexBuffer(i,Hi.members),e.createIndexBuffer(a),Ee.simpleSegment(0,0,i.length,a.length))}function EM(e,t){let r=e.granularity===void 0?1:Math.max(e.granularity,1),i=r+(e.generateBorders?2:0),a=r+(e.extendToNorthPole||e.generateBorders?1:0)+(e.extendToSouthPole||e.generateBorders?1:0),n=i+1,s=a+1,o=e.generateBorders?-1:0,l=e.generateBorders||e.extendToNorthPole?-1:0,u=r+ +!!e.generateBorders,h=r+(e.generateBorders||e.extendToSouthPole?1:0),c=n*s,p=i*a*6,d=n*s>65536;if(d&&t===\"16bit\")throw Error(\"Granularity is too large and meshes would not fit inside 16 bit vertex indices.\");let f=d||t===\"32bit\",m=new Int16Array(c*2),g=0;for(let x=l;x<=h;x++)for(let v=o;v<=u;v++){let w=v/r*z;v===-1&&(w=-Ko),v===r+1&&(w=z+Ko);let b=x/r*z;x===-1&&(b=e.extendToNorthPole?fa:-Ko),x===r+1&&(b=e.extendToSouthPole?ma:z+Ko),m[g++]=w,m[g++]=b}let y=f?new Uint32Array(p):new Uint16Array(p),_=0;for(let x=0;x<a;x++)for(let v=0;v<i;v++){let w=v+x*n,b=v+1+x*n,T=v+(x+1)*n,I=v+1+(x+1)*n;y[_++]=w,y[_++]=T,y[_++]=b,y[_++]=b,y[_++]=T,y[_++]=I}return{vertices:m.buffer.slice(0),indices:y.buffer.slice(0),uses32bitIndices:f}}var fs=class extends wt{constructor(e,t,r,i){super(),this.imageWarp=Ga,this.flippedWindingOrder=!1,this._warp=\"auto\",this._imageDirty=!1,this._subdividedQuad=!1,this._subdividedMesh=null,this.id=e,this.dispatcher=r,this.coordinates=t.coordinates,this.type=\"image\",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(i),this.options=t}async load(e){this._loaded=!1,this.fire(new Ie(\"dataloading\")),this.url=this.options.url;let t=new AbortController;this._abortController=t;try{let r=await Mr.transformAndGetImage(this.map._requestManager,this.url,\"Image\",t);if(this._abortController!==t)return;this._abortController=null,this._loaded=!0,r?.data&&(this._setImage(r.data),e&&(this.coordinates=e),this._finishLoading())}catch(r){if(this._abortController!==t||$r(r))return;this._abortController=null,this._loaded=!0,this.fire(new X(it(r)))}}loaded(){return this._loaded}updateImage(e){return this._abortController&&(this._abortController=(this._abortController.abort(),null)),\"image\"in e?(this._loaded=!0,this._setImage(e.image),e.coordinates&&(this.coordinates=e.coordinates),this._finishLoading(),this):e.url?(this.options.url=e.url,this.load(e.coordinates),this):this}_setImage(e){this.image=e,this._imageDirty=!0}getMesh(e,t){return!this._subdividedQuad||t?null:(this._subdividedMesh??(this._subdividedMesh=V0(e,{granularity:16})),this._subdividedMesh)}_disposeTexture(){this.texture?.destroy(),this.texture=null}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Ie(\"data\",{sourceDataType:\"metadata\"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._abortController&&(this._abortController=(this._abortController.abort(),null)),this._disposeTexture(),this._subdividedMesh?.destroy(),this._subdividedMesh=null,this.image=null,this.tiles={}}setWarp(e){return this._warp===e?this:(this._warp=e,this.tileCoords&&this.setCoordinates(this.coordinates),this)}getWarp(){return this._warp}setCoordinates(e){this.coordinates=e;let t=e.map(fe.fromLngLat);return this.tileID=IM(t),this.terrainTileRanges=this._getOverlappingTileRanges(t),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=t.map(r=>this.tileID.getTilePoint(r)._round()),this.imageWarp=MM(this.tileCoords,this._warp),this._subdividedQuad=this.imageWarp[2]>0&&!N0(this.tileCoords),this.flippedWindingOrder=AM(this.tileCoords),this.fire(new Ie(\"data\",{sourceDataType:\"content\"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,t=e.gl;this.texture?this._imageDirty&&(this.texture.update(this.image),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)):(this.texture=new Oe(e,this.image,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE)),this._imageDirty=!1;let r=!1;for(let i in this.tiles){let a=this.tiles[i];a.state!==\"loaded\"&&(a.state=\"loaded\",a.texture=this.texture,r=!0)}r&&this.fire(new Ie(\"data\",{sourceDataType:\"idle\",sourceId:this.id}))}async loadTile(e){this.tileID?.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state=\"errored\"}serialize(){return{type:\"image\",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let{minX:t,minY:r,maxX:i,maxY:a}=or.fromPoints(e),n={};for(let s=0;s<=25;s++){let o=2**s,l=Math.floor(t*o),u=Math.floor(r*o),h=Math.floor(i*o),c=Math.floor(a*o),p=(l%o+o)%o,d=h%o,f=Math.floor(l/o),m=Math.floor(h/o);n[s]={minWrap:f,maxWrap:m,minTileXWrapped:p,maxTileXWrapped:d,minTileY:u,maxTileY:c}}return n}};function IM(e){let t=or.fromPoints(e),r=t.width(),i=t.height(),a=Math.max(0,Math.floor(-Math.log(Math.max(r,i))/Math.LN2)),n=2**a;return new as(a,Math.floor((t.minX+t.maxX)/2*n),Math.floor((t.minY+t.maxY)/2*n))}function AM(e){let t=e[1].x-e[0].x,r=e[1].y-e[0].y,i=e[2].x-e[0].x;return t*(e[2].y-e[0].y)-r*i<0}function MM(e,t){if(t===\"flat\"||N0(e))return Ga;let[r,i,a,n]=e,s=r.x-i.x+a.x-n.x,o=r.y-i.y+a.y-n.y,l=[i.x-a.x,i.y-a.y,n.x-a.x,n.y-a.y],[u,h,c,p]=l,d=fA(l),f=(s*p-c*o)/d,m=(u*o-s*h)/d,g=[1,1+f,1+f+m,1+m],y=Math.max(...g)/Math.min(...g),_=t===\"perspective\"?0:PM(y);return!(y>=1&&y<=512)||_>=1?Ga:[f,m,_]}function PM(e){let t=(1-4/e)/.9921875;return Math.max(0,t)}function N0(e){let[t,r,i,a]=e;return t.x+i.x===r.x+a.x&&t.y+i.y===r.y+a.y}var CM=class extends fs{constructor(e,t,r,i){super(e,t,r,i),this._onPlayingHandler=()=>{this.map?.triggerRepaint()},this.roundZoom=!0,this.type=\"video\",this.options=t}async load(){this._loaded=!1;let e=this.options;this.urls=[];for(let t of e.urls)this.urls.push((await this.map._requestManager.transformRequest(t,\"Source\")).url);try{let t=await em(this.urls);if(this._loaded=!0,!t)return;this.video=t,this.video.loop=!0,this.video.addEventListener(\"playing\",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(t){this.fire(new X(it(t)))}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let t=this.video.seekable;e<t.start(0)||e>t.end(0)?this.fire(new X(new L(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}onRemove(){super.onRemove(),this.video&&(this.video.removeEventListener(\"playing\",this._onPlayingHandler),this.video.pause())}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,t=e.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new Oe(e,this.video,t.RGBA),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE));let r=!1;for(let i in this.tiles){let a=this.tiles[i];a.state!==\"loaded\"&&(a.state=\"loaded\",a.texture=this.texture,r=!0)}r&&this.fire(new Ie(\"data\",{sourceDataType:\"idle\",sourceId:this.id}))}serialize(){return{type:\"video\",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},kM=class extends fs{constructor(e,t,r,i){super(e,t,r,i),t.coordinates?(!Array.isArray(t.coordinates)||t.coordinates.length!==4||t.coordinates.some(a=>!Array.isArray(a)||a.length!==2||a.some(n=>typeof n!=\"number\")))&&this.fire(new X(new L(`sources.${e}`,null,'\"coordinates\" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new X(new L(`sources.${e}`,null,'missing required property \"coordinates\"'))),t.animate&&typeof t.animate!=\"boolean\"&&this.fire(new X(new L(`sources.${e}`,null,'optional \"animate\" property must be a boolean value'))),t.canvas?typeof t.canvas!=\"string\"&&!(t.canvas instanceof HTMLCanvasElement)&&this.fire(new X(new L(`sources.${e}`,null,'\"canvas\" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new X(new L(`sources.${e}`,null,'missing required property \"canvas\"'))),this.options=t,this.animate=t.animate===void 0||t.animate}async load(){if(this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()){this.fire(new X(Error(\"Canvas dimensions cannot be less than or equal to zero.\")));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this._playing=(this.prepare(),!1))},this._finishLoading()}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this._playing=!1,super.onRemove()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let t=this.map.painter.context,r=t.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new Oe(t,this.canvas,r.RGBA,{premultiply:!0}),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let a in this.tiles){let n=this.tiles[a];n.state!==\"loaded\"&&(n.state=\"loaded\",n.texture=this.texture,i=!0)}i&&this.fire(new Ie(\"data\",{sourceDataType:\"idle\",sourceId:this.id}))}serialize(){return{type:\"canvas\",animate:this.animate,canvas:this.options.canvas,coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}},DM={},FM=(e,t,r,i)=>{let a=new(zM(t.type))(e,t,r,i);if(a.id!==e)throw Error(`Expected Source id to be ${e} instead of ${a.id}`);return a},zM=e=>{switch(e){case\"geojson\":return _M;case\"image\":return fs;case\"raster\":return B0;case\"raster-dem\":return uM;case\"vector\":return lM;case\"video\":return CM;case\"canvas\":return kM}return DM[e]};function C_(e){let t=[];for(let r in e)t.push({id:r,state:e[r]});return t}var RM=class{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(e,t,r){var a,n;let i=String(t);if((a=this.stateChanges)[e]||(a[e]={}),(n=this.stateChanges[e])[i]||(n[i]={}),j(this.stateChanges[e][i],r),this.deletedStates[e]===null){this.deletedStates[e]={};for(let s in this.state[e])if(s===i){this.deletedStates[e][i]={};for(let o in this.state[e][s])r[o]===void 0&&(this.deletedStates[e][i][o]=null)}else this.deletedStates[e][s]=null}else if(this.deletedStates[e]?.[i]===null){this.deletedStates[e][i]={};for(let s in this.state[e][i])r[s]===void 0&&(this.deletedStates[e][i][s]=null)}else for(let s in r)this.deletedStates[e]?.[i]?.[s]===null&&delete this.deletedStates[e][i][s]}removeFeatureState(e,t,r){var a,n;if(this.deletedStates[e]===null)return;let i=String(t);if((a=this.deletedStates)[e]||(a[e]={}),r&&t!==void 0)this.deletedStates[e][i]!==null&&((n=this.deletedStates[e])[i]||(n[i]={}),this.deletedStates[e][i][r]=null);else if(t!==void 0)if(this.stateChanges[e]?.[i])for(r in this.deletedStates[e][i]={},this.stateChanges[e][i])this.deletedStates[e][i][r]=null;else this.deletedStates[e][i]=null;else this.deletedStates[e]=null}getState(e,t){let r=String(t),i=this.state[e]||{},a=this.stateChanges[e]||{},n=j({},i[r],a[r]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){let s=this.deletedStates[e][t];if(s===null)return{};for(let o in s)delete n[o]}return n}initializeTileState(e,t){let r={};for(let i in this.state)r[i]=C_(this.state[i]);e.setFeatureState(r,t,this.revision)}coalesceChanges(e,t){var a,n,s;let r={};for(let o in this.stateChanges){(a=this.state)[o]||(a[o]={}),r[o]||(r[o]={});for(let l in this.stateChanges[o])(n=this.state[o])[l]||(n[l]={}),j(this.state[o][l],this.stateChanges[o][l]),r[o][l]=this.state[o][l]}for(let o in this.deletedStates)if((s=this.state)[o]||(s[o]={}),r[o]||(r[o]={}),this.deletedStates[o]===null)for(let l in this.state[o])this.state[o][l]={},r[o][l]={};else for(let l in this.deletedStates[o]){if(this.deletedStates[o][l]===null)this.state[o][l]={};else for(let u of Object.keys(this.deletedStates[o][l]))delete this.state[o][l][u];r[o][l]=this.state[o][l]}if(this.stateChanges={},this.deletedStates={},Object.keys(r).length===0)return;this.revision++;let i={};for(let o in r)i[o]=C_(r[o]);e.setFeatureState(i,t,this.revision)}};function LM(e,t,r){let i=t.intersectsFrustum(e);if(!r||i===0)return i;let a=t.intersectsPlane(r);return a===0?0:i===2&&a===2?2:1}function k_(e,t,r){let i=0,a=(r-t)/10;for(let n=0;n<10;n++){let s=t+(n+.5)/10*(r-t);i+=a*Math.cos(s)**+e}return i}function Zc(e,t){return function(r,i,a,n,s){let o=2*((e-1)/dt(Math.cos(Fe(xi-s))/Math.cos(Fe(xi)))-1),l=Math.acos(a/n),u=2*k_(o-1,0,Fe(s/2)),h=Math.min(Fe(xi),l+Fe(s/2)),c=Math.min(h,l-Fe(s/2)),p=k_(o-1,c,h),d=Math.atan(i/a),f=Math.hypot(i,a),m=r;return m+=dt(n/f/Math.max(.5,Math.cos(Fe(s/2)))),m+=o*dt(Math.cos(d))/2,m-=dt(Math.max(1,p/u/t))/2,m}}var BM=Zc(9.314,3);function rp(e,t){let r=(t.roundZoom?Math.round:Math.floor)(e.zoom+dt(e.tileSize/t.tileSize));return Math.max(0,r)}function OM(e){let t=xi-e.pitch-e.fov/2,r=te((15-t)/15,0,1);return e.elevation+r*500}function Za(e,t){let r=e.getCameraFrustum(),i=e.getClippingPlane(),a=rc(e),n=fe.fromLngLat(e.center,e.elevation),s=OM(e),o=e.getCoveringTilesDetailsProvider(),l=o.allowVariableZoom(e,t),u=rp(e,t),h=t.minzoom||0,c=t.maxzoom===void 0?e.maxZoom:t.maxzoom,p=Math.min(Math.max(0,u),c),d=2**p,f=[d*a.x,d*a.y,0],m=[d*n.x,d*n.y,0],g=Math.hypot(n.x-a.x,n.y-a.y),y=Math.abs(n.z-a.z),_=Math.hypot(g,y),x=b=>({zoom:0,x:0,y:0,wrap:b,fullyVisible:!1}),v=[],w=[];if(e.renderWorldCopies&&o.allowWorldCopies())for(let b=1;b<=3;b++)v.push(x(-b)),v.push(x(b));for(v.push(x(0));v.length>0;){let b=v.pop(),T=b.x,I=b.y,S=b.fullyVisible,D={x:T,y:I,z:b.zoom},R=o.getTileBoundingVolume(D,b.wrap,s,t);if(!S){let A=LM(r,R,i);if(A===0)continue;S=A===2}let F=o.distanceToTile2d(a.x,a.y,D,R),E=u;l&&(E=(t.calculateTileZoom||BM)(e.zoom+dt(e.tileSize/t.tileSize),F,y,_,e.fov)),E=(t.roundZoom?Math.round:Math.floor)(E),E=Math.max(0,E);let M=Math.min(E,c);if(b.wrap=o.getWrap(n,D,b.wrap),b.zoom>=M){if(b.zoom<h)continue;let A=p-b.zoom,k=f[0]-.5-(T<<A),H=f[1]-.5-(I<<A),$=t.reparseOverscaled?Math.max(b.zoom,E):b.zoom;w.push({tileID:new nt(b.zoom===c?$:b.zoom,b.wrap,b.zoom,T,I),distanceSq:zf([m[0]-.5-T,m[1]-.5-I]),tileDistanceToCamera:Math.sqrt(k*k+H*H)});continue}for(let A=0;A<4;A++){let k=(T<<1)+A%2,H=(I<<1)+(A>>1),$=b.zoom+1;v.push({zoom:$,x:k,y:H,wrap:b.wrap,fullyVisible:S})}}return w.sort((b,T)=>b.distanceSq-T.distanceSq).map(b=>b.tileID)}function D_(e){return e===\"raster\"||e===\"image\"||e===\"video\"}function VM(e,t,r,i,a,n,s){let o=ye(),l=Bf(t);for(let u of t){let h=e.getTileById(u.key);(h.fadingDirection===0||h.fadeOpacity===0)&&h.resetFadeLogic(),!NM(e,h,r,o,i,a,s)&&(UM(e,h,r,o,n,s)||$M(h,l,o,s)||h.resetFadeLogic())}}function NM(e,t,r,i,a,n,s){if(!t.hasData())return!1;let{tileID:o,fadingRole:l,fadingDirection:u,fadingParentID:h}=t;if(l===0&&u===1&&h)return r[h.key]=h,!0;let c=Math.max(o.overscaledZ-a,n);for(let p=o.overscaledZ-1;p>=c;p--){let d=o.scaledTo(p),f=e.getLoadedTile(d);if(f)return t.setCrossFadeLogic({fadingRole:0,fadingDirection:1,fadingParentID:f.tileID,fadeEndTime:i+s}),f.setCrossFadeLogic({fadingRole:1,fadingDirection:0,fadeEndTime:i+s}),r[d.key]=d,!0}return!1}function UM(e,t,r,i,a,n){if(!t.hasData())return!1;let s=t.tileID.children(a),o=F_(e,t,s,r,i,a,n);if(o)return!0;for(let l of s)F_(e,t,l.children(a),r,i,a,n)&&(o=!0);return o}function F_(e,t,r,i,a,n,s){if(r[0].overscaledZ>=n)return!1;let o=!1;for(let l of r){let u=e.getLoadedTile(l);if(!u)continue;let{fadingRole:h,fadingDirection:c,fadingParentID:p}=u;(h!==0||c!==0||!p)&&(u.setCrossFadeLogic({fadingRole:0,fadingDirection:0,fadingParentID:t.tileID,fadeEndTime:a+s}),t.setCrossFadeLogic({fadingRole:1,fadingDirection:1,fadeEndTime:a+s})),i[l.key]=l,o=!0}return o}function $M(e,t,r,i){let a=e.tileID;if(e.selfFading)return!0;if(e.hasData())return!1;if(t.has(a)){let n=r+i;return e.setSelfFadeLogic(n),!0}return!1}function jM(e,t){if(t<=0)return!1;let r=ye();for(let i of e.getAllTiles())if(i.fadeEndTime>=r)return!0;return!1}function GM(e,t){let r=t.getRenderableIds();for(let i of r){if(!e.neighboringTiles?.[i])continue;let a=t.getTileById(i);e.neighboringTiles[i].backfilled||z_(e,a),!a.neighboringTiles?.[e.tileID.key]?.backfilled&&z_(a,e)}}function z_(e,t){e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.needsColorReliefPrepare=!0;let r=t.tileID.canonical.x-e.tileID.canonical.x,i=t.tileID.canonical.y-e.tileID.canonical.y,a=2**e.tileID.canonical.z,n=t.tileID.key;(r!==0||i!==0)&&(Math.abs(i)>1||(Math.abs(r)>1&&(Math.abs(r+a)===1?r+=a:Math.abs(r-a)===1&&(r-=a)),!(!t.dem||!e.dem)&&(e.dem.backfillBorder(t.dem,r,i),e.neighboringTiles?.[n]&&(e.neighboringTiles[n].backfilled=!0))))}var R_=class{constructor(){this._tiles={}}handleWrapJump(e){let t={};for(let r in this._tiles){let i=this._tiles[r];i.tileID=i.tileID.unwrapTo(i.tileID.wrap+e),t[i.tileID.key]=i}this._tiles=t}setFeatureState(e,t,r){for(let i in this._tiles)this._tiles[i].setFeatureState(e,t,r)}getAllTiles(){return Object.values(this._tiles)}getAllIds(e=!1){return e?Object.values(this._tiles).map(t=>t.tileID).sort(Tc).map(t=>t.key):Object.keys(this._tiles)}getTileById(e){return this._tiles[e]}setTile(e,t){this._tiles[e]=t}deleteTileById(e){delete this._tiles[e]}getLoadedTile(e){let t=this.getTileById(e.key);return t?.hasData()?t:null}isIdRenderable(e,t=!1){return this.getTileById(e)?.isRenderable(t)}getRenderableIds(e=0,t){let r=[];for(let i of this.getAllIds())this.isIdRenderable(i,t)&&r.push(this.getTileById(i));return t?r.sort((i,a)=>{let n=i.tileID,s=a.tileID,o=new C(n.canonical.x,n.canonical.y)._rotate(-e),l=new C(s.canonical.x,s.canonical.y)._rotate(-e);return n.overscaledZ-s.overscaledZ||l.y-o.y||l.x-o.x}).map(i=>i.tileID.key):r.map(i=>i.tileID).sort(Tc).map(i=>i.key)}},Yr,Wc=(Yr=class extends wt{constructor(t,r,i){super(),this.id=t,this.dispatcher=i,this.on(\"data\",a=>{this._dataHandler(a)}),this.on(\"dataloading\",()=>{this._sourceErrored=!1}),this.on(\"error\",()=>{this._sourceErrored=this._source.loaded()}),this._source=FM(t,r,i,this),this._inViewTiles=new R_,this._outOfViewCache=new p_(0,a=>this._unloadTile(a)),this._timers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new RM,this._didEmitContent=!1,this._updated=!1}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._maxTileCacheZoomLevels=t?t._maxTileCacheZoomLevels:null,this._source?.onAdd&&this._source.onAdd(t)}onRemove(t){for(let r of this._inViewTiles.getAllTiles())r.unloadVectorData();this.clearTiles(),this._source?.onRemove&&this._source.onRemove(t),this._inViewTiles=new R_}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let t of this._inViewTiles.getAllTiles())if(t.state!==\"loaded\"&&t.state!==\"errored\")return!1;return!0}getSource(){return this._source}getState(){return this._state}pause(){this._paused=!0}resume(){if(!this._paused)return;let t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}async _loadTile(t,r,i,a){try{let n=await this._source.loadTile(t);this._tileLoaded(t,r,i,a,n)}catch(n){t.state=\"errored\",n.status===404?this.update(this.transform,this.terrain):this._source.fire(new X(it(n),{tile:t}))}}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new Ie(\"dataabort\",{tile:t,coord:t.tileID}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._inViewTiles,this.map?this.map.painter:null);for(let r of this._inViewTiles.getAllTiles())r.upload(t),r.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){return this._inViewTiles.getRenderableIds(this.transform?.bearingInRadians,t)}hasRenderableParent(t){let r=t.overscaledZ-1;if(r>=this._source.minzoom){let i=this.getLoadedTile(t.scaledTo(r));if(i)return this._inViewTiles.isIdRenderable(i.tileID.key)}return!1}reload(t,r=void 0){if(this._paused){this._shouldReloadOnResume=!0;return}this._outOfViewCache.reset();for(let i of this._inViewTiles.getAllIds()){let a=this._inViewTiles.getTileById(i);r&&!this._source.shouldReloadTile(a,r)||(t?this._reloadTile(i,a.state===\"errored\"?\"loading\":\"expired\"):a.state!==\"errored\"&&this._reloadTile(i,\"reloading\"))}}async _reloadTile(t,r){if(this._paused){this._shouldReloadOnResume=!0;return}let i=this._inViewTiles.getTileById(t);if(!i)return;let a=i.hasData();i.state!==\"loading\"&&(i.state=r),await this._loadTile(i,t,r,a)}_tileLoaded(t,r,i,a,n){a||(t.timeAdded=ye(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration)),i===\"expired\"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(r,t),!n?.unmodified&&(this.getSource().type===\"raster-dem\"&&t.dem&&GM(t,this._inViewTiles),t.featureStateRevision=-1,this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new Ie(\"data\",{tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,r){let i=this._getLoadedDescendents(r),a=new Set;for(let n of r){let s=i[n.key];if(!s?.length){a.add(n);continue}let o=n.overscaledZ+Yr.maxOverzooming,l=s.filter(c=>c.tileID.overscaledZ<=o);if(!l.length){a.add(n);continue}let u=Math.min(...l.map(c=>c.tileID.overscaledZ)),h=l.filter(c=>c.tileID.overscaledZ===u).map(c=>c.tileID);for(let c of h)t[c.key]=c;this._areDescendentsComplete(h,u,n.overscaledZ)||a.add(n)}return a}_getLoadedDescendents(t){var i;let r={};for(let a of this._inViewTiles.getAllTiles().filter(n=>n.hasData()))for(let n of t)a.tileID.isChildOf(n)&&(r[i=n.key]||(r[i]=[]),r[n.key].push(a));return r}_areDescendentsComplete(t,r,i){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===r:4**(r-i)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){let r=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),i=this._maxTileCacheZoomLevels===null?Tr.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,a=Math.floor(r*i),n=typeof this._maxTileCacheSize==\"number\"?Math.min(this._maxTileCacheSize,a):a;this._outOfViewCache.setMaxSize(n)}handleWrapJump(t){let r=(t-(this._prevLng===void 0?t:this._prevLng))/360,i=Math.round(r);this._prevLng=t,i&&(this._inViewTiles.handleWrapJump(i),this._resetTileReloadTimers())}update(t,r){if(!this._sourceLoaded||this._paused)return;this.transform=t,this.terrain=r,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng);let i;!this.used&&!this.usedForTerrain?i=[]:this._source.tileID?i=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(l=>new nt(l.canonical.z,l.wrap,l.canonical.z,l.canonical.x,l.canonical.y)):(i=Za(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type===\"vector\"&&this.map._zoomLevelsToOverscale!==void 0?Math.max(this._source.maxzoom,t.maxZoom-this.map._zoomLevelsToOverscale):this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(i=i.filter(l=>this._source.hasTile(l)))),this.usedForTerrain&&(i=this._addTerrainIdealTiles(i));let a=i.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,a&&this.fire(new Ie(\"data\",{sourceDataType:\"idle\",sourceId:this.id}));let n=rp(t,this._source),s=this._updateRetainedTiles(i,n),o=D_(this._source.type);o&&this._rasterFadeDuration>0&&!r&&VM(this._inViewTiles,i,s,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),o?this._cleanUpRasterTiles(s):this._cleanUpVectorTiles(s)}_cleanUpRasterTiles(t){for(let r of this._inViewTiles.getAllIds())t[r]||this._removeTile(r)}_cleanUpVectorTiles(t){for(let r of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(r);if(t[r]){i.clearSymbolFadeHold();continue}if(!i.hasSymbolBuckets){this._removeTile(r);continue}i.holdingForSymbolFade()?i.symbolFadeFinished()&&this._removeTile(r):i.setSymbolHoldDuration(this.map._fadeDuration)}}_addTerrainIdealTiles(t){let r=[];for(let i of t)if(i.canonical.z>this._source.minzoom){let a=i.scaledTo(i.canonical.z-1);r.push(a);let n=i.scaledTo(Math.max(this._source.minzoom,Math.min(i.canonical.z,5)));r.push(n)}return t.concat(r)}releaseSymbolFadeTiles(){for(let t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,r){let i=new Set;for(let l of t)this._addTile(l).hasData()||i.add(l);let a=t.reduce((l,u)=>(l[u.key]=u,l),{}),n=this._retainLoadedChildren(a,i),s={},o=Math.max(r-Yr.maxUnderzooming,this._source.minzoom);for(let l of n){let u=this._inViewTiles.getTileById(l.key),h=u?.wasRequested();for(let c=l.overscaledZ-1;c>=o;--c){let p=l.scaledTo(c);if(s[p.key])break;if(s[p.key]=!0,u=this.getTile(p),!u&&h&&(u=this._addTile(p)),u){let d=u.hasData();if((d||!this.map?.cancelPendingTileRequestsWhileZooming||h)&&(a[p.key]=p),h=u.wasRequested(),d)break}}}return a}_addTile(t){let r=this._inViewTiles.getTileById(t.key);if(r)return r;r=this._outOfViewCache.getAndRemove(t),r&&(r.resetFadeLogic(),this._setTileReloadTimer(t.key,r),r.tileID=t,this._state.initializeTileState(r,this.map?this.map.painter:null));let i=r;return r||(r=new R0(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(r,t.key,r.state,!1)),r.uses++,this._inViewTiles.setTile(t.key,r),i||this._source.fire(new Ie(\"dataloading\",{tile:r,coord:r.tileID})),r}_setTileReloadTimer(t,r){this._clearTileReloadTimer(t);let i=r.getExpiryTimeout();if(i){let a=()=>{this._reloadTile(t,\"expired\"),delete this._timers[t]};this._timers[t]=setTimeout(a,i)}}_clearTileReloadTimer(t){let r=this._timers[t];r&&(clearTimeout(r),delete this._timers[t])}_resetTileReloadTimers(){for(let t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(let t of this._inViewTiles.getAllIds()){let r=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,r)}}refreshTiles(t){for(let r of this._inViewTiles.getAllIds()){let i=this._inViewTiles.getTileById(r);!this._inViewTiles.isIdRenderable(r)&&i.state!=\"errored\"||t.some(a=>a.equals(i.tileID.canonical))&&this._reloadTile(r,\"expired\")}}_removeTile(t){let r=this._inViewTiles.getTileById(t);r&&(r.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),!(r.uses>0)&&(r.hasData()&&r.state!==\"reloading\"?this._outOfViewCache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}_dataHandler(t){if(t.dataType===\"source\"){if(t.sourceDataType===\"metadata\"){this._sourceLoaded=!0;return}if(!(t.sourceDataType!==\"content\"||!this._sourceLoaded)){if(this._paused){this._shouldReloadOnResume=!0;return}this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0}}}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,r,i){let a=[],n=this.transform;if(!n)return a;let s=n.getCoveringTilesDetailsProvider().allowWorldCopies(),o=i?n.getCameraQueryGeometry(t):t,l=d=>n.screenPointToMercatorCoordinate(d,this.terrain),u=this.transformBbox(t,l,!s),h=this.transformBbox(o,l,!s),c=this.getIds(),p=or.fromPoints(h);for(let d of c){let f=this._inViewTiles.getTileById(d);if(f.holdingForSymbolFade())continue;let m=s?[f.tileID]:[f.tileID.unwrapTo(-1),f.tileID.unwrapTo(0)],g=2**(n.zoom-f.tileID.overscaledZ),y=r*f.queryPadding*z/f.tileSize/g;for(let _ of m){let x=p.map(v=>_.getTilePoint(new fe(v.x,v.y)));if(x.expandBy(y),x.intersects(my)){let v=u.map(b=>_.getTilePoint(b)),w=h.map(b=>_.getTilePoint(b));a.push({tile:f,tileID:s?_:_.unwrapTo(0),queryGeometry:v,cameraQueryGeometry:w,scale:g})}}}return a}transformBbox(t,r,i){let a=t.map(r);if(i){let n=or.fromPoints(t);n.shrinkBy(Math.min(n.width(),n.height())*.001);let s=n.map(r);or.fromPoints(a).covers(s)||(a=a.map(o=>o.x>.5?new fe(o.x-1,o.y,o.z):o))}return a}getVisibleCoordinates(t){let r=this.getRenderableIds(t).map(i=>this._inViewTiles.getTileById(i).tileID);return this.transform&&this.transform.populateCache(r),r}hasTransition(){return this._source.hasTransition()?!0:D_(this._source.type)&&jM(this._inViewTiles,this._rasterFadeDuration)}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,r,i){t||(t=ts),this._state.updateState(t,r,i)}removeFeatureState(t,r,i){t||(t=ts),this._state.removeFeatureState(t,r,i)}getFeatureState(t,r){return t||(t=ts),this._state.getState(t,r)}setDependencies(t,r,i){let a=this._inViewTiles.getTileById(t);a&&a.setDependencies(r,i)}reloadTilesForDependencies(t,r){for(let i of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(i).hasDependency(t,r)&&this._reloadTile(i,\"reloading\");this._outOfViewCache.filter(i=>!i.hasDependency(t,r))}areTilesLoaded(){for(let t of this._inViewTiles.getAllTiles())if(t.state!==\"loaded\"&&t.state!==\"errored\")return!1;return!0}},Yr.maxUnderzooming=10,Yr.maxOverzooming=3,Yr),qM=class{constructor(e,t){this.reset(e,t)}reset(e,t){this.points=e||[],this._distances=[0];for(let r=1;r<this.points.length;r++)this._distances[r]=this._distances[r-1]+this.points[r].dist(this.points[r-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(t||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(e){if(this.points.length===1)return this.points[0];e=te(e,0,1);let t=1,r=this._distances[t],i=e*this.paddedLength+this.padding;for(;r<i&&t<this._distances.length;)r=this._distances[++t];let a=t-1,n=this._distances[a],s=r-n,o=s>0?(i-n)/s:0;return this.points[a].mult(1-o).add(this.points[t].mult(o))}};function ul(e,t,r,i,a){return a?e?e(t,r)+i:i===0?void 0:i:i}function Jo(e,t){let r=!0;return e===\"always\"||(e===\"never\"||t===\"never\")&&(r=!1),r}var L_=class{constructor(e,t,r){let i=this.boxCells=[],a=this.circleCells=[];this.xCellCount=Math.ceil(e/r),this.yCellCount=Math.ceil(t/r);for(let n=0;n<this.xCellCount*this.yCellCount;n++)i.push([]),a.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=t,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/t,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,t,r,i,a){this._forEachCell(t,r,i,a,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(a)}insertCircle(e,t,r,i){this._forEachCell(t-i,r-i,t+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(t),this.circles.push(r),this.circles.push(i)}_insertBoxCell(e,t,r,i,a,n){this.boxCells[a].push(n)}_insertCircleCell(e,t,r,i,a,n){this.circleCells[a].push(n)}_query(e,t,r,i,a,n,s){if(r<0||e>this.width||i<0||t>this.height)return[];let o=[];if(e<=0&&t<=0&&this.width<=r&&this.height<=i){if(a)return[{key:null,x1:e,y1:t,x2:r,y2:i}];for(let l=0;l<this.boxKeys.length;l++)o.push({key:this.boxKeys[l],x1:this.bboxes[l*4],y1:this.bboxes[l*4+1],x2:this.bboxes[l*4+2],y2:this.bboxes[l*4+3]});for(let l=0;l<this.circleKeys.length;l++){let u=this.circles[l*3],h=this.circles[l*3+1],c=this.circles[l*3+2];o.push({key:this.circleKeys[l],x1:u-c,y1:h-c,x2:u+c,y2:h+c})}}else{let l={hitTest:a,overlapMode:n,seenUids:{box:{},circle:{}}};this._forEachCell(e,t,r,i,this._queryCell,o,l,s)}return o}query(e,t,r,i){return this._query(e,t,r,i,!1,null)}hitTest(e,t,r,i,a,n){return this._query(e,t,r,i,!0,a,n).length>0}hitTestCircle(e,t,r,i,a){let n=e-r,s=e+r,o=t-r,l=t+r;if(s<0||n>this.width||l<0||o>this.height)return!1;let u=[],h={hitTest:!0,overlapMode:i,circle:{x:e,y:t,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(n,o,s,l,this._queryCellCircle,u,h,a),u.length>0}_queryCell(e,t,r,i,a,n,s,o){let{seenUids:l,hitTest:u,overlapMode:h}=s,c=this.boxCells[a],p=1e-6;if(c!==null){let f=this.bboxes;for(let m of c)if(!l.box[m]){l.box[m]=!0;let g=m*4,y=this.boxKeys[m];if(e<=f[g+2]+p&&t<=f[g+3]+p&&r>=f[g+0]-p&&i>=f[g+1]-p&&(!o||o(y))&&(!u||!Jo(h,y.overlapMode))&&(n.push({key:y,x1:f[g],y1:f[g+1],x2:f[g+2],y2:f[g+3]}),u))return!0}}let d=this.circleCells[a];if(d!==null){let f=this.circles;for(let m of d)if(!l.circle[m]){l.circle[m]=!0;let g=m*3,y=this.circleKeys[m];if(this._circleAndRectCollide(f[g],f[g+1],f[g+2],e,t,r,i)&&(!o||o(y))&&(!u||!Jo(h,y.overlapMode))){let _=f[g],x=f[g+1],v=f[g+2];if(n.push({key:y,x1:_-v,y1:x-v,x2:_+v,y2:x+v}),u)return!0}}}return!1}_queryCellCircle(e,t,r,i,a,n,s,o){let{circle:l,seenUids:u,overlapMode:h}=s,c=this.boxCells[a];if(c!==null){let d=this.bboxes;for(let f of c)if(!u.box[f]){u.box[f]=!0;let m=f*4,g=this.boxKeys[f];if(this._circleAndRectCollide(l.x,l.y,l.radius,d[m+0],d[m+1],d[m+2],d[m+3])&&(!o||o(g))&&!Jo(h,g.overlapMode))return n.push(!0),!0}}let p=this.circleCells[a];if(p!==null){let d=this.circles;for(let f of p)if(!u.circle[f]){u.circle[f]=!0;let m=f*3,g=this.circleKeys[f];if(this._circlesCollide(d[m],d[m+1],d[m+2],l.x,l.y,l.radius)&&(!o||o(g))&&!Jo(h,g.overlapMode))return n.push(!0),!0}}}_forEachCell(e,t,r,i,a,n,s,o){let l=this._convertToXCellCoord(e),u=this._convertToYCellCoord(t),h=this._convertToXCellCoord(r),c=this._convertToYCellCoord(i);for(let p=l;p<=h;p++)for(let d=u;d<=c;d++){let f=this.xCellCount*d+p;if(a.call(this,e,t,r,i,f,n,s,o))return}}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,t,r,i,a,n){let s=i-e,o=a-t,l=r+n;return l*l>s*s+o*o}_circleAndRectCollide(e,t,r,i,a,n,s){let o=(n-i)/2,l=Math.abs(e-(i+o));if(l>o+r)return!1;let u=(s-a)/2,h=Math.abs(t-(a+u));if(h>u+r)return!1;if(l<=o||h<=u)return!0;let c=l-o,p=h-u;return c*c+p*p<=r*r}};function ZM(e,t){let r=1/(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),i=1/(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]),a=t[0]*r,n=t[4]*r,s=t[8]*i,o=t[1]*r,l=t[5]*r,u=t[9]*i,h=t[2]*r,c=t[6]*r,p=t[10]*i;e[0]=a,e[1]=n,e[2]=s,e[4]=o,e[5]=l,e[6]=u,e[8]=h,e[9]=c,e[10]=p;let d=t[12],f=t[13],m=t[14];return e[12]=-a*d-o*f-h*m,e[13]=-n*d-l*f-c*m,e[14]=-s*d-u*f-p*m,e[3]=0,e[7]=0,e[11]=0,e[15]=1,e}function WM(e,t){return e[0]=1/t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1/t[5],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=0,e[11]=1/t[14],e[12]=0,e[13]=0,e[14]=-1,e[15]=t[10]/t[14],e}function XM(e,t){let r=1/(t[0]*t[5]-t[1]*t[4]);return e[0]=t[5]*r,e[1]=-t[1]*r,e[2]=0,e[3]=0,e[4]=-t[4]*r,e[5]=t[0]*r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1/t[10],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1/t[15],e}var HM=Vr();function ip(e,t,r){let i=Vr();if(!e){let{vecSouth:a,vecEast:n}=ap(t),s=S0();s[0]=n[0],s[1]=n[1],s[2]=a[0],s[3]=a[1],dA(s,s),i[0]=s[0],i[1]=s[1],i[4]=s[2],i[5]=s[3]}return at(i,i,[1/r,1/r,1]),i}function YM(e,t,r,i){if(e){let a=Vr();if(!t){let{vecSouth:n,vecEast:s}=ap(r);a[0]=s[0],a[1]=s[1],a[4]=n[0],a[5]=n[1]}return at(a,a,[i,i,1]),a}return r.renderWindowCrop?.cropClipSpace(r.pixelsToClipSpaceMatrix)??r.pixelsToClipSpaceMatrix}function ap(e){let t=Math.cos(e.rollInRadians),r=Math.sin(e.rollInRadians),i=Math.cos(e.pitchInRadians),a=Math.cos(e.bearingInRadians),n=Math.sin(e.bearingInRadians),s=oo();s[0]=-a*i*r-n*t,s[1]=-n*i*r+a*t;let o=ph(s);o<1e-9?dh(s):ch(s,s,1/o);let l=oo();l[0]=a*i*t-n*r,l[1]=n*i*t+a*r;let u=ph(l);return u<1e-9?dh(l):ch(l,l,1/u),{vecEast:l,vecSouth:s}}function Ki(e,t,r){return ul(e.getElevation,t,r,e.heightOffset??0,e.heightAnchorGround??!0)}function np(e,t,r,i){let a;i==null?(a=[e,t,0,1],sp(a,a,r)):(a=[e,t,i,1],We(a,a,r));let n=a[3];return{point:new C(a[0]/n,a[1]/n),signedDistanceFromCamera:n,isOccluded:!1}}function U0(e,t){return .5+e/t*.5}function KM(e,t){return e.x>=-t[0]&&e.x<=t[0]&&e.y>=-t[1]&&e.y<=t[1]}function JM(e,t,r,i,a,n,s,o,l,u,h,c,p){let d=r?e.textSizeData:e.iconSizeData,f=es(d,t.transform.zoom),m=t.transform.renderWindowCrop,g=m?.fullWidth??t.width,y=m?.fullHeight??t.height,_=[256/g*2+1,256/y*2+1],x=r?e.text.dynamicLayoutVertexArray:e.icon.dynamicLayoutVertexArray;x.clear();let v=e.lineVertexArray,w=r?e.text.placedSymbolArray:e.icon.placedSymbolArray,b=t.transform.width/t.transform.height,T=!1;for(let I=0;I<w.length;I++){let S=w.get(I);if(S.hidden||S.writingMode===2&&!T){qa(S.numGlyphs,x);continue}T=!1;let D=new C(S.anchorX,S.anchorY),R={getElevation:p,pitchedLabelPlaneMatrix:i,lineVertexArray:v,pitchWithMap:n,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:D,unwrappedTileID:l,width:u,height:h,translation:c},F=G0(S.anchorX,S.anchorY,R);if(!KM(F.point,_)){qa(S.numGlyphs,x);continue}let E=F.signedDistanceFromCamera,M=U0(t.transform.cameraToCenterDistance,E),A=Go(d,f,S),k=n?A*t.transform.getPitchedTextCorrection(S.anchorX,S.anchorY,l)/M:A*M,H=O_({projectionContext:R,pitchedLabelPlaneMatrixInverse:a,symbol:S,fontSize:k,flip:!1,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:x,aspectRatio:b,rotateToLine:o});T=H.useVertical,(H.notEnoughRoom||T||H.needsFlipping&&O_({projectionContext:R,pitchedLabelPlaneMatrixInverse:a,symbol:S,fontSize:k,flip:!0,keepUpright:s,glyphOffsetArray:e.glyphOffsetArray,dynamicLayoutVertexArray:x,aspectRatio:b,rotateToLine:o}).notEnoughRoom)&&qa(S.numGlyphs,x)}r?e.text.dynamicLayoutVertexBuffer.updateData(x):e.icon.dynamicLayoutVertexBuffer.updateData(x)}function $0(e,t,r,i,a,n,s,o){let l=n.glyphStartIndex+n.numGlyphs,u=n.lineStartIndex,h=n.lineStartIndex+n.lineLength,c=t.getoffsetX(n.glyphStartIndex),p=t.getoffsetX(l-1),d=pl(e*c,r,i,a,n.segment,u,h,o,s);if(!d)return null;let f=pl(e*p,r,i,a,n.segment,u,h,o,s);return!f||o.projectionCache.anyProjectionOccluded?null:{first:d,last:f}}function B_(e,t,r,i){return e===1&&Math.abs(r.y-t.y)>Math.abs(r.x-t.x)*i?{useVertical:!0}:(e===2?t.y<r.y:t.x>r.x)?{needsFlipping:!0}:null}function O_(e){let{projectionContext:t,pitchedLabelPlaneMatrixInverse:r,symbol:i,fontSize:a,flip:n,keepUpright:s,glyphOffsetArray:o,dynamicLayoutVertexArray:l,aspectRatio:u,rotateToLine:h}=e,c=a/24,p=i.lineOffsetX*c,d=i.lineOffsetY*c,f;if(i.numGlyphs>1){let m=i.glyphStartIndex+i.numGlyphs,g=i.lineStartIndex,y=i.lineStartIndex+i.lineLength,_=$0(c,o,p,d,n,i,h,t);if(!_)return{notEnoughRoom:!0};let x=Qo(_.first.point.x,_.first.point.y,t,r),v=Qo(_.last.point.x,_.last.point.y,t,r);if(s&&!n){let w=B_(i.writingMode,x,v,u);if(w)return w}f=[_.first];for(let w=i.glyphStartIndex+1;w<m-1;w++){let b=pl(c*o.getoffsetX(w),p,d,n,i.segment,g,y,t,h);if(!b)return{notEnoughRoom:!0};f.push(b)}f.push(_.last)}else{if(s&&!n){let g=Ji(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,y=i.lineStartIndex+i.segment+1,_=new C(t.lineVertexArray.getx(y),t.lineVertexArray.gety(y)),x=Ji(_.x,_.y,t),v=x.signedDistanceFromCamera>0?x.point:j0(t.tileAnchorPoint,_,g,1,t),w=Qo(g.x,g.y,t,r),b=Qo(v.x,v.y,t,r),T=B_(i.writingMode,w,b,u);if(T)return T}let m=pl(c*o.getoffsetX(i.glyphStartIndex),p,d,n,i.segment,i.lineStartIndex,i.lineStartIndex+i.lineLength,t,h);if(!m||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};f=[m]}for(let m of f)Na(l,m.point,m.angle);return{}}function j0(e,t,r,i,a){let n=e.add(e.sub(t)._unit()),s=Ji(n.x,n.y,a).point,o=r.sub(s);return r.add(o._mult(i/o.mag()))}function Xc(e,t,r){let i=t.projectionCache;if(i.projections[e])return i.projections[e];let a=new C(t.lineVertexArray.getx(e),t.lineVertexArray.gety(e)),n=Ji(a.x,a.y,t);if(n.signedDistanceFromCamera>0)return i.projections[e]=n.point,i.anyProjectionOccluded||(i.anyProjectionOccluded=n.isOccluded),n.point;let s=e-r.direction,o=r.distanceFromAnchor===0?t.tileAnchorPoint:new C(t.lineVertexArray.getx(s),t.lineVertexArray.gety(s)),l=r.absOffsetX-r.distanceFromAnchor+1;return j0(o,a,r.previousVertex,l,t)}function Ji(e,t,r){let i=e+r.translation[0],a=t+r.translation[1],n;return r.pitchWithMap?(n=np(i,a,r.pitchedLabelPlaneMatrix,Ki(r,i,a)),n.isOccluded=!1):(n=r.transform.projectTileCoordinates(i,a,r.unwrappedTileID,Ki(r,i,a)),n.point.x=(n.point.x*.5+.5)*r.width,n.point.y=(-n.point.y*.5+.5)*r.height),n}function Qo(e,t,r,i){if(r.pitchWithMap){let a=[e,t,0,1];We(a,a,i);let n=a[0]/a[3],s=a[1]/a[3];return r.transform.projectTileCoordinates(n,s,r.unwrappedTileID,Ki(r,n,s)).point}return{x:e/r.width*2-1,y:1-t/r.height*2}}function G0(e,t,r){return r.transform.projectTileCoordinates(e,t,r.unwrappedTileID,Ki(r,e,t))}function Hc(e,t,r){return e._unit()._perp()._mult(t*r)}function QM(e,t,r,i,a,n,s,o,l){if(o.projectionCache.offsets[e])return o.projectionCache.offsets[e];let u=r.add(t);if(e+l.direction<i||e+l.direction>=a)return o.projectionCache.offsets[e]=u,u;let h=Xc(e+l.direction,o,l),c=Hc(h.sub(r),s,l.direction),p=r.add(c),d=h.add(c);return o.projectionCache.offsets[e]=Vf(n,u,p,d)||u,o.projectionCache.offsets[e]}function pl(e,t,r,i,a,n,s,o,l){let u=i?e-t:e+t,h=u>0?1:-1,c=0;i&&(h*=-1,c=Math.PI),h<0&&(c+=Math.PI);let p=h>0?n+a:n+a+1,d;o.projectionCache.cachedAnchorPoint?d=o.projectionCache.cachedAnchorPoint:(d=Ji(o.tileAnchorPoint.x,o.tileAnchorPoint.y,o).point,o.projectionCache.cachedAnchorPoint=d);let f=d,m=d,g,y,_=0,x=0,v=Math.abs(u),w=[],b;for(;_+x<=v;){if(p+=h,p<n||p>=s)return null;_+=x,m=f,y=g;let D={absOffsetX:v,direction:h,distanceFromAnchor:_,previousVertex:m};if(f=Xc(p,o,D),r===0)w.push(m),b=f.sub(m);else{let R,F=f.sub(m);R=F.mag()===0?Hc(Xc(p+h,o,D).sub(f),r,h):Hc(F,r,h),y||(y=m.add(R)),g=QM(p,R,f,n,s,y,r,o,D),w.push(y),b=g.sub(y)}x=b.mag()}let T=(v-_)/x,I=b._mult(T)._add(y||m),S=c+Math.atan2(f.y-m.y,f.x-m.x);return w.push(I),{point:I,angle:l?S:0,path:w}}var eP=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function qa(e,t){for(let r=0;r<e;r++){let i=t.length;t.resize(i+4),t.float32.set(eP,i*3)}}function sp(e,t,r){let i=t[0],a=t[1];return e[0]=r[0]*i+r[4]*a+r[12],e[1]=r[1]*i+r[5]*a+r[13],e[3]=r[3]*i+r[7]*a+r[15],e}function tP(e,t){let r=HM;return XM(r,t.pitchedLabelPlaneMatrix),e.map(i=>{let a=np(i.x,i.y,r,Ki(t,i.x,i.y)),n=t.transform.projectTileCoordinates(a.point.x,a.point.y,t.unwrappedTileID,Ki(t,a.point.x,a.point.y));return n.point.x=(n.point.x*.5+.5)*t.width,n.point.y=(-n.point.y*.5+.5)*t.height,n})}function rP(e){let t=0,r=0,i=0,a=0;for(let n=0;n<e.length;n++)e[n].isOccluded?(i=n+1,a=0):(a++,a>r&&(r=a,t=i));return e.slice(t,t+r)}var iP=class{constructor(e,t=new L_(e.width+200,e.height+200,25),r=new L_(e.width+200,e.height+200,25)){this.transform=e,this.grid=t,this.ignoredGrid=r,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+100,this.screenBottomBoundary=e.height+100,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,t,r,i,a,n,s,o,l,u,h,c,p=0,d=!0){let f=e.anchorPointX+o[0],m=e.anchorPointY+o[1],g=this.projectAndGetPerspectiveRatio(f,m,a,ul(u,f,m,p,d),c),y=r*g.perspectiveRatio,_;if(!n&&!s){let S=g.x+(h?h.x*y:0),D=g.y+(h?h.y*y:0);_={allPointsOccluded:!1,box:[S+e.x1*y,D+e.y1*y,S+e.x2*y,D+e.y2*y]}}else _=this._projectCollisionBox(e,y,i,a,n,s,o,g,u,h,c,p,d);let[x,v,w,b]=_.box,T=n?_.allPointsOccluded:g.isOccluded,I=T;return I||(I=g.perspectiveRatio<this.perspectiveRatioCutoff),I||(I=!this.isInsideGrid(x,v,w,b)),I||t!==\"always\"&&this.grid.hitTest(x,v,w,b,t,l)?{box:[x,v,w,b],placeable:!1,offscreen:!1,occluded:T}:{box:[x,v,w,b],placeable:!0,offscreen:this.isOffscreen(x,v,w,b),occluded:T}}placeCollisionCircles(e,t,r,i,a,n,s,o,l,u,h,c,p,d){let f=[],m=new C(t.anchorX,t.anchorY),g=this.getPerspectiveRatio(m.x,m.y,n,d?.(m.x,m.y)),y=(l?a*this.transform.getPitchedTextCorrection(t.anchorX,t.anchorY,n)/g:a*g)/24,_={projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},x=t.lineOffsetX*y,v=t.lineOffsetY*y,w={getElevation:d,pitchedLabelPlaneMatrix:s,lineVertexArray:r,pitchWithMap:l,projectionCache:_,transform:this.transform,tileAnchorPoint:m,unwrappedTileID:n,width:this.transform.width,height:this.transform.height,translation:p},b=$0(y,i,x,v,!1,t,!1,w),T=!1,I=!1,S=!0;if(b){let D=h*.5*g+c,R=new C(-100,-100),F=new C(this.screenRightBoundary,this.screenBottomBoundary),E=new qM,M=b.first,A=b.last,k=[];for(let U=M.path.length-1;U>=1;U--)k.push(M.path[U]);for(let U=1;U<A.path.length;U++)k.push(A.path[U]);let H=D*2.5;if(l){let U=this.projectPathToScreenSpace(k,w);k=U.some(Y=>Y.signedDistanceFromCamera<=0)?[]:U.map(Y=>Y.point)}let $=[];if(k.length>0){let U=k[0].clone(),Y=k[0].clone();for(let ue=1;ue<k.length;ue++)U.x=Math.min(U.x,k[ue].x),U.y=Math.min(U.y,k[ue].y),Y.x=Math.max(Y.x,k[ue].x),Y.y=Math.max(Y.y,k[ue].y);$=U.x>=R.x&&Y.x<=F.x&&U.y>=R.y&&Y.y<=F.y?[k]:Y.x<R.x||U.x>F.x||Y.y<R.y||U.y>F.y?[]:d_([k],R.x,R.y,F.x,F.y)}for(let U of $){E.reset(U,D*.25);let Y=0;Y=E.length<=.5*D?1:Math.ceil(E.paddedLength/H)+1;for(let ue=0;ue<Y;ue++){let Rt=ue/Math.max(Y-1,1),tt=E.lerp(Rt),ft=tt.x+100,mt=tt.y+100;f.push(ft,mt,D,0);let gt=ft-D,yt=mt-D,yr=ft+D,Cr=mt+D;if(S&&(S=this.isOffscreen(gt,yt,yr,Cr)),I||(I=this.isInsideGrid(gt,yt,yr,Cr)),e!==\"always\"&&this.grid.hitTestCircle(ft,mt,D,e,u)&&(T=!0,!o))return{circles:[],offscreen:!1,collisionDetected:T}}}}return{circles:!o&&T||!I||g<this.perspectiveRatioCutoff?[]:f,offscreen:S,collisionDetected:T}}projectPathToScreenSpace(e,t){return rP(tP(e,t))}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let t=[],r=new or;for(let h of e){let c=new C(h.x+100,h.y+100);r.extend(c),t.push(c)}let{minX:i,minY:a,maxX:n,maxY:s}=r,o=this.grid.query(i,a,n,s).concat(this.ignoredGrid.query(i,a,n,s)),l={},u={};for(let h of o){let c=h.key;if(l[c.bucketInstanceId]===void 0&&(l[c.bucketInstanceId]={}),l[c.bucketInstanceId][c.featureIndex])continue;let p=[new C(h.x1,h.y1),new C(h.x2,h.y1),new C(h.x2,h.y2),new C(h.x1,h.y2)];Xh(t,p)&&(l[c.bucketInstanceId][c.featureIndex]=!0,u[c.bucketInstanceId]===void 0&&(u[c.bucketInstanceId]=[]),u[c.bucketInstanceId].push(c.featureIndex))}return u}insertCollisionBox(e,t,r,i,a,n){let s=r?this.ignoredGrid:this.grid,o={bucketInstanceId:i,featureIndex:a,collisionGroupID:n,overlapMode:t};s.insert(o,e[0],e[1],e[2],e[3])}insertCollisionCircles(e,t,r,i,a,n){let s=r?this.ignoredGrid:this.grid,o={bucketInstanceId:i,featureIndex:a,collisionGroupID:n,overlapMode:t};for(let l=0;l<e.length;l+=4)s.insertCircle(o,e[l],e[l+1],e[l+2])}projectAndGetPerspectiveRatio(e,t,r,i,a){if(a){let n;i==null?(n=[e,t,0,1],sp(n,n,a)):(n=[e,t,i,1],We(n,n,a));let s=n[3];return{x:(n[0]/s+1)/2*this.transform.width+100,y:(-n[1]/s+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/s),isOccluded:!1,signedDistanceFromCamera:s}}{let n=this.transform.projectTileCoordinates(e,t,r,i);return{x:(n.point.x+1)/2*this.transform.width+100,y:(-n.point.y+1)/2*this.transform.height+100,perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/n.signedDistanceFromCamera),isOccluded:n.isOccluded,signedDistanceFromCamera:n.signedDistanceFromCamera}}}getPerspectiveRatio(e,t,r,i){let a=this.transform.projectTileCoordinates(e,t,r,i);return .5+.5*(this.transform.cameraToCenterDistance/a.signedDistanceFromCamera)}isOffscreen(e,t,r,i){return r<100||e>=this.screenRightBoundary||i<100||t>this.screenBottomBoundary}isInsideGrid(e,t,r,i){return r>=0&&e<this.gridRightBoundary&&i>=0&&t<this.gridBottomBoundary}getViewportMatrix(){let e=Kt([]);return ze(e,e,[-100,-100,0]),e}_projectCollisionBox(e,t,r,i,a,n,s,o,l,u,h,c=0,p=!0){let d=1,f=0,m=0,g=1,y=e.anchorPointX+s[0],_=e.anchorPointY+s[1];if(n&&!a){let A=this.projectAndGetPerspectiveRatio(y+1,_,i,ul(l,y+1,_,c,p),h),k=A.x-o.x,H=A.y-o.y,$=Math.atan(H/k)+(k<0?Math.PI:0),U=Math.sin($),Y=Math.cos($);d=Y,f=U,m=-U,g=Y}else if(!n&&a){let A=ap(this.transform);d=A.vecEast[0],f=A.vecEast[1],m=A.vecSouth[0],g=A.vecSouth[1]}let x=o.x,v=o.y,w=t;if(a&&(x=y,v=_,w=2**-(this.transform.zoom-r.overscaledZ),w*=this.transform.getPitchedTextCorrection(y,_,i),!u)){let A=o.signedDistanceFromCamera/this.transform.cameraToCenterDistance,k=te(.5+.5*A,0,4);w*=k}u&&(x+=d*u.x*w+m*u.y*w,v+=f*u.x*w+g*u.y*w);let b=e.x1*w,T=e.x2*w,I=(b+T)/2,S=e.y1*w,D=e.y2*w,R=(S+D)/2,F=[{offsetX:b,offsetY:S},{offsetX:I,offsetY:S},{offsetX:T,offsetY:S},{offsetX:T,offsetY:R},{offsetX:T,offsetY:D},{offsetX:I,offsetY:D},{offsetX:b,offsetY:D},{offsetX:b,offsetY:R}],E=[];for(let{offsetX:A,offsetY:k}of F)E.push(new C(x+d*A+m*k,v+f*A+g*k));let M=!1;if(a){let A=E.map(k=>this.projectAndGetPerspectiveRatio(k.x,k.y,i,ul(l,k.x,k.y,c,p),h));M=A.some(k=>!k.isOccluded),E=A.map(k=>new C(k.x,k.y))}else M=!0;return{box:Lf(E),allPointsOccluded:!M}}},V_=class{constructor(e,t,r,i){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?t:-t))):i&&r?1:0,this.placed=r}isHidden(){return this.opacity===0&&!this.placed}},ss=class{constructor(e,t,r,i,a){this.text=new V_(e?e.text:null,t,r,a),this.icon=new V_(e?e.icon:null,t,i,a)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}},N_=class{constructor(e,t,r){this.text=e,this.icon=t,this.skipFade=r}},aP=class{constructor(e,t,r,i,a){this.bucketInstanceId=e,this.featureIndex=t,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=a}},nP=class{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){let t=++this.maxGroupID;this.collisionGroups[e]={ID:t,predicate:r=>r.collisionGroupID===t}}return this.collisionGroups[e]}};function U_(e,t,r,i,a){let{horizontalAlign:n,verticalAlign:s}=ac(e),o=-(n-.5)*t,l=-(s-.5)*r;return new C(o+i[0]*a,l+i[1]*a)}var sP=class{constructor(e,t,r,i,a){this.transform=e.clone(),this.terrain=t,this.collisionIndex=new iP(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new nP(i),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=a,a&&(a.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){let t=this.terrain;if(t)return(r,i)=>t.getElevation(e,r,i)}getBucketParts(e,t,r,i){let a=r.getBucket(t),n=r.latestFeatureIndex;if(!a||!n||t.id!==a.layerIds[0])return;let s=r.collisionBoxArray,o=a.layers[0].layout,l=a.layers[0].paint,u=2**(this.transform.zoom-r.tileID.overscaledZ),h=r.tileSize/z,c=r.tileID.toUnwrapped(),p=o.get(\"text-rotation-alignment\")===\"map\",d=Ct(r,1,this.transform.zoom),f=Ur(this.collisionIndex.transform,r,l.get(\"text-translate\"),l.get(\"text-translate-anchor\")),m=Ur(this.collisionIndex.transform,r,l.get(\"icon-translate\"),l.get(\"icon-translate-anchor\")),g=ip(p,this.transform,d);this.retainedQueryData[a.bucketInstanceId]=new aP(a.bucketInstanceId,n,a.sourceLayerIndex,a.index,r.tileID);let y={bucket:a,layout:o,translationText:f,translationIcon:m,unwrappedTileID:c,pitchedLabelPlaneMatrix:g,scale:u,textPixelRatio:h,holdingForFade:r.holdingForSymbolFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:es(a.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(a.sourceID)};if(i)for(let _ of a.sortKeyRanges){let{sortKey:x,symbolInstanceStart:v,symbolInstanceEnd:w}=_;e.push({sortKey:x,symbolInstanceStart:v,symbolInstanceEnd:w,parameters:y})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:a.symbolInstances.length,parameters:y})}attemptAnchorPlacement(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,g,y,_,x,v,w){let b=Sc[e.textAnchor],T=[e.textOffset0,e.textOffset1],I=U_(b,r,i,T,a),S=this.collisionIndex.placeCollisionBox(t,c,o,l,u,s,n,m,h.predicate,_,I,x,v,w);if(!(y&&!this.collisionIndex.placeCollisionBox(y,c,o,l,u,s,n,g,h.predicate,_,I,x,v,w).placeable)&&S.placeable){let D;if(this.prevPlacement?.variableOffsets[p.crossTileID]&&this.prevPlacement?.placements[p.crossTileID]?.text&&(D=this.prevPlacement.variableOffsets[p.crossTileID].anchor),p.crossTileID===0)throw Error(\"symbolInstance.crossTileID can't be 0\");return this.variableOffsets[p.crossTileID]={textOffset:T,width:r,height:i,anchor:b,textBoxScale:a,prevAnchor:D},this.markUsedJustification(d,b,p,f),d.allowVerticalPlacement&&(this.markUsedOrientation(d,f,p),this.placedOrientations[p.crossTileID]=f),{shift:I,placedGlyphBoxes:S}}}placeLayerBucketPart(e,t,r){let{bucket:i,layout:a,translationText:n,translationIcon:s,unwrappedTileID:o,pitchedLabelPlaneMatrix:l,textPixelRatio:u,holdingForFade:h,collisionBoxArray:c,partiallyEvaluatedTextSize:p,collisionGroup:d}=e.parameters,f=a.get(\"text-optional\"),m=a.get(\"icon-optional\"),g=Rn(a,\"text-overlap\",\"text-allow-overlap\"),y=g===\"always\",_=Rn(a,\"icon-overlap\",\"icon-allow-overlap\"),x=_===\"always\",v=a.get(\"text-rotation-alignment\")===\"map\",w=a.get(\"text-pitch-alignment\")===\"map\",b=a.get(\"icon-text-fit\")!==\"none\",T=a.get(\"symbol-z-order\")===\"viewport-y\",I=a.get(\"symbol-height-anchor\")===\"ground\",S=y&&(x||!i.hasIconData()||m),D=x&&(y||!i.hasTextData()||f);!i.collisionArrays&&c&&i.deserializeCollisionBoxes(c);let R=this.retainedQueryData[i.bucketInstanceId].tileID,F=this._getTerrainElevationFunc(R),E=this.transform.getFastPathSimpleProjectionMatrix(R),M=(A,k,H)=>{if(t[A.crossTileID])return;if(h){this.placements[A.crossTileID]=new N_(!1,!1,!1);return}let $=A.heightOffset,U=!1,Y=!1,ue=!0,Rt=null,tt={box:null,placeable:!1,offscreen:null,occluded:!1},ft={box:null,placeable:!1,offscreen:null},mt=null,gt=null,yt=null,yr=0,Cr=0,Ya=0;k.textFeatureIndex?yr=k.textFeatureIndex:A.useRuntimeCollisionCircles&&(yr=A.featureIndex),k.verticalTextFeatureIndex&&(Cr=k.verticalTextFeatureIndex);let ei=k.textBox;if(ei){let $t=_t=>{let xt=1;if(i.allowVerticalPlacement&&!_t&&this.prevPlacement){let He=this.prevPlacement.placedOrientations[A.crossTileID];He&&(this.placedOrientations[A.crossTileID]=He,xt=He,this.markUsedOrientation(i,xt,A))}return xt},rr=(_t,xt)=>{if(i.allowVerticalPlacement&&A.numVerticalGlyphVertices>0&&k.verticalTextBox){for(let He of i.writingModes)if(He===2?(tt=xt(),ft=tt):tt=_t(),tt?.placeable)break}else tt=_t()},ti=A.textAnchorOffsetStartIndex,Si=A.textAnchorOffsetEndIndex;if(Si===ti){let _t=(xt,He)=>{let Ge=this.collisionIndex.placeCollisionBox(xt,g,u,R,o,w,v,n,d.predicate,F,void 0,E,$,I);return Ge?.placeable&&(this.markUsedOrientation(i,He,A),this.placedOrientations[A.crossTileID]=He),Ge};rr(()=>_t(ei,1),()=>{let xt=k.verticalTextBox;return i.allowVerticalPlacement&&A.numVerticalGlyphVertices>0&&xt?_t(xt,2):{box:null,offscreen:null}}),$t(tt?.placeable)}else{let _t=Sc[this.prevPlacement?.variableOffsets[A.crossTileID]?.anchor],xt=(Ge,Ja,kl)=>{let Ax=Ge.x2-Ge.x1,Mx=Ge.y2-Ge.y1,Px=A.textBoxScale,Cx=b&&_===\"never\"?Ja:null,ia=null,Bp=g===\"never\"?1:2,Op=\"never\";_t&&Bp++;for(let Vp=0;Vp<Bp;Vp++){for(let Dl=ti;Dl<Si;Dl++){let Np=i.textAnchorOffsets.get(Dl);if(_t&&Np.textAnchor!==_t)continue;let Fl=this.attemptAnchorPlacement(Np,Ge,Ax,Mx,Px,v,w,u,R,o,d,Op,A,i,kl,n,s,Cx,F,E,$,I);if(Fl&&(ia=Fl.placedGlyphBoxes,ia?.placeable))return U=!0,Rt=Fl.shift,ia}_t?_t=null:Op=g}return r&&!ia&&(ia={box:this.collisionIndex.placeCollisionBox(ei,\"always\",u,R,o,w,v,n,d.predicate,F,void 0,E,$,I).box,offscreen:!1,placeable:!1,occluded:!1}),ia};rr(()=>xt(ei,k.iconBox,1),()=>{let Ge=k.verticalTextBox,Ja=tt?.placeable;return i.allowVerticalPlacement&&!Ja&&A.numVerticalGlyphVertices>0&&Ge?xt(Ge,k.verticalIconBox,2):{box:null,occluded:!0,offscreen:null}}),tt&&(U=tt.placeable,ue=tt.offscreen);let He=$t(tt?.placeable);if(!U&&this.prevPlacement){let Ge=this.prevPlacement.variableOffsets[A.crossTileID];Ge&&(this.variableOffsets[A.crossTileID]=Ge,this.markUsedJustification(i,Ge.anchor,A,He))}}}if(mt=tt,U=mt?.placeable,ue=mt?.offscreen,A.useRuntimeCollisionCircles&&A.centerJustifiedTextSymbolIndex>=0){let $t=i.text.placedSymbolArray.get(A.centerJustifiedTextSymbolIndex),rr=Go(i.textSizeData,p,$t),ti=a.get(\"text-padding\"),Si=A.collisionCircleDiameter;gt=this.collisionIndex.placeCollisionCircles(g,$t,i.lineVertexArray,i.glyphOffsetArray,rr,o,l,r,w,d.predicate,Si,ti,n,F),gt.circles.length&&gt.collisionDetected&&!r&&pe(\"Collisions detected, but collision boxes are not shown\"),U=y||gt.circles.length>0&&!gt.collisionDetected,ue&&(ue=gt.offscreen)}if(k.iconFeatureIndex&&(Ya=k.iconFeatureIndex),k.iconBox){let $t=rr=>this.collisionIndex.placeCollisionBox(rr,_,u,R,o,w,v,s,d.predicate,F,b&&Rt?Rt:void 0,E,$,I);ft&&ft.placeable&&k.verticalIconBox?(yt=$t(k.verticalIconBox),Y=yt.placeable):(yt=$t(k.iconBox),Y=yt.placeable),ue&&(ue=yt.offscreen)}let ra=f||A.numHorizontalGlyphVertices===0&&A.numVerticalGlyphVertices===0,Ti=m||A.numIconVertices===0;!ra&&!Ti?Y=U=Y&&U:Ti?ra||Y&&(Y=U):U=Y&&U;let Ml=U&&mt.placeable,Pl=Y&&yt.placeable;if(Ml&&(ft&&ft.placeable&&Cr?this.collisionIndex.insertCollisionBox(mt.box,g,a.get(\"text-ignore-placement\"),i.bucketInstanceId,Cr,d.ID):this.collisionIndex.insertCollisionBox(mt.box,g,a.get(\"text-ignore-placement\"),i.bucketInstanceId,yr,d.ID)),Pl&&this.collisionIndex.insertCollisionBox(yt.box,_,a.get(\"icon-ignore-placement\"),i.bucketInstanceId,Ya,d.ID),gt&&U&&this.collisionIndex.insertCollisionCircles(gt.circles,g,a.get(\"text-ignore-placement\"),i.bucketInstanceId,yr,d.ID),r&&this.storeCollisionData(i.bucketInstanceId,H,k,mt,yt,gt),A.crossTileID===0)throw Error(\"symbolInstance.crossTileID can't be 0\");if(i.bucketInstanceId===0)throw Error(\"bucket.bucketInstanceId can't be 0\");let Cl=(U||S)&&!mt?.occluded,Ka=(Y||D)&&!yt?.occluded;this.placements[A.crossTileID]=new N_(Cl,Ka,ue||i.justReloaded),t[A.crossTileID]=!0};if(T){if(e.symbolInstanceStart!==0)throw Error(\"bucket.bucketInstanceId should be 0\");let A=i.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let k=A.length-1;k>=0;--k){let H=A[k];M(i.symbolInstances.get(H),i.collisionArrays[H],H)}}else for(let A=e.symbolInstanceStart;A<e.symbolInstanceEnd;A++)M(i.symbolInstances.get(A),i.collisionArrays[A],A);i.justReloaded=!1}storeCollisionData(e,t,r,i,a,n){if(r.textBox||r.iconBox){let s;this.collisionBoxArrays.has(e)?s=this.collisionBoxArrays.get(e):(s=new Map,this.collisionBoxArrays.set(e,s));let o;s.has(t)?o=s.get(t):(o={text:null,icon:null},s.set(t,o)),r.textBox&&(o.text=i.box),r.iconBox&&(o.icon=a.box)}if(n){let s=this.collisionCircleArrays[e];s===void 0&&(s=this.collisionCircleArrays[e]=[]);for(let o=0;o<n.circles.length;o+=4)s.push(n.circles[o+0]-100),s.push(n.circles[o+1]-100),s.push(n.circles[o+2]),s.push(+!!n.collisionDetected)}}markUsedJustification(e,t,r,i){let a={left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex},n;n=i===2?r.verticalPlacedTextSymbolIndex:a[m_(t)];let s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let o of s)o>=0&&(n>=0&&o!==n?e.text.placedSymbolArray.get(o).crossTileID=0:e.text.placedSymbolArray.get(o).crossTileID=r.crossTileID)}markUsedOrientation(e,t,r){let i=t===1||t===3?t:0,a=t===2?t:0,n=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let s of n)e.text.placedSymbolArray.get(s).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=a)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;let t=this.prevPlacement,r=!1;this.prevZoomAdjustment=t?t.zoomAdjustment(this.transform.zoom):0;let i=t?t.symbolFadeChange(e):1,a=t?t.opacities:{},n=t?t.variableOffsets:{},s=t?t.placedOrientations:{};for(let o in this.placements){let l=this.placements[o],u=a[o];u?(this.opacities[o]=new ss(u,i,l.text,l.icon),r||(r=l.text!==u.text.placed),r||(r=l.icon!==u.icon.placed)):(this.opacities[o]=new ss(null,i,l.text,l.icon,l.skipFade),r||(r=l.text||l.icon))}for(let o in a){let l=a[o];if(!this.opacities[o]){let u=new ss(l,i,!1,!1);u.isHidden()||(this.opacities[o]=u,r||(r=l.text.placed),r||(r=l.icon.placed))}}for(let o in n)!this.variableOffsets[o]&&this.opacities[o]&&!this.opacities[o].isHidden()&&(this.variableOffsets[o]=n[o]);for(let o in s)!this.placedOrientations[o]&&this.opacities[o]&&!this.opacities[o].isHidden()&&(this.placedOrientations[o]=s[o]);if(t&&t.lastPlacementChangeTime===void 0)throw Error(\"Last placement time for previous placement is not defined\");r?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!=\"number\"&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)}updateLayerOpacities(e,t){let r={};for(let i of t){let a=i.getBucket(e);a&&i.latestFeatureIndex&&e.id===a.layerIds[0]&&this.updateBucketOpacities(a,i.tileID,r,i.collisionBoxArray)}}updateBucketOpacities(e,t,r,i){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();let a=e.layers[0],n=a.layout,s=new ss(null,0,!1,!1,!0),o=n.get(\"text-allow-overlap\"),l=n.get(\"icon-allow-overlap\"),u=a._unevaluatedLayout.hasValue(\"text-variable-anchor\")||a._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\"),h=n.get(\"text-rotation-alignment\")===\"map\",c=n.get(\"text-pitch-alignment\")===\"map\",p=n.get(\"icon-text-fit\")!==\"none\",d=new ss(null,0,o&&(l||!e.hasIconData()||n.get(\"icon-optional\")),l&&(o||!e.hasTextData()||n.get(\"text-optional\")),!0);!e.collisionArrays&&i&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(i);let f=(g,y,_)=>{for(let x=0;x<y/4;x++)g.opacityVertexArray.emplaceBack(_);g.hasVisibleVertices||(g.hasVisibleVertices=_!==os)},m=this.collisionBoxArrays.get(e.bucketInstanceId);for(let g=0;g<e.symbolInstances.length;g++){let y=e.symbolInstances.get(g),{numHorizontalGlyphVertices:_,numVerticalGlyphVertices:x,crossTileID:v}=y,w=r[v],b=this.opacities[v];w?b=s:b||(b=d,this.opacities[v]=b),r[v]=!0;let T=_>0||x>0,I=y.numIconVertices>0,S=this.placedOrientations[y.crossTileID],D=S===2,R=S===1||S===3;if(T){let E=j_(b.text),M=D?os:E;f(e.text,_,M);let A=R?os:E;f(e.text,x,A);let k=b.text.isHidden(),H=[y.rightJustifiedTextSymbolIndex,y.centerJustifiedTextSymbolIndex,y.leftJustifiedTextSymbolIndex];for(let Y of H)Y>=0&&(e.text.placedSymbolArray.get(Y).hidden=k||D?1:0);y.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(y.verticalPlacedTextSymbolIndex).hidden=k||R?1:0);let $=this.variableOffsets[y.crossTileID];$&&this.markUsedJustification(e,$.anchor,y,S);let U=this.placedOrientations[y.crossTileID];U&&(this.markUsedJustification(e,\"left\",y,U),this.markUsedOrientation(e,U,y))}if(I){let E=j_(b.icon),M=!(p&&y.verticalPlacedIconSymbolIndex&&D);if(y.placedIconSymbolIndex>=0){let A=M?E:os;f(e.icon,y.numIconVertices,A),e.icon.placedSymbolArray.get(y.placedIconSymbolIndex).hidden=b.icon.isHidden()}if(y.verticalPlacedIconSymbolIndex>=0){let A=M?os:E;f(e.icon,y.numVerticalIconVertices,A),e.icon.placedSymbolArray.get(y.verticalPlacedIconSymbolIndex).hidden=b.icon.isHidden()}}let F=m?.has(g)?m.get(g):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){let E=e.collisionArrays[g];if(E){let M=new C(0,0);if(E.textBox||E.verticalTextBox){let A=!0;if(u){let k=this.variableOffsets[v];k?(M=U_(k.anchor,k.width,k.height,k.textOffset,k.textBoxScale),h&&M._rotate(c?-this.transform.bearingInRadians:this.transform.bearingInRadians)):A=!1}if(E.textBox||E.verticalTextBox){let k;E.textBox&&(k=D),E.verticalTextBox&&(k=R),$_(e.textCollisionBox.collisionVertexArray,b.text.placed,!A||k,F.text,M.x,M.y)}}if(E.iconBox||E.verticalIconBox){let A=!!(!R&&E.verticalIconBox),k;E.iconBox&&(k=A),E.verticalIconBox&&(k=!A),$_(e.iconCollisionBox.collisionVertexArray,b.icon.placed,k,F.icon,p?M.x:0,p?M.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,t){let r=this.zoomAtLastRecencyCheck===t?1-this.zoomAdjustment(t):1;return this.zoomAtLastRecencyCheck=t,this.commitTime+this.fadeDuration*r>e}setStale(){this.stale=!0}};function $_(e,t,r,i,a,n){(!i||i.length===0)&&(i=[0,0,0,0]);let s=i[0]-100,o=i[1]-100,l=i[2]-100,u=i[3]-100;e.emplaceBack(+!!t,+!!r,a||0,n||0,s,o),e.emplaceBack(+!!t,+!!r,a||0,n||0,l,o),e.emplaceBack(+!!t,+!!r,a||0,n||0,l,u),e.emplaceBack(+!!t,+!!r,a||0,n||0,s,u)}var oP=2**25,lP=2**24,uP=2**17,hP=2**16;function j_(e){if(e.opacity===0&&!e.placed)return 0;if(e.opacity===1&&e.placed)return 4294967295;let t=+!!e.placed,r=Math.floor(e.opacity*127);return r*oP+t*lP+r*uP+t*hP+r*512+t*256+r*2+t}var os=0,cP=class{constructor(e){this._sortAcrossTiles=e.layout.get(\"symbol-z-order\")!==\"viewport-y\"&&!e.layout.get(\"symbol-sort-key\").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,t,r,i,a){let n=this._bucketParts;for(;this._currentTileIndex<e.length;){let s=e[this._currentTileIndex];if(t.getBucketParts(n,i,s,this._sortAcrossTiles),this._currentTileIndex++,a())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,n.sort((s,o)=>s.sortKey-o.sortKey));this._currentPartIndex<n.length;){let s=n[this._currentPartIndex];if(t.placeLayerBucketPart(s,this._seenCrossTileIDs,r),this._currentPartIndex++,a())return!0}return!1}},pP=class{constructor(e,t,r,i,a,n,s,o){this.placement=new sP(e,t,n,s,o),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=a,this._done=!1}isDone(){return this._done}continuePlacement(e,t,r){let i=ye(),a=()=>!this._forceFullPlacement&&ye()-i>2;for(;this._currentPlacementIndex>=0;){let n=t[e[this._currentPlacementIndex]],s=this.placement.collisionIndex.transform.zoom;if(nc(n)&&n.layout&&(!n.minzoom||n.minzoom<=s)&&(!n.maxzoom||n.maxzoom>s)){if(this._inProgressLayer||(this._inProgressLayer=new cP(n)),this._inProgressLayer.continuePlacement(r[n.source],this.placement,this._showCollisionBoxes,n,a))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}},G_=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ke=new Uint32Array(96),dP=class q0{static from(t){if(!t||t.byteLength===void 0||t.buffer)throw Error(\"Data must be an instance of ArrayBuffer or SharedArrayBuffer.\");let[r,i]=new Uint8Array(t,0,2);if(r!==219)throw Error(\"Data does not appear to be in a KDBush format.\");let a=i>>4;if(a!==1)throw Error(`Got v${a} data when expected v1.`);let n=G_[i&15];if(!n)throw Error(\"Unrecognized array type.\");let[s]=new Uint16Array(t,2,1),[o]=new Uint32Array(t,4,1);return new q0(o,s,n,void 0,t)}constructor(t,r=64,i=Float64Array,a=ArrayBuffer,n){if(isNaN(t)||t<0)throw Error(`Unexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let s=G_.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,l=t*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${i}.`);if(n)this.data=n,this.ids=new this.IndexArrayType(n,8,t),this.coords=new i(n,8+l+u,t*2),this._pos=t*2,this._finished=!0;else{let h=this.data=new a(8+o+l+u);this.ids=new this.IndexArrayType(h,8,t),this.coords=new i(h,8+l+u,t*2),this._pos=0,this._finished=!1,new Uint8Array(h,0,2).set([219,16+s]),new Uint16Array(h,2,1)[0]=r,new Uint32Array(h,4,1)[0]=t}}add(t,r){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=t,this.coords[this._pos++]=r,i}finish(){let t=this._pos>>1;if(t!==this.numItems)throw Error(`Added ${t} items when expected ${this.numItems}.`);return Yc(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,i,a){if(!this._finished)throw Error(\"Data not yet indexed - call index.finish().\");let{ids:n,coords:s,nodeSize:o}=this;ke[0]=0,ke[1]=n.length-1,ke[2]=0;let l=3,u=[];for(;l>0;){let h=ke[--l],c=ke[--l],p=ke[--l];if(c-p<=o){for(let g=p;g<=c;g++){let y=s[2*g],_=s[2*g+1];y>=t&&y<=i&&_>=r&&_<=a&&u.push(n[g])}continue}let d=p+c>>1,f=s[2*d],m=s[2*d+1];f>=t&&f<=i&&m>=r&&m<=a&&u.push(n[d]),(h===0?t<=f:r<=m)&&(ke[l++]=p,ke[l++]=d-1,ke[l++]=1-h),(h===0?i>=f:a>=m)&&(ke[l++]=d+1,ke[l++]=c,ke[l++]=1-h)}return u}within(t,r,i){let a=[];return this.withinInto(t,r,i,a),a}withinInto(t,r,i,a){if(!this._finished)throw Error(\"Data not yet indexed - call index.finish().\");let{ids:n,coords:s,nodeSize:o}=this;ke[0]=0,ke[1]=n.length-1,ke[2]=0;let l=3,u=0,h=i*i;for(;l>0;){let c=ke[--l],p=ke[--l],d=ke[--l];if(p-d<=o){for(let y=d;y<=p;y++)q_(s[2*y],s[2*y+1],t,r)<=h&&(a[u++]=n[y]);continue}let f=d+p>>1,m=s[2*f],g=s[2*f+1];q_(m,g,t,r)<=h&&(a[u++]=n[f]),(c===0?t-i<=m:r-i<=g)&&(ke[l++]=d,ke[l++]=f-1,ke[l++]=1-c),(c===0?t+i>=m:r+i>=g)&&(ke[l++]=f+1,ke[l++]=p,ke[l++]=1-c)}return u}};function Yc(e,t,r,i,a,n){if(a-i<=r)return;let s=i+a>>1;Z0(e,t,s,i,a,n),Yc(e,t,r,i,s-1,1-n),Yc(e,t,r,s+1,a,1-n)}function Z0(e,t,r,i,a,n){for(;a>i;){if(a-i>600){let u=a-i+1,h=r-i+1,c=Math.log(u),p=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1);Z0(e,t,r,Math.max(i,Math.floor(r-h*p/u+d)),Math.min(a,Math.floor(r+(u-h)*p/u+d)),n)}let s=t[2*r+n],o=i,l=a;for(ls(e,t,i,r),t[2*a+n]>s&&ls(e,t,i,a);o<l;){for(ls(e,t,o,l),o++,l--;t[2*o+n]<s;)o++;for(;t[2*l+n]>s;)l--}t[2*i+n]===s?ls(e,t,i,l):(l++,ls(e,t,l,a)),l<=r&&(i=l+1),r<=l&&(a=l-1)}}function ls(e,t,r,i){Pc(e,r,i),Pc(t,2*r,2*i),Pc(t,2*r+1,2*i+1)}function Pc(e,t,r){let i=e[t];e[t]=e[r],e[r]=i}function q_(e,t,r,i){let a=e-r,n=t-i;return a*a+n*n}var us=512/z/2,fP=class{constructor(e,t,r){this.tileID=e,this.bucketInstanceId=r,this._symbolsByKey={};let i=new Map;for(let a=0;a<t.length;a++){let n=t.get(a),s=n.key,o=i.get(s);o?o.push(n):i.set(s,[n])}for(let[a,n]of i){let s={positions:n.map(o=>({x:Math.floor(o.anchorX*us),y:Math.floor(o.anchorY*us)})),crossTileIDs:n.map(o=>o.crossTileID)};if(s.positions.length>128){let o=new dP(s.positions.length,16,Uint16Array);for(let{x:l,y:u}of s.positions)o.add(l,u);o.finish(),delete s.positions,s.index=o}this._symbolsByKey[a]=s}}getScaledCoordinates(e,t){let{x:r,y:i,z:a}=this.tileID.canonical,{x:n,y:s,z:o}=t.canonical,l=o-a,u=us/2**l,h=(n*z+e.anchorX)*u,c=(s*z+e.anchorY)*u,p=r*z*us,d=i*z*us;return{x:Math.floor(h-p),y:Math.floor(c-d)}}findMatches(e,t,r){let i=this.tileID.canonical.z<t.canonical.z?1:2**(this.tileID.canonical.z-t.canonical.z);for(let a=0;a<e.length;a++){let n=e.get(a);if(n.crossTileID)continue;let s=this._symbolsByKey[n.key];if(!s)continue;let o=this.getScaledCoordinates(n,t);s.index?this.findMatchesForIndexedEntry(s,n,o,i,r):s.positions&&this.findMatchesForNonIndexedEntry(s,n,o,i,r)}}findMatchesForIndexedEntry(e,t,r,i,a){let n=e.index.range(r.x-i,r.y-i,r.x+i,r.y+i),s=1/0;for(let o of n)o<s&&!a[e.crossTileIDs[o]]&&(s=o);if(s!==1/0){let o=e.crossTileIDs[s];a[o]=!0,t.crossTileID=o}}findMatchesForNonIndexedEntry(e,t,r,i,a){for(let n=0;n<e.positions.length;n++){let s=e.positions[n],o=e.crossTileIDs[n];if(Math.abs(s.x-r.x)<=i&&Math.abs(s.y-r.y)<=i&&!a[o]){a[o]=!0,t.crossTileID=o;break}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}},mP=class{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}},gP=class{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){let t=Math.round((e-this.lng)/360);if(t!==0)for(let r in this.indexes){let i=this.indexes[r],a={};for(let n in i){let s=i[n];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+t),a[s.tileID.key]=s}this.indexes[r]=a}this.lng=e}addBucket(e,t,r){var a,n;if(this.indexes[e.overscaledZ]?.[e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===t.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let s=0;s<t.symbolInstances.length;s++){let o=t.symbolInstances.get(s);o.crossTileID=0}(a=this.usedCrossTileIDs)[n=e.overscaledZ]||(a[n]={});let i=this.usedCrossTileIDs[e.overscaledZ];for(let s in this.indexes){let o=this.indexes[s];if(Number(s)>e.overscaledZ)for(let l in o){let u=o[l];u.tileID.isChildOf(e)&&u.findMatches(t.symbolInstances,e,i)}else{let l=o[e.scaledTo(Number(s)).key];l&&l.findMatches(t.symbolInstances,e,i)}}for(let s=0;s<t.symbolInstances.length;s++){let o=t.symbolInstances.get(s);o.crossTileID||(o.crossTileID=r.generate(),i[o.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new fP(e,t.symbolInstances,t.bucketInstanceId),!0}removeBucketCrossTileIDs(e,t){for(let r of t.getCrossTileIDsLists())for(let i of r)delete this.usedCrossTileIDs[e][i]}removeStaleBuckets(e){let t=!1;for(let r in this.indexes){let i=this.indexes[r];for(let a in i)e[i[a].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[a]),delete i[a],t=!0)}return t}},W0=class{constructor(){this.layerIndexes={},this.crossTileIDs=new mP,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,t,r){let i=this.layerIndexes[e.id];i===void 0&&(i=this.layerIndexes[e.id]=new gP);let a=!1,n={};i.handleWrapJump(r);for(let s of t){let o=s.getBucket(e);e.id===o?.layerIds[0]&&(o.bucketInstanceId||(o.bucketInstanceId=(this.maxBucketInstanceId+=1,this.maxBucketInstanceId)),i.addBucket(s.tileID,o,this.crossTileIDs)&&(a=!0),n[o.bucketInstanceId]=!0)}return i.removeStaleBuckets(n)&&(a=!0),a}pruneUnusedLayers(e){let t={};for(let r of e)t[r]=!0;for(let r in this.layerIndexes)t[r]||delete this.layerIndexes[r]}},yP=`#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nout highp vec4 fragColor;`,_P=`#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const uint packedOpacity) {return vec2(float(packedOpacity >> 1u)/127.0,float(packedOpacity & 1u));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+      c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+    c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+    c\n);}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(ivec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texelFetch(u_terrain,pos,0)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\n#ifdef GLOBE\nif ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}\n#endif\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);ivec2 c=ivec2(floor(coord));ivec2 hi=textureSize(u_terrain,0)-1;float tl=ele(clamp(c,ivec2(0),hi));float tr=ele(clamp(c+ivec2(1,0),ivec2(0),hi));float bl=ele(clamp(c+ivec2(0,1),ivec2(0),hi));float br=ele(clamp(c+ivec2(1,1),ivec2(0),hi));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`,xP=`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,vP=\"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}\",bP=`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,wP=\"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}\",TP=`in vec3 v_data;in float v_visibility;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define mediump float radius\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 stroke_color\n#pragma maplibre: define mediump float stroke_width\n#pragma maplibre: define lowp float stroke_opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump float radius\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 stroke_color\n#pragma maplibre: initialize mediump float stroke_width\n#pragma maplibre: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,SP=`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;layout(location=0) in ivec2 a_pos;out vec3 v_data;out float v_visibility;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define mediump float radius\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define highp vec4 stroke_color\n#pragma maplibre: define mediump float stroke_width\n#pragma maplibre: define lowp float stroke_opacity\nvoid main(void) {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize mediump float radius\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize highp vec4 stroke_color\n#pragma maplibre: initialize mediump float stroke_width\n#pragma maplibre: initialize lowp float stroke_opacity\nivec2 pos_raw=a_pos+32768;vec2 extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;vec2 circle_center=vec2(pos_raw >> 3)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {\n#ifdef GLOBE\nvec3 center_vector=projectToSphere(circle_center);\n#endif\nfloat angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {\n#ifdef GLOBE\nvec4 projected_center=interpolateProjection(circle_center,center_vector,ele);\n#else\nvec4 projected_center=projectTileWithElevation(circle_center,ele);\n#endif\ncorner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}\n#ifdef GLOBE\nvec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);\n#else\ngl_Position=projectTileWithElevation(corner_position,ele);\n#endif\n} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`,Z_=\"void main() {fragColor=vec4(1.0);}\",Ar={prelude:oe(yP,_P),projectionMercator:oe(`\nvoid clipAntimeridian() {}`,\"float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}\"),projectionGlobe:oe(\"uniform bool u_projection_clip_antimeridian;in highp float v_projection_tile_x;void clipAntimeridian() {if (u_projection_clip_antimeridian && (v_projection_tile_x < 0.0 || v_projection_tile_x >=8192.0)) {discard;}}\",`#define GLOBE_RADIUS 6371008.8\nuniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;out highp float v_projection_tile_x;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos\n);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float t=exp(PI-(mercator_pos_y*PI*2.0));return (2.0*t)/(t*t+1.0);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;float spherical_x=mercator_pos.x*PI*2.0+PI;float t=exp(PI-(mercator_pos.y*PI*2.0));float t2=t*t;float denom=t2+1.0;float sin_sy=(t2-1.0)/denom;float cos_sy=(2.0*t)/denom;vec3 pos=vec3(sin(spherical_x)*cos_sy,sin_sy,cos(spherical_x)*cos_sy\n);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {v_projection_tile_x=posInTile.x;vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:oe(xP,vP),backgroundPattern:oe(bP,wP),circle:oe(TP,SP),clippingMask:oe(Z_,\"layout(location=0) in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}\"),heatmap:oe(`uniform highp float u_intensity;in vec2 v_extrude;\n#pragma maplibre: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma maplibre: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;layout(location=0) in ivec2 a_pos;out vec2 v_extrude;\n#pragma maplibre: define highp float weight\n#pragma maplibre: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma maplibre: initialize highp float weight\n#pragma maplibre: initialize mediump float radius\nivec2 pos_raw=a_pos+32768;vec2 unscaled_extrude=vec2(pos_raw & 7)/7.0*2.0-1.0;float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=vec2(pos_raw >> 3);\n#ifdef GLOBE\nvec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);\n#else\ngl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));\n#endif\n}`),heatmapTexture:oe(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_world;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}\"),collisionBox:oe(\"in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}\",\"layout(location=0) in vec2 a_anchor_pos;layout(location=1) in vec2 a_placed;layout(location=2) in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}\"),collisionCircle:oe(\"in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}\",\"layout(location=0) in vec2 a_pos;layout(location=1) in float a_radius;layout(location=2) in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}\"),colorRelief:oe(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform int u_color_ramp_size;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {vec4 data=texelFetch(u_elevation_stops,ivec2(stop,0),0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int r=(u_color_ramp_size-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else\n{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(u_color_ramp_size);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,\"uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}\"),debug:oe(\"uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}\",\"layout(location=0) in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}\"),depth:oe(Z_,`layout(location=0) in vec2 a_pos;void main() {\n#ifdef GLOBE\ngl_Position=projectTileFor3D(a_pos,0.0);\n#else\ngl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);\n#endif\n}`),fill:oe(`#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float opacity\nfragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float opacity\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:oe(`in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 outline_color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 outline_color\n#pragma maplibre: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define highp vec4 outline_color\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 outline_color\n#pragma maplibre: initialize lowp float opacity\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}`),fillOutlinePattern:oe(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n}`),fillPattern:oe(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:oe(`in vec4 v_color;void main() {fragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;\n#ifdef TERRAIN3D\nlayout(location=2) in vec2 a_centroid;\n#endif\nout vec4 v_color;\n#pragma maplibre: define highp float base\n#pragma maplibre: define highp float height\n#pragma maplibre: define highp vec4 color\nvoid main() {\n#pragma maplibre: initialize highp float base\n#pragma maplibre: initialize highp float height\n#pragma maplibre: initialize highp vec4 color\nvec3 normal=vec3(a_normal_ed.xyz);\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nfloat colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);\n#ifdef GLOBE\nmat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);\n#endif\ndirectional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:oe(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;\n#pragma maplibre: define lowp float base\n#pragma maplibre: define lowp float height\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float base\n#pragma maplibre: initialize lowp float height\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;layout(location=0) in vec2 a_pos;layout(location=1) in ivec4 a_normal_ed;\n#ifdef TERRAIN3D\nlayout(location=2) in vec2 a_centroid;\n#endif\n#ifdef GLOBE\nout vec3 v_sphere_pos;\n#endif\nout vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;\n#pragma maplibre: define lowp float base\n#pragma maplibre: define lowp float height\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float base\n#pragma maplibre: initialize lowp float height\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=vec3(a_normal_ed.xyz);float edgedistance=float(a_normal_ed.w);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=float(a_normal_ed.x & 1);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;\n#ifdef GLOBE\nvec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);\n#else\ngl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);\n#endif\nvec2 pos=a_normal_ed.x==1 && a_normal_ed.y==0 && a_normal_ed.z==16384\n? a_pos\n: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:oe(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(ivec2 texel) {vec4 data=texelFetch(u_image,texel,0)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {ivec2 pos=ivec2(gl_FragCoord.xy)+ivec2(1);float tileSize=u_dimension.x-2.0;float a=getElevation(pos+ivec2(-1,-1));float b=getElevation(pos+ivec2(0,-1));float c=getElevation(pos+ivec2(1,-1));float d=getElevation(pos+ivec2(-1,0));float e=getElevation(pos);float f=getElevation(pos+ivec2(1,0));float g=getElevation(pos+ivec2(-1,1));float h=getElevation(pos+ivec2(0,1));float i=getElevation(pos+ivec2(1,1));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;uniform vec2 u_dimension;layout(location=0) in vec2 a_pos;layout(location=1) in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}\"),hillshade:oe(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];\n#define PI 3.141592653589793\n#define STANDARD 0\n#define COMBINED 1\n#define IGOR 2\n#define MULTIDIRECTIONAL 3\n#define BASIC 4\nfloat get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else\n{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else\n{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;if (u_method==BASIC) {basic_hillshade(deriv);} else if (u_method==COMBINED) {combined_hillshade(deriv);} else if (u_method==IGOR) {igor_hillshade(deriv);} else if (u_method==MULTIDIRECTIONAL) {multidirectional_hillshade(deriv);} else if (u_method==STANDARD) {standard_hillshade(deriv);} else {standard_hillshade(deriv);}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,\"uniform mat4 u_matrix;layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}\"),line:oe(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform vec2 u_render_window_translation;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);v_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*2.0;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy-u_render_window_translation*(projected_with_extrude.w-projected_no_extrude.w))/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}`),lineGradient:oe(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform vec2 u_render_window_translation;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy-u_render_window_translation*(projected_with_extrude.w-projected_no_extrude.w))/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}`),linePattern:oe(`#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\nclipAntimeridian();vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform vec2 u_render_window_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define lowp vec4 pattern_from\n#pragma maplibre: define lowp vec4 pattern_to\n#pragma maplibre: define lowp float pixel_ratio_from\n#pragma maplibre: define lowp float pixel_ratio_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 pattern_from\n#pragma maplibre: initialize mediump vec4 pattern_to\n#pragma maplibre: initialize lowp float pixel_ratio_from\n#pragma maplibre: initialize lowp float pixel_ratio_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy-u_render_window_translation*(projected_with_extrude.w-projected_no_extrude.w))/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:oe(`uniform lowp float u_device_pixel_ratio;uniform lowp float u_lineatlas_width;uniform sampler2D u_image;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nclipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0/u_device_pixel_ratio)/min(dasharray_from.w,dasharray_to.w);alpha*=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform vec2 u_render_window_translation;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define highp vec4 color\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize highp vec4 color\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy-u_render_window_translation*(projected_with_extrude.w-projected_no_extrude.w))/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),lineGradientSDF:oe(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform sampler2D u_image_dash;uniform float u_mix;uniform lowp float u_lineatlas_width;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;in highp vec2 v_uv;\n#ifdef GLOBE\nin float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nclipAntimeridian();float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);float sdfdist_a=texture(u_image_dash,v_tex_a).a;float sdfdist_b=texture(u_image_dash,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);float sdfgamma=(u_lineatlas_width/256.0)/min(dasharray_from.w,dasharray_to.w);float dash_alpha=smoothstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*dash_alpha*opacity);\n#ifdef GLOBE\nif (v_depth > 1.0) {discard;}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nlayout(location=0) in ivec2 a_pos_normal;layout(location=1) in uvec4 a_data;layout(location=2) in float a_uv_x;layout(location=3) in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform vec2 u_render_window_translation;uniform float u_image_height;uniform float u_tileratio;uniform float u_crossfade_from;uniform float u_crossfade_to;uniform float u_lineatlas_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;out vec2 v_tex_a;out vec2 v_tex_b;\n#ifdef GLOBE\nout float v_depth;\n#endif\n#pragma maplibre: define lowp float blur\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define mediump float gapwidth\n#pragma maplibre: define lowp float offset\n#pragma maplibre: define mediump float width\n#pragma maplibre: define lowp float floorwidth\n#pragma maplibre: define mediump vec4 dasharray_from\n#pragma maplibre: define mediump vec4 dasharray_to\nvoid main() {\n#pragma maplibre: initialize lowp float blur\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize mediump float gapwidth\n#pragma maplibre: initialize lowp float offset\n#pragma maplibre: initialize mediump float width\n#pragma maplibre: initialize lowp float floorwidth\n#pragma maplibre: initialize mediump vec4 dasharray_from\n#pragma maplibre: initialize mediump vec4 dasharray_to\nif (opacity < 0.01) {gl_Position=vec4(-2.0,-2.0,-2.0,1.0);return;}float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(ivec2(a_data.xy)-128);float a_direction=float(int(a_data.z & 3u)-1);float a_linesofar=float((a_data.z >> 2u)+a_data.w*64u)*LINE_DISTANCE_SCALE;float texel_height=1.0/u_image_height;float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=vec2(a_pos_normal >> 1);mediump vec2 normal=vec2(a_pos_normal & 1);normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;\n#ifdef GLOBE\nv_depth=gl_Position.z/gl_Position.w;\n#endif\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy-u_render_window_translation*(projected_with_extrude.w-projected_no_extrude.w))/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nfloat u_patternscale_a_x=u_tileratio/dasharray_from.w/u_crossfade_from;float u_patternscale_a_y=-dasharray_from.z/2.0/u_lineatlas_height;float u_patternscale_b_x=u_tileratio/dasharray_to.w/u_crossfade_to;float u_patternscale_b_y=-dasharray_to.z/2.0/u_lineatlas_height;v_tex_a=vec2(a_linesofar*u_patternscale_a_x/floorwidth,normal.y*u_patternscale_a_y+(float(dasharray_from.y)+0.5)/u_lineatlas_height);v_tex_b=vec2(a_linesofar*u_patternscale_b_x/floorwidth,normal.y*u_patternscale_b_y+(float(dasharray_to.y)+0.5)/u_lineatlas_height);v_width2=vec2(outset,inset);}`),layerOpacity:oe(`uniform sampler2D u_image;uniform float u_opacity;in vec2 v_pos;void main() {fragColor=texture(u_image,v_pos)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(0.0);\n#endif\n}`,\"layout(location=0) in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos.x*2.0-1.0,1.0-a_pos.y*2.0,0.0,1.0);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}\"),raster:oe(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec3 v_pos0;in vec3 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec2 u_colorization_scale;uniform highp vec4 u_colorization_mix;highp vec4 colormap (highp float value) {highp float scaled_value=value*u_colorization_scale.y+u_colorization_scale.x;highp vec2 coords=vec2(scaled_value,0.5);return texture(u_color_ramp,coords);}\n#endif\nvoid main() {vec4 color0=texture(u_image0,v_pos0.xy/v_pos0.z);vec4 color1=texture(u_image1,v_pos1.xy/v_pos1.z);vec4 color;\n#ifdef RASTER_COLOR\nvec4 fadedColor=mix(color0,color1,u_fade_t);color=colormap(dot(vec4(fadedColor.rgb,1),u_colorization_mix));color.a*=fadedColor.a;if (color.a > 0.0) {color.rgb/=color.a;}\n#else\nif (color0.a > 0.0) {color0.rgb/=color0.a;}if (color1.a > 0.0) {color1.rgb/=color1.a;}color=mix(color0,color1,u_fade_t);\n#endif\ncolor.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec3 u_image_warp;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;layout(location=0) in vec2 a_pos;out vec3 v_pos0;out vec3 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 topLeft=u_coords_top.xy;vec2 topRight=u_coords_top.zw;vec2 bottomLeft=u_coords_bottom.xy;vec2 bottomRight=u_coords_bottom.zw;vec2 bilinearPos=mix(mix(topLeft,topRight,fractionalPos.x),mix(bottomLeft,bottomRight,fractionalPos.x),fractionalPos.y);float denominator=dot(u_image_warp.xy,fractionalPos)+1.0;vec2 acrossTop=topRight-topLeft+u_image_warp.x*topRight;vec2 downLeft=bottomLeft-topLeft+u_image_warp.y*bottomLeft;vec2 projectivePos=(acrossTop*fractionalPos.x+downLeft*fractionalPos.y+topLeft)/denominator;vec2 position=mix(projectivePos,bilinearPos,u_image_warp.z);gl_Position=projectTile(position,position);vec2 texturePos=((fractionalPos-0.5)/u_buffer_scale)+0.5;\n#ifdef GLOBE\nif (a_pos.y <-32767.5) {texturePos.y=0.0;}if (a_pos.y > 32766.5) {texturePos.y=1.0;}\n#endif\nfloat perspectiveRatio=mix(1.0/denominator,1.0,u_image_warp.z);v_pos0=vec3(texturePos*perspectiveRatio,perspectiveRatio);vec2 parentPos=(texturePos*u_scale_parent)+u_tl_parent;v_pos1=vec3(parentPos*perspectiveRatio,perspectiveRatio);}`),symbolIcon:oe(`uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_tex;out float v_total_opacity;\n#pragma maplibre: define lowp float opacity\nvoid main() {\n#pragma maplibre: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_total_opacity=opacity*max(0.0,min(visibility,fade_opacity[0]+fade_change));if (v_total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;}`),symbolSDF:oe(`#define SDF_PX 8.0\nuniform bool u_is_halo;uniform bool u_is_plain;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float total_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out_text,color_alpha_out_halo;if (u_is_plain){highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);color_alpha_out_text=total_opacity*alpha*fill_color;}if (u_is_halo) {float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);float inner_edge_halo=inner_edge+gamma_halo*gamma_scale;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(inner_edge_halo-gamma_scaled_halo,inner_edge_halo+gamma_scaled_halo,dist);highp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha_halo= min(smoothstep(halo_edge-gamma_scaled_halo,halo_edge+gamma_scaled_halo,dist),1.0-alpha_halo);color_alpha_out_halo=total_opacity*alpha_halo*halo_color;}if (u_is_plain && u_is_halo) {fragColor=color_alpha_out_text+(1.-color_alpha_out_text.a)*color_alpha_out_halo;} else if (u_is_halo){fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out_text;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec4 a_pixeloffset;layout(location=3) in vec3 a_projected_pos;layout(location=4) in uint a_fade_opacity;layout(location=5) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec2 v_data0;out vec3 v_data1;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,total_opacity);}`),symbolTextAndIcon:oe(`#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform bool u_is_text;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec3 v_data1;in float v_is_sdf;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nfloat total_opacity=v_data1[2];if (v_is_sdf==ICON) {vec2 tex_icon=v_data0.zw;fragColor=texture(u_texture_icon,tex_icon)*total_opacity;\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;lowp float dist=texture(u_texture,tex).a;lowp vec4 color_alpha_out,color_alpha_out_halo;if (u_is_text) {highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);color_alpha_out=fill_color*(alpha*total_opacity);}if (u_is_halo) {highp float gamma_halo=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);lowp float buff_halo=(6.0-halo_width/fontScale)/SDF_PX;highp float gamma_scaled_halo=gamma_halo*gamma_scale;highp float alpha_halo=smoothstep(buff_halo-gamma_scaled_halo,buff_halo+gamma_scaled_halo,dist);color_alpha_out_halo=halo_color*(alpha_halo*total_opacity);}if (u_is_text && u_is_halo) {fragColor=color_alpha_out+(1.-color_alpha_out.a)*color_alpha_out_halo;} else if (u_is_halo) {fragColor=color_alpha_out_halo;} else {fragColor=color_alpha_out;}\n#ifdef OVERDRAW_INSPECTOR\nfragColor=vec4(1.0);\n#endif\n}`,`layout(location=0) in vec4 a_pos_offset;layout(location=1) in uvec4 a_data;layout(location=2) in vec3 a_projected_pos;layout(location=3) in uint a_fade_opacity;layout(location=4) in float a_height_offset;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;uniform bool u_is_offset;uniform bool u_height_anchor_ground;out vec4 v_data0;out vec3 v_data1;out float v_is_sdf;\n#pragma maplibre: define highp vec4 fill_color\n#pragma maplibre: define highp vec4 halo_color\n#pragma maplibre: define lowp float opacity\n#pragma maplibre: define lowp float halo_width\n#pragma maplibre: define lowp float halo_blur\nvoid main() {\n#pragma maplibre: initialize highp vec4 fill_color\n#pragma maplibre: initialize highp vec4 halo_color\n#pragma maplibre: initialize lowp float opacity\n#pragma maplibre: initialize lowp float halo_width\n#pragma maplibre: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=vec2(a_data.xy);vec2 a_size=vec2(a_data.zw);float a_size_min=float(a_data.z >> 1u);float is_sdf=float(a_data.z & 1u);float ele=a_height_offset+(u_height_anchor_ground ? get_elevation(a_pos) : 0.0);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));float total_opacity=opacity*interpolated_fade_opacity;if (total_opacity < 0.1){gl_Position=vec4(-2.,-2.,-2.,1.);return;}highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);if (!u_is_offset) {size*=perspective_ratio;}float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;\n#ifdef GLOBE\nif(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}\n#endif\nvec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec3(gamma_scale,size,total_opacity);v_is_sdf=is_sdf;}`),terrain:oe(\"uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && u_fog_ground_blend_opacity > 0.0 && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}\",\"layout(location=0) in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}\"),terrainDepth:oe(\"in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}\",\"layout(location=0) in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}\"),atmosphere:oe(`#ifdef GL_ES\nprecision highp float;\n#endif\nin vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758\n);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,\"layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}\"),sky:oe(\"uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}\",\"layout(location=0) in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}\")};function oe(e,t){let r=/#pragma maplibre: ([\\w]+) ([\\w]+) ([\\w]+) ([\\w]+)/g,i=t.match(/in ([\\w]+) ([\\w]+)/g),a=e.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g),n=t.match(/uniform ([\\w]+) ([\\w]+)([\\s]*)([\\w]*)/g),s=n?n.concat(a):a,o=i?i.length:0,l={};return e=e.replace(r,(u,h,c,p,d)=>(l[d]=!0,h===\"define\"?`\n#ifndef HAS_UNIFORM_u_${d}\nin ${c} ${p} ${d};\n#else\nuniform ${c} ${p} u_${d};\n#endif\n`:`\n#ifdef HAS_UNIFORM_u_${d}\n    ${c} ${p} ${d} = u_${d};\n#endif\n`)),t=t.replace(r,(u,h,c,p,d)=>{let f=p===\"float\"?\"vec2\":\"vec4\",m=d.match(/color/)?\"color\":f;return l[d]?h===\"define\"?`\n#ifndef HAS_UNIFORM_u_${d}\nuniform lowp float u_${d}_t;\nlayout(location = ${o++}) in ${c} ${f} a_${d};\nout ${c} ${p} ${d};\n#else\nuniform ${c} ${p} u_${d};\n#endif\n`:m===\"vec4\"?`\n#ifndef HAS_UNIFORM_u_${d}\n    ${d} = a_${d};\n#else\n    ${c} ${p} ${d} = u_${d};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${d}\n    ${d} = unpack_mix_${m}(a_${d}, u_${d}_t);\n#else\n    ${c} ${p} ${d} = u_${d};\n#endif\n`:h===\"define\"?`\n#ifndef HAS_UNIFORM_u_${d}\nuniform lowp float u_${d}_t;\nlayout(location = ${o++}) in ${c} ${f} a_${d};\n#else\nuniform ${c} ${p} u_${d};\n#endif\n`:m===\"vec4\"?`\n#ifndef HAS_UNIFORM_u_${d}\n    ${c} ${p} ${d} = a_${d};\n#else\n    ${c} ${p} ${d} = u_${d};\n#endif\n`:`\n#ifndef HAS_UNIFORM_u_${d}\n    ${c} ${p} ${d} = unpack_mix_${m}(a_${d}, u_${d}_t);\n#else\n    ${c} ${p} ${d} = u_${d};\n#endif\n`}),{fragmentSource:e,vertexSource:t,staticAttributes:i,staticUniforms:s}}var X0=\"#define PROJECTION_MERCATOR\",H0=\"mercator\",Kc=class{constructor(){this._cachedMesh=null}get name(){return\"mercator\"}get useSubdivision(){return!1}get shaderVariantName(){return H0}get shaderDefine(){return X0}get shaderPreludeCode(){return Ar.projectionMercator}get vertexShaderPreludeCode(){return Ar.projectionMercator.vertexSource}get subdivisionGranularity(){return Vo.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(e,t,r,i,a){if(this._cachedMesh)return this._cachedMesh;let n=new Gr;n.emplaceBack(0,0),n.emplaceBack(z,0),n.emplaceBack(0,z),n.emplaceBack(z,z);let s=e.createVertexBuffer(n,Hi.members),o=Ee.simpleSegment(0,0,4,2),l=new pr;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3);let u=e.createIndexBuffer(l);return this._cachedMesh=new ds(s,u,o),this._cachedMesh}recalculate(){}hasTransition(){return!1}},W_=class Y0{constructor(t=0,r=0,i=0,a=0){if(isNaN(t)||t<0||isNaN(r)||r<0||isNaN(i)||i<0||isNaN(a)||a<0)throw Error(\"Invalid value for edge-insets, top, bottom, left and right must all be numbers\");this.top=t,this.bottom=r,this.left=i,this.right=a}interpolate(t,r,i){return r.top!=null&&t.top!=null&&(this.top=Ve.number(t.top,r.top,i)),r.bottom!=null&&t.bottom!=null&&(this.bottom=Ve.number(t.bottom,r.bottom,i)),r.left!=null&&t.left!=null&&(this.left=Ve.number(t.left,r.left,i)),r.right!=null&&t.right!=null&&(this.right=Ve.number(t.right,r.right,i)),this}getCenter(t,r){let i=te((this.left+t-this.right)/2,0,t),a=te((this.top+r-this.bottom)/2,0,r);return new C(i,a)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Y0(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};function dl(e,t){if(!e.renderWorldCopies||e.lngRange)return;let r=t.lng-e.center.lng;t.lng+=r>180?-360:r<-180?360:0}function X_(e){return Math.max(0,Math.floor(e))}var op=class{constructor(e,t){this.applyConstrain=(r,i)=>this._constrainOverride===null?this._callbacks.defaultConstrain(r,i):this._constrainOverride(r,i),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=t?.renderWorldCopies===void 0||!!t?.renderWorldCopies,this._minZoom=t?.minZoom||0,this._maxZoom=t?.maxZoom||22,this._minPitch=t?.minPitch===void 0||t?.minPitch===null?0:t?.minPitch,this._maxPitch=t?.maxPitch===void 0||t?.maxPitch===null?60:t?.maxPitch,this._constrainOverride=t?.constrainOverride??null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new K(0,0),this._elevation=0,this._zoom=0,this._tileZoom=X_(this._zoom),this._scale=bt(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new W_,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,t,r){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=X_(this._zoom),this._scale=bt(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new W_(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!r&&e.autoCalculateNearFarZ,t&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){if(this._minZoom===e)return;this._minZoom=e;let t=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t}get maxZoom(){return this._maxZoom}setMaxZoom(e){if(this._maxZoom===e)return;this._maxZoom=e;let t=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=t}get minPitch(){return this._minPitch}setMinPitch(e){if(this._minPitch===e)return;this._minPitch=e;let t=this._unmodified;this.setPitch(Math.max(this.pitch,e)),this._unmodified=t}get maxPitch(){return this._maxPitch}setMaxPitch(e){if(this._maxPitch===e)return;this._maxPitch=e;let t=this._unmodified;this.setPitch(Math.min(this.pitch,e)),this._unmodified=t}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){e===void 0&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new C(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let t=Ut(e,-180,180)*Math.PI/180;this._bearingInRadians!==t&&(this._unmodified=!1,this._bearingInRadians=t,this._calcMatrices(),this._rotationMatrix=S0(),mA(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let t=te(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==t&&(this._unmodified=!1,this._pitchInRadians=t,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let t=e/180*Math.PI;this._rollInRadians!==t&&(this._unmodified=!1,this._rollInRadians=t,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Pi(this._fovInRadians)}setFov(e){e=te(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=Fe(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let t=this.applyConstrain(this._center,e).zoom;this._zoom!==t&&(this._unmodified=!1,this._zoom=t,this._tileZoom=Math.max(0,Math.floor(t)),this._scale=bt(t),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){(e.lat!==this._center.lat||e.lng!==this._center.lng)&&(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,t){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=t,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,t,r){this._unmodified=!1,this._edgeInsets.interpolate(e,t,r),this.constrainInternal(),this._calcMatrices()}resize(e,t,r=!0){this._width=e,this._height=t,r&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange?.length!==2||this._lngRange?.length!==2?null:new Kr([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-hr,hr])}getCameraQueryGeometry(e,t){if(t.length===1)return[t[0],e];{let{minX:r,minY:i,maxX:a,maxY:n}=or.fromPoints(t).extend(e);return[new C(r,i),new C(a,i),new C(a,n),new C(r,n),new C(r,i)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:t,zoom:r}=this.applyConstrain(this.center,this.zoom);this.setCenter(t),this.setZoom(r),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=Kt(new Float64Array(16));at(e,e,[this._width/2,-this._height/2,1]),ze(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=Kt(new Float64Array(16)),at(e,e,[1,-1,1]),ze(e,e,[-1,-1,0]),at(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let t=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(t)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,t,r,i){let a=r===void 0?this.bearing:r,n=i=i===void 0?this.pitch:i,{distanceToCenter:s,clampedElevation:o}=this._distanceToCenterFromAltElevationPitch(t,this.elevation,n),{x:l,y:u}=$o(n,a),h=fe.fromLngLat(e,t),c=Qh(1,h.y),p,d,f=0;do{if(f+=1,f>10)break;d=s/c;let m=l*d,g=u*d;p=new fe(h.x+m,h.y+g),c=1/p.meterInMercatorCoordinateUnits()}while(Math.abs(s-d*c)>1e-12);return{center:p.toLngLat(),elevation:o,zoom:dt(this.height/2/Math.tan(this.fovInRadians/2)/d/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let t=1/this.worldSize,r=_i(1,this.center.lat)*this.worldSize,i=fe.fromLngLat(this.center,this.elevation),a=i.x/t,n=i.y/t,s=i.z/t,o=this.pitch,l=this.bearing,{x:u,y:h,z:c}=$o(o,l),p=this.cameraToCenterDistance,d=a+p*-u,f=n+p*-h,m=s+p*c,{distanceToCenter:g,clampedElevation:y}=this._distanceToCenterFromAltElevationPitch(m/r,e,o),_=g*r,x=d+u*_,v=f+h*_,w=new fe(x*t,v*t,0).toLngLat(),b=_i(1,w.lat),T=dt(this.height/2/Math.tan(this.fovInRadians/2)/g/b/this.tileSize);this._elevation=y,this._center=w,this.setZoom(T)}_distanceToCenterFromAltElevationPitch(e,t,r){let i=-Math.cos(Fe(r)),a=e-t,n,s=t;return i*a>=0||Math.abs(i)<.1?(n=1e4,s=e+n*i):n=-a/i,{distanceToCenter:n,clampedElevation:s}}getCameraPoint(){let e=this.pitchInRadians,t=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new C(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){return rc(this).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let t=e.canonical.z>=0?1<<e.canonical.z:2**e.canonical.z;return[e.canonical.x/t,e.canonical.y/t,1/t/z,1/t/z]}},K0=class J0{constructor(t,r){this.min=t,this.max=r,this.center=Me([],Ot([],this.min,this.max),.5)}quadrant(t){let r=[t%2==0,t<2],i=io(this.min),a=io(this.max);for(let n=0;n<r.length;n++)i[n]=r[n]?this.min[n]:this.center[n],a[n]=r[n]?this.center[n]:this.max[n];return a[2]=this.max[2],new J0(i,a)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersectsFrustum(t){let r=!0;for(let i of t.planes){let a=this.intersectsPlane(i);if(a===0)return 0;a===1&&(r=!1)}return r?2:t.aabb.min[0]>this.max[0]||t.aabb.min[1]>this.max[1]||t.aabb.min[2]>this.max[2]||t.aabb.max[0]<this.min[0]||t.aabb.max[1]<this.min[1]||t.aabb.max[2]<this.min[2]?0:1}intersectsPlane(t){let r=t[3],i=t[3];for(let a=0;a<3;a++)t[a]>0?(r+=t[a]*this.min[a],i+=t[a]*this.max[a]):(i+=t[a]*this.min[a],r+=t[a]*this.max[a]);return r>=0?2:i<0?0:1}},EP=class{distanceToTile2d(e,t,r,i){let a=i,n=a.distanceX([e,t]),s=a.distanceY([e,t]);return Math.hypot(n,s)}getWrap(e,t,r){return r}getTileBoundingVolume(e,t,r,i){let a=Math.min(0,r),n=Math.max(0,r);if(i?.terrain){let o=new nt(e.z,t,e.z,e.x,e.y),l=i.terrain.getMinMaxElevation(o);a=l.minElevation??a,n=l.maxElevation??n}let s=1<<e.z;return new K0([t+e.x/s,e.y/s,a],[t+(e.x+1)/s,(e.y+1)/s,n])}allowVariableZoom(e,t){let r=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,i=te(78.5-r/2,0,60);return!!t.terrain||e.pitch>i}allowWorldCopies(){return!0}prepareNextFrame(){}},Q0=class e1{constructor(t,r,i){this.points=t,this.planes=r,this.aabb=i}static fromInvProjectionMatrix(t,r=1,i=0,a,n){let s=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]],o=n?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],l=2**i,u=s.map(d=>IP(d,t,r,l));a&&AP(u,o[0],a,n);let h=o.map(d=>{let f=wr([],u[d[0]],u[d[1]]),m=wr([],u[d[2]],u[d[1]]),g=At([],Et([],f,m)),y=-je(g,u[d[1]]);return g.concat(y)}),c=[1/0,1/0,1/0],p=[-1/0,-1/0,-1/0];for(let d of u)for(let f=0;f<3;f++)c[f]=Math.min(c[f],d[f]),p[f]=Math.max(p[f],d[f]);return new e1(u,h,new K0(c,p))}};function IP(e,t,r,i){let a=We([],e,t),n=1/a[3]/r*i;return Df(a,a,[n,n,1/a[3],n])}function AP(e,t,r,i){let a=i?4:0,n=i?0:4,s=0,o=[],l=[];for(let c=0;c<4;c++){let p=wr([],e[c+n],e[c+a]),d=di(p);Me(p,p,1/d),o.push(d),l.push(p)}for(let c=0;c<4;c++){let p=Rf(e[c+a],l[c],r);s=p!==null&&p>=0?Math.max(s,p):Math.max(s,o[c])}let u=MP(e,t),h=PP(r,u);if(h!==null){let c=h/je(l[0],u);s=Math.min(s,c)}for(let c=0;c<4;c++){let p=Math.min(s,o[c]);e[c+n]=[e[c+a][0]+l[c][0]*p,e[c+a][1]+l[c][1]*p,e[c+a][2]+l[c][2]*p,1]}}function MP(e,t){let r=wr([],e[t[0]],e[t[1]]),i=wr([],e[t[2]],e[t[1]]),a=[0,0,0,0];return At(a,Et([],r,i)),a[3]=-je(a,e[t[0]]),a}function PP(e,t){let r=On(e),i=kf([],e,1/r),a=wr([],t,Me([],i,je(t,i))),n=On(a);if(n>0){let s=Math.sqrt(1-i[3]*i[3]),o=Me([],i,-i[3]),l=Ot([],o,Me([],a,s/n));return lo(t,l)}return null}var CP=Ae([{name:\"a_pos3d\",type:\"Int16\",components:3}]),kP=class extends wt{constructor(e){super(),this._lastTilesetChange=ye(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(e,t){this.tileManager.update(e,t),this._renderableTilesKeys=[];let r={};for(let i of Za(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:t,calculateTileZoom:this.tileManager._source.calculateTileZoom}))r[i.key]=!0,this._renderableTilesKeys.push(i.key),this._tiles[i.key]||(i.terrainRttPosMatrix32f=new Float32Array(16),ur(i.terrainRttPosMatrix32f,0,z,z,0,0,1),this._tiles[i.key]=new R0(i,this.tileSize),this._lastTilesetChange=ye());for(let i in this._tiles)r[i]||(this._tiles[i].releaseRTT(this.tileManager.map.painter),delete this._tiles[i])}releaseRTT(e){for(let t in this._tiles){let r=this._tiles[t];(r.tileID.equals(e)||r.tileID.isChildOf(e)||e.isChildOf(r.tileID))&&r.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let e in this._tiles)this._tiles[e].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,t){return t?this._getTerrainCoordsForTileRanges(e,t):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let t={};for(let r of this._renderableTilesKeys){let i=this._tiles[r].tileID,a=e.clone(),n=Vt();if(i.canonical.equals(e.canonical))ur(n,0,z,z,0,0,1);else if(i.canonical.isChildOf(e.canonical)){let s=i.canonical.z-e.canonical.z,o=i.canonical.x-(i.canonical.x>>s<<s),l=i.canonical.y-(i.canonical.y>>s<<s),u=z>>s;ur(n,0,u,u,0,0,1),ze(n,n,[-o*u,-l*u,0])}else if(e.canonical.isChildOf(i.canonical)){let s=e.canonical.z-i.canonical.z,o=e.canonical.x-(e.canonical.x>>s<<s),l=e.canonical.y-(e.canonical.y>>s<<s),u=z>>s;ur(n,0,z,z,0,0,1),ze(n,n,[o*u,l*u,0]),at(n,n,[1/2**s,1/2**s,0])}else continue;a.terrainRttPosMatrix32f=new Float32Array(n),t[r]=a}return t}_getTerrainCoordsForTileRanges(e,t){let r={};for(let i of this._renderableTilesKeys){let a=this._tiles[i].tileID;if(!this._isWithinTileRanges(a,t))continue;let n=e.clone(),s=Vt();if(a.canonical.z===e.canonical.z){let o=e.canonical.x-a.canonical.x+e.wrap*(1<<e.canonical.z),l=e.canonical.y-a.canonical.y;ur(s,0,z,z,0,0,1),ze(s,s,[o*z,l*z,0])}else if(a.canonical.z>e.canonical.z){let o=a.canonical.z-e.canonical.z,l=a.canonical.x-(a.canonical.x>>o<<o)+e.wrap*(1<<a.canonical.z),u=a.canonical.y-(a.canonical.y>>o<<o),h=e.canonical.x-(a.canonical.x>>o),c=e.canonical.y-(a.canonical.y>>o),p=z>>o;ur(s,0,p,p,0,0,1),ze(s,s,[-l*p+h*z,-u*p+c*z,0])}else{let o=e.canonical.z-a.canonical.z,l=e.canonical.x-(e.canonical.x>>o<<o)+e.wrap*(1<<e.canonical.z),u=e.canonical.y-(e.canonical.y>>o<<o),h=(e.canonical.x>>o)-a.canonical.x,c=(e.canonical.y>>o)-a.canonical.y,p=z<<o;ur(s,0,p,p,0,0,1),ze(s,s,[l*z+h*p,u*z+c*p,0])}n.terrainRttPosMatrix32f=new Float32Array(s),r[i]=n}return r}getSourceTile(e,t){var n,s;let r=this.tileManager._source,i=e.overscaledZ-this.deltaZoom;if(i>r.maxzoom&&(i=r.maxzoom),i<r.minzoom)return;(n=this._sourceTileCache)[s=e.key]||(n[s]=e.scaledTo(i).key);let a=this.findTileInCaches(this._sourceTileCache[e.key]);if(!a?.dem&&t)for(;i>=r.minzoom&&!a?.dem;)a=this.findTileInCaches(e.scaledTo(i--).key);return a}findTileInCaches(e){let t=this.tileManager.getTileByID(e);return t||(t=this.tileManager._outOfViewCache.getByKey(e),t)}anyTilesAfterTime(e=ye()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,t){let r=t[e.canonical.z];return!!r&&(e.wrap>r.minWrap||e.wrap<r.maxWrap||e.canonical.x>=r.minTileXWrapped&&e.canonical.x<=r.maxTileXWrapped&&e.canonical.y>=r.minTileY&&e.canonical.y<=r.maxTileY)}},H_=z*(1-1e-12),DP=class{constructor(e,t,r,i=\"auto\"){this._meshCache={},this.painter=e,this.tileManager=new kP(t),this.options=r,this.exaggeration=typeof r.exaggeration==\"number\"?r.exaggeration:1,this._terrainSkirtLength=i,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){this._fbo&&(this._fbo=(this._fbo.destroy(),null)),this._fboDepthTexture&&(this._fboDepthTexture=(this._fboDepthTexture.destroy(),null)),this._emptyDemTexture&&(this._emptyDemTexture=(this._emptyDemTexture.destroy(),null)),this._emptyDepthTexture&&(this._emptyDepthTexture=(this._emptyDepthTexture.destroy(),null));for(let e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,t,r,i=z){let a=e.normalizeCoordinates(t,r,i);if(!a)return 0;let n=this.getElevationSampler(a.tileID);return n?n(a.x,a.y,i):0}getElevationForLngLatZoom(e,t){if(!wc(t,e.wrap()))return 0;let{tileID:r,mercatorX:i,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getElevation(r,i%z,a%z,z)}getElevationForLngLat(e,t){let r=Za(t,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),i=0;for(let a of r)a.canonical.z>i&&(i=Math.min(a.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,i)}getElevation(e,t,r,i=z){return this.getDEMElevation(e,t,r,i)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear(),this._coverageIndex=void 0}getCoverageIndex(){return this._coverageIndex===void 0&&(this._coverageIndex=this._buildCoverageIndex()),this._coverageIndex}_buildCoverageIndex(){let e=[],t=new Map,r=0,i=0;for(let a of this.tileManager.getRenderableTiles()){if(!a)continue;let{canonical:n,wrap:s}=a.tileID;e.includes(n.z)||e.push(n.z);let o=this.getElevationSampler(a.tileID);t.set(`${s}/${n.z}/${n.x}/${n.y}`,o);let{minElevation:l,maxElevation:u}=this.getMinMaxElevation(a.tileID);r=Math.min(r,l??0),i=Math.max(i,u??0)}return t.size===0?null:(e.sort((a,n)=>n-a),{zooms:e,samplerPerTile:t,minElevation:r-10,maxElevation:i+10})}getElevationSampler(e){let t=e.key,r=this._elevationSamplerCache.get(t);if(r)return r;let i=this.tileManager.getSourceTile(e,!0),a=i?.dem;if(!i||!a)return null;let n=this._getDEMTileMatrix(e,i),s=n[0]*a.dim,o=n[5]*a.dim,l=n[12]*a.dim,u=n[13]*a.dim,h=(c,p,d)=>{let f=d===8192?1:z/d;return a.sampleBilinear(c*f*s+l,p*f*o+u)};return this._elevationSamplerCache.set(t,h),h}_getDEMTileMatrix(e,t){let r=`${t.tileID.key}/${e.key}`,i=this._demMatrixCache.get(r);if(i)return i;let a=this.tileManager.getSource().maxzoom,n=e.canonical.z-t.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=a?n=e.canonical.z-a:pe(\"cannot calculate elevation if elevation maxzoom > source.maxzoom\"));let s=e.canonical.x-(e.canonical.x>>n<<n),o=e.canonical.y-(e.canonical.y>>n<<n),l=Sf(new Float64Array(16),[1/(z<<n),1/(z<<n),0]);return ze(l,l,[s*z,o*z,0]),this._demMatrixCache.set(r,l),l}getTerrainData(e){if(!this._emptyDemTexture){let i=this.painter.context,a=new xe({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Oe(i,a,i.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Oe(i,new xe({width:1,height:1}),i.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=Kt([])}let t=this.tileManager.getSourceTile(e,!0);if(t?.dem&&(!t.demTexture||t.needsTerrainPrepare)){let i=this.painter.context;t.demTexture||(t.demTexture=this.painter.getTileTexture(t.dem.stride)),t.demTexture?t.demTexture.update(t.dem.getPixels(),{premultiply:!1}):t.demTexture=new Oe(i,t.dem.getPixels(),i.gl.RGBA,{premultiply:!1}),t.demTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),t.needsTerrainPrepare=!1}let r=t?this._getDEMTileMatrix(e,t):this._emptyDemMatrix;return{u_depth:2,u_terrain:3,u_terrain_dim:t?.dem?.dim||1,u_terrain_matrix:r,u_terrain_unpack:t?.dem?.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(t?.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:t}}getFramebuffer(){let e=this.painter,t=e.width/devicePixelRatio,r=e.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==t||this._fbo.height!==r)&&(this._fbo.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture),this._fboDepthTexture||(this._fboDepthTexture=new Oe(e.context,{width:t,height:r,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(t,r,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,t,r))),this._fbo.colorAttachment.set(this._fboDepthTexture.texture),this._fbo}depthAtPoint(e){let t=new Uint8Array(4),r=this.painter.context,i=r.gl;return r.bindFramebuffer.set(this.getFramebuffer().framebuffer),i.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,t),r.bindFramebuffer.set(null),(t[0]/16777216+t[1]/65536+t[2]/256+t[3])/256}getTerrainMesh(e){let t=this.painter.style.projection?.transitionState>0,r=t&&e.canonical.y===0,i=t&&e.canonical.y===(1<<e.canonical.z)-1,a=`m_${r?\"n\":\"\"}_${i?\"s\":\"\"}`;if(this._meshCache[a])return this._meshCache[a];let n=this.painter.context,s=new jg,o=new pr,l=this.meshSize,u=z/l,h=l*l;for(let p=0;p<=l;p++)for(let d=0;d<=l;d++)s.emplaceBack(d*u,p*u,0);for(let p=0;p<h;p+=l+1)for(let d=0;d<l;d++)o.emplaceBack(d+p,l+d+p+1,l+d+p+2),o.emplaceBack(d+p,l+d+p+2,d+p+1);this._terrainSkirtLength!==\"none\"&&this._buildSkirts(s,o,l,u,r,i);let c=new ds(n.createVertexBuffer(s,CP.members),n.createIndexBuffer(o),Ee.simpleSegment(0,0,s.length,o.length));return this._meshCache[a]=c,c}getSkirtLength(e){return 2*Math.PI*Qt/2**Math.max(e,0)/5}getMinTileElevationForLngLatZoom(e,t){if(!wc(t,e.wrap()))return 0;let{tileID:r}=this._getOverscaledTileIDFromLngLatZoom(e,t);return this.getMinMaxElevation(r).minElevation??0}getMinMaxElevation(e){let t=this.tileManager.getSourceTile(e,!0),r={minElevation:null,maxElevation:null};return t?.dem&&(r.minElevation=t.dem.min*this.exaggeration,r.maxElevation=t.dem.max*this.exaggeration),r}_getOverscaledTileIDFromLngLatZoom(e,t){let r=fe.fromLngLat(e.wrap()),i=(1<<t)*z,a=r.x*i,n=r.y*i,s=Math.floor(a/z),o=Math.floor(n/z);return{tileID:new nt(t,0,t,s,o),mercatorX:a,mercatorY:n}}_buildSkirts(e,t,r,i,a,n){let s=e.length,o=s+(r+1),l=(r+1)*r,u=a?fa:0,h=+!a,c=n?ma:z,p=+!n;for(let m=0;m<=r;m++)e.emplaceBack(m*i,u,h);for(let m=0;m<=r;m++)e.emplaceBack(m*i,c,p);for(let m=0;m<r;m++)t.emplaceBack(l+m,o+m,o+m+1),t.emplaceBack(l+m,o+m+1,l+m+1),t.emplaceBack(0+m,s+m+1,s+m),t.emplaceBack(0+m,0+m+1,s+m+1);let d=e.length,f=d+(r+1)*2;for(let m of[0,1])for(let g=0;g<=r;g++)for(let y of[0,1])e.emplaceBack(m*z,g*i,y);for(let m=0;m<r*2;m+=2)t.emplaceBack(d+m,d+m+1,d+m+3),t.emplaceBack(d+m,d+m+3,d+m+2),t.emplaceBack(f+m,f+m+3,f+m+1),t.emplaceBack(f+m,f+m+2,f+m+3)}},Y_={covered:!1,elevation:0};function t1(e,t,r,i){if(i<0||i>=1)return Y_;let a=Math.floor(r),n=r-a;for(let s of e.zooms){let o=1<<s,l=n*o,u=i*o,h=Math.floor(l),c=Math.floor(u),p=`${a}/${s}/${h}/${c}`;if(!e.samplerPerTile.has(p))continue;let d=e.samplerPerTile.get(p);return d?{covered:!0,elevation:d(Math.min((l-h)*z,H_),Math.min((u-c)*z,H_),z)*t}:{covered:!0,elevation:0}}return Y_}function r1(e,t){return e.covered&&t<=e.elevation+1e-6}function i1(e,t,r,i,a){for(let n=0;n<40&&i-r>a;n++){let s=(r+i)/2;t(e,s)?i=s:r=s}return{lo:r,hi:i}}var fl=class a1{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,r,i){this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r,i=!0){this._helper.resize(t,r,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(t){}get renderWindowCrop(){return this._renderWindowCrop}setRenderWindowCrop(t){this._renderWindowCrop=t,this._croppedPosMatrixCacheF32.clear()}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._renderWindowCrop=null,this._croppedPosMatrixCacheF32=new Map,this.defaultConstrain=(r,i)=>{i=te(+i,this.minZoom,this.maxZoom);let a={center:new K(r.lng,r.lat),zoom:i},n=this._helper._lngRange;!this._helper._renderWorldCopies&&n===null&&(n=[-179.9999999999,180-1e-10]);let s=this.tileSize*bt(a.zoom),o=0,l=s,u=0,h=s,c=0,p=0,{x:d,y:f}=this.size;if(this._helper._latRange){let v=this._helper._latRange;o=qi(v[1])*s,l=qi(v[0])*s,l-o<f&&(c=f/(l-o))}n&&(u=Ut(Gi(n[0])*s,0,s),h=Ut(Gi(n[1])*s,0,s),h<u&&(h+=s),h-u<d&&(p=d/(h-u)));let{x:m,y:g}=dr(s,r),y,_,x=Math.max(p||0,c||0);if(x){let v=new C(p?(h+u)/2:m,c?(l+o)/2:g);return a.center=Oa(s,v).wrap(),a.zoom+=dt(x),a}if(this._helper._latRange){let v=f/2;g-v<o&&(_=o+v),g+v>l&&(_=l-v)}if(n){let v=(u+h)/2,w=m;this._helper._renderWorldCopies&&(w=Ut(m,v-s/2,v+s/2));let b=d/2;w-b<u&&(y=u+b),w+b>h&&(y=h-b)}if(y!==void 0||_!==void 0){let v=new C(y??m,_??g);a.center=Oa(s,v).wrap()}return a},this.applyConstrain=(r,i)=>this._helper.applyConstrain(r,i),this._helper=new op({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(r,i)=>this.defaultConstrain(r,i)},t),this._coveringTilesDetailsProvider=new EP}clone(){let t=new a1;return t.apply(this,!1),t}apply(t,r,i){this._helper.apply(t,r,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let r=[new ns(0,t)];if(this._helper._renderWorldCopies){let i=this.screenPointToMercatorCoordinate(new C(0,0)),a=this.screenPointToMercatorCoordinate(new C(this._helper._width,0)),n=this.screenPointToMercatorCoordinate(new C(this._helper._width,this._helper._height)),s=this.screenPointToMercatorCoordinate(new C(0,this._helper._height)),o=Math.floor(Math.min(i.x,a.x,n.x,s.x)),l=Math.floor(Math.max(i.x,a.x,n.x,s.x));for(let u=o-1;u<=l+1;u++)u!==0&&r.push(new ns(u,t))}return r}getCameraFrustum(){return Q0.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let r=this.screenPointToLocation(this.centerPoint,t),i=t?t.getElevationForLngLatZoom(r,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(t,r,i=this.elevation){let a=i-this.elevation,n=this.screenPointToMercatorCoordinateAtZ(r,a),s=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),o=fe.fromLngLat(t),l=new fe(o.x-(n.x-s.x),o.y-(n.y-s.y));this.setCenter(l?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,r){return r?this.coordinatePoint(fe.fromLngLat(t),r.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(fe.fromLngLat(t))}screenPointToLocation(t,r){return this.screenPointToMercatorCoordinate(t,r)?.toLngLat()}screenPointToLocationAtElevation(t,r){return this.screenPointToMercatorCoordinateAtZ(t,r-this.elevation)?.toLngLat()}screenPointToMercatorCoordinate(t,r){if(r){let i=this.screenTerrainPointToMercatorCoordinate(t,r);if(i!=null)return i}return this.screenPointToMercatorCoordinateAtZ(t)}screenTerrainPointToMercatorCoordinate(t,r){let i=r.getCoverageIndex();if(!i)return null;let{near:a,far:n}=this.getRaySegmentFromPixel(t),s=this.worldSize,o=n[0]-a[0],l=n[1]-a[1],u=n[2]-a[2],h={index:i,exaggeration:r.exaggeration,near:a,dx:o,dy:l,dz:u,worldSize:s},c=0,p=1;if(u===0){if(a[2]>i.maxElevation||a[2]<i.minElevation)return null}else{let y=(i.maxElevation-a[2])/u,_=(i.minElevation-a[2])/u;if(c=Math.max(c,Math.min(y,_)),p=Math.min(p,Math.max(y,_)),c>p)return null}let d=Math.hypot(o,l),f=te(Math.ceil(d*(p-c)/4),1,512),m=0,g=!el(h,0);for(let y=0;y<=f;y++){let _=c+(p-c)*y/f;if(!g)g=!el(h,_);else if(el(h,_)){let{lo:x,hi:v}=i1(h,el,m,_,.001/d),w=hl(h,x),b=hl(h,v),T=a[2]+x*u-w.elevation,I=a[2]+v*u-b.elevation,S=w.covered&&T>I?te(x+T*(v-x)/(T-I),x,v):v;return new fe((a[0]+S*o)/s,(a[1]+S*l)/s,hl(h,S).elevation)}m=_}return null}getRaySegmentFromPixel(t){let r=[t.x,t.y,0,1],i=[t.x,t.y,1,1];We(r,r,this._pixelMatrixInverse),We(i,i,this._pixelMatrixInverse);let a=r[3],n=i[3],s=this.elevation;return{near:[r[0]/a,r[1]/a,r[2]/a+s],far:[i[0]/n,i[1]/n,i[2]/n+s]}}screenPointToMercatorCoordinateAtZ(t,r){let i=r||0,{near:a,far:n}=this.getRaySegmentFromPixel(t),s=a[2]===n[2]?0:(i+this.elevation-a[2])/(n[2]-a[2]);return new fe(Ve.number(a[0],n[0],s)/this.worldSize,Ve.number(a[1],n[1],s)/this.worldSize,i)}coordinatePoint(t,r=0,i=this._pixelMatrix){let a=[t.x*this.worldSize,t.y*this.worldSize,r,1];return We(a,a,i),new C(a[0]/a[3],a[1]/a[3])}getBounds(){let t=Math.max(0,this._helper._height/2-Va(this));return new Kr().extend(this.screenPointToLocation(new C(0,t))).extend(this.screenPointToLocation(new C(this._helper._width,t))).extend(this.screenPointToLocation(new C(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new C(0,this._helper._height)))}isPointOnMapSurface(t,r){return r?this.screenTerrainPointToMercatorCoordinate(t,r)!=null:t.y>this.height/2-Va(this)}calculatePosMatrix(t,r=!1,i=!1){let a=t.key??zi(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),n=r?this._alignedPosMatrixCache:this._posMatrixCache;if(n.has(a)){let l=n.get(a);return i?l.f32:l.f64}let s=Uo(t,this.worldSize);Jt(s,r?this._alignedProjMatrix:this._viewProjMatrix,s);let o={f64:s,f32:new Float32Array(s)};return n.set(a,o),i?o.f32:o.f64}calculateFogMatrix(t){let r=t.key,i=this._fogMatrixCacheF32;if(i.has(r))return i.get(r);let a=Uo(t,this.worldSize);return Jt(a,this._fogMatrix,a),i.set(r,new Float32Array(a)),i.get(r)}calculateCenterFromCameraLngLatAlt(t,r,i,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,a)}_calculateNearFarZIfNeeded(t,r,i){if(!this._helper.autoCalculateNearFarZ)return;let a=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),n=t-a*this._helper._pixelPerMeter/Math.cos(r),s=a<0?n:t,o=Math.PI/2+this.pitchInRadians,l=Fe(this.fov)*(Math.abs(Math.cos(Fe(this.roll)))*this.height+Math.abs(Math.sin(Fe(this.roll)))*this.width)/this.height*(.5+i.y/this.height),u=Math.sin(l)*s/Math.sin(te(Math.PI-o-l,.01,Math.PI-.01)),h=Va(this),c=Math.atan(h/this._helper.cameraToCenterDistance),p=Fe(90-xi),d=c>p?2*c*(.5+i.y/(h*2)):p,f=Math.sin(d)*s/Math.sin(te(Math.PI-o-d,.01,Math.PI-.01)),m=Math.min(u,f);this._helper._farZ=(Math.cos(Math.PI/2-r)*m+s)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;let t=this.centerOffset,r=dr(this.worldSize,this.center),i=r.x,a=r.y;this._helper._pixelPerMeter=_i(1,this.center.lat)*this.worldSize;let n=Fe(Math.min(this.pitch,xi)),s=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(n));this._calculateNearFarZIfNeeded(s,n,t);let o;o=new Float64Array(16),ro(o,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),WM(this._invProjMatrix,o),o[8]=-t.x*2/this._helper._width,o[9]=t.y*2/this._helper._height,this._projectionMatrix=to(o),at(o,o,[1,-1,1]),ze(o,o,[0,0,-this._helper.cameraToCenterDistance]),Nr(o,o,-this.rollInRadians),Ni(o,o,this.pitchInRadians),Nr(o,o,-this.bearingInRadians),ze(o,o,[-i,-a,0]),this._mercatorMatrix=at([],o,[this.worldSize,this.worldSize,this.worldSize]),at(o,o,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=Jt(new Float64Array(16),this.clipSpaceToPixelsMatrix,o),ze(o,o,[0,0,-this.elevation]),this._viewProjMatrix=o,this._invViewProjMatrix=Ma([],o);let l=[0,0,-1,1];We(l,l,this._invViewProjMatrix),this._cameraPosition=[l[0]/l[3],l[1]/l[3],l[2]/l[3]],this._fogMatrix=new Float64Array(16),ro(this._fogMatrix,this.fovInRadians,this.width/this.height,s,this._helper._farZ),this._fogMatrix[8]=-t.x*2/this.width,this._fogMatrix[9]=t.y*2/this.height,at(this._fogMatrix,this._fogMatrix,[1,-1,1]),ze(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),Nr(this._fogMatrix,this._fogMatrix,-this.rollInRadians),Ni(this._fogMatrix,this._fogMatrix,this.pitchInRadians),Nr(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),ze(this._fogMatrix,this._fogMatrix,[-i,-a,0]),at(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),ze(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=Jt(new Float64Array(16),this.clipSpaceToPixelsMatrix,o);let u=this._helper._width%2/2,h=this._helper._height%2/2,c=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),d=i-Math.round(i)+c*u+p*h,f=a-Math.round(a)+c*h+p*u,m=new Float64Array(o);if(ze(m,m,[d>.5?d-1:d,f>.5?f-1:f,0]),this._alignedProjMatrix=m,o=Ma(new Float64Array(16),this._pixelMatrix),!o)throw Error(\"failed to invert matrix\");this._pixelMatrixInverse=o,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear(),this._croppedPosMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new C(0,0)),r=[t.x*this.worldSize,t.y*this.worldSize,0,1];return We(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){let t=_i(1,this.center.lat)*this.worldSize,r=this._helper.cameraToCenterDistance/t;return tc(this.center,this.elevation,this.pitch,this.bearing,r).toLngLat()}lngLatToCameraDepth(t,r){let i=fe.fromLngLat(t),a=[i.x*this.worldSize,i.y*this.worldSize,r,1];return We(a,a,this._viewProjMatrix),a[2]/a[3]}getProjectionData(t){let{overscaledTileID:r,aligned:i,applyTerrainMatrix:a}=t,n=this._helper.getMercatorTileCoordinates(r),s=r?this._calculateRenderPosMatrix(r,i):null,o;return o=r?.terrainRttPosMatrix32f&&a?r.terrainRttPosMatrix32f:s||fh(),{mainMatrix:o,tileMercatorCoords:n,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:o,clipAntimeridian:!1}}_calculateRenderPosMatrix(t,r){if(!this._renderWindowCrop)return this.calculatePosMatrix(t,r,!0);let i=`${r?\"aligned/\":\"\"}${t.key}`,a=this._croppedPosMatrixCacheF32.get(i);return a||(a=new Float32Array(this._renderWindowCrop.cropClipSpace(this.calculatePosMatrix(t,r))),this._croppedPosMatrixCacheF32.set(i,a)),a}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,r,i){return 1}transformLightDirection(t){return io(t)}getRayDirectionFromPixel(t){throw Error(\"Not implemented.\")}projectTileCoordinates(t,r,i,a){let n=this.calculatePosMatrix(i),s;a==null?(s=[t,r,0,1],sp(s,s,n)):(s=[t,r,a,1],We(s,s,n));let o=s[3];return{point:new C(s[0]/o,s[1]/o),signedDistanceFromCamera:o,isOccluded:!1}}populateCache(t){for(let r of t)this.calculatePosMatrix(r)}getProjectionDataForCustomLayer(t=!0){let r=new nt(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:t}),a=Uo(r,this.worldSize);Jt(a,this._viewProjMatrix,a),this._renderWindowCrop&&Jt(a,this._renderWindowCrop.clipMatrix,a);let n=[z,z,this.worldSize/this._helper.pixelsPerMeter],s=Vt();return at(s,a,n),{...i,tileMercatorCoords:[0,0,1,1],fallbackMatrix:s,mainMatrix:s}}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}};function hl(e,t){return t1(e.index,e.exaggeration,(e.near[0]+t*e.dx)/e.worldSize,(e.near[1]+t*e.dy)/e.worldSize)}function el(e,t){return r1(hl(e,t),e.near[2]+t*e.dz)}function n1(){pe(\"Map cannot fit within canvas with the given bounds, padding, and/or offset.\")}function s1(e){if(e.useSlerp)if(e.k<1){let t=_h(e.startEulerAngles.roll,e.startEulerAngles.pitch,e.startEulerAngles.bearing),r=_h(e.endEulerAngles.roll,e.endEulerAngles.pitch,e.endEulerAngles.bearing),i=new Float64Array(4);dn(i,t,r,e.k);let a=Zf(i);e.tr.setRoll(a.roll),e.tr.setPitch(a.pitch),e.tr.setBearing(a.bearing)}else e.tr.setRoll(e.endEulerAngles.roll),e.tr.setPitch(e.endEulerAngles.pitch),e.tr.setBearing(e.endEulerAngles.bearing);else e.tr.setRoll(Ve.number(e.startEulerAngles.roll,e.endEulerAngles.roll,e.k)),e.tr.setPitch(Ve.number(e.startEulerAngles.pitch,e.endEulerAngles.pitch,e.k)),e.tr.setBearing(Ve.number(e.startEulerAngles.bearing,e.endEulerAngles.bearing,e.k))}function o1(e,t,r,i,a){let n=a.padding,s=dr(a.worldSize,r.getNorthWest()),o=dr(a.worldSize,r.getNorthEast()),l=dr(a.worldSize,r.getSouthEast()),u=dr(a.worldSize,r.getSouthWest()),h=Fe(-i),c=s.rotate(h),p=o.rotate(h),d=l.rotate(h),f=u.rotate(h),m=new C(Math.max(c.x,p.x,f.x,d.x),Math.max(c.y,p.y,f.y,d.y)),g=new C(Math.min(c.x,p.x,f.x,d.x),Math.min(c.y,p.y,f.y,d.y)),y=m.sub(g),_=a.width-(n.left+n.right+t.left+t.right),x=a.height-(n.top+n.bottom+t.top+t.bottom),v=_/y.x,w=x/y.y;if(w<0||v<0){n1();return}let b=Math.min(dt(a.scale*Math.min(v,w)),e.maxZoom),T=C.convert(e.offset),I=(t.left-t.right)/2,S=(t.top-t.bottom)/2,D=new C(I,S).rotate(Fe(i)),R=T.add(D).mult(a.scale/bt(b));return{center:Oa(a.worldSize,s.add(l).div(2).sub(R)),zoom:b,bearing:i}}var ml=class{get useGlobeControls(){return!1}handlePanInertia(e,t){let r=e.mag(),i=Math.abs(Va(t));return{easingOffset:e.mult(Math.min(i*.75/r,1)),easingCenter:t.center}}handleMapControlsRollPitchBearingZoom(e,t){e.bearingDelta&&t.setBearing(t.bearing+e.bearingDelta),e.pitchDelta&&t.setPitch(t.pitch+e.pitchDelta),e.rollDelta&&t.setRoll(t.roll+e.rollDelta),e.zoomDelta&&t.setZoom(t.zoom+e.zoomDelta)}handleMapControlsPan(e,t,r){e.around.distSqr(t.centerPoint)<.01||t.setLocationAtPoint(r,e.around,e.aroundElevation)}cameraForBoxAndBearing(e,t,r,i,a){return o1(e,t,r,i,a)}handleJumpToCenterZoom(e,t){let r=t.zoom===void 0?e.zoom:+t.zoom;e.zoom!==r&&e.setZoom(+t.zoom),t.center!==void 0&&e.setCenter(K.convert(t.center))}handleEaseTo(e,t){let r=e.zoom,i=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},n={roll:t.roll===void 0?e.roll:t.roll,pitch:t.pitch===void 0?e.pitch:t.pitch,bearing:t.bearing===void 0?e.bearing:t.bearing},s=t.zoom!==void 0,o=!e.isPaddingEqual(t.padding),l=!1,u=s?+t.zoom:e.zoom,h=e.centerPoint.add(t.offsetAsPoint),c=e.screenPointToLocation(h),{center:p,zoom:d}=e.applyConstrain(K.convert(t.center||c),u??r);dl(e,p);let f=dr(e.worldSize,c),m=dr(e.worldSize,p).sub(f),g=bt(d-r);return l=d!==r,{easeFunc:y=>{if(l&&e.setZoom(Ve.number(r,d,y)),yh(a,n)||s1({startEulerAngles:a,endEulerAngles:n,tr:e,k:y,useSlerp:a.roll!=n.roll}),o&&(e.interpolatePadding(i,t.padding,y),h=e.centerPoint.add(t.offsetAsPoint)),t.around)e.setLocationAtPoint(t.around,t.aroundPoint);else{let _=bt(e.zoom-r),x=(d>r?Math.min(2,g):Math.max(.5,g))**(1-y),v=Oa(e.worldSize,f.add(m.mult(y*x)).mult(_));e.setLocationAtPoint(e.renderWorldCopies?v.wrap():v,h)}},isZooming:l,elevationCenter:p}}handleFlyTo(e,t){let r=t.zoom!==void 0,i=e.zoom,a=e.applyConstrain(K.convert(t.center||t.locationAtOffset),r?+t.zoom:i),n=a.center,s=a.zoom;dl(e,n);let o=e.worldSize,l=dr(o,t.locationAtOffset),u=dr(o,n).sub(l),h=u.mag(),c=bt(s-i),p=t.minZoom===void 0?e.minZoom:+t.minZoom,d=Math.max(p,e.minZoom),f=Math.min(d,i,s),m=e.applyConstrain(n,f).zoom;return{easeFunc:(g,y,_,x)=>{e.setZoom(g===1?s:i+dt(y));let v=g===1?n:Oa(o,l.add(u.mult(_)));e.setLocationAtPoint(e.renderWorldCopies?v.wrap():v,x)},scaleOfZoom:c,targetCenter:n,scaleOfMinZoom:bt(m-i),pixelPathLength:h}}},FP,zP=()=>FP||(FP=new Qe({type:new V(P.projection.type,\"type\")})),Cc=new Vo({fill:new xr(128,2),line:new xr(512,0),tile:new xr(128,32),stencil:new xr(128,1),circle:3}),l1=class{constructor(){this._tileMeshCache={}}get name(){return\"vertical-perspective\"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return\"globe\"}get shaderDefine(){return\"#define GLOBE\"}get shaderPreludeCode(){return Ar.projectionGlobe}get vertexShaderPreludeCode(){return Ar.projectionMercator.vertexSource}get subdivisionGranularity(){return Cc}get useGlobeControls(){return!0}destroy(){}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?\"b\":\"\"}${e.extendToNorthPole?\"n\":\"\"}${e.extendToSouthPole?\"s\":\"\"}`}getMeshFromTileID(e,t,r,i,a){let n=(a===\"stencil\"?Cc.stencil:Cc.tile).getGranularityForZoomLevel(t.z),s=t.y===0&&i,o=t.y===(1<<t.z)-1&&i;return this._getMesh(e,{granularity:n,generateBorders:r,extendToNorthPole:s,extendToSouthPole:o})}_getMesh(e,t){let r=this._getMeshKey(t);if(r in this._tileMeshCache)return this._tileMeshCache[r];let i=V0(e,t);return this._tileMeshCache[r]=i,i}recalculate(e){}hasTransition(){return!1}},K_=class extends wt{constructor(e,t){super(),this._transitionable=new Hn(zP(),\"projection\",t),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new Te(0)),this._mercatorProjection=new Kc,this._verticalPerspectiveProjection=new l1}get transitionState(){let e=this.properties.get(\"type\");if(typeof e==\"string\"&&e===\"mercator\")return 0;if(typeof e==\"string\"&&e===\"vertical-perspective\")return 1;if(e instanceof jr){if(e.from===e.to)return e.from===\"mercator\"?0:1;if(e.from===\"vertical-perspective\"&&e.to===\"mercator\")return 1-e.transition;if(e.from===\"mercator\"&&e.to===\"vertical-perspective\")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return\"globe\"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}getMeshFromTileID(e,t,r,i,a){return this.currentProjection.getMeshFromTileID(e,t,r,i,a)}setProjection(e){this._transitionable.setValue(\"type\",e?.type||\"mercator\")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}};function u1(e){let t=xl(e.worldSize,e.center.lat);return 2*Math.PI*t}function RP(e,t,r){let i=ot(t),a=ot(r),n=je(i,a),s=Math.acos(n),o=u1(e);return s/(2*Math.PI)*o}function LP(e,t){return[ci(e*Math.PI*2+Math.PI,Math.PI*2),2*Math.atan(Math.exp(Math.PI-t*Math.PI*2))-Math.PI*.5]}function BP(e,t){let r=Math.cos(t),i=new Float64Array(3);return i[0]=Math.sin(e)*r,i[1]=Math.sin(t),i[2]=Math.cos(e)*r,i}function vi(e,t,r,i,a){let n=1/(1<<a),s=e/z*n+r*n,o=t/z*n+i*n,l=ci(s*Math.PI*2+Math.PI,Math.PI*2),u=2*Math.atan(Math.exp(Math.PI-o*Math.PI*2))-Math.PI*.5,h=Math.cos(u),c=new Float64Array(3);return c[0]=Math.sin(l)*h,c[1]=Math.sin(u),c[2]=Math.cos(l)*h,c}function ot(e){return BP(e.lng*Math.PI/180,e.lat*Math.PI/180)}function xl(e,t){return e/(2*Math.PI)/Math.cos(t*Math.PI/180)}function gl(e){let t=Math.asin(e[1])/Math.PI*180,r=Math.sqrt(e[0]*e[0]+e[2]*e[2]);if(r>1e-6){let i=e[0]/r,a=e[2]/r,n=Math.acos(a),s=(i>0?n:-n)/Math.PI*180;return new K(Ut(s,-180,180),t)}return new K(0,t)}function OP(e,t){return so(fi(),-e.lng,-e.lat,t)}function VP(e){let t=e[0],r=e[1],i=e[2],a=e[3];return{lng:-Math.atan2(2*(a*t+r*i),1-2*(t*t+r*r))*180/Math.PI,lat:-Math.asin(te(2*(a*r-i*t),-1,1))*180/Math.PI,bearing:Math.atan2(2*(a*i+t*r),1-2*(r*r+i*i))*180/Math.PI}}var kc=Math.PI*.98;function J_(e,t){let r=e.cameraPosition,i=di(r);if(i<=1)return e.screenPointToLocation(t);let a=_e();At(a,r);let n=e.getRayDirectionFromPixel(t),s=-je(n,a),o=_e();Ln(o,n,a,s);let l=di(o);if(l<1e-9)return e.screenPointToLocation(t);let u=Math.atan2(l,s),h=Math.asin(1/i)*.9;if(u<h)return e.screenPointToLocation(t);let c=i*Math.sin(h),p=Math.asin(te(c,-1,1))-h,d=i*Math.cos(h)/Math.sqrt(Math.max(1-c*c,1e-12))-1,f=kc-p,m=u-h,g=p+d*m*f/(f+d*m),y=_e();Me(y,o,1/l);let _=_e();return Me(_,a,Math.cos(te(g,0,kc))),Ln(_,_,y,Math.sin(te(g,0,kc))),At(_,_),gl(_)}function NP(e,t,r,i,a=!0){let n=J_(e,r),s=t;if(i)s=J_(e,r.sub(i));else if(!e.isPointOnMapSurface(r))return;let o=ot(n),l=ot(s),u=OP(e.center,e.bearing),h=Et(_e(),l,o),c=Math.sqrt(je(h,h)),p=Math.acos(te(je(l,o),-1,1))/2,d=Math.sin(p),f=c?hh(h[1]/c*d,-h[0]/c*d,h[2]/c*d,Math.cos(p)):hh(0,0,0,1),{lng:m,lat:g,bearing:y}=VP(Ff(fi(),u,f)),_=e.center.lat,x=e.zoom,v=te(g,-90,90),w=a?UP(e,r,i,m):m;e.setCenter(new K(Ut(w,-180,180),v)),a||e.setBearing(y),e.setZoom(x+st(_,e.center.lat))}function UP(e,t,r,i){let a=e.center.lng,n=e.center.lat,s=n>=0?90:-90,o=e.locationToScreenPoint(new K(0,s)),l=t.x-o.x,u=t.y-o.y,h=l*l+u*u,c=te(1-(hr-Math.abs(n))/12,0,1),p=c*c*(3-2*c),d=ci(i-a+180,360)-180,f=0;if(p>0&&r){let m=(l*r.y-u*r.x)/Math.max(h,400);f=(s>0?1:-1)*m*180/Math.PI}return a+(1-p)*d+p*f}function $P(e){let t=_e();return t[0]=e[0]*-e[3],t[1]=e[1]*-e[3],t[2]=e[2]*-e[3],{center:t,radius:Math.sqrt(1-e[3]*e[3])}}function jP(e,t,r){let i=_e();wr(i,r,e);let a=_e();return Ln(a,e,i,t/On(i)),a}function yl(e){return Math.cos(e*Math.PI/180)}function st(e,t){let r=yl(e),i=yl(t);return dt(i/r)}function GP(e,t){return 360/u1({worldSize:e,center:{lat:t}})}function qP(e,t){let r=e.rotate(t.bearingInRadians),i=t.zoom+st(t.center.lat,0),a=Ui(1/yl(t.center.lat),1/yl(Math.min(Math.abs(t.center.lat),60)),Un(i,7,3,0,1)),n=GP(t.worldSize,t.center.lat);return new K(t.center.lng-r.x*n*a,te(t.center.lat+r.y*n,-hr,hr))}function Dc(e){let t=.5*e,r=Math.sin(t),i=Math.cos(t);return Math.log(r+i)-Math.log(i-r)}function Q_(e,t,r,i){let a=e.lat+r*i;if(Math.abs(r)>1){let n=e.lat+r,s=(Math.sign(n)===Math.sign(e.lat)?Math.abs(e.lat):-Math.abs(e.lat))*Math.PI/180,o=Math.abs(e.lat+r)*Math.PI/180,l=Dc(s+i*(o-s)),u=Dc(s),h=Dc(o),c=(l-u)/(h-u),p=e.lng+t*c;return new K(p,a)}{let n=e.lng+t*i;return new K(n,a)}}function tl(e,t,r=1){let i=je(e,t),a=r*r,n=_e(),s=_e();Me(s,t,i),wr(n,e,s);let o=a-je(n,n);if(o<0)return null;let l=je(e,e)-a,u=-i+(i<0?1:-1)*Math.sqrt(o),h=l/u,c=u;return{tMin:Math.min(h,c),tMax:Math.max(h,c)}}var ZP=class{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,t,r,i){let a=`${e.z}_${e.x}_${e.y}_${i?.terrain?\"t\":\"\"}_${Math.round(r)}`,n=this._cache.get(a);if(n)return n;let s=this._cachePrevious.get(a);if(s)return this._cache.set(a,s),s;let o=this._boundingVolumeFactory(e,t,r,i);return this._cache.set(a,o),this._hadAnyChanges=!0,o}},Fc=class Jc{constructor(t,r,i,a){this.min=i,this.max=a,this.points=t,this.planes=r}static fromAabb(t,r){let i=[];for(let a=0;a<8;a++)i.push([(a>>0&1)==1?r[0]:t[0],(a>>1&1)==1?r[1]:t[1],(a>>2&1)==1?r[2]:t[2]]);return new Jc(i,[[-1,0,0,r[0]],[1,0,0,-t[0]],[0,-1,0,r[1]],[0,1,0,-t[1]],[0,0,-1,r[2]],[0,0,1,-t[2]]],t,r)}static fromCenterSizeAngles(t,r,i){let a=so([],i[0],i[1],i[2]),n=ao([],[r[0],0,0],a),s=ao([],[0,r[1],0],a),o=ao([],[0,0,r[2]],a),l=[...t],u=[...t];for(let c=0;c<8;c++)for(let p=0;p<3;p++){let d=t[p]+n[p]*((c>>0&1)==1?1:-1)+s[p]*((c>>1&1)==1?1:-1)+o[p]*((c>>2&1)==1?1:-1);l[p]=Math.min(l[p],d),u[p]=Math.max(u[p],d)}let h=[];for(let c=0;c<8;c++){let p=[...t];Ot(p,p,Me([],n,(c>>0&1)==1?1:-1)),Ot(p,p,Me([],s,(c>>1&1)==1?1:-1)),Ot(p,p,Me([],o,(c>>2&1)==1?1:-1)),h.push(p)}return new Jc(h,[[...n,-je(n,h[0])],[...s,-je(s,h[0])],[...o,-je(o,h[0])],[-n[0],-n[1],-n[2],-je(n,h[7])],[-s[0],-s[1],-s[2],-je(s,h[7])],[-o[0],-o[1],-o[2],-je(o,h[7])]],l,u)}intersectsFrustum(t){let r=!0,i=this.points.length,a=this.planes.length,n=t.planes.length,s=t.points.length;for(let o=0;o<n;o++){let l=t.planes[o],u=0;for(let h=0;h<i;h++){let c=this.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0;u<i&&(r=!1)}if(r)return 2;for(let o=0;o<a;o++){let l=this.planes[o],u=0;for(let h=0;h<s;h++){let c=t.points[h];l[0]*c[0]+l[1]*c[1]+l[2]*c[2]+l[3]>=0&&u++}if(u===0)return 0}return 1}intersectsPlane(t){let r=this.points.length,i=0;for(let a=0;a<r;a++){let n=this.points[a];t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]>=0&&i++}return i===r?2:i===0?0:1}};function cl(e,t,r){let i=e-t;return i<0?-i:Math.max(0,i-r)}function zc(e,t,r,i,a){let n=e-r,s;return s=n<0?Math.min(-n,1+n-a):n>a?Math.min(Math.max(n-a,0),1-n):0,Math.max(s,cl(t,i,a))}var WP=class{constructor(){this._boundingVolumeCache=new ZP(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,t,r,i){let a=1<<r.z,n=1/a,s=r.x/a,o=r.y/a,l=.5,u=2;return u=Math.min(u,zc(e,t,s,o,n)),u=Math.min(u,zc(e,t,s+l,-o-n,n)),u=Math.min(u,zc(e,t,s+l,2-o-n,n)),u}getWrap(e,t,r){let i=1<<t.z,a=1/i,n=t.x/i,s=cl(e.x,n,a),o=cl(e.x,n-1,a),l=cl(e.x,n+1,a),u=Math.min(s,o,l);return u===l?1:u===o?-1:0}allowVariableZoom(e,t){return rp(e,t)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,t,r,i){return this._boundingVolumeCache.getTileBoundingVolume(e,t,r,i)}_computeTileBoundingVolume(e,t,r,i){let a=Math.min(0,r),n=Math.max(0,r);if(i?.terrain){let s=new nt(e.z,t,e.z,e.x,e.y),o=i.terrain.getMinMaxElevation(s);a=o.minElevation??a,n=o.maxElevation??n}if(a/=Qt,n/=Qt,a+=1,n+=1,e.z<=0)return Fc.fromAabb([-n,-n,-n],[n,n,n]);if(e.z===1)return Fc.fromAabb([e.x===0?-n:0,e.y===0?0:-n,-n],[e.x===0?0:n,e.y===0?n:0,n]);{let s=[vi(0,0,e.x,e.y,e.z),vi(z,0,e.x,e.y,e.z),vi(z,z,e.x,e.y,e.z),vi(0,z,e.x,e.y,e.z)],o=[];for(let I of s)o.push(Me([],I,n));if(n!==a)for(let I of s)o.push(Me([],I,a));e.y===0&&o.push([0,1,0]),e.y===(1<<e.z)-1&&o.push([0,-1,0]);let l=[1,1,1],u=[-1,-1,-1];for(let I of o)for(let S=0;S<3;S++)l[S]=Math.min(l[S],I[S]),u[S]=Math.max(u[S],I[S]);let h=vi(z/2,z/2,e.x,e.y,e.z),c=Et([],[0,1,0],h);At(c,c);let p=Et([],h,c);At(p,p);let d=Et([],s[2],s[1]);At(d,d);let f=Et([],s[0],s[3]);At(f,f),o.push(Me([],h,n)),e.y>=(1<<e.z)/2&&o.push(Me([],vi(z/2,0,e.x,e.y,e.z),n)),e.y<(1<<e.z)/2&&o.push(Me([],vi(z/2,z,e.x,e.y,e.z),n));let m=e0(h,o),g=e0(p,o),y=[-h[0],-h[1],-h[2],m.max],_=[h[0],h[1],h[2],-m.min],x=[-p[0],-p[1],-p[2],g.max],v=[p[0],p[1],p[2],-g.min],w=[...d,0],b=[...f,0],T=[];return e.y===0?T.push(Nt(b,w,y),Nt(b,w,_)):T.push(Nt(x,w,y),Nt(x,w,_),Nt(x,b,y),Nt(x,b,_)),e.y===(1<<e.z)-1?T.push(Nt(b,w,y),Nt(b,w,_)):T.push(Nt(v,w,y),Nt(v,w,_),Nt(v,b,y),Nt(v,b,_)),new Fc(T,[y,_,x,v,w,b],l,u)}}};function e0(e,t){let r=1/0,i=-1/0;for(let a of t){let n=je(e,a);r=Math.min(r,n),i=Math.max(i,n)}return{min:r,max:i}}var h1=class c1{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,r,i){this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r){this._helper.resize(t,r)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get renderWindowCrop(){return null}setRenderWindowCrop(t){if(t)throw Error(\"Render windows are only supported with the mercator projection.\")}setTransitionState(t){}constructor(t){this._cachedClippingPlane=fi(),this._projectionMatrix=Ca(),this._globeViewProjMatrix32f=fh(),this._globeViewProjMatrixF64=Ca(),this._globeViewProjMatrixF64Inverted=Ca(),this._globeProjMatrixInverted=Ca(),this._cameraPosition=_e(),this.defaultConstrain=(r,i)=>{let a=te(r.lat,-hr,hr),n=te(+i,this.minZoom+st(0,a),this.maxZoom);return{center:new K(r.lng,a),zoom:n}},this.applyConstrain=(r,i)=>this._helper.applyConstrain(r,i),this._helper=new op({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(r,i)=>this.defaultConstrain(r,i)},t),this._coveringTilesDetailsProvider=new WP}clone(){let t=new c1;return t.apply(this,!1),t}apply(t,r){this._helper.apply(t,r)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=_e();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:r,applyGlobeMatrix:i}=t,a=this._helper.getMercatorTileCoordinates(r);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:a,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!i,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:r?.canonical.z===0}}_computeClippingPlane(t){let r=this.pitchInRadians,i=this.cameraToCenterDistance/t,a=Math.sin(r)*i,n=Math.cos(r)*i+1,s=1/Math.sqrt(a*a+n*n)*1,o=-a,l=n,u=Math.sqrt(o*o+l*l);o/=u,l/=u;let h=[0,o,l];no(h,h,[0,0,0],-this.bearingInRadians),Bn(h,h,[0,0,0],-1*this.center.lat*Math.PI/180),Pa(h,h,[0,0,0],this.center.lng*Math.PI/180);let c=1/di(h);return Me(h,h,c),[...h,-s*c]}isLocationOccluded(t){return!this.isSurfacePointVisible(ot(t))}transformLightDirection(t){let r=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,a=Math.cos(i),n=[Math.sin(r)*a,Math.sin(i),Math.cos(r)*a],s=[n[2],0,-n[0]],o=[0,0,0];Et(o,s,n),At(s,s),At(o,o);let l=[s[0]*t[0]+o[0]*t[1]+n[0]*t[2],s[1]*t[0]+o[1]*t[1]+n[1]*t[2],s[2]*t[0]+o[2]*t[1]+n[2]*t[2]],u=[0,0,0];return At(u,l),u}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,r,i){let a=ec(t,r,i.canonical),n=LP(a.x,a.y);return this.getCircleRadiusCorrection()/Math.cos(n[1])}projectTileCoordinates(t,r,i,a){let n=i.canonical,s=vi(t,r,n.x,n.y,n.z),o=1+(a??0)/Qt,l=[s[0]*o,s[1]*o,s[2]*o,1];We(l,l,this._globeViewProjMatrixF64);let u=this._cachedClippingPlane,h=u[0]*s[0]+u[1]*s[1]+u[2]*s[2]+u[3]<0;return{point:new C(l[0]/l[3],l[1]/l[3]),signedDistanceFromCamera:l[3],isOccluded:h}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;let t=xl(this.worldSize,this.center.lat),r=Vt();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+t*2),ro(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let i=this.centerOffset;r[8]=-i.x*2/this._helper._width,r[9]=i.y*2/this._helper._height,this._projectionMatrix=to(r),this._globeProjMatrixInverted=Vt(),Ma(this._globeProjMatrixInverted,r),ze(r,r,[0,0,-this.cameraToCenterDistance]),Nr(r,r,this.rollInRadians),Ni(r,r,-this.pitchInRadians),Nr(r,r,this.bearingInRadians),ze(r,r,[0,0,-t]);let a=_e();a[0]=t,a[1]=t,a[2]=t,Ni(r,r,this.center.lat*Math.PI/180),uh(r,r,-this.center.lng*Math.PI/180),at(r,r,a),this._globeViewProjMatrixF64=r,this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixF64Inverted=Vt(),Ma(this._globeViewProjMatrixF64Inverted,r);let n=_e();this._cameraPosition=_e(),this._cameraPosition[2]=this.cameraToCenterDistance/t,no(this._cameraPosition,this._cameraPosition,n,-this.rollInRadians),Bn(this._cameraPosition,this._cameraPosition,n,this.pitchInRadians),no(this._cameraPosition,this._cameraPosition,n,-this.bearingInRadians),Ot(this._cameraPosition,this._cameraPosition,[0,0,1]),Bn(this._cameraPosition,this._cameraPosition,n,-this.center.lat*Math.PI/180),Pa(this._cameraPosition,this._cameraPosition,n,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let s=to(this._globeViewProjMatrixF64Inverted);at(s,s,[1,1,-1]),this._cachedFrustum=Q0.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){pe(\"calculateFogMatrix is not supported on globe projection.\");let r=Vt();return Kt(r),r}getVisibleUnwrappedCoordinates(t){return[new ns(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){if(t){pe(\"terrain is not fully supported on vertical perspective projection.\");return}this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,r){if(!this._globeViewProjMatrixF64)return 1;let i=ot(t);Me(i,i,1+r/Qt);let a=fi();return We(a,[i[0],i[1],i[2],1],this._globeViewProjMatrixF64),a[2]/a[3]}populateCache(t){}getBounds(){let t=this.width*.5,r=this.height*.5,i=[new C(0,0),new C(t,0),new C(this.width,0),new C(this.width,r),new C(this.width,this.height),new C(t,this.height),new C(0,this.height),new C(0,r)],a=[];for(let c of i)a.push(this.unprojectScreenPoint(c));let n=0,s=0,o=0,l=0,u=this.center;for(let c of a){let p=kt(u.lng,c.lng),d=kt(u.lat,c.lat);p<s&&(s=p),p>n&&(n=p),d<l&&(l=d),d>o&&(o=d)}let h=[u.lng+s,u.lat+l,u.lng+n,u.lat+o];return this.isSurfacePointOnScreen([0,1,0])&&(h[3]=90,h[0]=-180,h[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(h[1]=-90,h[0]=-180,h[2]=180),new Kr(h)}calculateCenterFromCameraLngLatAlt(t,r,i,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,a)}setLocationAtPoint(t,r,i){let a=ot(this.unprojectScreenPoint(r)),n=ot(t),s=_e();Cf(s);let o=_e();Pa(o,a,s,-this.center.lng*Math.PI/180),Bn(o,o,s,this.center.lat*Math.PI/180);let l=n[0]*n[0]+n[2]*n[2],u=o[0]*o[0];if(l<u)return;let h=Math.sqrt(l-u),c=-h,p=Vn(n[0],n[2],o[0],h),d=Vn(n[0],n[2],o[0],c),f=_e();Pa(f,n,s,-p);let m=Vn(f[1],f[2],o[1],o[2]),g=_e();Pa(g,n,s,-d);let y=Vn(g[1],g[2],o[1],o[2]),_=Math.PI*.5,x=m>=-_&&m<=_,v=y>=-_&&y<=_,w,b;if(x&&v){let D=this.center.lng*Math.PI/180,R=this.center.lat*Math.PI/180,F=Nn(p,D),E=Nn(m,R),M=Nn(d,D),A=Nn(y,R);F+E<M+A?(w=p,b=m):(w=d,b=y)}else if(x)w=p,b=m;else if(v)w=d,b=y;else return;let T=w/Math.PI*180,I=b/Math.PI*180,S=this.center.lat;this.setCenter(new K(T,te(I,-90,90))),this.setZoom(this.zoom+st(S,this.center.lat))}locationToScreenPoint(t,r){let i=ot(t);if(r){let a=r.getElevationForLngLatZoom(t,this._helper._tileZoom);Me(i,i,1+a/Qt)}return this._projectSurfacePointToScreen(i)}_projectSurfacePointToScreen(t){let r=fi();return We(r,[...t,1],this._globeViewProjMatrixF64),r[0]/=r[3],r[1]/=r[3],new C((r[0]*.5+.5)*this.width,(-r[1]*.5+.5)*this.height)}screenPointToMercatorCoordinate(t,r){if(r){let i=this.screenTerrainPointToMercatorCoordinate(t,r);if(i)return i}return fe.fromLngLat(this.unprojectScreenPoint(t))}screenTerrainPointToMercatorCoordinate(t,r){let i=r.getCoverageIndex();if(!i)return null;let a=this.cameraPosition,n=this.getRayDirectionFromPixel(t),s=tl(a,n,1+i.maxElevation/Qt);if(!s)return null;let o=tl(a,n,1+i.minElevation/Qt),l=Math.max(s.tMin,0),u=o?o.tMin:s.tMax;if(u<=l)return null;let h={index:i,exaggeration:r.exaggeration,origin:a,direction:n},c=0;for(let p=0;p<=256;p++){let d=l+(u-l)*p/256;if(t0(h,d)){let{hi:f}=i1(h,t0,c,d,1e-12),{sample:m,mercator:g}=p1(h,f);return new fe(g.x,g.y,m.elevation)}c=d}return null}screenPointToLocation(t,r){return this.screenPointToMercatorCoordinate(t,r)?.toLngLat()}screenPointToLocationAtElevation(t,r){return this.screenPointToLocation(t)}isPointOnMapSurface(t,r){let i=this._cameraPosition;return!!tl(i,this.getRayDirectionFromPixel(t))}getRayDirectionFromPixel(t){let r=fi();r[0]=t.x/this.width*2-1,r[1]=(t.y/this.height*2-1)*-1,r[2]=1,r[3]=1,We(r,r,this._globeViewProjMatrixF64Inverted),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3];let i=_e();i[0]=r[0]-this._cameraPosition[0],i[1]=r[1]-this._cameraPosition[1],i[2]=r[2]-this._cameraPosition[2];let a=_e();return At(a,i),a}isSurfacePointVisible(t){let r=this._cachedClippingPlane;return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let r=fi();return We(r,[...t,1],this._globeViewProjMatrixF64),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],r[0]>-1&&r[0]<1&&r[1]>-1&&r[1]<1&&r[2]>-1&&r[2]<1}unprojectScreenPoint(t){let r=this._cameraPosition,i=this.getRayDirectionFromPixel(t),a=tl(r,i);if(a){let h=_e();Ot(h,r,[i[0]*a.tMin,i[1]*a.tMin,i[2]*a.tMin]);let c=_e();return At(c,h),gl(c)}let n=this._cachedClippingPlane,s=n[0]*i[0]+n[1]*i[1]+n[2]*i[2],o=-lo(n,r)/s,l=_e();if(o>0)Ot(l,r,[i[0]*o,i[1]*o,i[2]*o]);else{let h=_e();Ot(h,r,[i[0]*2,i[1]*2,i[2]*2]);let c=lo(this._cachedClippingPlane,h);wr(l,h,[this._cachedClippingPlane[0]*c,this._cachedClippingPlane[1]*c,this._cachedClippingPlane[2]*c])}let u=$P(n);return gl(jP(u.center,u.radius,l))}getProjectionDataForCustomLayer(t=!0){let r=this.getProjectionData({overscaledTileID:new nt(0,0,0,0,0),applyGlobeMatrix:t});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(t){}};function p1(e,t){let r=_e();Ln(r,e.origin,e.direction,t);let i=di(r),a=_e();Me(a,r,1/i);let n=gl(a),s=fe.fromLngLat(n),o=new fe(s.x,te(s.y,0,.999999999)),l=t1(e.index,e.exaggeration,o.x,o.y),u=Math.abs(n.lat)>85.051129?0:l.elevation;return{sample:{covered:l.covered,elevation:u},radius:i,mercator:o}}function t0(e,t){let{sample:r,radius:i}=p1(e,t);return r1(r,(i-1)*Qt)}var r0=class d1{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,r,i){this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r,i=!0){this._helper.resize(t,r,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}get renderWindowCrop(){return null}setRenderWindowCrop(t){if(t)throw Error(\"Render windows are only supported with the mercator projection.\")}setTransitionState(t){this._globeness=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeness=1,this.defaultConstrain=(r,i)=>this.currentTransform.defaultConstrain(r,i),this.applyConstrain=(r,i)=>this._helper.applyConstrain(r,i),this._helper=new op({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(r,i)=>this.defaultConstrain(r,i)},t),this._globeness=1,this._mercatorTransform=new fl,this._verticalPerspectiveTransform=new h1}clone(){let t=new d1;return t._globeness=this._globeness,t.apply(this,!1),t}apply(t,r){this._helper.apply(t,r),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let r=this._mercatorTransform.getProjectionData(t),i=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:r.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:r.fallbackMatrix,clipAntimeridian:i.clipAntimeridian}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return Ui(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return Ui(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,r,i){let a=this._mercatorTransform.getPitchedTextCorrection(t,r,i),n=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,r,i);return Ui(a,n,this._globeness)}projectTileCoordinates(t,r,i,a){return this.currentTransform.projectTileCoordinates(t,r,i,a)}_calcMatrices(){!this._helper._width||!this._helper._height||(this._verticalPerspectiveTransform.apply(this,!1),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this.currentTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,r){return this.currentTransform.lngLatToCameraDepth(t,r)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,r,i,a){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,a)}setLocationAtPoint(t,r,i){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(t,r,i),this.apply(this._mercatorTransform,!1);return}this._verticalPerspectiveTransform.setLocationAtPoint(t,r,i),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,r){return this.currentTransform.locationToScreenPoint(t,r)}screenPointToMercatorCoordinate(t,r){return this.currentTransform.screenPointToMercatorCoordinate(t,r)}screenTerrainPointToMercatorCoordinate(t,r){return this.currentTransform.screenTerrainPointToMercatorCoordinate(t,r)}screenPointToLocation(t,r){return this.currentTransform.screenPointToLocation(t,r)}screenPointToLocationAtElevation(t,r){return this.currentTransform.screenPointToLocationAtElevation(t,r)}isPointOnMapSurface(t,r){return this.currentTransform.isPointOnMapSurface(t,r)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getProjectionDataForCustomLayer(t=!0){let r=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return r;let i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return i.fallbackMatrix=r.mainMatrix,i.projectionTransition=this._globeness,i}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}},f1=class Xr{get useGlobeControls(){return!0}handlePanInertia(t,r){let i=qP(t,r);return Math.abs(i.lng-r.center.lng)>180&&(i.lng=r.center.lng+179.5*Math.sign(i.lng-r.center.lng)),{easingCenter:i,easingOffset:new C(0,0)}}handleMapControlsRollPitchBearingZoom(t,r){let i=t.around,a=r.screenPointToLocation(i);t.bearingDelta&&r.setBearing(r.bearing+t.bearingDelta),t.pitchDelta&&r.setPitch(r.pitch+t.pitchDelta),t.rollDelta&&r.setRoll(r.roll+t.rollDelta);let n=r.zoom;t.zoomDelta&&r.setZoom(r.zoom+t.zoomDelta);let s=r.zoom-n;if(s===0)return;let o=kt(r.center.lng,a.lng),l=o/(Math.abs(o/180)+1),u=kt(r.center.lat,a.lat),h=r.getRayDirectionFromPixel(i),c=r.cameraPosition,p=je(c,h)*-1,d=_e();Ot(d,c,[h[0]*p,h[1]*p,h[2]*p]);let f=di(d),m=f-1,g=Math.exp(-Math.max(m-.3,0)*.5),y=Un(f,.95,.999,0,1),_=xl(r.worldSize,r.center.lat)/Math.min(r.width,r.height),x=Un(_,.9,.5,1,.25),v=Math.min(g,Ui(1,x,y)),w=(1-bt(-s))*v,b=r.center.lat,T=r.zoom,I=new K(r.center.lng+l*w,te(r.center.lat+u*w,-hr,hr));r.setLocationAtPoint(a,i);let S=r.center,D=Un(Math.abs(o),45,85,0,1),R=Math.max(D,y)**.25,F=kt(S.lng,I.lng),E=kt(S.lat,I.lat);r.setCenter(new K(S.lng+F*R,S.lat+E*R).wrap()),r.setZoom(T+st(b,r.center.lat))}handleMapControlsPan(t,r,i){t.panDelta&&NP(r,i,r.isPointOnMapSurface(t.around)?t.around:r.centerPoint,t.panDelta)}cameraForBoxAndBearing(t,r,i,a,n){let s=o1(t,r,i,a,n),o=r.left/n.width*2-1,l=(n.width-r.right)/n.width*2-1,u=r.top/n.height*-2+1,h=(n.height-r.bottom)/n.height*-2+1,c=kt(i.getWest(),i.getEast())<0,p=c?i.getEast():i.getWest(),d=c?i.getWest():i.getEast(),f=Math.max(i.getNorth(),i.getSouth()),m=Math.min(i.getNorth(),i.getSouth()),g=p+kt(p,d)*.5,y=f+kt(f,m)*.5,_=n.clone();_.setCenter(s.center),_.setBearing(s.bearing),_.setPitch(0),_.setRoll(0),_.setZoom(s.zoom);let x=_.modelViewProjectionMatrix,v=[ot(i.getNorthWest()),ot(i.getNorthEast()),ot(i.getSouthWest()),ot(i.getSouthEast()),ot(new K(d,y)),ot(new K(p,y)),ot(new K(g,f)),ot(new K(g,m))],w=ot(s.center),b=1/0;for(let T of v)o<0&&(b=Xr.getLesserNonNegativeNonNull(b,Xr.solveVectorScale(T,w,x,\"x\",o))),l>0&&(b=Xr.getLesserNonNegativeNonNull(b,Xr.solveVectorScale(T,w,x,\"x\",l))),u>0&&(b=Xr.getLesserNonNegativeNonNull(b,Xr.solveVectorScale(T,w,x,\"y\",u))),h<0&&(b=Xr.getLesserNonNegativeNonNull(b,Xr.solveVectorScale(T,w,x,\"y\",h)));if(!Number.isFinite(b)||b===0){n1();return}return s.zoom=Math.min(_.zoom+dt(b),t.maxZoom),s}handleJumpToCenterZoom(t,r){let i=t.center.lat,a=t.applyConstrain(r.center?K.convert(r.center):t.center,t.zoom).center;t.setCenter(a.wrap());let n=r.zoom===void 0?t.zoom+st(i,a.lat):+r.zoom;t.zoom!==n&&t.setZoom(n)}handleEaseTo(t,r){let i=t.zoom,a=t.center,n=t.padding,s={roll:t.roll,pitch:t.pitch,bearing:t.bearing},o={roll:r.roll===void 0?t.roll:r.roll,pitch:r.pitch===void 0?t.pitch:r.pitch,bearing:r.bearing===void 0?t.bearing:r.bearing},l=r.zoom!==void 0,u=!t.isPaddingEqual(r.padding),h=!1,c=r.center?K.convert(r.center):a,p=t.applyConstrain(c,i).center;dl(t,p);let d=t.clone();d.setCenter(p),d.setZoom(l?+r.zoom:i+st(a.lat,c.lat)),d.setBearing(r.bearing);let f=new C(te(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),te(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));d.setLocationAtPoint(p,f);let m=(r.offset&&r.offsetAsPoint.mag())>0?d.center:p,g=l?+r.zoom:i+st(a.lat,m.lat),y=i+st(a.lat,0),_=g+st(m.lat,0),x=kt(a.lng,m.lng),v=kt(a.lat,m.lat),w=bt(_-y);return h=g!==i,{easeFunc:b=>{if(yh(s,o)||s1({startEulerAngles:s,endEulerAngles:o,tr:t,k:b,useSlerp:s.roll!=o.roll}),u&&t.interpolatePadding(n,r.padding,b),r.around)pe(\"Easing around a point is not supported under globe projection.\"),t.setLocationAtPoint(r.around,r.aroundPoint);else{let T=b*(_>y?Math.min(2,w):Math.max(.5,w))**(1-b),I=Q_(a,x,v,T);t.setCenter(I.wrap())}if(h){let T=Ve.number(y,_,b)+st(0,t.center.lat);t.setZoom(T)}},isZooming:h,elevationCenter:m}}handleFlyTo(t,r){let i=r.zoom!==void 0,a=t.center,n=t.zoom,s=t.padding,o=!t.isPaddingEqual(r.padding),l=t.applyConstrain(K.convert(r.center||r.locationAtOffset),n).center,u=i?+r.zoom:t.zoom+st(t.center.lat,l.lat),h=t.clone();h.setCenter(l),h.setZoom(u),h.setBearing(r.bearing);let c=new C(te(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),te(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));h.setLocationAtPoint(l,c);let p=h.center;dl(t,p);let d=RP(t,a,p),f=n+st(a.lat,0),m=u+st(p.lat,0),g=bt(m-f),y=typeof r.minZoom==\"number\"?+r.minZoom:t.minZoom,_=Math.max(y,t.minZoom)+st(p.lat,0),x=Math.min(_,f,m)+st(0,p.lat),v=t.applyConstrain(p,x).zoom+st(p.lat,0),w=bt(v-f),b=kt(a.lng,p.lng),T=kt(a.lat,p.lat);return{easeFunc:(I,S,D,R)=>{let F=Q_(a,b,T,D);o&&t.interpolatePadding(s,r.padding,I);let E=I===1?p:F;t.setCenter(E.wrap());let M=f+dt(S);t.setZoom(I===1?u:M+st(0,E.lat))},scaleOfZoom:g,targetCenter:p,scaleOfMinZoom:w,pixelPathLength:d}}static solveVectorScale(t,r,i,a,n){let s=n,o=a===\"x\"?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],l=[i[3],i[7],i[11],i[15]],u=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],h=t[0]*l[0]+t[1]*l[1]+t[2]*l[2],c=r[0]*o[0]+r[1]*o[1]+r[2]*o[2],p=r[0]*l[0]+r[1]*l[1]+r[2]*l[2],d=(c+o[3]-s*p-s*l[3])/(c-u-s*p+s*h);return c+s*h===u+s*p||l[3]*(u-c)+o[3]*(p-h)+u*p===c*h?null:d}static getLesserNonNegativeNonNull(t,r){return r!==null&&r>=0&&r<t?r:t}},i0=class{constructor(e){this._globe=e,this._mercatorCameraHelper=new ml,this._verticalPerspectiveCameraHelper=new f1}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,t){return this.currentHelper.handlePanInertia(e,t)}handleMapControlsRollPitchBearingZoom(e,t){this.currentHelper.handleMapControlsRollPitchBearingZoom(e,t)}handleMapControlsPan(e,t,r){this.currentHelper.handleMapControlsPan(e,t,r)}cameraForBoxAndBearing(e,t,r,i,a){return this.currentHelper.cameraForBoxAndBearing(e,t,r,i,a)}handleJumpToCenterZoom(e,t){this.currentHelper.handleJumpToCenterZoom(e,t)}handleEaseTo(e,t){return this.currentHelper.handleEaseTo(e,t)}handleFlyTo(e,t){return this.currentHelper.handleFlyTo(e,t)}};function XP(e,t,r){let i={constrainOverride:t};if(Array.isArray(e)){let a=new K_({type:e},r);return{projection:a,transform:new r0(i),cameraHelper:new i0(a)}}switch(e){case\"mercator\":return{projection:new Kc,transform:new fl(i),cameraHelper:new ml};case\"globe\":{let a=new K_({type:[\"interpolate\",[\"linear\"],[\"zoom\"],11,\"vertical-perspective\",12,\"mercator\"]},{});return{projection:a,transform:new r0(i),cameraHelper:new i0(a)}}case\"vertical-perspective\":return{projection:new l1,transform:new h1(i),cameraHelper:new f1};default:return pe(`Unknown projection name: ${e}. Falling back to mercator projection.`),{projection:new Kc,transform:new fl(i),cameraHelper:new ml}}}var HP=MA(),a0=class extends wt{constructor(e,t={}){super(),this._rtlPluginLoaded=()=>{for(let i in this.tileManagers){let a=this.tileManagers[i].getSource().type;(a===\"vector\"||a===\"geojson\")&&this.tileManagers[i].reload()}},this.map=e,this.dispatcher=new C0(P0(),e._getMapId()),this.dispatcher.registerMessageHandler(\"GG\",(i,a)=>this.getGlyphs(i,a)),this.dispatcher.registerMessageHandler(\"GI\",(i,a)=>this.getImages(i,a)),this.dispatcher.registerMessageHandler(\"GDA\",(i,a)=>this.getDashes(i,a)),this.imageManager=new kA,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(e._missingStyleImageResolver),this.patternAtlas=new DA(this.imageManager);let r=e._container?.lang||typeof document<\"u\"&&document.documentElement?.lang||void 0;this.glyphManager=new LA(e._requestManager,t.localIdeographFontFamily,r),this.lineAtlas=new jA(256,512),this.crossTileSymbolIndex=new W0,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast(\"SR\",fo()),qc().on(Gc,this._rtlPluginLoaded),this.on(\"data\",i=>{if(i.dataType!==\"source\"||i.sourceDataType!==\"metadata\")return;let a=this.tileManagers[i.sourceId];if(!a)return;let n=a.getSource();if(n?.vectorLayerIds)for(let s in this._layers){let o=this._layers[s];o.source===n.id&&this._validateLayer(o)}})}_setInitialValues(){this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new Ws,this._imagesListDirty=!1,this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this.crossTileSymbolIndex=new(this.crossTileSymbolIndex?.constructor||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,t){this._checkLoaded();let r=t===null?this.stylesheet.state?.[e]?.default??null:t;if(sr(r,this._globalState[e]))return this;this._globalState[e]=r,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let t=[];for(let r in e)sr(this._globalState[r],e[r].default)||(t.push(r),this._globalState[r]=e[r].default);this._applyGlobalStateChanges(t)}_applyGlobalStateChanges(e){if(e.length===0)return;let t=new Set,r={};for(let i of e){r[i]=this._globalState[i];for(let a in this._layers){let n=this._layers[a],s=n.getLayoutAffectingGlobalStateRefs(),o=n.getPaintAffectingGlobalStateRefs(),l=n.getVisibilityAffectingGlobalStateRefs();if(s.has(i)&&t.add(n.source),o.has(i))for(let{name:u,value:h}of o.get(i))this._updatePaintProperty(n,u,h);l?.has(i)&&(n.recalculateVisibility(),this._updateLayer(n))}}this.dispatcher.broadcast(\"UGS\",r);for(let i in this.tileManagers)t.has(i)&&(this._reloadSource(i),this._changed=!0)}async loadURL(e,t={},r){this.fire(new fr(\"dataloading\")),t.validate=typeof t.validate!=\"boolean\"||t.validate,this._loadStyleRequest=new AbortController;let i=this._loadStyleRequest;try{let a=await this.map._requestManager.transformRequest(e,\"Style\");po(i.signal);let n=await jn(a,i);this._loadStyleRequest===i&&(this._loadStyleRequest=null),this._load(n.data,t,r)}catch(a){this._loadStyleRequest===i&&(this._loadStyleRequest=null),a&&!i.signal.aborted&&this.fire(new X(it(a)))}}loadJSON(e,t={},r){this.fire(new fr(\"dataloading\")),this._frameRequest=new AbortController,zt.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,t.validate=t.validate!==!1,this._load(e,t,r)}).catch(()=>{})}loadEmpty(){this.fire(new fr(\"dataloading\")),this._load(HP,{validate:!1})}_load(e,t,r){let i=t.transformStyle?t.transformStyle(r,e):e;if(!(t.validate&&Nh(this,i))){i={...i},this._loaded=!0,this.stylesheet=i;for(let a in i.sources)this.addSource(a,i.sources[a],{validate:!1});i.sprite?this._loadSprite(i.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(i.glyphs),this._createLayers(),this.light=new VA(this.stylesheet.light??{},this._globalState),this._setProjectionInternal(this.stylesheet.projection?.type||\"mercator\"),this.sky=new $A(this.stylesheet.sky,this._globalState),this.map.setTerrain(this.stylesheet.terrain??null,{validate:!1}),this.fire(new fr(\"data\")),this.fire(new y_)}}_createLayers(){let e=x_(this.stylesheet.layers);this.setGlobalState(this.stylesheet.state??null),this.dispatcher.broadcast(\"SL\",e),this._order=e.map(t=>t.id),this._layers={},this._serializedLayers=null;for(let t of e){let r=qo(t,this._globalState);if(r.setEventedParent(this,{layer:{id:t.id}}),this._layers[t.id]=r,Ro(r)&&this.tileManagers[r.source]){let i=t.paint?.[\"raster-fade-duration\"]??r.paint.get(\"raster-fade-duration\");this.tileManagers[r.source].setRasterFadeDuration(i)}}}async _loadSprite(e,t=!1,r=void 0){this.imageManager.setLoaded(!1);let i=new AbortController;this._spriteRequest=i;let a;try{let n=await PA(e,this.map._requestManager,this.map.getPixelRatio(),i);if(!n)return;for(let s in n){let{loaded:o,removed:l}=this.imageManager.setSpriteImages(s,n[s]);this._markImagesChanged(l),t&&this._markImagesChanged(o)}}catch(n){a=n,i.signal.aborted||this.fire(new X(a))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),t&&(this._changed=!0),this.dispatcher.broadcast(\"SI\",this.imageManager.listImages()),this.fire(new fr(\"data\")),r?.(a)}}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new fr(\"data\"))}_validateLayer(e){let t=this.tileManagers[e.source];if(!t)return;let r=e.sourceLayer;if(!r)return;let i=t.getSource();(i.type===\"geojson\"||i.vectorLayerIds&&!i.vectorLayerIds.includes(r))&&this.fire(new X(Error(`Source layer \"${r}\" does not exist on source \"${i.id}\" as specified by style layer \"${e.id}\".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(e,t=!1){let r=this._serializedAllLayers();if(!e||e.length===0)return Object.values(t?St(r):r);let i=[];for(let a of e)if(r[a]){let n=t?St(r[a]):r[a];i.push(n)}return i}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let t=Object.keys(this._layers);for(let r of t){let i=this._layers[r];i.type!==\"custom\"&&(e[r]=i.serialize())}return e}hasTransitions(){if(this.light?.hasTransition()||this.sky?.hasTransition()||this.projection?.hasTransition())return!0;for(let e in this.tileManagers)if(this.tileManagers[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error(\"Style is not done loading.\")}update(e){if(!this._loaded)return;let t=this._changed;if(t){this._imagesListDirty&&(this._imagesListDirty=(this.dispatcher.broadcast(\"SI\",this.imageManager.listImages()),!1));let a=Object.keys(this._updatedLayers),n=Object.keys(this._removedLayers);(a.length||n.length)&&this._updateWorkerLayers(a,n);for(let s in this._updatedSources){let o=this._updatedSources[s];if(o===\"reload\")this._reloadSource(s);else if(o===\"clear\")this._clearSource(s);else throw Error(`Invalid action ${o}`)}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let s in this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}let r={};for(let a in this.tileManagers){let n=this.tileManagers[a];r[a]=n.used,n.used=!1}let i=this.imageManager.listImages();for(let a of this._order){let n=this._layers[a];n.recalculate(e,i),!n.isHidden(e.zoom)&&n.source&&(this.tileManagers[n.source].used=!0)}for(let a in r){let n=this.tileManagers[a];!!r[a]!=!!n.used&&n.fire(new Ie(\"data\",{sourceDataType:\"visibility\",sourceId:a}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,t&&this.fire(new fr(\"data\"))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies([\"icons\",\"patterns\"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies([\"glyphs\"],[\"\"]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,t){this.dispatcher.broadcast(\"UL\",{layers:this._serializeByIds(e,!1),removedIds:t})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,t={}){this._checkLoaded();let r=this.serialize();if(e=t.transformStyle?t.transformStyle(r,e):e,(t.validate??!0)&&Nh(this,e))return!1;e=St(e),e.layers=x_(e.layers);let i=AA(r,e),a=this._getOperationsToPerform(i);if(a.unimplemented.length>0)throw Error(`Unimplemented: ${a.unimplemented.join(\", \")}.`);if(a.operations.length===0)return!1;for(let n of a.operations)n();return this.stylesheet=e,this._serializedLayers=null,this.fire(new y_({style:this})),!0}_getOperationsToPerform(e){let t=[],r=[];for(let i of e)switch(i.command){case\"setCenter\":case\"setZoom\":case\"setBearing\":case\"setPitch\":case\"setRoll\":continue;case\"addLayer\":t.push(()=>this.addLayer.apply(this,i.args));break;case\"removeLayer\":t.push(()=>this.removeLayer.apply(this,i.args));break;case\"setPaintProperty\":t.push(()=>this.setPaintProperty.apply(this,i.args));break;case\"setLayoutProperty\":t.push(()=>this.setLayoutProperty.apply(this,i.args));break;case\"setFilter\":t.push(()=>this.setFilter.apply(this,i.args));break;case\"addSource\":t.push(()=>this.addSource.apply(this,i.args));break;case\"removeSource\":t.push(()=>this.removeSource.apply(this,i.args));break;case\"setLayerZoomRange\":t.push(()=>this.setLayerZoomRange.apply(this,i.args));break;case\"setLight\":t.push(()=>this.setLight.apply(this,i.args));break;case\"setGeoJSONSourceData\":t.push(()=>this.setGeoJSONSourceData.apply(this,i.args));break;case\"setGlyphs\":t.push(()=>this.setGlyphs.apply(this,i.args));break;case\"setSprite\":t.push(()=>this.setSprite.apply(this,i.args));break;case\"setTerrain\":t.push(()=>this.map.setTerrain.apply(this,i.args));break;case\"setSky\":t.push(()=>this.setSky.apply(this,i.args));break;case\"setProjection\":this.setProjection.apply(this,i.args);break;case\"setGlobalState\":t.push(()=>this.setGlobalState.apply(this,i.args));break;case\"setTransition\":t.push(()=>{});break;default:r.push(i.command)}return{operations:t,unimplemented:r}}addImage(e,t){if(this.getImage(e)){this.fire(new X(Error(`An image named \"${e}\" already exists.`)));return}this.imageManager.addImage(e,t),this._afterImageUpdated(e)}updateImage(e,t){this.imageManager.updateImage(e,t)}getImage(e){return this.imageManager.getImage(e)}setMissingImageResolver(e){this.imageManager.setMissingImageResolver(e)}removeImage(e){if(!this.getImage(e)){this.fire(new X(Error(`An image named \"${e}\" does not exist.`)));return}this.imageManager.removeImage(e),this._afterImageUpdated(e)}_markImagesChanged(e){for(let t of e)this._changedImages[t]=!0}_afterImageUpdated(e){this._changedImages[e]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new fr(\"data\"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,t,r={}){if(this._checkLoaded(),this.tileManagers[e]!==void 0)throw Error(`Source \"${e}\" already exists.`);if(!t.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(t).join(\", \")}.`);if(Vh.has(t.type)&&this._validate(It.source,`sources.${e}`,t,null,r))return;this.map?._collectResourceTiming&&(t.collectResourceTiming=!0);let i=this.tileManagers[e]=new Wc(e,t,this.dispatcher);i.style=this,i.setEventedParent(this,()=>({isSourceLoaded:i.loaded(),source:i.serialize(),sourceId:e})),i.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);for(let r in this._layers)if(this._layers[r].source===e)return this.fire(new X(Error(`Source \"${e}\" cannot be removed while layer \"${r}\" is using it.`)));let t=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],t.fire(new Ie(\"data\",{sourceDataType:\"metadata\",sourceId:e})),t.setEventedParent(null),t.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,t){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);let r=this.tileManagers[e].getSource();if(r.type!==\"geojson\")throw Error(`geojsonSource.type is ${r.type}, which is !== 'geojson`);r.setData(t),this._changed=!0}getSource(e){return this.tileManagers[e]?.getSource()}addLayer(e,t,r={}){this._checkLoaded();let i=e.id;if(this.getLayer(i)){this.fire(new X(Error(`Layer \"${i}\" already exists on this map.`)));return}let a;if(e.type===\"custom\"){if(Po(this,Dy(e)))return;a=qo(e,this._globalState)}else{if(\"source\"in e&&typeof e.source==\"object\"&&(this.addSource(i,e.source),e=St(e),e=j(e,{source:i})),this._validate(It.layer,`layers.${i}`,e,{arrayIndex:-1},r))return;a=qo(e,this._globalState),this._validateLayer(a),a.setEventedParent(this,{layer:{id:i}})}let n=t?this._order.indexOf(t):this._order.length;if(t&&n===-1){this.fire(new X(Error(`Cannot add layer \"${i}\" before non-existing layer \"${t}\".`)));return}if(this._order.splice(n,0,i),this._layerOrderChanged=!0,this._layers[i]=a,this._removedLayers[i]&&a.source&&a.type!==\"custom\"){let s=this._removedLayers[i];delete this._removedLayers[i],s.type===a.type?(this._updatedSources[a.source]=\"reload\",this.tileManagers[a.source].pause()):this._updatedSources[a.source]=\"clear\"}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(e,t){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new X(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));return}if(e===t)return;let r=this._order.indexOf(e);this._order.splice(r,1);let i=t?this._order.indexOf(t):this._order.length;if(t&&i===-1){this.fire(new X(Error(`Cannot move layer \"${e}\" before non-existing layer \"${t}\".`)));return}this._order.splice(i,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let t=this._layers[e];if(!t){this.fire(new X(Error(`Cannot remove non-existing layer \"${e}\".`)));return}t.setEventedParent(null);let r=this._order.indexOf(e);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,t,r){this._checkLoaded();let i=this.getLayer(e);if(!i){this.fire(new X(Error(`Cannot set the zoom range of non-existing layer \"${e}\".`)));return}(i.minzoom!==t||i.maxzoom!==r)&&(t!=null&&(i.minzoom=t),r!=null&&(i.maxzoom=r),this._updateLayer(i))}setFilter(e,t,r={}){this._checkLoaded();let i=this.getLayer(e);if(!i){this.fire(new X(Error(`Cannot filter non-existing layer \"${e}\".`)));return}if(!sr(i.filter,t)){if(t==null){i.setFilter(void 0),this._updateLayer(i);return}this._validate(It.filter,`layers.${i.id}.filter`,t,null,r)||(i.setFilter(St(t)),this._updateLayer(i))}}getFilter(e){return St(this.getLayer(e).filter)}setLayoutProperty(e,t,r,i={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new X(Error(`Cannot style non-existing layer \"${e}\".`)));return}sr(a.getLayoutProperty(t),r)||(a.setLayoutProperty(t,r,i),this._updateLayer(a))}getLayoutProperty(e,t){let r=this.getLayer(e);if(!r){this.fire(new X(Error(`Cannot get style of non-existing layer \"${e}\".`)));return}return r.getLayoutProperty(t)}setPaintProperty(e,t,r,i={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new X(Error(`Cannot style non-existing layer \"${e}\".`)));return}sr(a.getPaintProperty(t),r)||this._updatePaintProperty(a,t,r,i)}_updatePaintProperty(e,t,r,i={}){e.setPaintProperty(t,r,i)&&this._updateLayer(e),Ro(e)&&t===\"raster-fade-duration\"&&this.tileManagers[e.source].setRasterFadeDuration(r),this._changed=!0,this._updatedPaintProps[e.id]=!0,this._serializedLayers=null}getPaintProperty(e,t){return this.getLayer(e).getPaintProperty(t)}setFeatureState(e,t){this._checkLoaded();let r=e.source,i=e.sourceLayer,a=this.tileManagers[r];if(a===void 0){this.fire(new X(Error(`The source '${r}' does not exist in the map's style.`)));return}let n=a.getSource().type;if(n===\"geojson\"&&i){this.fire(new X(Error(\"GeoJSON sources cannot have a sourceLayer parameter.\")));return}if(n===\"vector\"&&!i){this.fire(new X(Error(\"The sourceLayer parameter must be provided for vector source types.\")));return}if(e.id===void 0){this.fire(new X(Error(\"The feature id parameter must be provided.\")));return}let s=[\"__proto__\",\"constructor\",\"prototype\"];if(t&&Object.keys(t).some(o=>s.includes(o))){this.fire(new X(Error(`The feature state should not include one of the following keys: ${s}`)));return}a.setFeatureState(i,e.id,t)}removeFeatureState(e,t){this._checkLoaded();let r=e.source,i=this.tileManagers[r];if(i===void 0){this.fire(new X(Error(`The source '${r}' does not exist in the map's style.`)));return}let a=i.getSource().type,n=a===\"vector\"?e.sourceLayer:void 0;if(a===\"vector\"&&!n){this.fire(new X(Error(\"The sourceLayer parameter must be provided for vector source types.\")));return}if(t&&typeof e.id!=\"string\"&&typeof e.id!=\"number\"){this.fire(new X(Error(\"A feature id is required to remove its specific state property.\")));return}i.removeFeatureState(n,e.id,t)}getFeatureState(e){this._checkLoaded();let t=e.source,r=e.sourceLayer,i=this.tileManagers[t];if(i===void 0){this.fire(new X(Error(`The source '${t}' does not exist in the map's style.`)));return}if(i.getSource().type===\"vector\"&&!r){this.fire(new X(Error(\"The sourceLayer parameter must be provided for vector source types.\")));return}return e.id===void 0&&this.fire(new X(Error(\"The feature id parameter must be provided.\"))),i.getFeatureState(r,e.id)}getTransition(){return j({duration:300,delay:0},this.stylesheet?.transition)}serialize(){if(!this._loaded)return;let e=co(this.tileManagers,a=>a.serialize()),t=this._serializeByIds(this._order,!0),r=this.map.getTerrain()||void 0,i=this.stylesheet;return gh({version:i.version,name:i.name,metadata:i.metadata,light:i.light,sky:i.sky,center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,sprite:i.sprite,glyphs:i.glyphs,transition:i.transition,projection:i.projection,sources:e,layers:t,terrain:r},a=>a!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.tileManagers[e.source].getSource().type!==\"raster\"&&(this._updatedSources[e.source]=\"reload\",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let t=n=>this._layers[n].type===\"fill-extrusion\",r={},i=[];for(let n=this._order.length-1;n>=0;n--){let s=this._order[n];if(t(s)){r[s]=n;for(let o of e){let l=o[s];if(l)for(let u of l)i.push(u)}}}i.sort((n,s)=>s.intersectionZ-n.intersectionZ);let a=[];for(let n=this._order.length-1;n>=0;n--){let s=this._order[n];if(t(s))for(let o=i.length-1;o>=0;o--){let l=i[o].feature;if(r[l.layer.id]<n)break;a.push(l),i.pop()}else for(let o of e){let l=o[s];if(l)for(let u of l)a.push(u.feature)}}return a}queryRenderedFeatures(e,t,r){t?.filter&&this._validate(It.filter,\"queryRenderedFeatures.filter\",t.filter,null,t);let i={};if(t?.layers){if(!(Array.isArray(t.layers)||t.layers instanceof Set))return this.fire(new X(Error(\"parameters.layers must be an Array or a Set of strings\"))),[];for(let l of t.layers){let u=this._layers[l];if(!u)return this.fire(new X(Error(`The layer '${l}' does not exist in the map's style and cannot be queried for features.`))),[];i[u.source]=!0}}let a=[];t.availableImages=this.imageManager.listImages();let n=this._serializedAllLayers(),s=t.layers instanceof Set?t.layers:Array.isArray(t.layers)?new Set(t.layers):null,o={...t,layers:s,globalState:this._globalState};for(let l in this.tileManagers)t.layers&&!i[l]||a.push(eM(this.tileManagers[l],this._layers,n,e,o,r,this.map.terrain?(u,h,c)=>this.map.terrain.getElevation(u,h,c):void 0));return this.placement&&a.push(tM(this._layers,n,this.tileManagers,e,o,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,t){t?.filter&&this._validate(It.filter,\"querySourceFeatures.filter\",t.filter,null,t);let r=this.tileManagers[e];return r?rM(r,t?{...t,globalState:this._globalState}:{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,t={}){this._checkLoaded();let r=this.light.getLight(),i=!1;for(let n in e)if(!sr(e[n],r[n])){i=!0;break}if(!i)return;let a={now:ye(),transition:j({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,t),this.light.updateTransitions(a)}getProjection(){return this.stylesheet?.projection}setProjection(e){this._checkLoaded();let t=e??{type:\"mercator\"};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===t.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(t.type)}getSky(){return this.stylesheet?.sky}setSky(e,t={}){this._checkLoaded();let r=this.getSky(),i=!1;if(!e&&!r)return;if(e&&!r)i=!0;else if(!e&&r)i=!0;else for(let n in e)if(!sr(e[n],r[n])){i=!0;break}if(!i)return;let a={now:ye(),transition:j({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,t),this.sky.updateTransitions(a)}_setProjectionInternal(e){let t=XP(e,this.map._camera?.transform.constrainOverride,this._globalState);this.projection=t.projection,this.map.migrateProjection(t.transform,t.cameraHelper);for(let r in this.tileManagers)this.tileManagers[r].reload()}_validate(e,t,r,i,a={}){return Ba(this,e,{key:t,style:this.serialize(),value:r,...i},a)}_remove(e=!0){this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._loadStyleRequest&&(this._loadStyleRequest=(this._loadStyleRequest.abort(),null)),this._spriteRequest&&(this._spriteRequest=(this._spriteRequest.abort(),null)),qc().off(Gc,this._rtlPluginLoaded);for(let t in this._layers)this._layers[t].setEventedParent(null);for(let t in this.tileManagers){let r=this.tileManagers[t];r.setEventedParent(null),r.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast(\"RM\",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){let t=this.tileManagers[e];t._shouldReloadOnResume=!1,t.resume(),t.reload()}_updateSources(e){for(let t in this.tileManagers)this.tileManagers[t].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.tileManagers)this._reloadSource(e)}_updatePlacement(e,t,r,i,a=!1){let n=!1,s=!1,o={};for(let l of this._order){let u=this._layers[l];if(u.type!==\"symbol\")continue;if(!o[u.source]){let c=this.tileManagers[u.source];o[u.source]=c.getRenderableIds(!0).map(p=>c.getTileByID(p)).sort((p,d)=>d.tileID.overscaledZ-p.tileID.overscaledZ||(p.tileID.isLessThan(d.tileID)?-1:1))}let h=this.crossTileSymbolIndex.addLayer(u,o[u.source],e.center.lng);n||(n=h)}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a||(a=this._layerOrderChanged||r===0),(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ye(),e.zoom))&&(this.pauseablePlacement=new pP(e,this.map.terrain,this._order,a,t,r,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,o),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ye()),s=!0),n&&this.pauseablePlacement.placement.setStale()),s||n)for(let l of this._order){let u=this._layers[l];u.type===\"symbol\"&&this.placement.updateLayerOpacities(u,o[u.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ye())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}async getImages(e,t){let r=await this.imageManager.getImages(t.icons);this._updateTilesForChangedImages();let i=this.tileManagers[t.source];return i&&i.setDependencies(t.tileID.key,t.type,t.icons),r}async getGlyphs(e,t){let r=await this.glyphManager.getGlyphs(t.stacks),i=this.tileManagers[t.source];return i&&i.setDependencies(t.tileID.key,t.type,[\"\"]),r}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,t={}){this._checkLoaded(),!(e&&this._validate(It.glyphs,\"glyphs\",e,null,t))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}async getDashes(e,t){let r={};for(let[i,a]of Object.entries(t.dashes))r[i]=this.lineAtlas.getDash(a.dasharray,a.round);return r}addSprite(e,t,r={},i){this._checkLoaded();let a=[{id:e,url:t}],n=[...ol(this.stylesheet.sprite),...a];this._validate(It.sprite,\"sprite\",n,null,r)||(this.stylesheet.sprite=n,this._loadSprite(a,!0,i))}removeSprite(e){this._checkLoaded();let t=ol(this.stylesheet.sprite);if(!t.find(i=>i.id===e)){this.fire(new X(Error(`Sprite \"${e}\" doesn't exists on this map.`)));return}let r=this.imageManager.removeSpriteImages(e);this._markImagesChanged(r),t.splice(t.findIndex(i=>i.id===e),1),this.stylesheet.sprite=t.length>0?t:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new fr(\"data\"))}getSprite(){return ol(this.stylesheet.sprite)}setSprite(e,t={},r){this._checkLoaded(),!(e&&this._validate(It.sprite,\"sprite\",e,null,t))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,r):(this._unloadSprite(),r&&r(null)))}destroy(){this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._loadStyleRequest&&(this._loadStyleRequest=(this._loadStyleRequest.abort(),null)),this._spriteRequest&&(this._spriteRequest=(this._spriteRequest.abort(),null));for(let e in this.tileManagers){let t=this.tileManagers[e];t.setEventedParent(null),t.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy();for(let e in this._layers){let t=this._layers[e];t.setEventedParent(null),t.onRemove&&t.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler(\"GG\"),this.dispatcher.unregisterMessageHandler(\"GI\"),this.dispatcher.unregisterMessageHandler(\"GDA\"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}},YP=Ae([{name:\"a_pos\",type:\"Int16\",components:2},{name:\"a_texture_pos\",type:\"Int16\",components:2}]),KP=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,t,r,i,a,n,s,o,l){this.context=e;let u=this.boundPaintVertexBuffers.length!==i.length;for(let h=0;!u&&h<i.length;h++)this.boundPaintVertexBuffers[h]!==i[h]&&(u=!0);!this.vao||this.boundProgram!==t||this.boundLayoutVertexBuffer!==r||u||this.boundIndexBuffer!==a||this.boundVertexOffset!==n||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==o||this.boundDynamicVertexBuffer3!==l?this.freshBind(t,r,i,a,n,s,o,l):(e.bindVertexArray.set(this.vao),s&&s.bind(),a?.dynamicDraw&&a.bind(),o&&o.bind(),l&&l.bind())}freshBind(e,t,r,i,a,n,s,o){let l=e.numAttributes,u=this.context,h=u.gl;this.vao&&this.destroy(),this.vao=u.createVertexArray(),u.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=t,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=a,this.boundDynamicVertexBuffer=n,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=o,t.enableAttributes(h,e);for(let c of r)c.enableAttributes(h,e);n&&n.enableAttributes(h,e),s&&s.enableAttributes(h,e),o&&o.enableAttributes(h,e),t.bind(),t.setVertexAttribPointers(h,e,a);for(let c of r)c.bind(),c.setVertexAttribPointers(h,e,a);n&&(n.bind(),n.setVertexAttribPointers(h,e,a)),i&&i.bind(),s&&(s.bind(),s.setVertexAttribPointers(h,e,a)),o&&(o.bind(),o.setVertexAttribPointers(h,e,a)),u.currentNumAttributes=l}destroy(){this.vao&&(this.vao=(this.context.deleteVertexArray(this.vao),null))}},JP=(e,t)=>({u_depth:new G(e,t.u_depth),u_terrain:new G(e,t.u_terrain),u_terrain_dim:new B(e,t.u_terrain_dim),u_terrain_matrix:new Ft(e,t.u_terrain_matrix),u_terrain_unpack:new Ir(e,t.u_terrain_unpack),u_terrain_exaggeration:new B(e,t.u_terrain_exaggeration)}),QP=(e,t)=>({u_texture:new G(e,t.u_texture),u_ele_delta:new B(e,t.u_ele_delta),u_fog_matrix:new Ft(e,t.u_fog_matrix),u_fog_color:new Zr(e,t.u_fog_color),u_fog_ground_blend:new B(e,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new B(e,t.u_fog_ground_blend_opacity),u_horizon_color:new Zr(e,t.u_horizon_color),u_horizon_fog_blend:new B(e,t.u_horizon_fog_blend),u_is_globe_mode:new B(e,t.u_is_globe_mode)}),e3=(e,t)=>({u_ele_delta:new B(e,t.u_ele_delta)}),t3=(e,t,r,i,a)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:t,u_fog_color:r?r.properties.get(\"fog-color\"):J.white,u_fog_ground_blend:r?r.properties.get(\"fog-ground-blend\"):1,u_fog_ground_blend_opacity:a?0:r?r.calculateFogBlendOpacity(i):0,u_horizon_color:r?r.properties.get(\"horizon-color\"):J.white,u_horizon_fog_blend:r?r.properties.get(\"horizon-fog-blend\"):1,u_is_globe_mode:+!!a}),r3=e=>({u_ele_delta:e}),i3=(e,t)=>({u_projection_matrix:new Ft(e,t.u_projection_matrix),u_projection_tile_mercator_coords:new Ir(e,t.u_projection_tile_mercator_coords),u_projection_clipping_plane:new Ir(e,t.u_projection_clipping_plane),u_projection_transition:new B(e,t.u_projection_transition),u_projection_fallback_matrix:new Ft(e,t.u_projection_fallback_matrix),u_projection_clip_antimeridian:new G(e,t.u_projection_clip_antimeridian)}),a3=e=>({u_projection_matrix:e.mainMatrix,u_projection_tile_mercator_coords:e.tileMercatorCoords,u_projection_clipping_plane:e.clippingPlane,u_projection_transition:e.projectionTransition,u_projection_fallback_matrix:e.fallbackMatrix,u_projection_clip_antimeridian:+!!e.clipAntimeridian});function rl(e){let t=[];for(let r of e){if(r===null)continue;let i=r.split(\" \");t.push(i.pop())}return t}function n3(e,t){let r=new Set([e.INT,e.INT_VEC2,e.INT_VEC3,e.INT_VEC4,e.UNSIGNED_INT,e.UNSIGNED_INT_VEC2,e.UNSIGNED_INT_VEC3,e.UNSIGNED_INT_VEC4]),i=new Set,a=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let n=0;n<a;n++){let s=e.getActiveAttrib(t,n);s&&r.has(s.type)&&i.add(s.name)}return i}var s3=class{constructor(e,t,r,i,a,n,s,o,l=[]){let u=e.gl;this.program=u.createProgram();let h=rl(t.staticAttributes),c=r?r.getBinderAttributes():[],p=h.concat(c),d=Ar.prelude.staticUniforms?rl(Ar.prelude.staticUniforms):[],f=s.staticUniforms?rl(s.staticUniforms):[],m=t.staticUniforms?rl(t.staticUniforms):[],g=r?r.getBinderUniforms():[],y=d.concat(f).concat(m).concat(g),_=[];for(let D of y)_.includes(D)||_.push(D);let x=r?r.defines():[];x.unshift(\"#version 300 es\"),a&&x.push(\"#define OVERDRAW_INSPECTOR;\"),n&&x.push(\"#define TERRAIN3D;\"),o&&x.push(o),l&&x.push(...l);let v=x.concat(Ar.prelude.fragmentSource,s.fragmentSource,t.fragmentSource).join(`\n`),w=x.concat(Ar.prelude.vertexSource,s.vertexSource,t.vertexSource).join(`\n`),b=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}if(u.shaderSource(b,v),u.compileShader(b),!u.getShaderParameter(b,u.COMPILE_STATUS))throw Error(`Could not compile fragment shader: ${u.getShaderInfoLog(b)}`);u.attachShader(this.program,b);let T=u.createShader(u.VERTEX_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}if(u.shaderSource(T,w),u.compileShader(T),!u.getShaderParameter(T,u.COMPILE_STATUS))throw Error(`Could not compile vertex shader: ${u.getShaderInfoLog(T)}`);u.attachShader(this.program,T),this.attributes={};let I={};if(this.numAttributes=p.length,u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS))throw Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`);let S=n3(u,this.program);for(let D of p){if(!D)continue;let R=u.getAttribLocation(this.program,D);R>=0&&(this.attributes[D]={location:R,isInteger:S.has(D)})}u.deleteShader(T),u.deleteShader(b);for(let D of _)if(D&&!I[D]){let R=u.getUniformLocation(this.program,D);R&&(I[D]=R)}this.fixedUniforms=i(e,I),this.terrainUniforms=JP(e,I),this.projectionUniforms=i3(e,I),this.binderUniforms=r?r.getUniforms(e,I):[]}draw(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m,g,y,_){var w;let x=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(r),e.setStencilMode(i),e.setColorMode(a),e.setCullFace(n),o){e.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,o.depthTexture),e.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,o.texture);for(let b in this.terrainUniforms)this.terrainUniforms[b].set(o[b])}if(l){let b=a3(l);for(let T in this.projectionUniforms)this.projectionUniforms[T].set(b[T])}if(s)for(let b in this.fixedUniforms)this.fixedUniforms[b].set(s[b]);m&&m.setUniforms(e,this.binderUniforms,d,{zoom:f});let v=0;switch(t){case x.LINES:v=2;break;case x.TRIANGLES:v=3;break;case x.LINE_STRIP:v=1}for(let b of p.get())b.vaos||(b.vaos={}),(w=b.vaos)[u]||(w[u]=new KP),b.vaos[u].bind(e,this,h,m?m.getPaintVertexBuffers():[],c,b.vertexOffset,g,y,_),x.drawElements(t,b.primitiveLength*v,x.UNSIGNED_SHORT,b.primitiveOffset*v*2)}};function m1(e,t,r){let i=1/Ct(r,1,t.transform.tileZoom),a=2**r.tileID.overscaledZ,n=r.tileSize*2**t.transform.tileZoom/a,s=n*(r.tileID.canonical.x+r.tileID.wrap*a),o=n*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture.size,u_scale:[i,e.fromScale,e.toScale],u_fade:e.t,u_pixel_coord_upper:[s>>16,o>>16],u_pixel_coord_lower:[s&65535,o&65535]}}function o3(e,t,r,i){let a=r.patternAtlas.getPattern(e.from.toString()),n=r.patternAtlas.getPattern(e.to.toString()),{width:s,height:o}=r.patternAtlas.getPixelSize(),l=2**i.tileID.overscaledZ,u=i.tileSize*2**r.transform.tileZoom/l,h=u*(i.tileID.canonical.x+i.tileID.wrap*l),c=u*i.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:n.tl,u_pattern_br_b:n.br,u_texsize:[s,o],u_mix:t.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:n.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/Ct(i,1,r.transform.tileZoom),u_pixel_coord_upper:[h>>16,c>>16],u_pixel_coord_lower:[h&65535,c&65535]}}var l3=(e,t)=>({u_lightpos:new Mt(e,t.u_lightpos),u_lightpos_globe:new Mt(e,t.u_lightpos_globe),u_lightintensity:new B(e,t.u_lightintensity),u_lightcolor:new Mt(e,t.u_lightcolor),u_vertical_gradient:new B(e,t.u_vertical_gradient),u_opacity:new B(e,t.u_opacity),u_fill_translate:new Z(e,t.u_fill_translate)}),u3=(e,t)=>({u_lightpos:new Mt(e,t.u_lightpos),u_lightpos_globe:new Mt(e,t.u_lightpos_globe),u_lightintensity:new B(e,t.u_lightintensity),u_lightcolor:new Mt(e,t.u_lightcolor),u_vertical_gradient:new B(e,t.u_vertical_gradient),u_height_factor:new B(e,t.u_height_factor),u_opacity:new B(e,t.u_opacity),u_fill_translate:new Z(e,t.u_fill_translate),u_image:new G(e,t.u_image),u_texsize:new Z(e,t.u_texsize),u_pixel_coord_upper:new Z(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new Z(e,t.u_pixel_coord_lower),u_scale:new Mt(e,t.u_scale),u_fade:new B(e,t.u_fade)}),g1=(e,t,r,i)=>{let a=e.style.light,n=a.getCartesianPosition(),s=lh();a.properties.get(\"anchor\")===\"viewport\"&&wf(s,e.transform.bearingInRadians),Pf(n,n,s);let o=e.transform.transformLightDirection(n),l=a.properties.get(\"color\");return{u_lightpos:n,u_lightpos_globe:o,u_lightintensity:a.properties.get(\"intensity\"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+t,u_opacity:r,u_fill_translate:i}},h3=(e,t,r,i,a,n,s)=>j(g1(e,t,r,i),m1(n,e,s),{u_height_factor:-(2**a.overscaledZ)/s.tileSize/8}),c3=(e,t)=>({u_fill_translate:new Z(e,t.u_fill_translate)}),p3=(e,t)=>({u_image:new G(e,t.u_image),u_texsize:new Z(e,t.u_texsize),u_pixel_coord_upper:new Z(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new Z(e,t.u_pixel_coord_lower),u_scale:new Mt(e,t.u_scale),u_fade:new B(e,t.u_fade),u_fill_translate:new Z(e,t.u_fill_translate)}),d3=(e,t)=>({u_world:new Z(e,t.u_world),u_fill_translate:new Z(e,t.u_fill_translate)}),f3=(e,t)=>({u_world:new Z(e,t.u_world),u_image:new G(e,t.u_image),u_texsize:new Z(e,t.u_texsize),u_pixel_coord_upper:new Z(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new Z(e,t.u_pixel_coord_lower),u_scale:new Mt(e,t.u_scale),u_fade:new B(e,t.u_fade),u_fill_translate:new Z(e,t.u_fill_translate)}),y1=(e,t,r,i)=>j(m1(t,e,r),{u_fill_translate:i}),m3=e=>({u_fill_translate:e}),g3=(e,t)=>({u_world:e,u_fill_translate:t}),y3=(e,t,r,i,a)=>j(y1(e,t,r,a),{u_world:i}),_3=(e,t)=>({u_camera_to_center_distance:new B(e,t.u_camera_to_center_distance),u_scale_with_map:new G(e,t.u_scale_with_map),u_pitch_with_map:new G(e,t.u_pitch_with_map),u_extrude_scale:new Z(e,t.u_extrude_scale),u_device_pixel_ratio:new B(e,t.u_device_pixel_ratio),u_globe_extrude_scale:new B(e,t.u_globe_extrude_scale),u_translate:new Z(e,t.u_translate)}),x3=(e,t,r,i,a)=>{let n=e.transform,s,o,l=0;if(r.paint.get(\"circle-pitch-alignment\")===\"map\"){let u=Ct(t,1,n.zoom);s=!0,o=[u,u],l=u/(z*2**t.tileID.overscaledZ)*2*Math.PI*a}else{s=!1;let u=n.renderWindowCrop;o=u?[n.pixelsToGLUnits[0]*u.scaleX,n.pixelsToGLUnits[1]*u.scaleY]:n.pixelsToGLUnits}return{u_camera_to_center_distance:n.cameraToCenterDistance,u_scale_with_map:+(r.paint.get(\"circle-pitch-scale\")===\"map\"),u_pitch_with_map:+s,u_device_pixel_ratio:e.pixelRatio,u_extrude_scale:o,u_globe_extrude_scale:l,u_translate:i}},v3=(e,t)=>({u_pixel_extrude_scale:new Z(e,t.u_pixel_extrude_scale)}),b3=(e,t)=>({u_viewport_size:new Z(e,t.u_viewport_size)}),w3=e=>({u_pixel_extrude_scale:[1/e.width,1/e.height]}),T3=e=>({u_viewport_size:[e.width,e.height]}),S3=(e,t)=>({u_color:new Zr(e,t.u_color),u_overlay:new G(e,t.u_overlay),u_overlay_scale:new B(e,t.u_overlay_scale)}),n0=(e,t=1)=>({u_color:e,u_overlay:0,u_overlay_scale:t}),E3=(e,t)=>({u_extrude_scale:new B(e,t.u_extrude_scale),u_intensity:new B(e,t.u_intensity),u_globe_extrude_scale:new B(e,t.u_globe_extrude_scale)}),I3=(e,t)=>({u_matrix:new Ft(e,t.u_matrix),u_world:new Z(e,t.u_world),u_image:new G(e,t.u_image),u_color_ramp:new G(e,t.u_color_ramp),u_opacity:new B(e,t.u_opacity)}),_1=(e,t,r,i)=>{let a=Ct(e,1,t)/(z*2**e.tileID.overscaledZ)*2*Math.PI*i;return{u_extrude_scale:Ct(e,1,t),u_intensity:r,u_globe_extrude_scale:a}},x1=(e,t,r,i,a=null)=>{let n=Vr();ur(n,0,e.width,e.height,0,0,1);let s=e.context.gl,o=[s.drawingBufferWidth,s.drawingBufferHeight],l=e.transform.renderWindowCrop;if(a&&l){let u=l.fullWidth/a.fullWidth,h=l.fullHeight/a.fullHeight;ze(n,n,[a.window.x*u-l.window.x,a.window.y*h-l.window.y,0]),o=[a.window.width*u,a.window.height*h]}return{u_matrix:n,u_world:o,u_image:r,u_color_ramp:i,u_opacity:t.paint.get(\"heatmap-opacity\")}},A3=(e,t)=>({u_image:new G(e,t.u_image),u_latrange:new Z(e,t.u_latrange),u_exaggeration:new B(e,t.u_exaggeration),u_altitudes:new Zh(e,t.u_altitudes),u_azimuths:new Zh(e,t.u_azimuths),u_accent:new Zr(e,t.u_accent),u_method:new G(e,t.u_method),u_shadows:new qh(e,t.u_shadows),u_highlights:new qh(e,t.u_highlights)}),M3=(e,t)=>({u_matrix:new Ft(e,t.u_matrix),u_image:new G(e,t.u_image),u_dimension:new Z(e,t.u_dimension),u_zoom:new B(e,t.u_zoom),u_unpack:new Ir(e,t.u_unpack)}),P3=(e,t,r)=>{let i=r.paint.get(\"hillshade-accent-color\"),a;switch(r.paint.get(\"hillshade-method\")){case\"basic\":a=4;break;case\"combined\":a=1;break;case\"igor\":a=2;break;case\"multidirectional\":a=3;break;default:a=0}let n=r.getIlluminationProperties();for(let s=0;s<n.directionRadians.length;s++)r.paint.get(\"hillshade-illumination-anchor\")===\"viewport\"&&(n.directionRadians[s]+=e.transform.bearingInRadians);return{u_image:0,u_latrange:k3(e,t.tileID),u_exaggeration:r.paint.get(\"hillshade-exaggeration\"),u_altitudes:n.altitudeRadians,u_azimuths:n.directionRadians,u_accent:i,u_method:a,u_highlights:n.highlightColor,u_shadows:n.shadowColor}},C3=(e,t)=>{let r=t.stride,i=Vr();return ur(i,0,z,-z,0,0,1),ze(i,i,[0,-z,0]),{u_matrix:i,u_image:1,u_dimension:[r,r],u_zoom:e.overscaledZ,u_unpack:t.getUnpackVector()}};function k3(e,t){let r=2**t.canonical.z,i=t.canonical.y;return[new fe(0,i/r).toLngLat().lat,new fe(0,(i+1)/r).toLngLat().lat]}var D3=(e,t)=>({u_image:new G(e,t.u_image),u_unpack:new Ir(e,t.u_unpack),u_dimension:new Z(e,t.u_dimension),u_elevation_stops:new G(e,t.u_elevation_stops),u_color_stops:new G(e,t.u_color_stops),u_color_ramp_size:new G(e,t.u_color_ramp_size),u_opacity:new B(e,t.u_opacity)}),F3=(e,t,r=0)=>({u_image:0,u_unpack:t.getUnpackVector(),u_dimension:[t.stride,t.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:r,u_opacity:e.paint.get(\"color-relief-opacity\")}),z3=(e,t)=>({u_translation:new Z(e,t.u_translation),u_ratio:new B(e,t.u_ratio),u_device_pixel_ratio:new B(e,t.u_device_pixel_ratio),u_units_to_pixels:new Z(e,t.u_units_to_pixels),u_render_window_translation:new Z(e,t.u_render_window_translation)}),R3=(e,t)=>({u_translation:new Z(e,t.u_translation),u_ratio:new B(e,t.u_ratio),u_device_pixel_ratio:new B(e,t.u_device_pixel_ratio),u_units_to_pixels:new Z(e,t.u_units_to_pixels),u_render_window_translation:new Z(e,t.u_render_window_translation),u_image:new G(e,t.u_image),u_image_height:new B(e,t.u_image_height)}),L3=(e,t)=>({u_translation:new Z(e,t.u_translation),u_texsize:new Z(e,t.u_texsize),u_ratio:new B(e,t.u_ratio),u_device_pixel_ratio:new B(e,t.u_device_pixel_ratio),u_image:new G(e,t.u_image),u_units_to_pixels:new Z(e,t.u_units_to_pixels),u_render_window_translation:new Z(e,t.u_render_window_translation),u_scale:new Mt(e,t.u_scale),u_fade:new B(e,t.u_fade)}),B3=(e,t)=>({u_translation:new Z(e,t.u_translation),u_ratio:new B(e,t.u_ratio),u_device_pixel_ratio:new B(e,t.u_device_pixel_ratio),u_units_to_pixels:new Z(e,t.u_units_to_pixels),u_render_window_translation:new Z(e,t.u_render_window_translation),u_image:new G(e,t.u_image),u_mix:new B(e,t.u_mix),u_tileratio:new B(e,t.u_tileratio),u_crossfade_from:new B(e,t.u_crossfade_from),u_crossfade_to:new B(e,t.u_crossfade_to),u_lineatlas_width:new B(e,t.u_lineatlas_width),u_lineatlas_height:new B(e,t.u_lineatlas_height)}),O3=(e,t)=>({u_translation:new Z(e,t.u_translation),u_ratio:new B(e,t.u_ratio),u_device_pixel_ratio:new B(e,t.u_device_pixel_ratio),u_units_to_pixels:new Z(e,t.u_units_to_pixels),u_render_window_translation:new Z(e,t.u_render_window_translation),u_image:new G(e,t.u_image),u_image_height:new B(e,t.u_image_height),u_tileratio:new B(e,t.u_tileratio),u_crossfade_from:new B(e,t.u_crossfade_from),u_crossfade_to:new B(e,t.u_crossfade_to),u_image_dash:new G(e,t.u_image_dash),u_mix:new B(e,t.u_mix),u_lineatlas_width:new B(e,t.u_lineatlas_width),u_lineatlas_height:new B(e,t.u_lineatlas_height)}),V3=[0,0];function v1(e){let t=e.renderWindowCrop?.clipMatrix;return t?[t[12],t[13]]:V3}function b1(e){let t=e.renderWindowCrop;return[1/(e.pixelsToGLUnits[0]*(t?t.scaleX:1)),1/(e.pixelsToGLUnits[1]*(t?t.scaleY:1))]}var vl=(e,t,r,i)=>{let a=e.transform;return{u_translation:w1(e,t,r),u_ratio:i/Ct(t,1,a.zoom),u_device_pixel_ratio:e.pixelRatio,u_units_to_pixels:b1(a),u_render_window_translation:v1(a)}},N3=(e,t,r,i,a)=>j(vl(e,t,r,i),{u_image:0,u_image_height:a}),U3=(e,t,r,i,a)=>{let n=e.transform,s=lp(t,n);return{u_translation:w1(e,t,r),u_texsize:t.imageAtlasTexture.size,u_ratio:i/Ct(t,1,n.zoom),u_device_pixel_ratio:e.pixelRatio,u_image:0,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t,u_units_to_pixels:b1(n),u_render_window_translation:v1(n)}},$3=(e,t,r,i,a)=>{let n=e.transform,s=lp(t,n);return j(vl(e,t,r,i),{u_tileratio:s,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},j3=(e,t,r,i,a,n)=>{let s=e.transform,o=lp(t,s);return j(vl(e,t,r,i),{u_image:0,u_image_height:n,u_tileratio:o,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})};function lp(e,t){return 1/Ct(e,1,t.tileZoom)}function w1(e,t,r){return Ur(e.transform,t,r.paint.get(\"line-translate\"),r.paint.get(\"line-translate-anchor\"))}var G3=(e,t)=>({u_image:new G(e,t.u_image),u_opacity:new B(e,t.u_opacity)}),q3=(e,t)=>({u_image:t,u_opacity:e}),Z3=(e,t)=>({u_is_size_zoom_constant:new G(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new G(e,t.u_is_size_feature_constant),u_size_t:new B(e,t.u_size_t),u_size:new B(e,t.u_size),u_camera_to_center_distance:new B(e,t.u_camera_to_center_distance),u_pitch:new B(e,t.u_pitch),u_rotate_symbol:new G(e,t.u_rotate_symbol),u_aspect_ratio:new B(e,t.u_aspect_ratio),u_fade_change:new B(e,t.u_fade_change),u_label_plane_matrix:new Ft(e,t.u_label_plane_matrix),u_coord_matrix:new Ft(e,t.u_coord_matrix),u_is_text:new G(e,t.u_is_text),u_pitch_with_map:new G(e,t.u_pitch_with_map),u_is_along_line:new G(e,t.u_is_along_line),u_is_variable_anchor:new G(e,t.u_is_variable_anchor),u_texsize:new Z(e,t.u_texsize),u_texture:new G(e,t.u_texture),u_translation:new Z(e,t.u_translation),u_pitched_scale:new B(e,t.u_pitched_scale),u_is_offset:new G(e,t.u_is_offset),u_height_anchor_ground:new G(e,t.u_height_anchor_ground)}),W3=(e,t)=>({u_is_size_zoom_constant:new G(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new G(e,t.u_is_size_feature_constant),u_size_t:new B(e,t.u_size_t),u_size:new B(e,t.u_size),u_camera_to_center_distance:new B(e,t.u_camera_to_center_distance),u_pitch:new B(e,t.u_pitch),u_rotate_symbol:new G(e,t.u_rotate_symbol),u_aspect_ratio:new B(e,t.u_aspect_ratio),u_fade_change:new B(e,t.u_fade_change),u_label_plane_matrix:new Ft(e,t.u_label_plane_matrix),u_coord_matrix:new Ft(e,t.u_coord_matrix),u_is_text:new G(e,t.u_is_text),u_pitch_with_map:new G(e,t.u_pitch_with_map),u_is_along_line:new G(e,t.u_is_along_line),u_is_variable_anchor:new G(e,t.u_is_variable_anchor),u_texsize:new Z(e,t.u_texsize),u_texture:new G(e,t.u_texture),u_gamma_scale:new B(e,t.u_gamma_scale),u_device_pixel_ratio:new B(e,t.u_device_pixel_ratio),u_is_halo:new G(e,t.u_is_halo),u_is_plain:new G(e,t.u_is_plain),u_translation:new Z(e,t.u_translation),u_pitched_scale:new B(e,t.u_pitched_scale),u_is_offset:new G(e,t.u_is_offset),u_height_anchor_ground:new G(e,t.u_height_anchor_ground)}),X3=(e,t)=>({u_is_size_zoom_constant:new G(e,t.u_is_size_zoom_constant),u_is_size_feature_constant:new G(e,t.u_is_size_feature_constant),u_size_t:new B(e,t.u_size_t),u_size:new B(e,t.u_size),u_camera_to_center_distance:new B(e,t.u_camera_to_center_distance),u_pitch:new B(e,t.u_pitch),u_rotate_symbol:new G(e,t.u_rotate_symbol),u_aspect_ratio:new B(e,t.u_aspect_ratio),u_fade_change:new B(e,t.u_fade_change),u_label_plane_matrix:new Ft(e,t.u_label_plane_matrix),u_coord_matrix:new Ft(e,t.u_coord_matrix),u_is_text:new G(e,t.u_is_text),u_pitch_with_map:new G(e,t.u_pitch_with_map),u_is_along_line:new G(e,t.u_is_along_line),u_is_variable_anchor:new G(e,t.u_is_variable_anchor),u_texsize:new Z(e,t.u_texsize),u_texsize_icon:new Z(e,t.u_texsize_icon),u_texture:new G(e,t.u_texture),u_texture_icon:new G(e,t.u_texture_icon),u_gamma_scale:new B(e,t.u_gamma_scale),u_device_pixel_ratio:new B(e,t.u_device_pixel_ratio),u_is_halo:new G(e,t.u_is_halo),u_translation:new Z(e,t.u_translation),u_pitched_scale:new B(e,t.u_pitched_scale),u_is_offset:new G(e,t.u_is_offset),u_height_anchor_ground:new G(e,t.u_height_anchor_ground)}),T1=(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f)=>{let m=s.transform,g=m.renderWindowCrop;return{u_is_size_zoom_constant:+(e===\"constant\"||e===\"source\"),u_is_size_feature_constant:+(e===\"constant\"||e===\"camera\"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:m.cameraToCenterDistance,u_pitch:m.pitch/360*2*Math.PI,u_rotate_symbol:+r,u_aspect_ratio:m.width/m.height*(g?g.scaleY/g.scaleX:1),u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_label_plane_matrix:o,u_coord_matrix:l,u_is_text:+h,u_pitch_with_map:+i,u_is_along_line:a,u_is_variable_anchor:n,u_texsize:c,u_texture:0,u_translation:u,u_pitched_scale:p,u_is_offset:d,u_height_anchor_ground:+f}},S1=(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f,m)=>{let g=s.transform;return j(T1(e,t,r,i,a,n,s,o,l,u,h,c,d,f,m),{u_gamma_scale:i?Math.cos(g.pitch*Math.PI/180)*g.cameraToCenterDistance:1,u_device_pixel_ratio:s.pixelRatio,u_is_halo:+!!p,u_is_plain:1})},H3=(e,t,r,i,a,n,s,o,l,u,h,c,p,d,f)=>j(S1(e,t,r,i,a,n,s,o,l,u,!0,h,!0,p,d,f),{u_texsize_icon:c,u_texture_icon:1}),Y3=(e,t)=>({u_opacity:new B(e,t.u_opacity),u_color:new Zr(e,t.u_color)}),K3=(e,t)=>({u_opacity:new B(e,t.u_opacity),u_image:new G(e,t.u_image),u_pattern_tl_a:new Z(e,t.u_pattern_tl_a),u_pattern_br_a:new Z(e,t.u_pattern_br_a),u_pattern_tl_b:new Z(e,t.u_pattern_tl_b),u_pattern_br_b:new Z(e,t.u_pattern_br_b),u_texsize:new Z(e,t.u_texsize),u_mix:new B(e,t.u_mix),u_pattern_size_a:new Z(e,t.u_pattern_size_a),u_pattern_size_b:new Z(e,t.u_pattern_size_b),u_scale_a:new B(e,t.u_scale_a),u_scale_b:new B(e,t.u_scale_b),u_pixel_coord_upper:new Z(e,t.u_pixel_coord_upper),u_pixel_coord_lower:new Z(e,t.u_pixel_coord_lower),u_tile_units_to_pixels:new B(e,t.u_tile_units_to_pixels)}),J3=(e,t)=>({u_opacity:e,u_color:t}),Q3=(e,t,r,i,a)=>j(o3(r,a,t,i),{u_opacity:e}),eC=(e,t)=>({u_sun_pos:new Mt(e,t.u_sun_pos),u_atmosphere_blend:new B(e,t.u_atmosphere_blend),u_globe_position:new Mt(e,t.u_globe_position),u_globe_radius:new B(e,t.u_globe_radius),u_inv_proj_matrix:new Ft(e,t.u_inv_proj_matrix)}),tC=(e,t,r,i,a)=>({u_sun_pos:e,u_atmosphere_blend:t,u_globe_position:r,u_globe_radius:i,u_inv_proj_matrix:a}),rC=(e,t)=>({u_sky_color:new Zr(e,t.u_sky_color),u_horizon_color:new Zr(e,t.u_horizon_color),u_horizon:new Z(e,t.u_horizon),u_horizon_normal:new Z(e,t.u_horizon_normal),u_sky_horizon_blend:new B(e,t.u_sky_horizon_blend),u_sky_blend:new B(e,t.u_sky_blend)}),iC=(e,t,r)=>{let i=Math.cos(t.rollInRadians),a=Math.sin(t.rollInRadians),n=Va(t),s=t.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition,[o,l]=t.renderWindowCrop?.fragCoordOffset??[0,0];return{u_sky_color:e.properties.get(\"sky-color\"),u_horizon_color:e.properties.get(\"horizon-color\"),u_horizon:[(t.width/2-n*a)*r-o,(t.height/2+n*i)*r-l],u_horizon_normal:[-a,i],u_sky_horizon_blend:e.properties.get(\"sky-horizon-blend\")*t.height/2*r,u_sky_blend:s}},s0=(e,t)=>{},aC={fillExtrusion:l3,fillExtrusionPattern:u3,fill:c3,fillPattern:p3,fillOutline:d3,fillOutlinePattern:f3,circle:_3,collisionBox:v3,collisionCircle:b3,debug:S3,depth:s0,clippingMask:s0,heatmap:E3,heatmapTexture:I3,hillshade:A3,hillshadePrepare:M3,colorRelief:D3,line:z3,lineGradient:R3,linePattern:L3,lineSDF:B3,lineGradientSDF:O3,layerOpacity:G3,raster:xM,symbolIcon:Z3,symbolSDF:W3,symbolTextAndIcon:X3,background:Y3,backgroundPattern:K3,terrain:QP,terrainDepth:e3,atmosphere:eC,sky:rC},nC=class{constructor(e,t,r){this.context=e;let i=e.gl;this.buffer=i.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let t=this.context.gl;if(!this.dynamicDraw)throw Error(\"Attempted to update data while not in dynamic mode.\");this.context.unbindVAO(),this.bind(),t.bufferSubData(t.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},o0={Int8:\"BYTE\",Uint8:\"UNSIGNED_BYTE\",Int16:\"SHORT\",Uint16:\"UNSIGNED_SHORT\",Int32:\"INT\",Uint32:\"UNSIGNED_INT\",Float32:\"FLOAT\"},sC=class{constructor(e,t,r,i){this.length=t.length,this.attributes=r,this.itemSize=t.bytesPerElement,this.dynamicDraw=i,this.context=e;let a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,t.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||t.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let t=this.context.gl;this.bind(),t.bufferSubData(t.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,t){for(let r of this.attributes){let i=t.attributes[r.name];i!==void 0&&e.enableVertexAttribArray(i.location)}}setVertexAttribPointers(e,t,r){for(let i of this.attributes){let a=t.attributes[i.name];if(a!==void 0){let n=i.offset+this.itemSize*(r||0);a.isInteger?e.vertexAttribIPointer(a.location,i.components,e[o0[i.type]],this.itemSize,n):e.vertexAttribPointer(a.location,i.components,e[o0[i.type]],!1,this.itemSize,n)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},ce=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},oC=class extends ce{getDefault(){return J.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},lC=class extends ce{getDefault(){return 1}set(e){e===this.current&&!this.dirty||(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},uC=class extends ce{getDefault(){return 0}set(e){e===this.current&&!this.dirty||(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},hC=class extends ce{getDefault(){return[!0,!0,!0,!0]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},cC=class extends ce{getDefault(){return!0}set(e){e===this.current&&!this.dirty||(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},pC=class extends ce{getDefault(){return 255}set(e){e===this.current&&!this.dirty||(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},dC=class extends ce{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let t=this.current;e.func===t.func&&e.ref===t.ref&&e.mask===t.mask&&!this.dirty||(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},fC=class extends ce{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&!this.dirty||(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},mC=class extends ce{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.STENCIL_TEST):t.disable(t.STENCIL_TEST),this.current=e,this.dirty=!1}},gC=class extends ce{getDefault(){return[0,1]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},yC=class extends ce{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.DEPTH_TEST):t.disable(t.DEPTH_TEST),this.current=e,this.dirty=!1}},_C=class extends ce{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.POLYGON_OFFSET_FILL):t.disable(t.POLYGON_OFFSET_FILL),this.current=e,this.dirty=!1}},xC=class extends ce{getDefault(){return[0,0]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.polygonOffset(e[0],e[1]),this.current=e,this.dirty=!1)}},vC=class extends ce{getDefault(){return this.gl.LESS}set(e){e===this.current&&!this.dirty||(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},bC=class extends ce{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.BLEND):t.disable(t.BLEND),this.current=e,this.dirty=!1}},wC=class extends ce{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&!this.dirty||(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},TC=class extends ce{getDefault(){return J.transparent}set(e){let t=this.current;e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a&&!this.dirty||(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},SC=class extends ce{getDefault(){return this.gl.FUNC_ADD}set(e){e===this.current&&!this.dirty||(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},EC=class extends ce{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;e?t.enable(t.CULL_FACE):t.disable(t.CULL_FACE),this.current=e,this.dirty=!1}},IC=class extends ce{getDefault(){return this.gl.BACK}set(e){e===this.current&&!this.dirty||(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},AC=class extends ce{getDefault(){return this.gl.CCW}set(e){e===this.current&&!this.dirty||(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},MC=class extends ce{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},PC=class extends ce{getDefault(){return this.gl.TEXTURE0}set(e){e===this.current&&!this.dirty||(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},CC=class extends ce{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let t=this.current;e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]&&!this.dirty||(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},kC=class extends ce{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},DC=class extends ce{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindRenderbuffer(t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},FC=class extends ce{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindTexture(t.TEXTURE_2D,e),this.current=e,this.dirty=!1}},zC=class extends ce{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.bindBuffer(t.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},RC=class extends ce{getDefault(){return null}set(e){let t=this.gl;t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},LC=class extends ce{getDefault(){return null}set(e){e===this.current&&!this.dirty||(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}},BC=class extends ce{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},OC=class extends ce{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},VC=class extends ce{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let t=this.gl;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},up=class extends ce{constructor(e,t){super(e),this.context=e,this.parent=t}getDefault(){return null}},NC=class extends up{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},UC=class extends up{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},$C=class extends up{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let t=this.gl;t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,e),this.current=e,this.dirty=!1}},jC=class{constructor(e,t,r,i,a){this.context=e,this.width=t,this.height=r;let n=e.gl,s=this.framebuffer=n.createFramebuffer();if(this.colorAttachment=new NC(e,s),i)this.depthAttachment=a?new $C(e,s):new UC(e,s);else if(a)throw Error(\"Stencil cannot be set without depth\")}destroy(){let e=this.context.gl,t=this.colorAttachment.get();if(t&&e.deleteTexture(t),this.depthAttachment){let r=this.depthAttachment.get();r&&e.deleteRenderbuffer(r)}e.deleteFramebuffer(this.framebuffer)}},Re=class{constructor(e,t,r){this.blendFunction=e,this.blendColor=t,this.mask=r}};Re.Replace=[1,0],Re.disabled=new Re(Re.Replace,J.transparent,[!1,!1,!1,!1]),Re.unblended=new Re(Re.Replace,J.transparent,[!0,!0,!0,!0]),Re.alphaBlended=new Re([1,771],J.transparent,[!0,!0,!0,!0]);var GC=class{constructor(e){this.gl=e,this.clearColor=new oC(this),this.clearDepth=new lC(this),this.clearStencil=new uC(this),this.colorMask=new hC(this),this.depthMask=new cC(this),this.stencilMask=new pC(this),this.stencilFunc=new dC(this),this.stencilOp=new fC(this),this.stencilTest=new mC(this),this.depthRange=new gC(this),this.depthTest=new yC(this),this.depthFunc=new vC(this),this.polygonOffsetFill=new _C(this),this.polygonOffset=new xC(this),this.blend=new bC(this),this.blendFunc=new wC(this),this.blendColor=new TC(this),this.blendEquation=new SC(this),this.cullFace=new EC(this),this.cullFaceSide=new IC(this),this.frontFace=new AC(this),this.program=new MC(this),this.activeTexture=new PC(this),this.viewport=new CC(this),this.bindFramebuffer=new kC(this),this.bindRenderbuffer=new DC(this),this.bindTexture=new FC(this),this.bindVertexBuffer=new zC(this),this.bindElementBuffer=new RC(this),this.bindVertexArray=new LC(this),this.pixelStoreUnpack=new BC(this),this.pixelStoreUnpackPremultiplyAlpha=new OC(this),this.pixelStoreUnpackFlipY=new VC(this),this.extTextureFilterAnisotropic=e.getExtension(\"EXT_texture_filter_anisotropic\"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),e.getExtension(\"EXT_color_buffer_half_float\"),e.getExtension(\"EXT_color_buffer_float\")}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.polygonOffsetFill.setDefault(),this.polygonOffset.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.polygonOffsetFill.dirty=!0,this.polygonOffset.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(e,t){return new nC(this,e,t)}createVertexBuffer(e,t,r){return new sC(this,e,t,r)}createRenderbuffer(e,t,r){let i=this.gl,a=i.createRenderbuffer();return this.bindRenderbuffer.set(a),i.renderbufferStorage(i.RENDERBUFFER,e,t,r),this.bindRenderbuffer.set(null),a}createFramebuffer(e,t,r,i){return new jC(this,e,t,r,i)}clear({color:e,depth:t,stencil:r}){let i=this.gl,a=0;e&&(a|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),t!==void 0&&(a|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(t),this.depthMask.set(!0)),r!==void 0&&(a|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(a)}setPolygonOffset(e,t){let r=e!==0||t!==0;this.polygonOffsetFill.set(r),r&&this.polygonOffset.set([e,t])}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){sr(e.blendFunction,Re.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(e){this.gl.deleteVertexArray(e)}unbindVAO(){this.bindVertexArray.set(null)}},ne=class{constructor(e,t,r){this.func=e,this.mask=t,this.range=r}};ne.ReadOnly=!1,ne.ReadWrite=!0,ne.disabled=new ne(519,ne.ReadOnly,[0,1]);var Rc=7680,de=class{constructor(e,t,r,i,a,n){this.test=e,this.ref=t,this.mask=r,this.fail=i,this.depthFail=a,this.pass=n}};de.disabled=new de({func:519,mask:0},0,0,Rc,Rc,Rc);var l0=1029,Lc=2305,he=class{constructor(e,t,r){this.enable=e,this.mode=t,this.frontFace=r}};he.disabled=new he(!1,l0,Lc),he.backCCW=new he(!0,l0,Lc),he.frontCCW=new he(!0,1028,Lc);var il;function u0(e,t,r,i,a){let n=e.context,s=e.transform,o=n.gl,l=e.useProgram(\"collisionBox\"),u=[],h=0,c=0;for(let y of i){let _=t.getTile(y).getBucket(r);if(!_)continue;let x=a?_.textCollisionBox:_.iconCollisionBox,v=_.collisionCircleArray;v.length>0&&(u.push({circleArray:v,circleOffset:c,coord:y}),h+=v.length/4,c=h),x&&l.draw(n,o.LINES,ne.disabled,de.disabled,e.colorModeForRenderPass(),he.disabled,w3(e.transform),e.style.map.terrain?.getTerrainData(y),s.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),r.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,null,e.transform.zoom,null,null,x.collisionVertexBuffer)}if(!a||!u.length)return;let p=e.useProgram(\"collisionCircle\"),d=new qg;d.resize(h*4),d._trim();let f=0;for(let y of u)for(let _=0;_<y.circleArray.length/4;_++){let x=_*4,v=y.circleArray[x+0],w=y.circleArray[x+1],b=y.circleArray[x+2],T=y.circleArray[x+3];d.emplace(f++,v,w,b,T,0),d.emplace(f++,v,w,b,T,1),d.emplace(f++,v,w,b,T,2),d.emplace(f++,v,w,b,T,3)}(!il||il.length<h*2)&&(il=qC(h));let m=n.createIndexBuffer(il,!0),g=n.createVertexBuffer(d,Ey.members,!0);for(let y of u){let _=T3(e.transform);p.draw(n,o.TRIANGLES,ne.disabled,de.disabled,e.colorModeForRenderPass(),he.disabled,_,e.style.map.terrain?.getTerrainData(y.coord),null,r.id,g,m,Ee.simpleSegment(0,y.circleOffset*2,y.circleArray.length,y.circleArray.length/2),null,e.transform.zoom,null,null,null)}g.destroy(),m.destroy()}function qC(e){let t=e*2,r=new Zg;r.resize(t),r._trim();for(let i=0;i<t;i++){let a=i*6;r.uint16[a+0]=i*4+0,r.uint16[a+1]=i*4+1,r.uint16[a+2]=i*4+2,r.uint16[a+3]=i*4+2,r.uint16[a+4]=i*4+3,r.uint16[a+5]=i*4+0}return r}var ZC=Kt(new Float32Array(16));function WC(e,t,r,i,a,n){if(e.renderPass!==\"translucent\")return;let{isRenderingToTexture:s}=n,o=de.disabled,l=e.colorModeForRenderPass();(r._unevaluatedLayout.hasValue(\"text-variable-anchor\")||r._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\"))&&HC(i,e,r,t,r.layout.get(\"text-rotation-alignment\"),r.layout.get(\"text-pitch-alignment\"),r.paint.get(\"text-translate\"),r.paint.get(\"text-translate-anchor\"),a),r.paint.get(\"icon-opacity\").constantOr(1)!==0&&h0(e,t,r,i,!1,r.paint.get(\"icon-translate\"),r.paint.get(\"icon-translate-anchor\"),r.layout.get(\"icon-rotation-alignment\").constantOr(\"viewport\"),r.layout.get(\"icon-pitch-alignment\"),r.layout.get(\"icon-keep-upright\"),o,l,s),r.paint.get(\"text-opacity\").constantOr(1)!==0&&h0(e,t,r,i,!0,r.paint.get(\"text-translate\"),r.paint.get(\"text-translate-anchor\"),r.layout.get(\"text-rotation-alignment\"),r.layout.get(\"text-pitch-alignment\"),r.layout.get(\"text-keep-upright\"),o,l,s),t.map.showCollisionBoxes&&(u0(e,t,r,i,!0),u0(e,t,r,i,!1))}function XC(e,t,r,i,a,n){let{horizontalAlign:s,verticalAlign:o}=ac(e),l=-(s-.5)*t,u=-(o-.5)*r;return new C((l/a+i[0])*n,(u/a+i[1])*n)}function HC(e,t,r,i,a,n,s,o,l){let u=t.transform,h=t.style.map.terrain,c=a===\"map\",p=n===\"map\";for(let d of e){let f=i.getTile(d),m=f.getBucket(r);if(!m?.text?.segments.get().length)continue;let g=m.textSizeData,y=es(g,u.zoom),_=Ct(f,1,t.transform.zoom),x=ip(c,t.transform,_),v=r.layout.get(\"icon-text-fit\")!==\"none\"&&m.hasIconData();if(y){let w=2**(u.zoom-f.tileID.overscaledZ),b=h?(T,I)=>h.getElevation(d,T,I):void 0;KC(m,c,p,l,u,x,w,y,v,Ur(u,f,s,o),d.toUnwrapped(),b,r.layout.get(\"symbol-height-anchor\")===\"ground\")}}}function YC(e,t,r,i,a,n){let s=t.tileAnchorPoint.add(new C(t.translation[0],t.translation[1]));if(t.pitchWithMap){let o=i.mult(n);r||(o=o.rotate(-a));let l=s.add(o);return np(l.x,l.y,t.pitchedLabelPlaneMatrix,Ki(t,l.x,l.y)).point}if(r){let o=Ji(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(e),l=Math.atan(o.y/o.x)+(o.x<0?Math.PI:0);return e.add(i.rotate(l))}return e.add(i)}function KC(e,t,r,i,a,n,s,o,l,u,h,c,p){let d=e.text.placedSymbolArray,f=e.text.dynamicLayoutVertexArray,m=e.icon.dynamicLayoutVertexArray,g={};f.clear();for(let y=0;y<d.length;y++){let _=d.get(y),x=e.allowVerticalPlacement&&!_.placedOrientation,v=!_.hidden&&_.crossTileID&&!x?i[_.crossTileID]:null;if(!v)qa(_.numGlyphs,f);else{let w=new C(_.anchorX,_.anchorY),b={getElevation:c,heightOffset:_.heightOffset,heightAnchorGround:p,width:a.width,height:a.height,pitchedLabelPlaneMatrix:n,lineVertexArray:null,pitchWithMap:r,transform:a,projectionCache:null,tileAnchorPoint:w,translation:u,unwrappedTileID:h},T=r?G0(w.x,w.y,b):Ji(w.x,w.y,b),I=U0(a.cameraToCenterDistance,T.signedDistanceFromCamera),S=Go(e.textSizeData,o,_)*I/24;r&&(S*=e.tilePixelRatio/s);let{width:D,height:R,anchor:F,textOffset:E,textBoxScale:M}=v,A=XC(F,D,R,E,M,S),k=a.getPitchedTextCorrection(w.x+u[0],w.y+u[1],h),H=YC(T.point,b,t,A,-a.bearingInRadians,k),$=e.allowVerticalPlacement&&_.placedOrientation===2?Math.PI/2:0;for(let U=0;U<_.numGlyphs;U++)Na(f,H,$);l&&_.associatedIconIndex>=0&&(g[_.associatedIconIndex]={shiftedAnchor:H,angle:$})}}if(l){m.clear();let y=e.icon.placedSymbolArray;for(let _=0;_<y.length;_++){let x=y.get(_);if(x.hidden)qa(x.numGlyphs,m);else{let v=g[_];if(!v)qa(x.numGlyphs,m);else for(let w=0;w<x.numGlyphs;w++)Na(m,v.shiftedAnchor,v.angle)}}e.icon.dynamicLayoutVertexBuffer.updateData(m)}e.text.dynamicLayoutVertexBuffer.updateData(f)}function JC(e,t,r){return r.iconsInText&&t?\"symbolTextAndIcon\":e?\"symbolSDF\":\"symbolIcon\"}function h0(e,t,r,i,a,n,s,o,l,u,h,c,p){let d=e.context,f=d.gl,m=e.transform,g=o===\"map\",y=l===\"map\",_=o!==\"viewport\"&&r.layout.get(\"symbol-placement\")!==\"point\",x=g&&!y&&!_,v=!r.layout.get(\"symbol-sort-key\").isConstant(),w=!1,b=e.getDepthModeForSublayer(0,ne.ReadOnly),T=r._unevaluatedLayout.hasValue(\"text-variable-anchor\")||r._unevaluatedLayout.hasValue(\"text-variable-anchor-offset\"),I=[],S=m.getCircleRadiusCorrection(),D=m.renderWindowCrop?.uncropClipSpace(m.clipSpaceToPixelsMatrix)??m.clipSpaceToPixelsMatrix;for(let E of i){let M=t.getTile(E),A=M.getBucket(r);if(!A)continue;let k=a?A.text:A.icon;if(!k?.segments.get().length||!k.hasVisibleVertices)continue;let H=k.programConfigurations.get(r.id),$=a||A.sdfIcons,U=a?A.textSizeData:A.iconSizeData,Y=y||m.pitch!==0,ue=e.useProgram(JC($,a,A),H),Rt=es(U,m.zoom),tt=e.style.map.terrain?.getTerrainData(E),ft,mt=[0,0],gt,yt,yr=null,Cr;if(a){if(gt=M.glyphAtlasTexture,yt=f.LINEAR,ft=M.glyphAtlasTexture.size,A.iconsInText){mt=M.imageAtlasTexture.size,yr=M.imageAtlasTexture;let He=U.kind===\"composite\"||U.kind===\"camera\"||A.pixelRatio!==e.pixelRatio;Cr=Y||e.options.rotating||e.options.zooming||He?f.LINEAR:f.NEAREST}}else{let He=r.layout.get(\"icon-size\").constantOr(0)!==1||A.iconsNeedLinear||A.pixelRatio!==e.pixelRatio;gt=M.imageAtlasTexture,yt=$||e.options.rotating||e.options.zooming||He||Y?f.LINEAR:f.NEAREST,ft=M.imageAtlasTexture.size}let Ya=Ct(M,1,e.transform.zoom),ei=ip(g,e.transform,Ya),ra=YM(y,g,e.transform,Ya),Ti=Ur(m,M,n,s),Ml=m.getProjectionData({overscaledTileID:E,applyGlobeMatrix:!p,applyTerrainMatrix:!0}),Pl=T&&A.hasTextData(),Cl=r.layout.get(\"icon-text-fit\")!==\"none\"&&Pl&&A.hasIconData(),Ka=r._unevaluatedLayout.hasValue(\"icon-offset\"),$t=r.layout.get(\"symbol-height-anchor\")===\"ground\";if(_){let He=Vr();ZM(He,ei);let Ge=e.style.map.terrain?(Ja,kl)=>e.style.map.terrain.getElevation(E,Ja,kl):void 0;JM(A,e,a,ei,He,y,u,r.layout.get(\"text-rotation-alignment\")===\"map\",E.toUnwrapped(),m.width,m.height,Ti,Ge)}let rr=a&&T||Cl,ti=_||rr?ZC:y?ei:D,Si=$&&r.paint.get(a?\"text-halo-width\":\"icon-halo-width\").constantOr(1)!==0,_t;_t=$?A.iconsInText?H3(U.kind,Rt,x,y,_,rr,e,ti,ra,Ti,ft,mt,S,Ka,$t):S1(U.kind,Rt,x,y,_,rr,e,ti,ra,Ti,a,ft,Si,S,Ka,$t):T1(U.kind,Rt,x,y,_,rr,e,ti,ra,Ti,a,ft,S,Ka,$t);let xt={program:ue,buffers:k,uniformValues:_t,projectionData:Ml,atlasTexture:gt,atlasTextureIcon:yr,atlasInterpolation:yt,atlasInterpolationIcon:Cr,isSDF:$,hasHalo:Si};if(v&&A.canOverlap){w=!0;let He=k.segments.get();for(let Ge of He)I.push({segments:new Ee([Ge]),sortKey:Ge.sortKey,state:xt,terrainData:tt})}else I.push({segments:k.segments,sortKey:0,state:xt,terrainData:tt})}w&&I.sort((E,M)=>E.sortKey-M.sortKey);let R=r.paint.get(a?\"text-halo-width\":\"icon-halo-width\").constantOr(null)??1/0,F=r.layout.get(\"text-letter-spacing\").constantOr(0)*24<0||R>1;for(let E of I){let M=E.state;d.activeTexture.set(f.TEXTURE0),M.atlasTexture.bind(M.atlasInterpolation,f.CLAMP_TO_EDGE),M.atlasTextureIcon&&(d.activeTexture.set(f.TEXTURE1),M.atlasTextureIcon&&M.atlasTextureIcon.bind(M.atlasInterpolationIcon,f.CLAMP_TO_EDGE));let A=M.isSDF&&M.hasHalo;if(A){let k=M.uniformValues;k.u_is_halo=1,F&&(k.u_is_plain=0,c0(M.buffers,E.segments,r,e,M.program,b,h,c,k,M.projectionData,E.terrainData),k.u_is_halo=0,k.u_is_plain=1)}c0(M.buffers,E.segments,r,e,M.program,b,h,c,M.uniformValues,M.projectionData,E.terrainData),A&&!F&&(M.uniformValues.u_is_halo=0)}}function c0(e,t,r,i,a,n,s,o,l,u,h){let c=i.context,p=c.gl;a.draw(c,p.TRIANGLES,n,s,o,he.backCCW,l,h,u,r.id,e.layoutVertexBuffer,e.indexBuffer,t,r.paint,i.transform.zoom,e.programConfigurations.get(r.id),e.dynamicLayoutVertexBuffer,e.opacityVertexBuffer)}function QC(e,t,r,i,a){if(e.renderPass!==\"translucent\")return;let{isRenderingToTexture:n}=a,s=r.paint.get(\"circle-opacity\"),o=r.paint.get(\"circle-stroke-width\"),l=r.paint.get(\"circle-stroke-opacity\"),u=!r.layout.get(\"circle-sort-key\").isConstant();if(s.constantOr(1)===0&&(o.constantOr(1)===0||l.constantOr(1)===0))return;let h=e.context,c=h.gl,p=e.transform,d=e.getDepthModeForSublayer(0,ne.ReadOnly),f=de.disabled,m=e.colorModeForRenderPass(),g=[],y=p.getCircleRadiusCorrection();for(let _ of i){let x=t.getTile(_),v=x.getBucket(r);if(!v)continue;let w=r.paint.get(\"circle-translate\"),b=r.paint.get(\"circle-translate-anchor\"),T=Ur(p,x,w,b),I=v.programConfigurations.get(r.id),S=e.useProgram(\"circle\",I),D=v.layoutVertexBuffer,R=v.indexBuffer,F=e.style.map.terrain?.getTerrainData(_),E={programConfiguration:I,program:S,layoutVertexBuffer:D,indexBuffer:R,uniformValues:x3(e,x,r,T,y),terrainData:F,projectionData:p.getProjectionData({overscaledTileID:_,applyGlobeMatrix:!n,applyTerrainMatrix:!0})};if(u){let M=v.segments.get();for(let A of M)g.push({segments:new Ee([A]),sortKey:A.sortKey,state:E})}else g.push({segments:v.segments,sortKey:0,state:E})}u&&g.sort((_,x)=>_.sortKey-x.sortKey);for(let _ of g){let{programConfiguration:x,program:v,layoutVertexBuffer:w,indexBuffer:b,uniformValues:T,terrainData:I,projectionData:S}=_.state,D=_.segments;v.draw(h,c.TRIANGLES,d,f,m,he.backCCW,T,I,S,r.id,w,b,D,r.paint,e.transform.zoom,x)}}var E1=class{constructor(e,t,r){let{x:i,y:a,width:n,height:s}=e;this.window={x:i,y:a,width:n,height:s},this.fullWidth=t,this.fullHeight=r,this.scaleX=t/n,this.scaleY=r/s,this.clipMatrix=Ca(),this.clipMatrix[0]=this.scaleX,this.clipMatrix[5]=this.scaleY,this.clipMatrix[12]=(t-2*i-n)/n,this.clipMatrix[13]=(2*a+s-r)/s,this.inverseClipMatrix=Ma(Vt(),this.clipMatrix)}cropClipSpace(e){return Jt(Vt(),this.clipMatrix,e)}uncropClipSpace(e){return Jt(Vt(),e,this.inverseClipMatrix)}get fragCoordOffset(){return[this.window.x,this.fullHeight-this.window.y-this.window.height]}};function ek(e,t,r,i,a){if(r.paint.get(\"heatmap-opacity\")===0)return;let n=e.context,{isRenderingToTexture:s,isRenderingGlobe:o}=a;if(e.style.map.terrain){for(let l of i){let u=t.getTile(l);t.hasRenderableParent(l)||(e.renderPass===\"offscreen\"?ik(e,u,r,l,o):e.renderPass===\"translucent\"&&ak(e,r,l,s,o))}n.viewport.set([0,0,e.width,e.height])}else{let l=nk(e.transform.renderWindowCrop);e.renderPass===\"offscreen\"?tk(e,t,r,i,l):e.renderPass===\"translucent\"&&rk(e,r,l)}}function tk(e,t,r,i,a){let n=e.context,s=n.gl,o=e.transform,l=de.disabled,u=new Re([s.ONE,s.ONE],J.transparent,[!0,!0,!0,!0]),h=a&&Jt(Vt(),a.clipMatrix,o.renderWindowCrop.inverseClipMatrix);sk(n,e,r,a),n.clear({color:J.transparent});for(let c of i){if(t.hasRenderableParent(c))continue;let p=t.getTile(c),d=p.getBucket(r);if(!d)continue;let f=d.programConfigurations.get(r.id),m=e.useProgram(\"heatmap\",f),g=o.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!0,applyTerrainMatrix:!1});if(h){let _=new Float32Array(Jt(Vt(),h,g.mainMatrix));g={...g,mainMatrix:_,fallbackMatrix:_}}let y=o.getCircleRadiusCorrection();m.draw(n,s.TRIANGLES,ne.disabled,l,u,he.backCCW,_1(p,o.zoom,r.paint.get(\"heatmap-intensity\"),y),null,g,r.id,d.layoutVertexBuffer,d.indexBuffer,d.segments,r.paint,o.zoom,f)}n.viewport.set([0,0,e.width,e.height])}function rk(e,t,r){let i=e.context,a=i.gl;i.setColorMode(e.colorModeForRenderPass());let n=t.heatmapFbos.get(Ia);n&&(i.activeTexture.set(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,n.colorAttachment.get()),i.activeTexture.set(a.TEXTURE1),A1(i,t).bind(a.LINEAR,a.CLAMP_TO_EDGE),e.useProgram(\"heatmapTexture\").draw(i,a.TRIANGLES,ne.disabled,de.disabled,e.colorModeForRenderPass(),he.disabled,x1(e,t,0,1,r),null,null,t.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,t.paint,e.transform.zoom))}function ik(e,t,r,i,a){let n=e.context,s=n.gl,o=de.disabled,l=new Re([s.ONE,s.ONE],J.transparent,[!0,!0,!0,!0]),u=t.getBucket(r);if(!u)return;let h=i.key,c=r.heatmapFbos.get(h);c||(c=I1(n,t.tileSize,t.tileSize),r.heatmapFbos.set(h,c)),n.bindFramebuffer.set(c.framebuffer),n.viewport.set([0,0,t.tileSize,t.tileSize]),n.clear({color:J.transparent});let p=u.programConfigurations.get(r.id),d=e.useProgram(\"heatmap\",p,!a),f=e.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),m=e.style.map.terrain.getTerrainData(i);d.draw(n,s.TRIANGLES,ne.disabled,o,l,he.disabled,_1(t,e.transform.zoom,r.paint.get(\"heatmap-intensity\"),1),m,f,r.id,u.layoutVertexBuffer,u.indexBuffer,u.segments,r.paint,e.transform.zoom,p)}function ak(e,t,r,i,a){let n=e.context,s=n.gl,o=e.transform;n.setColorMode(e.colorModeForRenderPass());let l=A1(n,t),u=r.key,h=t.heatmapFbos.get(u);if(!h)return;n.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,h.colorAttachment.get()),n.activeTexture.set(s.TEXTURE1),l.bind(s.LINEAR,s.CLAMP_TO_EDGE);let c=o.getProjectionData({overscaledTileID:r,applyTerrainMatrix:a,applyGlobeMatrix:!i});e.useProgram(\"heatmapTexture\").draw(n,s.TRIANGLES,ne.disabled,de.disabled,e.colorModeForRenderPass(),he.disabled,x1(e,t,0,1),null,c,t.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments,t.paint,o.zoom),h.destroy(),t.heatmapFbos.delete(u)}function nk(e){if(!e)return null;let{fullWidth:t,fullHeight:r,window:i}=e,a=Math.floor(t/4),n=Math.floor(r/4),s=Math.max(0,Math.floor(i.x*a/t)-1),o=Math.max(0,Math.floor(i.y*n/r)-1),l=Math.min(a,Math.ceil((i.x+i.width)*a/t)+1),u=Math.min(n,Math.ceil((i.y+i.height)*n/r)+1);return new E1({x:s,y:o,width:l-s,height:u-o},a,n)}function sk(e,t,r,i){let a=e.gl;e.activeTexture.set(a.TEXTURE1);let n=i?i.window.width:t.width/4,s=i?i.window.height:t.height/4;e.viewport.set([0,0,n,s]);let o=r.heatmapFbos.get(Ia);o?(a.bindTexture(a.TEXTURE_2D,o.colorAttachment.get()),e.bindFramebuffer.set(o.framebuffer)):(o=I1(e,n,s),r.heatmapFbos.set(Ia,o))}function I1(e,t,r){let i=e.gl,a=i.createTexture();i.bindTexture(i.TEXTURE_2D,a),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texStorage2D(i.TEXTURE_2D,1,i.RGBA16F,t,r);let n=e.createFramebuffer(t,r,!1,!1);return n.colorAttachment.set(a),n}function A1(e,t){return t.colorRampTexture||(t.colorRampTexture=new Oe(e,t.colorRamp,e.gl.RGBA)),t.colorRampTexture}function M1(e,t,r,i){let a=e.context,n=a.bindFramebuffer.get(),s=a.viewport.get(),[,,o,l]=s;return ok(e,o,l),a.viewport.set([0,0,o,l]),a.clear({color:J.transparent,depth:1,stencil:0}),e.currentStencilSource=void 0,e.renderTileClippingMasks(t,r,i),{compositeTarget:n,compositeViewport:s}}function ok(e,t,r){let i=e.context.gl;if(!e.layerOpacityFbo){let n=e.context.createFramebuffer(t,r,!0,!0),s=i.createTexture();i.bindTexture(i.TEXTURE_2D,s),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,t,r,0,i.RGBA,i.UNSIGNED_BYTE,null),n.colorAttachment.set(s),n.depthAttachment.set(e.context.createRenderbuffer(i.DEPTH_STENCIL,t,r)),e.layerOpacityFbo=n,e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);return}if(e.layerOpacityFbo.width===t&&e.layerOpacityFbo.height===r){e.context.bindFramebuffer.set(e.layerOpacityFbo.framebuffer);return}let a=e.layerOpacityFbo;i.bindTexture(i.TEXTURE_2D,a.colorAttachment.get()),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,t,r,0,i.RGBA,i.UNSIGNED_BYTE,null),e.context.bindRenderbuffer.set(a.depthAttachment.get()),i.renderbufferStorage(i.RENDERBUFFER,i.DEPTH_STENCIL,t,r),e.context.bindRenderbuffer.set(null),a.width=t,a.height=r,e.context.bindFramebuffer.set(a.framebuffer)}function P1(e,t,r,i){let a=e.context,n=a.gl;a.bindFramebuffer.set(r.compositeTarget),a.viewport.set(r.compositeViewport),a.activeTexture.set(n.TEXTURE0),n.bindTexture(n.TEXTURE_2D,e.layerOpacityFbo.colorAttachment.get()),e.useProgram(\"layerOpacity\").draw(a,n.TRIANGLES,ne.disabled,de.disabled,e.colorModeForRenderPass(),he.disabled,q3(t,0),null,null,i.id,e.viewportBuffer,e.quadTriangleIndexBuffer,e.viewportSegments,i.paint,e.transform.zoom),e.currentStencilSource=void 0}function C1(e,t,r,i,a,n,s,o){let l=256;if(a.stepInterpolant){let u=t.getSource().maxzoom,h=s.canonical.z===u?Math.ceil(1<<e.transform.maxZoom-s.canonical.z):1,c=n.maxLineLength/z*1024*h;l=te(Of(c),256,r.maxTextureSize)}return o.gradient=zo({expression:a.gradientExpression(),evaluationKey:\"lineProgress\",resolution:l,image:o.gradient||void 0,clips:n.lineClipsArray}),o.texture?o.texture.update(o.gradient):o.texture=new Oe(r,o.gradient,i.RGBA),o.version=a.gradientVersion,o.texture}function lk(e,t,r,i,a){e.activeTexture.set(t.TEXTURE0),r.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),i.updatePaintBuffers(a)}function uk(e,t,r,i,a,n){(a||e.lineAtlas.dirty)&&(t.activeTexture.set(r.TEXTURE0),e.lineAtlas.bind(t)),i.updatePaintBuffers(n)}function hk(e,t,r,i,a,n,s){let o=n.gradients[a.id],l=o.texture;a.gradientVersion!==o.version&&(l=C1(e,t,r,i,a,n,s,o)),r.activeTexture.set(i.TEXTURE0),l.bind(a.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE)}function ck(e,t,r,i,a,n,s,o,l){let u=n.gradients[a.id],h=u.texture;a.gradientVersion!==u.version&&(h=C1(e,t,r,i,a,n,s,u)),r.activeTexture.set(i.TEXTURE0),h.bind(a.stepInterpolant?i.NEAREST:i.LINEAR,i.CLAMP_TO_EDGE),r.activeTexture.set(i.TEXTURE1),e.lineAtlas.bind(r),o.updatePaintBuffers(l)}function pk(e,t,r,i,a){if(e.renderPass!==\"translucent\")return;let n=r.paint.get(\"line-opacity\"),s=r.paint.get(\"line-width\"),o=r.paint.get(\"line-layer-opacity\");if(n.constantOr(1)===0||s.constantOr(1)===0||o===0)return;let l=!!e.style.map.terrain;if(o<1){let u=M1(e,r,i,l);p0(e,t,r,i,a,l),P1(e,o,u,r);return}p0(e,t,r,i,a,l)}function p0(e,t,r,i,a,n){let{isRenderingToTexture:s}=a,o=e.getDepthModeForSublayer(0,ne.ReadOnly),l=e.colorModeForRenderPass(),u=r.paint.get(\"line-dasharray\"),h=u.constantOr(1),c=r.paint.get(\"line-pattern\"),p=c.constantOr(1),d=r.paint.get(\"line-gradient\"),f=r.getCrossfadeParameters(),m;m=p?\"linePattern\":h&&d?\"lineGradientSDF\":h?\"lineSDF\":d?\"lineGradient\":\"line\";let g=e.context,y=g.gl,_=e.transform,x=!0;for(let v of i){let w=t.getTile(v);if(p&&!w.patternsLoaded())continue;let b=w.getBucket(r);if(!b)continue;let T=b.programConfigurations.get(r.id),I=e.context.program.get(),S=e.useProgram(m,T),D=x||S.program!==I,R=n?e.getTerrainDataForTile(v,s):null,F=c.constantOr(null),E=u?.constantOr(null);if(F&&w.imageAtlas){let $=w.imageAtlas,U=$.patternPositions[F.to.toString()],Y=$.patternPositions[F.from.toString()];U&&Y&&T.setConstantPatternPositions(U,Y)}else if(E){let $=r.layout.get(\"line-cap\").constantOr(null)===\"round\",U=e.lineAtlas.getDash(E.to,$),Y=e.lineAtlas.getDash(E.from,$);T.setConstantDashPositions(U,Y)}let M=_.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!s,applyTerrainMatrix:!0}),A=_.getPixelScale(),k;p?(k=U3(e,w,r,A,f),lk(g,y,w,T,f)):h&&d?(k=j3(e,w,r,A,f,b.lineClipsArray.length),ck(e,t,g,y,r,b,v,T,f)):h?(k=$3(e,w,r,A,f),uk(e,g,y,T,D,f)):d?(k=N3(e,w,r,A,b.lineClipsArray.length),hk(e,t,g,y,r,b,v)):k=vl(e,w,r,A);let H=e.stencilModeForClipping(v);S.draw(g,y.TRIANGLES,o,H,l,he.disabled,k,R,M,r.id,b.layoutVertexBuffer,b.indexBuffer,b.segments,r.paint,e.transform.zoom,T,b.layoutVertexBuffer2),x=!1}}function k1(e,t,r,i,a){if(!r||!i?.imageAtlas)return;let n=i.imageAtlas.patternPositions,s=n[r.to.toString()],o=n[r.from.toString()];if(!s&&o&&(s=o),!o&&s&&(o=s),!s||!o){let l=a.getPaintProperty(t);s=n[l],o=n[l]}s&&o&&e.setConstantPatternPositions(s,o)}function dk(e,t,r,i,a){let n=r.paint.get(\"fill-color\"),s=r.paint.get(\"fill-opacity\"),o=r.paint.get(\"fill-layer-opacity\");if(s.constantOr(1)===0||o===0)return;if(o<1){if(e.renderPass!==\"translucent\")return;let h=M1(e,r,i,!!e.style.map.terrain);d0(e,t,r,i,a),P1(e,o,h,r);return}let l=r.paint.get(\"fill-pattern\"),u=e.opaquePassEnabledForLayer()&&!l.constantOr(1)&&n.constantOr(J.transparent).a===1&&s.constantOr(0)===1;if(u&&e.renderPass===\"opaque\"){let{isRenderingToTexture:h}=a,c=e.colorModeForRenderPass();hp(e,t,r,i,e.getDepthModeForSublayer(1,ne.ReadWrite),c,!1,h);return}if(u&&e.renderPass===\"translucent\"){D1(e,t,r,i,a);return}e.renderPass===\"translucent\"&&d0(e,t,r,i,a)}function d0(e,t,r,i,a){let{isRenderingToTexture:n}=a,s=e.colorModeForRenderPass();hp(e,t,r,i,e.getDepthModeForSublayer(1,ne.ReadOnly),s,!1,n),D1(e,t,r,i,a)}function D1(e,t,r,i,a){if(!r.paint.get(\"fill-antialias\"))return;let{isRenderingToTexture:n}=a,s=e.colorModeForRenderPass();hp(e,t,r,i,e.getDepthModeForSublayer(r.getPaintProperty(\"fill-outline-color\")?2:0,ne.ReadOnly),s,!0,n)}function hp(e,t,r,i,a,n,s,o){let l=e.context.gl,u=\"fill-pattern\",h=r.paint.get(u),c=h?.constantOr(1),p=r.getCrossfadeParameters(),d,f,m,g,y,_=e.transform,x=r.paint.get(\"fill-translate\"),v=r.paint.get(\"fill-translate-anchor\");s?(f=c&&!r.getPaintProperty(\"fill-outline-color\")?\"fillOutlinePattern\":\"fillOutline\",d=l.LINES):(f=c?\"fillPattern\":\"fill\",d=l.TRIANGLES);let w=h.constantOr(null);for(let b of i){let T=t.getTile(b);if(c&&!T.patternsLoaded())continue;let I=T.getBucket(r);if(!I)continue;let S=I.programConfigurations.get(r.id),D=e.useProgram(f,S),R=e.getTerrainDataForTile(b,o);c&&(e.context.activeTexture.set(l.TEXTURE0),T.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),S.updatePaintBuffers(p)),k1(S,u,w,T,r);let F=_.getProjectionData({overscaledTileID:b,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),E=Ur(_,T,x,v);if(!s)g=I.indexBuffer,y=I.segments,m=c?y1(e,p,T,E):m3(E);else{g=I.indexBuffer2,y=I.segments2;let A=[l.drawingBufferWidth,l.drawingBufferHeight];m=f===\"fillOutlinePattern\"&&c?y3(e,p,T,A,E):g3(A,E)}let M=e.stencilModeForClipping(b);D.draw(e.context,d,a,M,n,he.backCCW,m,R,F,r.id,I.layoutVertexBuffer,g,y,r.paint,e.transform.zoom,S)}}function fk(e,t,r,i,a){let n=r.paint.get(\"fill-extrusion-opacity\");if(n===0)return;let{isRenderingToTexture:s}=a;if(e.renderPass===\"translucent\"){e.context.setPolygonOffset(0,-1);let o=new ne(e.context.gl.LEQUAL,ne.ReadWrite,e.depthRangeFor3D);if(n===1&&!r.paint.get(\"fill-extrusion-pattern\").constantOr(1)){let l=e.colorModeForRenderPass();Bc(e,t,r,i,o,de.disabled,l,s)}else Bc(e,t,r,i,o,de.disabled,Re.disabled,s),Bc(e,t,r,i,o,e.stencilModeFor3D(),e.colorModeForRenderPass(),s);e.context.setPolygonOffset(0,0)}}function Bc(e,t,r,i,a,n,s,o){let l=e.context,u=l.gl,h=\"fill-extrusion-pattern\",c=r.paint.get(h),p=c.constantOr(1),d=r.getCrossfadeParameters(),f=r.paint.get(\"fill-extrusion-opacity\"),m=c.constantOr(null),g=e.transform;for(let y of i){let _=t.getTile(y),x=_.getBucket(r);if(!x)continue;let v=e.style.map.terrain?.getTerrainData(y),w=x.programConfigurations.get(r.id),b=e.useProgram(p?\"fillExtrusionPattern\":\"fillExtrusion\",w);p&&(e.context.activeTexture.set(u.TEXTURE0),_.imageAtlasTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE),w.updatePaintBuffers(d));let T=g.getProjectionData({overscaledTileID:y,applyGlobeMatrix:!o,applyTerrainMatrix:!0});k1(w,h,m,_,r);let I=Ur(g,_,r.paint.get(\"fill-extrusion-translate\"),r.paint.get(\"fill-extrusion-translate-anchor\")),S=r.paint.get(\"fill-extrusion-vertical-gradient\"),D=p?h3(e,S,f,I,y,d,_):g1(e,S,f,I);b.draw(l,l.gl.TRIANGLES,a,n,s,he.backCCW,D,v,T,r.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,r.paint,e.transform.zoom,w,e.style.map.terrain&&x.centroidVertexBuffer)}}function mk(e,t,r,i,a){if(e.renderPass!==\"offscreen\"&&e.renderPass!==\"translucent\")return;let{isRenderingToTexture:n}=a,s=e.context,o=e.style.projection.useSubdivision,l=e.getDepthModeForSublayer(0,ne.ReadOnly),u=e.colorModeForRenderPass();if(e.renderPass===\"offscreen\")gk(e,t,i,r,l,de.disabled,u),s.viewport.set([0,0,e.width,e.height]);else if(e.renderPass===\"translucent\")if(o){let[h,c,p]=e.stencilConfigForOverlapTwoPass(i);Oc(e,t,r,p,h,l,u,!1,n),Oc(e,t,r,p,c,l,u,!0,n)}else{let[h,c]=e.getStencilConfigForOverlapAndUpdateStencilID(i);Oc(e,t,r,c,h,l,u,!1,n)}}function Oc(e,t,r,i,a,n,s,o,l){let u=e.style.projection,h=e.context,c=e.transform,p=h.gl,d=[`#define NUM_ILLUMINATION_SOURCES ${r.paint.get(\"hillshade-highlight-color\").values.length}`],f=e.useProgram(\"hillshade\",null,!1,d),m=!e.options.moving;for(let g of i){let y=t.getTile(g),_=y.fbo;if(!_)continue;let x=u.getMeshFromTileID(h,g.canonical,o,!0,\"raster\"),v=e.getTerrainDataForTile(g,l);h.activeTexture.set(p.TEXTURE0),p.bindTexture(p.TEXTURE_2D,_.colorAttachment.get());let w=c.getProjectionData({overscaledTileID:g,aligned:m,applyGlobeMatrix:!l,applyTerrainMatrix:!0});f.draw(h,p.TRIANGLES,n,a[g.overscaledZ],s,he.backCCW,P3(e,y,r),v,w,r.id,x.vertexBuffer,x.indexBuffer,x.segments)}}function gk(e,t,r,i,a,n,s){let o=e.context,l=o.gl,u=i.paint.get(\"resampling\")===\"nearest\"?l.NEAREST:l.LINEAR;for(let h of r){let c=t.getTile(h),p=c.dem;if(!p?.data||!c.needsHillshadePrepare)continue;let d=p.dim,f=p.stride,m=p.getPixels();if(o.activeTexture.set(l.TEXTURE1),o.pixelStoreUnpackPremultiplyAlpha.set(!1),c.demTexture||(c.demTexture=e.getTileTexture(f)),c.demTexture){let y=c.demTexture;y.update(m,{premultiply:!1}),y.bind(l.NEAREST,l.CLAMP_TO_EDGE)}else c.demTexture=new Oe(o,m,l.RGBA,{premultiply:!1}),c.demTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE);o.activeTexture.set(l.TEXTURE0);let g=c.fbo;if(!g){let y=new Oe(o,{width:d,height:d,data:null},l.RGBA);y.bind(u,l.CLAMP_TO_EDGE),g=c.fbo=o.createFramebuffer(d,d,!0,!1),g.colorAttachment.set(y.texture)}o.bindFramebuffer.set(g.framebuffer),o.viewport.set([0,0,d,d]),e.useProgram(\"hillshadePrepare\").draw(o,l.TRIANGLES,a,n,s,he.disabled,C3(c.tileID,p),null,null,i.id,e.rasterBoundsBuffer,e.quadTriangleIndexBuffer,e.rasterBoundsSegments),c.needsHillshadePrepare=!1}}function yk(e,t,r,i,a){if(e.renderPass!==\"translucent\"||!i.length)return;let{isRenderingToTexture:n}=a,s=e.style.projection.useSubdivision,o=e.getDepthModeForSublayer(0,ne.ReadOnly),l=e.colorModeForRenderPass();if(s){let[u,h,c]=e.stencilConfigForOverlapTwoPass(i);Vc(e,t,r,c,u,o,l,!1,n),Vc(e,t,r,c,h,o,l,!0,n)}else{let[u,h]=e.getStencilConfigForOverlapAndUpdateStencilID(i);Vc(e,t,r,h,u,o,l,!1,n)}}var f0=0;function Vc(e,t,r,i,a,n,s,o,l){let u=e.style.projection,h=e.context,c=e.transform,p=h.gl,d=e.useProgram(\"colorRelief\"),f=!e.options.moving,m=r.paint.get(\"resampling\")===\"nearest\"?p.NEAREST:p.LINEAR,g=!0,y=0;for(let _ of i){let x=t.getTile(_),v=x.dem;if(g){f0||(f0=p.getParameter(p.MAX_TEXTURE_SIZE));let S=f0,{elevationTexture:D,colorTexture:R}=r.getColorRampTextures(h,S,v.getUnpackVector());h.activeTexture.set(p.TEXTURE1),D.bind(p.NEAREST,p.CLAMP_TO_EDGE),h.activeTexture.set(p.TEXTURE4),R.bind(p.LINEAR,p.CLAMP_TO_EDGE),g=!1,y=D.size[0]}if(!v?.data)continue;let w=v.stride;h.activeTexture.set(p.TEXTURE0),(!x.demTexture||x.needsColorReliefPrepare)&&(h.pixelStoreUnpackPremultiplyAlpha.set(!1),x.demTexture||(x.demTexture=e.getTileTexture(w)??new Oe(h,{width:w,height:w,data:null},p.RGBA)),x.demTexture.update(v.getPixels(),{premultiply:!1}),x.needsColorReliefPrepare=!1),x.demTexture.bind(m,p.CLAMP_TO_EDGE);let b=u.getMeshFromTileID(h,_.canonical,o,!0,\"raster\"),T=e.getTerrainDataForTile(_,l),I=c.getProjectionData({overscaledTileID:_,aligned:f,applyGlobeMatrix:!l,applyTerrainMatrix:!0});d.draw(h,p.TRIANGLES,n,a[_.overscaledZ],s,he.backCCW,F3(r,x.dem,y),T,I,r.id,b.vertexBuffer,b.indexBuffer,b.segments)}}var Nc=[new C(0,0),new C(z,0),new C(z,z),new C(0,z)];function _k(e,t,r,i,a){if(e.renderPass!==\"translucent\"||r.paint.get(\"raster-opacity\")===0||!i.length)return;let{isRenderingToTexture:n}=a,s=t.getSource(),o=e.style.projection.useSubdivision;if(s instanceof fs)al(e,t,r,i,null,!1,!1,s.tileCoords,s.imageWarp,s.flippedWindingOrder,n,s.getMesh(e.context,o));else if(o){let[l,u,h]=e.stencilConfigForOverlapTwoPass(i);al(e,t,r,h,l,!1,!0,Nc,Ga,!1,n),al(e,t,r,h,u,!0,!0,Nc,Ga,!1,n)}else{let[l,u]=e.getStencilConfigForOverlapAndUpdateStencilID(i);al(e,t,r,u,l,!1,!0,Nc,Ga,!1,n)}}function al(e,t,r,i,a,n,s,o,l,u=!1,h=!1,c=null){let p=i[i.length-1].overscaledZ,d=e.context,f=d.gl,{defines:m,mix:g,range:y}=wk(r,d,f),_=e.useProgram(\"raster\",null,!1,m),x=e.transform,v=e.style.projection,w=e.colorModeForRenderPass(),b=!e.options.moving,T=r.paint.get(\"raster-opacity\"),I=r.paint.get(\"resampling\")===\"nearest\"||r.paint.get(\"raster-resampling\")===\"nearest\"?f.NEAREST:f.LINEAR,S=r.paint.get(\"raster-fade-duration\"),D=!!e.style.map.terrain;for(let R of i){let F=e.getDepthModeForSublayer(R.overscaledZ-p,T===1?ne.ReadWrite:ne.ReadOnly,f.LESS),E=t.getTile(R);d.activeTexture.set(f.TEXTURE0),E.texture.bind(I,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),d.activeTexture.set(f.TEXTURE1);let{parentTile:M,parentScaleBy:A,parentTopLeft:k,fadeValues:H}=xk(E,t,S,D);E.fadeOpacity=H.tileOpacity,M?(M.fadeOpacity=H.parentTileOpacity,M.texture.bind(I,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)):E.texture.bind(I,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST),E.texture.useMipmap&&d.extTextureFilterAnisotropic&&e.transform.pitch>e.options.anisotropicFilterPitch&&f.texParameterf(f.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax);let $=e.getTerrainDataForTile(R,h),U=x.getProjectionData({overscaledTileID:R,aligned:b,applyGlobeMatrix:!h,applyTerrainMatrix:!0}),Y=vM(k,A,H.fadeMix,r,o,l,4,g,y),ue=c??v.getMeshFromTileID(d,R.canonical,n,s,\"raster\"),Rt=a?a[R.overscaledZ]:de.disabled;_.draw(d,f.TRIANGLES,F,Rt,w,u?he.frontCCW:he.backCCW,Y,$,U,r.id,ue.vertexBuffer,ue.indexBuffer,ue.segments)}}function xk(e,t,r,i){let a={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(r===0||i)return a;if(e.fadingParentID){let n=t.getLoadedTile(e.fadingParentID);if(!n)return a;let s=2**(n.tileID.overscaledZ-e.tileID.overscaledZ);return{parentTile:n,parentScaleBy:s,parentTopLeft:[e.tileID.canonical.x*s%1,e.tileID.canonical.y*s%1],fadeValues:vk(e,n,r)}}return e.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:bk(e,r)}:a}function vk(e,t,r){let i=ye(),a=(i-e.timeAdded)/r,n=(i-t.timeAdded)/r,s=e.fadingDirection===1,o=te(a,0,1),l=te(1-n,0,1),u=s?o:l;return{tileOpacity:u,parentTileOpacity:s?l:o,fadeMix:{opacity:1,mix:1-u}}}function bk(e,t){let r=(ye()-e.timeAdded)/t,i=te(r,0,1);return{tileOpacity:i,fadeMix:{opacity:i,mix:0}}}function wk(e,t,r){let i=[],a=[0,0,0,0],n;if(e.paint.get(\"raster-color\")){i.push(\"#define RASTER_COLOR;\"),a=e.paint.get(\"raster-color-mix\"),n=e.paint.get(\"raster-color-range\"),t.activeTexture.set(r.TEXTURE4);let s=e.colorRampTexture;s||(s=e.colorRampTexture=new Oe(t,e.colorRamp,r.RGBA)),s.bind(r.LINEAR,r.CLAMP_TO_EDGE)}return{defines:i,mix:a,range:n}}function Tk(e,t,r,i,a){let n=r.paint.get(\"background-color\"),s=r.paint.get(\"background-opacity\");if(s===0)return;let{isRenderingToTexture:o}=a,l=e.context,u=l.gl,h=e.style.projection,c=e.transform,p=c.tileSize,d=r.paint.get(\"background-pattern\");if(e.isPatternMissing(d))return;let f=!d&&n.a===1&&s===1&&e.opaquePassEnabledForLayer()?\"opaque\":\"translucent\";if(e.renderPass!==f)return;let m=de.disabled,g=e.getDepthModeForSublayer(0,f===\"opaque\"?ne.ReadWrite:ne.ReadOnly),y=e.colorModeForRenderPass(),_=e.useProgram(d?\"backgroundPattern\":\"background\"),x=i||Za(c,{tileSize:p,terrain:e.style.map.terrain});d&&(l.activeTexture.set(u.TEXTURE0),e.patternAtlas.bind(e.context));let v=r.getCrossfadeParameters();for(let w of x){let b=c.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!o,applyTerrainMatrix:!0}),T=d?Q3(s,e,d,{tileID:w,tileSize:p},v):J3(s,n),I=e.getTerrainDataForTile(w,o),S=h.getMeshFromTileID(l,w.canonical,!1,!0,\"raster\");_.draw(l,u.TRIANGLES,g,m,y,he.backCCW,T,I,b,r.id,S.vertexBuffer,S.indexBuffer,S.segments)}}var Sk=new J(1,0,0,1),Ek=new J(0,1,0,1),Ik=new J(0,0,1,1),Ak=new J(1,0,1,1),Mk=new J(0,1,1,1);function Pk(e){let t=e.transform.padding;m0(e,e.transform.height-(t.top||0),3,Sk),m0(e,t.bottom||0,3,Ek),g0(e,t.left||0,3,Ik),g0(e,e.transform.width-(t.right||0),3,Ak);let r=e.transform.centerPoint;Ck(e,r.x,e.transform.height-r.y,Mk)}function Ck(e,t,r,i){_l(e,t-1,r-10,2,20,i),_l(e,t-10,r-1,20,2,i)}function m0(e,t,r,i){_l(e,0,t+r/2,e.transform.width,r,i)}function g0(e,t,r,i){_l(e,t-r/2,0,r,e.transform.height,i)}function _l(e,t,r,i,a,n){let s=e.context,o=s.gl;o.enable(o.SCISSOR_TEST),o.scissor(t*e.pixelRatio,r*e.pixelRatio,i*e.pixelRatio,a*e.pixelRatio),s.clear({color:n}),o.disable(o.SCISSOR_TEST)}function kk(e,t,r){for(let i of r)Dk(e,t,i)}function Dk(e,t,r){let i=e.context,a=i.gl,n=e.useProgram(\"debug\"),s=ne.disabled,o=de.disabled,l=e.colorModeForRenderPass(),u=\"$debug\",h=e.style.map.terrain?.getTerrainData(r);i.activeTexture.set(a.TEXTURE0);let c=t.getTileByID(r.key).latestRawTileData?.byteLength||0,p=Math.floor(c/1024),d=t.getTile(r).tileSize,f=512/Math.min(d,512)*(r.overscaledZ/e.transform.zoom)*.5,m=r.canonical.toString();r.overscaledZ!==r.canonical.z&&(m+=` => ${r.overscaledZ}`),Fk(e,`${m} ${p}kB`);let g=e.transform.getProjectionData({overscaledTileID:r,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(i,a.TRIANGLES,s,o,Re.alphaBlended,he.disabled,n0(J.transparent,f),null,g,u,e.debugBuffer,e.quadTriangleIndexBuffer,e.debugSegments),n.draw(i,a.LINE_STRIP,s,o,l,he.disabled,n0(J.red),h,g,u,e.debugBuffer,e.tileBorderIndexBuffer,e.debugSegments)}function Fk(e,t){e.initDebugOverlayCanvas();let r=e.debugOverlayCanvas,i=e.context.gl,a=e.debugOverlayCanvas.getContext(\"2d\");a.clearRect(0,0,r.width,r.height),a.shadowColor=\"white\",a.shadowBlur=2,a.lineWidth=1.5,a.strokeStyle=\"white\",a.textBaseline=\"top\",a.font=\"bold 36px Open Sans, sans-serif\",a.fillText(t,5,5),a.strokeText(t,5,5),e.debugOverlayTexture.update(r),e.debugOverlayTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}function zk(e,t){let r=null,i=Object.values(e._layers).flatMap(o=>o.source&&!o.isHidden(t)?[e.tileManagers[o.source]]:[]),a=i.filter(o=>o.getSource().type===\"vector\"),n=i.filter(o=>o.getSource().type!==\"vector\"),s=o=>{(!r||r.getSource().maxzoom<o.getSource().maxzoom)&&(r=o)};for(let o of a)s(o);if(!r)for(let o of n)s(o);return r}function Rk(e,t,r,i){let{isRenderingGlobe:a}=i,n=e.context,s=r.implementation,o=e.style.projection,l=e.transform,u=l.getProjectionDataForCustomLayer(a),h=l.renderWindowCrop,c={farZ:l.farZ,nearZ:l.nearZ,fov:l.fov*Math.PI/180,modelViewProjectionMatrix:h?.cropClipSpace(l.modelViewProjectionMatrix)??l.modelViewProjectionMatrix,projectionMatrix:h?.cropClipSpace(l.projectionMatrix)??l.projectionMatrix,shaderData:{variantName:o.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;\nuniform mat4 u_projection_matrix;\n${o.shaderPreludeCode.vertexSource}`,define:o.shaderDefine},defaultProjectionData:u,getProjectionData:d=>l.getProjectionData({overscaledTileID:new nt(d.tileID.canonical.z,d.tileID.wrap??0,d.tileID.canonical.z,d.tileID.canonical.x,d.tileID.canonical.y),aligned:d.aligned,applyGlobeMatrix:d.applyGlobeMatrix,applyTerrainMatrix:d.applyTerrainMatrix})},p=s.renderingMode?s.renderingMode:\"2d\";if(e.renderPass===\"offscreen\"){let d=s.prerender;d&&(e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),d.call(s,n.gl,c),n.setDirty(),e.setBaseState())}else if(e.renderPass===\"translucent\"){e.setCustomLayerDefaults(),n.setColorMode(e.colorModeForRenderPass()),n.setStencilMode(de.disabled);let d=p===\"3d\"?e.getDepthModeFor3D():e.getDepthModeForSublayer(0,ne.ReadOnly);n.setDepthMode(d),s.render(n.gl,c),n.setDirty(),e.setBaseState(),n.bindFramebuffer.set(null)}}function Lk(e,t){let r=e.context,i=r.gl,a=e.transform,n=Re.unblended,s=new ne(i.LEQUAL,ne.ReadWrite,[0,1]),o=t.tileManager.getRenderableTiles(),l=e.useProgram(\"terrainDepth\");r.bindFramebuffer.set(t.getFramebuffer().framebuffer),r.viewport.set([0,0,e.width/devicePixelRatio,e.height/devicePixelRatio]),r.clear({color:J.white,depth:1});for(let u of o){let h=t.getTerrainMesh(u.tileID),c=t.getTerrainData(u.tileID),p=a.getProjectionData({overscaledTileID:u.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),d=r3(t.getSkirtLength(a.zoom));l.draw(r,i.TRIANGLES,s,de.disabled,n,he.backCCW,d,c,p,\"terrain\",h.vertexBuffer,h.indexBuffer,h.segments)}r.bindFramebuffer.set(null),r.viewport.set([0,0,e.width,e.height])}function Bk(e,t,r,i){let{isRenderingGlobe:a}=i,n=e.context,s=n.gl,o=e.transform,l=e.colorModeForRenderPass(),u=e.getDepthModeFor3D(),h=e.useProgram(\"terrain\");n.bindFramebuffer.set(null),n.viewport.set([0,0,e.width,e.height]);for(let c of r){let p=t.getTerrainMesh(c.tileID),d=e.renderToTexture.getTexture(c),f=t.getTerrainData(c.tileID);n.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,d.texture);let m=t.getSkirtLength(o.zoom),g=o.calculateFogMatrix(c.tileID.toUnwrapped()),y=t3(m,g,e.style.sky,o.pitch,a),_=o.getProjectionData({overscaledTileID:c.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(n,s.TRIANGLES,u,de.disabled,l,he.backCCW,y,f,_,\"terrain\",p.vertexBuffer,p.indexBuffer,p.segments)}}function F1(e,t){if(!t.mesh){let r=new Gr;r.emplaceBack(-1,-1),r.emplaceBack(1,-1),r.emplaceBack(1,1),r.emplaceBack(-1,1);let i=new pr;i.emplaceBack(0,1,2),i.emplaceBack(0,2,3),t.mesh=new ds(e.createVertexBuffer(r,Hi.members),e.createIndexBuffer(i),Ee.simpleSegment(0,0,r.length,i.length))}return t.mesh}function Ok(e,t){let r=e.context,i=r.gl,a=iC(t,e.transform,e.pixelRatio),n=new ne(i.LEQUAL,ne.ReadWrite,[0,1]),s=de.disabled,o=e.colorModeForRenderPass(),l=e.useProgram(\"sky\"),u=F1(r,t);l.draw(r,i.TRIANGLES,n,s,o,he.disabled,a,null,void 0,\"sky\",u.vertexBuffer,u.indexBuffer,u.segments)}function Vk(e,t){let r=e.getCartesianPosition();Af(r,r);let i=Kt(new Float64Array(16));return e.properties.get(\"anchor\")===\"map\"&&(Nr(i,i,t.rollInRadians),Ni(i,i,-t.pitchInRadians),Nr(i,i,t.bearingInRadians),Ni(i,i,t.center.lat*Math.PI/180),uh(i,i,-t.center.lng*Math.PI/180)),Mf(r,r,i),r}function Nk(e,t,r){let i=e.context,a=i.gl,n=e.useProgram(\"atmosphere\"),s=new ne(a.LEQUAL,ne.ReadOnly,[0,1]),o=e.transform,l=Vk(r,e.transform),u=o.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),h=t.properties.get(\"atmosphere-blend\")*u.projectionTransition;if(h===0)return;let c=xl(o.worldSize,o.center.lat),p=o.inverseProjectionMatrix,d=new Float64Array(4);d[3]=1,We(d,d,o.modelViewProjectionMatrix),d[0]/=d[3],d[1]/=d[3],d[2]/=d[3],d[3]=1,We(d,d,p),d[0]/=d[3],d[1]/=d[3],d[2]/=d[3],d[3]=1;let f=[d[0],d[1],d[2]],m=tC(l,h,f,c,p),g=F1(i,t);n.draw(i,a.TRIANGLES,s,de.disabled,Re.alphaBlended,he.disabled,m,null,null,\"atmosphere\",g.vertexBuffer,g.indexBuffer,g.segments)}var Uk={symbol:WC,circle:QC,heatmap:ek,line:pk,fill:dk,fillExtrusion:fk,hillshade:mk,colorRelief:yk,raster:_k,background:Tk,sky:Ok,atmosphere:Nk,custom:Rk,debug:kk,debugPadding:Pk,terrainDepth:Lk},Yi,$k=(Yi=class{constructor(t,r){this.drawFunctions=Uk,this.context=new GC(t),this.transform=r,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:Kt(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Wc.maxOverzooming+Wc.maxUnderzooming+1,this.depthEpsilon=1/2**16,this.crossTileSymbolIndex=new W0}resize(t,r,i){this.resizeDrawingBuffer(Math.floor(t*i),Math.floor(r*i),i)}resizeDrawingBuffer(t,r,i){if(this.width=t,this.height=r,this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let a of this.style._order)this.style._layers[a].resize()}setup(){let t=this.context,r=new Gr;r.emplaceBack(0,0),r.emplaceBack(z,0),r.emplaceBack(0,z),r.emplaceBack(z,z),this.tileExtentBuffer=t.createVertexBuffer(r,Hi.members),this.tileExtentSegments=Ee.simpleSegment(0,0,4,2);let i=new Gr;i.emplaceBack(0,0),i.emplaceBack(z,0),i.emplaceBack(0,z),i.emplaceBack(z,z),this.debugBuffer=t.createVertexBuffer(i,Hi.members),this.debugSegments=Ee.simpleSegment(0,0,4,5);let a=new Gg;a.emplaceBack(0,0,0,0),a.emplaceBack(z,0,z,0),a.emplaceBack(0,z,0,z),a.emplaceBack(z,z,z,z),this.rasterBoundsBuffer=t.createVertexBuffer(a,YP.members),this.rasterBoundsSegments=Ee.simpleSegment(0,0,4,2);let n=new Gr;n.emplaceBack(0,0),n.emplaceBack(z,0),n.emplaceBack(0,z),n.emplaceBack(z,z),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(n,Hi.members),this.rasterBoundsSegmentsPosOnly=Ee.simpleSegment(0,0,4,5);let s=new Gr;s.emplaceBack(0,0),s.emplaceBack(1,0),s.emplaceBack(0,1),s.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(s,Hi.members),this.viewportSegments=Ee.simpleSegment(0,0,4,2);let o=new Wg;o.emplaceBack(0),o.emplaceBack(1),o.emplaceBack(3),o.emplaceBack(2),o.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(o);let l=new pr;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);let u=this.context.gl;this.stencilClearMode=new de({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new ds(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,r=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=Vr();ur(i,0,this.width,this.height,0,0,1),at(i,i,[r.drawingBufferWidth,r.drawingBufferHeight,0]);let a={mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i,clipAntimeridian:!1};this.useProgram(\"clippingMask\",null,!0).draw(t,r.TRIANGLES,ne.disabled,this.stencilClearMode,Re.disabled,he.disabled,null,null,a,\"$clipping\",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(t,r,i){if(this.currentStencilSource===t.source||!t.isTileClipped()||!r?.length)return;this.currentStencilSource=t.source,this.nextStencilID+r.length>256&&this.clearStencil();let a=this.context;a.setColorMode(Re.disabled),a.setDepthMode(ne.disabled);let n={};for(let s of r)n[s.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(n,r,i,!0),this._renderTileMasks(n,r,i,!1),this._tileClippingMaskIDs=n}_renderTileMasks(t,r,i,a){let n=this.context,s=n.gl,o=this.style.projection,l=this.transform,u=this.useProgram(\"clippingMask\");for(let h of r){let c=t[h.key],p=this.getTerrainDataForTile(h,i),d=o.getMeshFromTileID(this.context,h.canonical,a,!0,\"stencil\"),f=l.getProjectionData({overscaledTileID:h,applyGlobeMatrix:!i,applyTerrainMatrix:!0});u.draw(n,s.TRIANGLES,ne.disabled,new de({func:s.ALWAYS,mask:0},c,255,s.KEEP,s.KEEP,s.REPLACE),Re.disabled,i?he.disabled:he.backCCW,null,p,f,\"$clipping\",d.vertexBuffer,d.indexBuffer,d.segments)}}getTerrainDataForTile(t,r){return r&&this.style.projection?.name===\"mercator\"?null:this.style.map.terrain?.getTerrainData(t)||null}_renderTilesDepthBuffer(){let t=this.context,r=t.gl,i=this.style.projection,a=this.transform,n=this.useProgram(\"depth\"),s=this.getDepthModeFor3D(),o=Za(a,{tileSize:a.tileSize});for(let l of o){let u=this.style.map.terrain?.getTerrainData(l),h=i.getMeshFromTileID(this.context,l.canonical,!0,!0,\"raster\"),c=a.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!0,applyTerrainMatrix:!0});n.draw(t,r.TRIANGLES,s,de.disabled,Re.disabled,he.backCCW,null,u,c,\"$clipping\",h.vertexBuffer,h.indexBuffer,h.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,r=this.context.gl;return new de({func:r.NOTEQUAL,mask:255},t,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(t){let r=this.context.gl;return new de({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,r.KEEP,r.KEEP,r.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let r=this.context.gl,i=t.sort((s,o)=>o.overscaledZ-s.overscaledZ),a=i[i.length-1].overscaledZ,n=i[0].overscaledZ-a+1;if(n>1){this.currentStencilSource=void 0,this.nextStencilID+n>256&&this.clearStencil();let s={};for(let o=0;o<n;o++)s[o+a]=new de({func:r.GEQUAL,mask:255},o+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=n,[s,i]}return[{[a]:de.disabled},i]}stencilConfigForOverlapTwoPass(t){let r=this.context.gl,i=t.sort((s,o)=>o.overscaledZ-s.overscaledZ),a=i[i.length-1].overscaledZ,n=i[0].overscaledZ-a+1;if(this.clearStencil(),n>1){let s={},o={};for(let l=0;l<n;l++)s[l+a]=new de({func:r.GREATER,mask:255},n+1+l,255,r.KEEP,r.KEEP,r.REPLACE),o[l+a]=new de({func:r.GREATER,mask:255},1+l,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID=n*2+1,[s,o,i]}return this.nextStencilID=3,[{[a]:new de({func:r.GREATER,mask:255},2,255,r.KEEP,r.KEEP,r.REPLACE)},{[a]:new de({func:r.GREATER,mask:255},1,255,r.KEEP,r.KEEP,r.REPLACE)},i]}colorModeForRenderPass(){let t=this.context.gl;if(this._showOverdrawInspector){let r=.125;return new Re([t.CONSTANT_COLOR,t.ONE],new J(r,r,r,0),[!0,!0,!0,!0])}return this.renderPass===\"opaque\"?Re.unblended:Re.alphaBlended}getDepthModeForSublayer(t,r,i){if(!this.opaquePassEnabledForLayer())return ne.disabled;let a=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new ne(i||this.context.gl.LEQUAL,r,[a,a])}getDepthModeFor3D(){return new ne(this.context.gl.LEQUAL,ne.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,r){this.style=t,this.options=r,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.patternAtlas=t.patternAtlas,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(ye()),this.imageManager.beginFrame();let i=this.style._order,a=this.style.tileManagers,n={},s={},o={},l={isRenderingToTexture:!1,isRenderingGlobe:t.projection?.transitionState>0};for(let h in a){let c=a[h];c.used&&c.prepare(this.context),n[h]=c.getVisibleCoordinates(!1),s[h]=n[h].slice().reverse(),o[h]=c.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let h=0;h<i.length;h++){let c=i[h];if(this.style._layers[c].is3D()){this.opaquePassCutoff=h;break}}this.maybeDrawDepth(),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass=\"offscreen\";for(let h of i){let c=this.style._layers[h];if(!c.hasOffscreenPass()||c.isHidden(this.transform.zoom))continue;let p=s[c.source];c.type!==\"custom\"&&!p.length||this.renderLayer(this,a[c.source],c,p,l)}if(this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:r.showOverdrawInspector?J.black:J.transparent,depth:1}),this.clearStencil(),this.style.sky&&this.drawFunctions.sky(this,this.style.sky),this._showOverdrawInspector=r.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass=\"opaque\",this.currentLayer=i.length-1;this.currentLayer>=0;this.currentLayer--){let h=this.style._layers[i[this.currentLayer]],c=a[h.source],p=n[h.source];this.renderTileClippingMasks(h,p,!1),this.renderLayer(this,c,h,p,l)}this.renderPass=\"translucent\";let u=!1;for(this.currentLayer=0;this.currentLayer<i.length;this.currentLayer++){let h=this.style._layers[i[this.currentLayer]],c=a[h.source];if(this.renderToTexture?.renderLayer(h,l))continue;!this.opaquePassEnabledForLayer()&&!u&&(u=!0,l.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());let p=(h.type===\"symbol\"?o:s)[h.source];this.renderTileClippingMasks(h,n[h.source],!!this.renderToTexture),this.renderLayer(this,c,h,p,l)}if(l.isRenderingGlobe&&this.drawFunctions.atmosphere(this,this.style.sky,this.style.light),this.options.showTileBoundaries){let h=zk(this.style,this.transform.zoom);h&&this.drawFunctions.debug(this,h,h.getVisibleCoordinates())}this.options.showPadding&&this.drawFunctions.debugPadding(this),this.context.setDefault()}maybeDrawDepth(){if(!this.style?.map?.terrain)return;let t=this.terrainFacilitator.matrix,r=this.transform.modelViewProjectionMatrix,i=this.terrainFacilitator.depthDirty;i||(i=!Ef(t,r)),i||(i=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),i&&(Tf(t,r),this.terrainFacilitator.renderTime=ye(),this.terrainFacilitator.depthDirty=!1,this.drawFunctions.terrainDepth(this,this.style.map.terrain))}renderLayer(t,r,i,a,n){if(i.isHidden(this.transform.zoom)||i.type!==\"background\"&&i.type!==\"custom\"&&!(a||[]).length)return;this.id=i.id;let s=this.drawFunctions;nc(i)?s.symbol(t,r,i,a,this.style.placement.variableOffsets,n):ty(i)?s.circle(t,r,i,a,n):iy(i)?s.heatmap(t,r,i,a,n):Sy(i)?s.line(t,r,i,a,n):fy(i)?s.fill(t,r,i,a,n):by(i)?s.fillExtrusion(t,r,i,a,n):ay(i)?s.hillshade(t,r,i,a,n):sy(i)?s.colorRelief(t,r,i,a,n):Ro(i)?s.raster(t,r,i,a,n):ky(i)?s.background(t,r,i,a,n):Fy(i)&&s.custom(t,r,i,n)}saveTileTexture(t){let r=this._tileTextures[t.size[0]];r?r.length<Yi.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?r.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let r=this._tileTextures[t];return r&&r.length>0?r.pop():null}acquireRTT(t){let r=this.context.gl,i=this._rttObjectRecyclePool.pop();if(i)return i.size!==t&&(r.bindTexture(r.TEXTURE_2D,i.texture.texture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,t,0,r.RGBA,r.UNSIGNED_BYTE,null),i.texture.size=[t,t],i.size=t),i;let a=new Oe(this.context,{width:t,height:t,data:null},r.RGBA);return a.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:a,size:t}}bindRTT(t){let r=this.context.gl,i=t.size;if(!this._rttSharedFbo){let a=this.context.createFramebuffer(i,i,!0,!0),n=this.context.createRenderbuffer(r.DEPTH_STENCIL,i,i);a.depthAttachment.set(n),this._rttSharedFbo={fbo:a,depthRenderbuffer:n,size:i}}this._rttSharedFbo.size!==i&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,i,i),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=i,this._rttSharedFbo.fbo.height=i,this._rttSharedFbo.size=i),this._rttSharedFbo.fbo.colorAttachment.set(t.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(t){this._rttObjectRecyclePool.push(t)}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let r=this.patternAtlas.getPattern(t.from.toString()),i=this.patternAtlas.getPattern(t.to.toString());return!r||!i}useProgram(t,r,i=!1,a=[]){var m;this.cache||(this.cache={});let n=!!this.style.map.terrain,s=this.style.projection,o=i?Ar.projectionMercator:s.shaderPreludeCode,l=i?X0:s.shaderDefine,u=`/${i?H0:s.shaderVariantName}`,h=r?r.cacheKey:\"\",c=this._showOverdrawInspector?\"/overdraw\":\"\",p=n?\"/terrain\":\"\",d=a?`/${a.join(\"/\")}`:\"\",f=t+h+u+c+p+d;return(m=this.cache)[f]||(m[f]=new s3(this.context,Ar[t],r,aC[t],this._showOverdrawInspector,n,o,l,a)),this.cache[f]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement(\"canvas\"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new Oe(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){if(this._tileTextures){for(let t in this._tileTextures){let r=this._tileTextures[t];if(r)for(let i of r)i.destroy()}this._tileTextures={}}for(let t of this._rttObjectRecyclePool)t.texture.destroy();if(this._rttObjectRecyclePool=[],this._rttSharedFbo){this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let t=this.context.gl;t.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),t.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}if(this.layerOpacityFbo?.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&this.tileExtentMesh.vertexBuffer?.destroy(),this.tileExtentMesh&&this.tileExtentMesh.indexBuffer?.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(let t in this.cache){let r=this.cache[t];r?.program&&this.context.gl.deleteProgram(r.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:r}=this.context.gl;return this.width!==t||this.height!==r}},Yi.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50,Yi),z1=class extends Error{constructor(e,t){super(\"WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL\"),this.name=\"GPUInitializationError\",this.requestedAttributes=e,this.statusMessage=t?.statusMessage??null}},y0=class extends Error{constructor(e,t,r,i){super(`A ${e}\\xD7${t} render window does not fit in the drawing buffer this browser provides (${r}\\xD7${i}).`),this.name=\"RenderWindowSizeError\",this.requestedWidth=e,this.requestedHeight=t,this.availableWidth=r,this.availableHeight=i}},jk=class extends Error{constructor(){super(\"setRenderWindow needs a loaded, still map: call it after the map fires `idle`.\"),this.name=\"RenderWindowNotSettledError\"}};function R1(e,t){let r=!1,i=null,a,n=()=>{i=null,r&&(r=(e(...a),i=setTimeout(n,t),!1))};return(...s)=>(r=!0,a=s,i||n(),i)}var Gk=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace(\"#\",\"\")),this._getCurrentHash=()=>{let t=this._getHashParams();return this._hashName?(t.get(this._hashName)||\"\").split(\"/\"):([...t.keys()][0]??\"\").split(\"/\")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let r=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:r,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getHashParams();if(this._hashName)t.delete(this._hashName);else{let n=Array.from(t.keys());n.length>0&&t.delete(n[0])}let r=decodeURIComponent(t.toString()).replace(/=&/g,\"&\").replace(/=$/g,\"\"),i=r?`#${r}`:\"\",a=window.location.href.replace(/(#.+)?$/,i);a=a.replace(\"&&\",\"&\"),window.history.replaceState(window.history.state,null,a)},this._updateHash=R1(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener(\"hashchange\",this._onHashChange,!1),this._map.on(\"moveend\",this._updateHash),this}remove(){return removeEventListener(\"hashchange\",this._onHashChange,!1),this._map.off(\"moveend\",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let t=this._map.getCenter(),r=Math.round(this._map.getZoom()*100)/100,i=10**Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.round(t.lng*i)/i,n=Math.round(t.lat*i)/i,s=this._map.getBearing(),o=this._map.getPitch(),l=\"\";if(l+=e?`/${a}/${n}/${r}`:`${r}/${n}/${a}`,(s||o)&&(l+=`/${Math.round(s*10)/10}`),o&&(l+=`/${Math.round(o)}`),this._hashName){let u=this._getHashParams();return u.set(this._hashName,l),`#${decodeURIComponent(u.toString()).replace(/=&/g,\"&\").replace(/=$/g,\"\")}`}return`#${l}`}_isValidHash(e){if(e.length<3||e.some(a=>isNaN(+a)))return!1;try{new K(+e[2],+e[1])}catch{return!1}let t=+e[0],r=+(e[3]||0),i=+(e[4]||0);return t>=this._map.getMinZoom()&&t<=this._map.getMaxZoom()&&r>=-180&&r<=180&&i>=this._map.getMinPitch()&&i<=this._map.getMaxPitch()}},ms={linearity:.3,easing:uo(0,0,.3,1)},qk=j({deceleration:2500,maxSpeed:1400},ms),Zk=j({deceleration:20,maxSpeed:1400},ms),Wk=j({deceleration:1e3,maxSpeed:360},ms),Xk=j({deceleration:1e3,maxSpeed:90},ms),Hk=j({deceleration:1e3,maxSpeed:360},ms),Yk=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ye(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,t=ye();for(;e.length>0&&t-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,t=ye()-60,r=Math.max(0,e.length-2);for(;r>0&&e[r-1].time>=t;)r--;return e.slice(r)}_onMoveEnd(e){this._drainInertiaBuffer();let t=this._getVelocityEntries();if(t.length<2){this.clear();return}let r={zoom:0,bearing:0,pitch:0,roll:0,pan:new C(0,0),pinchAround:void 0,around:void 0};for(let{settings:n}of t)n.around&&(r.around=n.around),n.pinchAround&&(r.pinchAround=n.pinchAround);for(let{settings:n}of t.slice(1))r.zoom+=n.zoomDelta||0,r.bearing+=n.bearingDelta||0,r.pitch+=n.pitchDelta||0,r.roll+=n.rollDelta||0,n.panDelta&&r.pan._add(n.panDelta);if(!r.pan.mag()&&!r.zoom&&!r.bearing&&!r.pitch&&!r.roll){this.clear();return}let i=ye()-t[0].time,a={};if(r.pan.mag()){let n=cs(r.pan.mag(),i,j({},qk,e||{})),s=r.pan.mult(n.amount/r.pan.mag()),o=this._map._camera.cameraHelper.handlePanInertia(s,this._map._camera.transform);a.center=o.easingCenter,a.offset=o.easingOffset,hs(a,n)}if(r.zoom){let n=cs(r.zoom,i,Zk);a.zoom=Dt(this._map.getZoom()+n.amount,this._map.getZoomSnap(),n.amount),hs(a,n)}if(r.bearing){let n=cs(r.bearing,i,Wk);a.bearing=this._map.getBearing()+te(n.amount,-179,179),hs(a,n)}if(r.pitch){let n=cs(r.pitch,i,Xk);a.pitch=this._map.getPitch()+n.amount,hs(a,n)}if(r.roll){let n=cs(r.roll,i,Hk);a.roll=this._map.getRoll()+te(n.amount,-179,179),hs(a,n)}if(a.zoom||a.bearing){let n=r.pinchAround===void 0?r.around:r.pinchAround;a.around=n?this._map.unproject(n):this._map.getCenter()}return this.clear(),j(a,{noMoveStart:!0})}};function hs(e,t){(!e.duration||e.duration<t.duration)&&(e.duration=t.duration,e.easing=t.easing)}function cs(e,t,r){let{maxSpeed:i,linearity:a,deceleration:n}=r,s=te(e*a/(t/1e3),-i,i),o=Math.abs(s)/(n*a);return{easing:r.easing,duration:o*1e3,amount:o/2*s}}var Kk=class{constructor(e,t){this._map=e,this._clickTolerance=t.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new _A(this._map,e))}mousedown(e,t){return this._mousedownPos=t,this._firePreventable(new tr(e.type,this._map,e))}mouseup(e){this._map.fire(new tr(e.type,this._map,e))}click(e,t){this._mousedownPos&&this._mousedownPos.dist(t)>=this._clickTolerance||this._map.fire(new tr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new tr(e.type,this._map,e))}mouseover(e){this._map.fire(new tr(e.type,this._map,e))}mouseout(e){this._map.fire(new tr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Xo(e.type,this._map,e))}touchmove(e){this._map.fire(new Xo(e.type,this._map,e))}touchend(e){this._map.fire(new Xo(e.type,this._map,e))}touchcancel(e){this._map.fire(new Xo(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},Jk=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new tr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new tr(\"contextmenu\",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new tr(e.type,this._map,e)),this._map.listens(\"contextmenu\")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},Qk=class{constructor(e,t,r){this._map=e,this._tr=r,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=t.clickTolerance||1,t.boxZoom&&typeof t.boxZoom==\"object\"&&(this._boxZoomEnd=t.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,t){this.isEnabled()&&e.shiftKey&&e.button===0&&(Ne.disableDrag(),this._startPos=this._lastPos=t,this._active=!0)}mousemoveWindow(e,t){if(!this._active)return;let r=t;if(this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)<this._clickTolerance)return;let i=this._startPos;this._lastPos=r,this._box||(this._box=Ne.create(\"div\",\"maplibregl-boxzoom\",this._container),this._container.classList.add(\"maplibregl-crosshair\"),this._fireEvent(\"boxzoomstart\",e));let a=Math.min(i.x,r.x),n=Math.max(i.x,r.x),s=Math.min(i.y,r.y),o=Math.max(i.y,r.y);this._box.style.transform=`translate(${a}px,${s}px)`,this._box.style.width=`${n-a}px`,this._box.style.height=`${o-s}px`}mouseupWindow(e,t){if(!this._active||e.button!==0)return;let r=this._startPos,i=t;if(this.reset(),Ne.suppressClick(),r.x===i.x&&r.y===i.y)this._fireEvent(\"boxzoomcancel\",e);else{if(this._map.fire(new __(\"boxzoomend\",{originalEvent:e})),this._boxZoomEnd){this._boxZoomEnd(this._map,r,i,e);return}return{cameraAnimation:a=>a.fitScreenCoordinates(r,i,this._tr.bearing,{linear:!0})}}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent(\"boxzoomcancel\",e))}reset(){this._active=!1,this._container.classList.remove(\"maplibregl-crosshair\"),this._box&&(this._box=(this._box.remove(),null)),Ne.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,t){return this._map.fire(new __(e,{originalEvent:t}))}};function Qc(e,t){if(e.length!==t.length)throw Error(`The number of touches and points are not equal - touches ${e.length}, points ${t.length}`);let r={};for(let i=0;i<e.length;i++)r[e[i].identifier]=t[i];return r}function e5(e){let t=new C(0,0);for(let r of e)t._add(r);return t.div(e.length)}var t5=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,t,r){(this.centroid||r.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),r.length===this.numTouches&&(this.centroid=e5(t),this.touches=Qc(r,t)))}touchmove(e,t,r){if(this.aborted||!this.centroid)return;let i=Qc(r,t);for(let a in this.touches){let n=this.touches[a],s=i[a];(!s||s.dist(n)>30)&&(this.aborted=!0)}}touchend(e,t,r){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),r.length===0){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}},ep=class{constructor(e){this.singleTap=new t5(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,t,r){this.singleTap.touchstart(e,t,r)}touchmove(e,t,r){this.singleTap.touchmove(e,t,r)}touchend(e,t,r){let i=this.singleTap.touchend(e,t,r);if(i){let a=e.timeStamp-this.lastTime<500,n=!this.lastTap||this.lastTap.dist(i)<30;if((!a||!n)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}},r5=class{constructor(e,t){this._tr=t,this._zoomIn=new ep({numTouches:1,numTaps:2}),this._zoomOut=new ep({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,t,r){this._zoomIn.touchstart(e,t,r),this._zoomOut.touchstart(e,t,r)}touchmove(e,t,r){this._zoomIn.touchmove(e,t,r),this._zoomOut.touchmove(e,t,r)}touchend(e,t,r){let i=this._zoomIn.touchend(e,t,r),a=this._zoomOut.touchend(e,t,r),n=this._tr;if(i)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:Dt(n.zoom+1,s.getZoomSnap()),around:n.unproject(i)},{originalEvent:e})};if(a)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:Dt(n.zoom-1,s.getZoomSnap()),around:n.unproject(a)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},bl=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let t=this._moveFunction(...e);if(t.bearingDelta||t.pitchDelta||t.rollDelta||t.around||t.panDelta)return this._active=!0,t}dragStart(e,t){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(t)?t[0]:t,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,t){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let i=Array.isArray(t)?t[0]:t;if(!(!this._moved&&i.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(r,i)}dragEnd(e){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(e)&&(this._moved&&Ne.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}},i5={0:1,2:2};function a5(e,t){let r=i5[t];return e.buttons===void 0||(e.buttons&r)!==r}var wl=class{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){this._eventButton=e.button}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!a5(e,this._eventButton)}isValidEndEvent(e){return e.button===this._eventButton}};var Tl=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=t=>{t.preventDefault()}};function n5({enable:e,clickTolerance:t}){return new bl({clickTolerance:t,move:(r,i)=>({around:i,panDelta:i.sub(r)}),activateOnStart:!0,moveStateManager:new wl({checkCorrectEvent:r=>r.button===0&&!r.ctrlKey}),enable:e,assignEvents:Tl})}function s5({enable:e,clickTolerance:t,aroundCenter:r=!0,minPixelCenterThreshold:i=100,rotateSpeed:a=.8},n){return new bl({clickTolerance:t,move:(s,o)=>{let l=n();if(r&&Math.abs(l.y-s.y)>i)return{bearingDelta:Wf(new C(s.x,o.y),o,l)};let u=(o.x-s.x)*a;return r&&o.y<l.y&&(u=-u),{bearingDelta:u}},moveStateManager:new wl({checkCorrectEvent:s=>s.button===0&&s.ctrlKey||s.button===2&&!s.ctrlKey}),enable:e,assignEvents:Tl})}function o5({enable:e,clickTolerance:t,pitchSpeed:r=-.5}){return new bl({clickTolerance:t,move:(i,a)=>({pitchDelta:(a.y-i.y)*r}),moveStateManager:new wl({checkCorrectEvent:i=>i.button===0&&i.ctrlKey||i.button===2}),enable:e,assignEvents:Tl})}function l5({enable:e,clickTolerance:t,rollDegreesPerPixelMoved:r=.3},i){return new bl({clickTolerance:t,move:(a,n)=>{let s=i(),o=(n.x-a.x)*r;return n.y<s.y&&(o=-o),{rollDelta:o}},moveStateManager:new wl({checkCorrectEvent:a=>a.button===2&&a.ctrlKey}),enable:e,assignEvents:Tl})}var u5=class{constructor(e,t){this._clickTolerance=e.clickTolerance||1,this._map=t,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new C(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,t,r){return this._calculateTransform(e,t,r)}touchmove(e,t,r){if(this._active){if(this._shouldBePrevented(r.length)){this._map.cooperativeGestures.notifyGestureBlocked(\"touch_pan\",e);return}return e.preventDefault(),this._calculateTransform(e,t,r)}}touchend(e,t,r){this._calculateTransform(e,t,r),this._active&&this._shouldBePrevented(r.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,t,r){r.length>0&&(this._active=!0);let i=Qc(r,t),a=new C(0,0),n=new C(0,0),s=0;for(let l in i){let u=i[l],h=this._touches[l];h&&(a._add(u),n._add(u.sub(h)),s++,i[l]=u)}if(this._touches=i,this._shouldBePrevented(s)||!n.mag())return;let o=n.div(s);if(this._sum._add(o),!(this._sum.mag()<this._clickTolerance))return{around:a.div(s),panDelta:o}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},cp=class{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,t,r){this._firstTwoTouches||r.length<2||(this._firstTwoTouches=[r[0].identifier,r[1].identifier],this._start([t[0],t[1]]))}touchmove(e,t,r){if(!this._firstTwoTouches)return;e.preventDefault();let[i,a]=this._firstTwoTouches,n=nl(r,t,i),s=nl(r,t,a);if(!n||!s)return;let o=this._aroundCenter?null:n.add(s).div(2);return this._move([n,s],o,e)}touchend(e,t,r){if(!this._firstTwoTouches)return;let[i,a]=this._firstTwoTouches,n=nl(r,t,i),s=nl(r,t,a);n&&s||(this._active&&Ne.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around===\"center\"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}};function nl(e,t,r){for(let i=0;i<e.length;i++)if(e[i].identifier===r)return t[i]}var _0=.1;function x0(e,t){return Math.log(e/t)/Math.LN2}var h5=class extends cp{constructor(){super(),this._zoomRate=1,this._zoomThreshold=_0}setZoomRate(e){this._zoomRate=e??1}setZoomThreshold(e){this._zoomThreshold=e??_0}reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,t){let r=this._distance;if(this._distance=e[0].dist(e[1]),!(!this._active&&Math.abs(x0(this._distance,this._startDistance))<this._zoomThreshold))return this._active=!0,{zoomDelta:x0(this._distance,r)*this._zoomRate,pinchAround:t}}};function v0(e,t){return e.angleWith(t)*180/Math.PI}var c5=class extends cp{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,t,r){let i=this._vector;if(this._vector=e[0].sub(e[1]),!(!this._active&&this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:v0(this._vector,i),pinchAround:t}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());let t=25/(Math.PI*this._minDiameter)*360,r=v0(e,this._startVector);return Math.abs(r)<t}};function Uc(e){return Math.abs(e.y)>Math.abs(e.x)}var p5=class extends cp{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,t,r){super.touchstart(e,t,r),this._currentTouchCount=r.length}_start(e){this._lastPoints=e,Uc(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,t,r){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;let i=e[0].sub(this._lastPoints[0]),a=e[1].sub(this._lastPoints[1]);if(this._valid=this.gestureBeginsVertically(i,a,r.timeStamp),this._valid)return this._lastPoints=e,this._active=!0,{pitchDelta:(i.y+a.y)/2*-.5}}gestureBeginsVertically(e,t,r){if(this._valid!==void 0)return this._valid;let i=e.mag()>=2,a=t.mag()>=2;if(!i&&!a)return;if(!i||!a)return this._firstMove===void 0&&(this._firstMove=r),r-this._firstMove<100&&void 0;let n=e.y>0==t.y>0;return Uc(e)&&Uc(t)&&n}},d5={panStep:100,bearingStep:15,pitchStep:10},f5=class{constructor(e,t){this._tr=t;let r=d5;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let t=0,r=0,i=0,a=0,n=0;switch(e.keyCode){case 61:case 107:case 171:case 187:t=1;break;case 189:case 109:case 173:t=-1;break;case 37:e.shiftKey?r=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?r=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),n=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),n=1);break;default:return}return this._rotationDisabled&&(r=0,i=0),{cameraAnimation:s=>{let o=this._tr;s.easeTo({duration:300,easeId:\"keyboardHandler\",easing:m5,zoom:t?Dt(o.zoom+t*(e.shiftKey?2:1),s.getZoomSnap()):o.zoom,bearing:o.bearing+r*this._bearingStep,pitch:o.pitch+i*this._pitchStep,offset:[-a*this._panStep,-n*this._panStep],center:o.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}};function m5(e){return e*(2-e)}var b0=4.000244140625,g5=class{constructor(e,t,r){this._onTimeout=i=>{this._type=\"wheel\",this._delta-=this._lastValue,this._active||this._start(i)},this._map=e,this._tr=r,this._triggerRenderFrame=t,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around===\"center\")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked(\"wheel_zoom\",e);return}let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,r=ye(),i=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,t!==0&&t%b0==0?this._type=\"wheel\":t!==0&&Math.abs(t)<4?this._type=\"trackpad\":i>400?(this._type=null,this._lastValue=t,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*t)<200?\"trackpad\":\"wheel\",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,t+=this._lastValue)),e.shiftKey&&t&&(t/=4),this._type&&(this._lastWheelEvent=e,this._delta-=t,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let t=Ne.mousePos(this._map.getCanvas(),e),r=this._tr;this._aroundPoint=this._aroundCenter?r.transform.locationToScreenPoint(K.convert(r.center)):t,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom==\"number\"){let s=e.zoom-this._lastExpectedZoom;typeof this._startZoom==\"number\"&&(this._startZoom+=s),typeof this._targetZoom==\"number\"&&(this._targetZoom+=s)}if(this._delta!==0){let s=this._type===\"wheel\"&&Math.abs(this._delta)>b0?this._wheelZoomRate:this._defaultZoomRate,o=2/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&o!==0&&(o=1/o);let l=typeof this._targetZoom==\"number\"?bt(this._targetZoom):e.scale,u=e.applyConstrain(e.getCameraLngLat(),dt(l*o)).zoom,h=this._map.getZoomSnap();if(this._type===\"wheel\"&&h>0){let c=Dt(e.zoom,h);this._targetZoom=Dt(u,h,u-c)}else this._targetZoom=u;this._type===\"wheel\"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let t=typeof this._targetZoom==\"number\"?this._targetZoom:e.zoom,r=this._startZoom,i=this._easing,a=!1,n;if(this._type===\"wheel\"&&r&&i){let s=ye()-this._lastWheelEventTime,o=Math.min((s+5)/200,1),l=i(o);n=Ve.number(r,t,l),o<1?this._needsRerender=!0:a=!0}else n=t,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=n,{noInertia:!0,needsRenderFrame:!a,zoomDelta:n-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let t=ho;if(this._prevEase){let r=this._prevEase,i=(ye()-r.start)/r.duration,a=r.easing(i+.01)-r.easing(i),n=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-n*n);t=uo(n,s,.25,1)}return this._prevEase={start:ye(),duration:e,easing:t},t}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},y5=class{constructor(e,t){this._clickZoom=e,this._tapZoom=t}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},_5=class{constructor(e,t){this._tr=t,this.reset()}reset(){this._active=!1}dblclick(e,t){return e.preventDefault(),{cameraAnimation:r=>{r.easeTo({duration:300,zoom:Dt(this._tr.zoom+(e.shiftKey?-1:1),r.getZoomSnap()),around:this._tr.unproject(t)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},x5=class{constructor(){this._tap=new ep({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,t,r){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,t,r);else{let i=t[0],a=e.timeStamp-this._tapTime<500,n=this._tapPoint.dist(i)<30;!a||!n?this.reset():r.length>0&&(this._swipePoint=i,this._swipeTouch=r[0].identifier)}}touchmove(e,t,r){if(!this._tapTime)this._tap.touchmove(e,t,r);else if(this._swipePoint){if(r[0].identifier!==this._swipeTouch)return;let i=t[0],a=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:a/128*this._zoomRate}}}touchend(e,t,r){if(this._tapTime)this._swipePoint&&r.length===0&&this.reset();else{let i=this._tap.touchend(e,t,r);i&&(this._tapTime=e.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},v5=class{constructor(e,t,r){this._el=e,this._mousePan=t,this._touchPan=r}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add(\"maplibregl-touch-drag-pan\")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove(\"maplibregl-touch-drag-pan\")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},b5=class{constructor(e,t,r,i){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=t,this._mousePitch=r,this._mouseRoll=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},w5=class{constructor(e,t,r,i){this._el=e,this._touchZoom=t,this._touchRotate=r,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add(\"maplibregl-touch-zoom-rotate\")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove(\"maplibregl-touch-zoom-rotate\")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},T5=class{constructor(e,t){this._bypassKey=navigator.userAgent.includes(\"Mac\")?\"metaKey\":\"ctrlKey\",this._map=e,this._options=t,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add(\"maplibregl-cooperative-gestures\"),this._container=Ne.create(\"div\",\"maplibregl-cooperative-gesture-screen\",e);let t=this._map._getUIString(\"CooperativeGesturesHandler.WindowsHelpText\");this._bypassKey===\"metaKey\"&&(t=this._map._getUIString(\"CooperativeGesturesHandler.MacHelpText\"));let r=this._map._getUIString(\"CooperativeGesturesHandler.MobileHelpText\"),i=document.createElement(\"div\");i.className=\"maplibregl-desktop-message\",i.textContent=t,this._container.appendChild(i);let a=document.createElement(\"div\");a.className=\"maplibregl-mobile-message\",a.textContent=r,this._container.appendChild(a),this._container.setAttribute(\"aria-hidden\",\"true\")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove(\"maplibregl-cooperative-gestures\")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,t){this._enabled&&(this._map.fire(new lt(\"cooperativegestureprevented\",{gestureType:e,originalEvent:t})),this._container.classList.add(\"maplibregl-show\"),setTimeout(()=>{this._container.classList.remove(\"maplibregl-show\")},100))}},S5=class{constructor(e){this._camera=e}get transform(){return this._camera._requestedCameraState||this._camera.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(C.convert(e),this._camera.terrain)}},sl=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate,E5=class extends Fa{};function $c(e){return e.panDelta?.mag()||e.zoomDelta||e.bearingDelta||e.pitchDelta||e.rollDelta}var I5=class{get _ownerDocument(){return this._el?.ownerDocument||document}get _ownerWindow(){return this._el?.ownerDocument?.defaultView||window}constructor(e,t,r){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,n)=>{if(a.type===\"blur\"){this.stop(!0);return}this._updatingCamera=!0;let s=a.type===\"renderFrame\"?void 0:a,o={needsRenderFrame:!1},l={},u={};for(let{handlerName:p,handler:d,allowed:f}of this._handlers){if(!d.isEnabled())continue;let m;if(this._blockedByActive(u,f,p))d.reset();else if(d[n||a.type]){if(Kf(a,n||a.type)){let g=Ne.mousePos(this._map.getCanvas(),a);m=d[n||a.type](a,g)}else if(Yf(a,n||a.type)){let g=a.touches,y=this._getMapTouches(g),_=Ne.touchPos(this._map.getCanvas(),y);m=d[n||a.type](a,_,y)}else Jf(n||a.type)||(m=d[n||a.type](a));this.mergeHandlerResult(o,l,m,p,s),m?.needsRenderFrame&&this._triggerRenderFrame()}(m||d.isActive())&&(u[p]=d)}let h={};for(let p in this._previousActiveHandlers)u[p]||(h[p]=s);this._previousActiveHandlers=u,(Object.keys(h).length||$c(o))&&(this._changes.push([o,l,h]),this._triggerRenderFrame()),(Object.keys(u).length||$c(o))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:c}=o;c&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],c(this._map))},this._map=e,this._camera=t,this._transformProvider=new S5(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Yk(e),this._bearingSnap=r.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(r);let i=this._el;this._listeners=[[i,\"touchstart\",{passive:!0}],[i,\"touchmove\",{passive:!1}],[i,\"touchend\",void 0],[i,\"touchcancel\",void 0],[i,\"mousedown\",void 0],[i,\"mousemove\",void 0],[i,\"mouseup\",void 0],[this._ownerDocument,\"mousemove\",{capture:!0}],[this._ownerDocument,\"mouseup\",void 0],[i,\"mouseover\",void 0],[i,\"mouseout\",void 0],[i,\"dblclick\",void 0],[i,\"click\",void 0],[i,\"keydown\",{capture:!1}],[i,\"keyup\",void 0],[i,\"wheel\",{passive:!1}],[i,\"contextmenu\",void 0],[this._ownerWindow,\"blur\",void 0]];for(let[a,n,s]of this._listeners)a.addEventListener(n,a===this._ownerDocument?this.handleWindowEvent:this.handleEvent,s)}destroy(){for(let[e,t,r]of this._listeners)e.removeEventListener(t,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,r)}_addDefaultHandlers(e){let t=this._map,r=t.getCanvasContainer();this._add(\"mapEvent\",new Kk(t,e));let i=t.boxZoom=new Qk(t,e,this._transformProvider);this._add(\"boxZoom\",i),e.interactive&&e.boxZoom&&i.enable();let a=t.cooperativeGestures=new T5(t,e.cooperativeGestures);this._add(\"cooperativeGestures\",a),e.cooperativeGestures&&a.enable();let n=new r5(t,this._transformProvider),s=new _5(t,this._transformProvider);t.doubleClickZoom=new y5(s,n),this._add(\"tapZoom\",n),this._add(\"clickZoom\",s),e.interactive&&e.doubleClickZoom&&t.doubleClickZoom.enable();let o=new x5;this._add(\"tapDragZoom\",o);let l=t.touchPitch=new p5(t);this._add(\"touchPitch\",l),e.interactive&&e.touchPitch&&t.touchPitch.enable(e.touchPitch);let u=()=>t.project(t.getCenter()),h=s5(e,u),c=o5(e),p=l5(e,u);t.dragRotate=new b5(e,h,c,p),this._add(\"mouseRotate\",h,[\"mousePitch\"]),this._add(\"mousePitch\",c,[\"mouseRotate\",\"mouseRoll\"]),this._add(\"mouseRoll\",p,[\"mousePitch\"]),e.interactive&&e.dragRotate&&t.dragRotate.enable();let d=n5(e),f=new u5(e,t);t.dragPan=new v5(r,d,f),this._add(\"mousePan\",d),this._add(\"touchPan\",f,[\"touchZoom\",\"touchRotate\"]),e.interactive&&e.dragPan&&t.dragPan.enable(e.dragPan);let m=new c5,g=new h5;t.touchZoomRotate=new w5(r,g,m,o),this._add(\"touchRotate\",m,[\"touchPan\",\"touchZoom\"]),this._add(\"touchZoom\",g,[\"touchPan\",\"touchRotate\"]),e.interactive&&e.touchZoomRotate&&t.touchZoomRotate.enable(e.touchZoomRotate),this._add(\"blockableMapEvent\",new Jk(t));let y=t.scrollZoom=new g5(t,()=>this._triggerRenderFrame(),this._transformProvider);this._add(\"scrollZoom\",y,[\"mousePan\"]),e.interactive&&e.scrollZoom&&t.scrollZoom.enable(e.scrollZoom);let _=t.keyboard=new f5(t,this._transformProvider);this._add(\"keyboard\",_),e.interactive&&e.keyboard&&t.keyboard.enable()}_add(e,t,r){this._handlers.push({handlerName:e,handler:t,allowed:r}),this._handlersById[e]=t}stop(e){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!sl(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,t,r){for(let i in e)if(i!==r&&!t?.includes(i))return!0;return!1}_getMapTouches(e){let t=[];for(let r of e){let i=r.target;this._el.contains(i)&&t.push(r)}return t}mergeHandlerResult(e,t,r,i,a){if(!r)return;j(e,r);let n={handlerName:i,originalEvent:r.originalEvent||a};r.zoomDelta!==void 0&&(t.zoom=n),r.panDelta!==void 0&&(t.drag=n),r.rollDelta!==void 0&&(t.roll=n),r.pitchDelta!==void 0&&(t.pitch=n),r.bearingDelta!==void 0&&(t.rotate=n)}_applyChanges(){let e={},t={},r={};for(let[i,a,n]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new C(0,0))._add(i.panDelta)),i.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+i.pitchDelta),i.rollDelta&&(e.rollDelta=(e.rollDelta||0)+i.rollDelta),i.around!==void 0&&(e.around=i.around),i.pinchAround!==void 0&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),j(t,a),j(r,n);this._updateMapTransform(e,t,r),this._changes=[]}_updateMapTransform(e,t,r){let i=this._map,a=this._camera.getTransformForUpdate(),n=i.terrain;if(!$c(e)&&!(n&&this._terrainMovement)){this._fireEvents(t,r,!0);return}this._camera.stop(!0);let{panDelta:s,zoomDelta:o,bearingDelta:l,pitchDelta:u,rollDelta:h}=e,{around:c,aroundOnSurface:p}=this._resolveAround(e,n,a),d=n?this._terrainGestureElevation(n,c,p,a,t):void 0,f={panDelta:s,zoomDelta:o,rollDelta:h,pitchDelta:u,bearingDelta:l,around:c,aroundElevation:d};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(c)&&(c=a.centerPoint);let m=this._computePreZoomAroundLoc(a,c,s,d);this._handleMapControls({terrain:n,tr:a,deltasForHelper:f,preZoomAroundLoc:m,combinedEventsInProgress:t,panDelta:s}),this._camera.applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(t,r,!0)}_resolveAround(e,t,r){let i=e.pinchAround===void 0?e.around:e.pinchAround;return i||(i=this._camera.transform.centerPoint),t&&!r.isPointOnMapSurface(i)?{around:r.centerPoint,aroundOnSurface:!1}:{around:i,aroundOnSurface:!0}}_terrainGestureElevation(e,t,r,i,a){if(!r)return;if(!this._terrainMovement&&(a.drag||a.zoom)){let s=i.screenTerrainPointToMercatorCoordinate(t,e);this._terrainGestureAnchorElevation=s?s.z:null}if(this._terrainGestureAnchorElevation===null)return;let n=this._terrainGestureAnchorElevation;if(!(t.distSqr(i.centerPoint)<.01)&&!(n-i.elevation>=.9*(i.getCameraAltitude()-i.elevation)))return n}_computePreZoomAroundLoc(e,t,r,i){if(t.distSqr(e.centerPoint)<.01)return e.center;let a=r?t.sub(r):t;return i===void 0?e.screenPointToLocation(a):e.screenPointToLocationAtElevation(a,i)}_handleMapControls({terrain:e,tr:t,deltasForHelper:r,preZoomAroundLoc:i,combinedEventsInProgress:a,panDelta:n}){let s=this._camera.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(r,t),!e){s.handleMapControlsPan(r,t,i);return}if(s.useGlobeControls){!this._terrainMovement&&(a.drag||a.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),s.handleMapControlsPan(r,t,i);return}if(!this._terrainMovement&&(a.drag||a.zoom)){this._terrainMovement=!0,this._camera.elevationFreeze=!0,s.handleMapControlsPan(r,t,i);return}if(r.aroundElevation===void 0&&a.drag&&this._terrainMovement&&n){t.setCenter(t.screenPointToLocation(t.centerPoint.sub(n)));return}s.handleMapControlsPan(r,t,i)}_fireEvents(e,t,r){let i=sl(this._eventsInProgress),a=sl(e),n={};for(let h in e){let{originalEvent:c}=e[h];this._eventsInProgress[h]||(n[`${h}start`]=c),this._eventsInProgress[h]=e[h]}!i&&a&&this._fireEvent(\"movestart\",a.originalEvent);for(let h in n)this._fireEvent(h,n[h]);a&&this._fireEvent(\"move\",a.originalEvent);for(let h in e){let{originalEvent:c}=e[h];this._fireEvent(h,c)}let s={},o;for(let h in this._eventsInProgress){let{handlerName:c,originalEvent:p}=this._eventsInProgress[h];this._handlersById[c].isActive()||(delete this._eventsInProgress[h],o=t[c]||p,s[`${h}end`]=o)}for(let h in s)this._fireEvent(h,s[h]);let l=sl(this._eventsInProgress),u=(i||a)&&!l;if(u&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let h=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&h.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(h)}if(r&&u){this._updatingCamera=!0;let h=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),c=p=>p!==0&&-this._bearingSnap<p&&p<this._bearingSnap;h&&(h.essential||!zt.prefersReducedMotion)?(c(h.bearing||this._map.getBearing())&&(h.bearing=0),h.freezeElevation=!0,this._map.easeTo(h,{originalEvent:o})):(this._map.fire(new W(\"moveend\",{originalEvent:o})),c(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(e,t){this._map.fire(new W(e,t?{originalEvent:t}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new E5(\"renderFrame\",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},A5=class extends wt{constructor(e){super(),this._renderFrameCallback=()=>{let t=Math.min((ye()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new fl,this.cameraHelper=new ml,e.minZoom!==void 0&&this.transform.setMinZoom(e.minZoom),e.maxZoom!==void 0&&this.transform.setMaxZoom(e.maxZoom),e.minPitch!==void 0&&this.transform.setMinPitch(e.minPitch),e.maxPitch!==void 0&&this.transform.setMaxPitch(e.maxPitch),e.renderWorldCopies!==void 0&&this.transform.setRenderWorldCopies(e.renderWorldCopies),e.transformConstrain!==null&&this.transform.setConstrainOverride(e.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=e.bearingSnap,this._zoomSnap=e.zoomSnap,this._requestRenderFrame=e.requestRenderFrame,this._cancelRenderFrame=e.cancelRenderFrame,this.terrain=e.terrain,this._centerClampedToGround=e.centerClampedToGround??!0,this.transformCameraUpdate=e.transformCameraUpdate??null,this._stopHandlers=e.stopHandlers??(()=>{}),this.on(\"moveend\",()=>{delete this._requestedCameraState})}migrateProjection(e,t){e.apply(this.transform,!0),this.transform=e,this.cameraHelper=t}getCenter(){return new K(this.transform.center.lng,this.transform.center.lat)}setCenter(e,t){return this.jumpTo({center:e},t)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,t){return this.jumpTo({elevation:e},t),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,t,r){return e=C.convert(e).mult(-1),this.panTo(this.transform.center,j({offset:e},t),r)}panTo(e,t,r){return this.easeTo(j({center:e},t),r)}getZoom(){return this.transform.zoom}setZoom(e,t){return this.jumpTo({zoom:e},t),this}zoomTo(e,t,r){return this.easeTo(j({zoom:e},t),r)}zoomIn(e,t){return this.zoomTo(Dt(this.getZoom()+1,this._zoomSnap),e,t),this}zoomOut(e,t){return this.zoomTo(Dt(this.getZoom()-1,this._zoomSnap),e,t),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,t){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new W(\"movestart\",t)).fire(new W(\"move\",t)).fire(new W(\"moveend\",t))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,t){return this.jumpTo({bearing:e},t),this}getPadding(){return this.transform.padding}setPadding(e,t){return this.jumpTo({padding:e},t),this}rotateTo(e,t,r){return this.easeTo(j({bearing:e},t),r)}resetNorth(e,t){return this.rotateTo(0,j({duration:1e3},e),t),this}resetNorthPitch(e,t){return this.easeTo(j({bearing:0,pitch:0,roll:0,duration:1e3},e),t),this}snapToNorth(e,t){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,t):this}getPitch(){return this.transform.pitch}setPitch(e,t){return this.jumpTo({pitch:e},t),this}getRoll(){return this.transform.roll}setRoll(e,t){return this.jumpTo({roll:e},t),this}cameraForBounds(e,t){e=Kr.convert(e).adjustAntiMeridian();let r=t?.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),r,t)}_cameraForBoxAndBearing(e,t,r,i){let a={top:0,bottom:0,right:0,left:0};if(i=j({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},i),typeof i.padding==\"number\"){let u=i.padding;i.padding={top:u,bottom:u,right:u,left:u}}let n=j(a,i.padding);i.padding=n;let s=this.transform,o=new Kr(e,t),l=this.cameraHelper.cameraForBoxAndBearing(i,n,o,r,s);return l&&this._zoomSnap&&(l.zoom=Dt(l.zoom,this._zoomSnap,-1)),l}fitBounds(e,t,r){return this._fitInternal(this.cameraForBounds(e,t),t,r)}fitScreenCoordinates(e,t,r,i,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(C.convert(e)),this.transform.screenPointToLocation(C.convert(t)),r,i),i,a)}_fitInternal(e,t,r){return e?(t=j(e,t),delete t.padding,t.linear?this.easeTo(t,r):this.flyTo(t,r)):this}jumpTo(e,t){this.stop(),\"zoom\"in e&&this._zoomSnap&&(e.zoom=Dt(e.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),i=!1,a=!1,n=!1,s=r.zoom;this.terrain&&r.setElevation(this.terrain.getElevationForLngLatZoom(e.center?K.convert(e.center):r.center,e.zoom||r.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(r,e);let o=r.zoom!==s;return\"elevation\"in e&&r.elevation!==+e.elevation&&r.setElevation(+e.elevation),\"bearing\"in e&&r.bearing!==+e.bearing&&(i=!0,r.setBearing(+e.bearing)),\"pitch\"in e&&r.pitch!==+e.pitch&&(a=!0,r.setPitch(+e.pitch)),\"roll\"in e&&r.roll!==+e.roll&&(n=!0,r.setRoll(+e.roll)),e.padding!=null&&!r.isPaddingEqual(e.padding)&&r.setPadding(e.padding),this.applyUpdatedTransform(r),this.fire(new W(\"movestart\",t)).fire(new W(\"move\",t)),o&&this.fire(new W(\"zoomstart\",t)).fire(new W(\"zoom\",t)).fire(new W(\"zoomend\",t)),i&&this.fire(new W(\"rotatestart\",t)).fire(new W(\"rotate\",t)).fire(new W(\"rotateend\",t)),a&&this.fire(new W(\"pitchstart\",t)).fire(new W(\"pitch\",t)).fire(new W(\"pitchend\",t)),n&&this.fire(new W(\"rollstart\",t)).fire(new W(\"roll\",t)).fire(new W(\"rollend\",t)),this.fire(new W(\"moveend\",t))}calculateCameraOptionsFromTo(e,t,r,i=0){let a=fe.fromLngLat(e,t),n=fe.fromLngLat(r,i),s=n.x-a.x,o=n.y-a.y,l=n.z-a.z,u=Math.hypot(s,o,l);if(u===0)throw Error(\"Can't calculate camera options with same From and To\");let h=Math.hypot(s,o),c=dt(this.transform.cameraToCenterDistance/u/this.transform.tileSize),p=Math.atan2(s,-o)*180/Math.PI,d=Math.acos(h/u)*180/Math.PI;return d=l<0?90-d:90+d,{center:n.toLngLat(),elevation:i,zoom:c,pitch:d,bearing:p}}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,a){let n=this.transform.calculateCenterFromCameraLngLatAlt(e,t,r,i);return{center:n.center,elevation:n.elevation,zoom:n.zoom,bearing:r,pitch:i,roll:a}}easeTo(e,t){this._stop(!1,e.easeId),e=j({offset:[0,0],duration:500,easing:ho},e),\"zoom\"in e&&this._zoomSnap&&(e.zoom=Dt(e.zoom,this._zoomSnap)),(e.animate===!1||!e.essential&&zt.prefersReducedMotion)&&(e.duration=0);let r=this.getTransformForUpdate(),i=this.getBearing(),a=r.pitch,n=r.roll,s=\"bearing\"in e?this._normalizeBearing(e.bearing,i):i,o=\"pitch\"in e?+e.pitch:a,l=\"roll\"in e?this._normalizeBearing(e.roll,n):n,u=\"padding\"in e?e.padding:r.padding,h=C.convert(e.offset),c,p;e.around&&(c=K.convert(e.around),p=r.locationToScreenPoint(c));let d={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},f=this.cameraHelper.handleEaseTo(r,{bearing:s,pitch:o,roll:l,padding:u,around:c,aroundPoint:p,offsetAsPoint:h,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating||(this._rotating=i!==s),this._pitching||(this._pitching=o!==a),this._rolling||(this._rolling=l!==n),this._padding=!r.isPaddingEqual(u),this._zooming||(this._zooming=f.isZooming),this._easeId=e.easeId,this._prepareEase(t,e.noMoveStart,d),this.terrain&&this._prepareElevation(f.elevationCenter),this._ease(m=>{f.easeFunc(m),this.terrain&&!e.freezeElevation&&this._updateElevation(m),this.applyUpdatedTransform(r),this._fireMoveEvents(t)},m=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t,m)},e),this}_prepareEase(e,t,r={}){this._moving=!0,!t&&!r.moving&&this.fire(new W(\"movestart\",e)),this._zooming&&!r.zooming&&this.fire(new W(\"zoomstart\",e)),this._rotating&&!r.rotating&&this.fire(new W(\"rotatestart\",e)),this._pitching&&!r.pitching&&this.fire(new W(\"pitchstart\",e)),this._rolling&&!r.rolling&&this.fire(new W(\"rollstart\",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this.elevationFreeze=!0}_updateElevation(e){(this._elevationStart===void 0||this._elevationCenter===void 0)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let t=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&t!==this._elevationTarget){let r=this._elevationTarget-this._elevationStart,i=(t-(r*e+this._elevationStart))/(1-e);this._elevationStart+=e*(r-i),this._elevationTarget=t}this.transform.setElevation(Ve.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let t=e.getCameraLngLat(),r=e.getCameraAltitude(),i=this.terrain?this.terrain.getElevationForLngLatZoom(t,e.zoom):0;if(r<i){let a=this.calculateCameraOptionsFromTo(t,i,e.center,e.elevation);return{pitch:a.pitch,zoom:a.zoom}}return{}}applyUpdatedTransform(e){let t=[];if(t.push(i=>this._elevateCameraIfInsideTerrain(i)),this.transformCameraUpdate&&t.push(i=>this.transformCameraUpdate(i)),!t.length)return;let r=e.clone();for(let i of t){let a=r.clone(),{center:n,zoom:s,roll:o,pitch:l,bearing:u,elevation:h}=i(a);n&&a.setCenter(n),h!==void 0&&a.setElevation(h),s!==void 0&&a.setZoom(s),o!==void 0&&a.setRoll(o),l!==void 0&&a.setPitch(l),u!==void 0&&a.setBearing(u),r.apply(a,!1)}this.transform.apply(r,!1)}_fireMoveEvents(e){this.fire(new W(\"move\",e)),this._zooming&&this.fire(new W(\"zoom\",e)),this._rotating&&this.fire(new W(\"rotate\",e)),this._pitching&&this.fire(new W(\"pitch\",e)),this._rolling&&this.fire(new W(\"roll\",e))}_afterEase(e,t){if(this._easeId&&t&&this._easeId===t)return;delete this._easeId;let r=this._zooming,i=this._rotating,a=this._pitching,n=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,r&&this.fire(new W(\"zoomend\",e)),i&&this.fire(new W(\"rotateend\",e)),a&&this.fire(new W(\"pitchend\",e)),n&&this.fire(new W(\"rollend\",e)),this.fire(new W(\"moveend\",e))}flyTo(e,t){if(!e.essential&&zt.prefersReducedMotion){let E=ka(e,[\"center\",\"zoom\",\"bearing\",\"pitch\",\"roll\",\"elevation\",\"padding\"]);return this.jumpTo(E,t)}this.stop(),e=j({offset:[0,0],speed:1.2,curve:1.42,easing:ho},e),\"zoom\"in e&&this._zoomSnap&&(e.zoom=Dt(e.zoom,this._zoomSnap));let r=this.getTransformForUpdate(),i=r.bearing,a=r.pitch,n=r.roll,s=r.padding,o=\"bearing\"in e?this._normalizeBearing(e.bearing,i):i,l=\"pitch\"in e?+e.pitch:a,u=\"roll\"in e?this._normalizeBearing(e.roll,n):n,h=\"padding\"in e?e.padding:r.padding,c=C.convert(e.offset),p=r.centerPoint.add(c),d=r.screenPointToLocation(p),f=this.cameraHelper.handleFlyTo(r,{bearing:o,pitch:l,roll:u,padding:h,locationAtOffset:d,offsetAsPoint:c,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),m=e.curve,g=Math.max(r.width,r.height),y=g/f.scaleOfZoom,_=f.pixelPathLength,x=g/f.scaleOfMinZoom;m=Math.min(m,Math.sqrt(x/_*2));let v=m*m;function w(E){let M=(y*y-g*g+(E?-1:1)*v*v*_*_)/(2*(E?y:g)*v*_);return Math.log(Math.sqrt(M*M+1)-M)}function b(E){return(Math.exp(E)-Math.exp(-E))/2}function T(E){return(Math.exp(E)+Math.exp(-E))/2}function I(E){return b(E)/T(E)}let S=w(!1),D=function(E){return T(S)/T(S+m*E)},R=function(E){return g*((T(S)*I(S+m*E)-b(S))/v)/_},F=(w(!0)-S)/m;if(Math.abs(_)<2e-6||!isFinite(F)){if(Math.abs(g-y)<1e-6)return this.easeTo(e,t);let E=y<g?-1:1;F=Math.abs(Math.log(y/g))/m,R=()=>0,D=M=>Math.exp(E*m*M)}if(\"duration\"in e)e.duration=+e.duration;else{let E=\"screenSpeed\"in e?+e.screenSpeed/m:+e.speed;e.duration=1e3*F/E}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=i!==o,this._pitching=l!==a,this._rolling=u!==n,this._padding=!r.isPaddingEqual(h),this._prepareEase(t,!1),this.terrain&&this._prepareElevation(f.targetCenter),this._ease(E=>{let M=E*F,A=1/D(M),k=R(M);this._rotating&&r.setBearing(Ve.number(i,o,E)),this._pitching&&r.setPitch(Ve.number(a,l,E)),this._rolling&&r.setRoll(Ve.number(n,u,E)),this._padding&&(r.interpolatePadding(s,h,E),p=r.centerPoint.add(c)),f.easeFunc(E,A,k,p),this.terrain&&!e.freezeElevation&&this._updateElevation(E),this.applyUpdatedTransform(r),this._fireMoveEvents(t)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(t)},e),this}isEasing(){return!!this._easeFrameId}stop(e){return this._stop(e)}_stop(e,t){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let r=this._onEaseEnd;delete this._onEaseEnd,r.call(this,t)}return e||this._stopHandlers(),this}_ease(e,t,r){r.animate===!1||r.duration===0?(e(1),t()):(this._easeStart=ye(),this._easeOptions=r,this._onEaseFrame=e,this._onEaseEnd=t,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,t){e=Ut(e,-180,180);let r=Math.abs(e-t);return Math.abs(e-360-t)<r&&(e-=360),Math.abs(e+360-t)<r&&(e+=360),e}isMoving(){return this._moving}isZooming(){return this._zooming}isRotating(){return this._rotating}},L1={compact:!0,customAttribution:'<a href=\"https://maplibre.org/\" target=\"_blank\">MapLibre</a>'},M5=class{constructor(e=L1){this._toggleAttribution=()=>{this._container.classList.contains(\"maplibregl-compact\")&&(this._container.classList.contains(\"maplibregl-compact-show\")?(this._container.setAttribute(\"open\",\"\"),this._container.classList.remove(\"maplibregl-compact-show\")):(this._container.classList.add(\"maplibregl-compact-show\"),this._container.removeAttribute(\"open\")))},this._updateData=t=>{t&&(t.type===\"terrain\"||t.dataType===\"style\"||t.dataType===\"source\"&&(t.sourceDataType===\"metadata\"||t.sourceDataType===\"visibility\"))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute(\"open\",\"\"):!this._container.classList.contains(\"maplibregl-compact\")&&!this._container.classList.contains(\"maplibregl-attrib-empty\")&&(this._container.setAttribute(\"open\",\"\"),this._container.classList.add(\"maplibregl-compact\",\"maplibregl-compact-show\")):(this._container.setAttribute(\"open\",\"\"),this._container.classList.contains(\"maplibregl-compact\")&&this._container.classList.remove(\"maplibregl-compact\",\"maplibregl-compact-show\"))},this._updateCompactMinimize=()=>{this._container.classList.contains(\"maplibregl-compact\")&&this._container.classList.contains(\"maplibregl-compact-show\")&&this._container.classList.remove(\"maplibregl-compact-show\")},this.options=e}getDefaultPosition(){return\"bottom-right\"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=Ne.create(\"details\",\"maplibregl-ctrl maplibregl-ctrl-attrib\"),this._compactButton=Ne.create(\"summary\",\"maplibregl-ctrl-attrib-button\",this._container),this._compactButton.addEventListener(\"click\",this._toggleAttribution),this._setElementTitle(this._compactButton,\"ToggleAttribution\"),this._innerContainer=Ne.create(\"div\",\"maplibregl-ctrl-attrib-inner\",this._container),this._updateAttributions(),this._updateCompact(),this._map.on(\"styledata\",this._updateData),this._map.on(\"sourcedata\",this._updateData),this._map.on(\"terrain\",this._updateData),this._map.on(\"resize\",this._updateCompact),this._map.on(\"drag\",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off(\"styledata\",this._updateData),this._map.off(\"sourcedata\",this._updateData),this._map.off(\"terrain\",this._updateData),this._map.off(\"resize\",this._updateCompact),this._map.off(\"drag\",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,t){let r=this._map._getUIString(`AttributionControl.${t}`);e.title=r,e.setAttribute(\"aria-label\",r)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(i=>typeof i==\"string\"?i:\"\")):typeof this.options.customAttribution==\"string\"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let t=this._map.style.tileManagers;for(let i in t){let a=t[i];if(a.used||a.usedForTerrain){let n=a.getSource();n.attribution&&!e.includes(n.attribution)&&e.push(n.attribution)}}e=e.filter(i=>String(i).trim()),e.sort((i,a)=>i.length-a.length),e=e.filter((i,a)=>{for(let n=a+1;n<e.length;n++)if(e[n].includes(i))return!1;return!0});let r=e.join(\" | \");r!==this._attribHTML&&(this._attribHTML=r,e.length?(this._innerContainer.innerHTML=Ne.sanitize(r),this._container.classList.remove(\"maplibregl-attrib-empty\")):this._container.classList.add(\"maplibregl-attrib-empty\"),this._updateCompact(),this._editLink=null)}},P5=class{constructor(e={}){this._updateCompact=()=>{let t=this._container.children;if(t.length){let r=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&r.classList.add(\"maplibregl-compact\"):r.classList.remove(\"maplibregl-compact\")}},this.options=e}getDefaultPosition(){return\"bottom-left\"}onAdd(e){this._map=e,this._compact=this.options?.compact,this._container=Ne.create(\"div\",\"maplibregl-ctrl\");let t=Ne.create(\"a\",\"maplibregl-ctrl-logo\");return t.target=\"_blank\",t.rel=\"noopener nofollow\",t.href=\"https://maplibre.org/\",t.setAttribute(\"aria-label\",this._map._getUIString(\"LogoControl.Title\")),t.setAttribute(\"rel\",\"noopener nofollow\"),this._container.appendChild(t),this._container.style.display=\"block\",this._map.on(\"resize\",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off(\"resize\",this._updateCompact),this._map=void 0,this._compact=void 0}},C5=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let t=++this._id;return this._queue.push({callback:e,id:t,cancelled:!1}),t}remove(e){let t=this._currentlyRunning,r=t?this._queue.concat(t):this._queue;for(let i of r)if(i.id===e){i.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw Error(\"Attempting to run(), but is already running.\");let t=this._currentlyRunning=this._queue;this._queue=[];for(let r of t)if(!r.cancelled&&(r.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}},ja={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,\"color-relief\":!0},k5=class{constructor(e,t){this.painter=e,this.terrain=t,this.rttSize=t.tileManager.tileSize*t.qualityFactor}getTexture(e){return e.getRTT(this._stacks.length-1).texture}prepareForRender(e,t){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(i=>!e._layers[i].isHidden(t));let r=new Set;for(let i of this._renderableLayerIds){let a=e._layers[i],n=a.source;n&&ja[a.type]&&r.add(n)}this._coordsAscending={},this._rttFingerprints={};for(let i of r){let a=e.tileManagers[i];if(!a)continue;this._coordsAscending[i]={};let n=this._coordsAscending[i],s=a.getSource(),o=s instanceof fs?s.terrainTileRanges:null;for(let h of a.getVisibleCoordinates()){let c=this.terrain.tileManager.getTerrainCoords(h,o);for(let p in c)n[p]||(n[p]=[]),n[p].push(c[p])}this._rttFingerprints[i]={};let l=this._rttFingerprints[i],u=a.getState().revision;for(let h in n)l[h]=`${n[h].map(c=>c.key).sort().join()}#${u}`}for(let i of this._renderableTiles)for(let a in this._rttFingerprints){let n=this._rttFingerprints[a][i.tileID.key];n&&n!==i.rttFingerprint[a]&&i.releaseRTT(this.painter)}}renderLayer(e,t){if(e.isHidden(this.painter.transform.zoom))return!1;let r={...t,isRenderingToTexture:!0},i=e.type,a=this.painter,n=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(ja[i]&&((!this._prevType||!ja[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!n))return!0;if(ja[this._prevType]||ja[i]&&n){this._prevType=i;let s=this._stacks.length-1,o=this._stacks[s]||[];for(let l of this._renderableTiles){if(this._rttTiles.push(l),l.getRTT(s))continue;let u=l.acquireRTT(a,s,this.rttSize);a.bindRTT(u),a.context.clear({color:J.transparent,stencil:0}),a.currentStencilSource=void 0;for(let h of o){let c=a.style._layers[h],p=c.source?this._coordsAscending[c.source][l.tileID.key]:[l.tileID];a.context.viewport.set([0,0,this.rttSize,this.rttSize]),a.renderTileClippingMasks(c,p,!0),a.renderLayer(a,a.style.tileManagers[c.source],c,p,r),c.source&&(l.rttFingerprint[c.source]=this._rttFingerprints[c.source][l.tileID.key])}}return Bk(this.painter,this.terrain,this._rttTiles,r),this._rttTiles=[],ja[i]}return!1}},D5={\"AttributionControl.ToggleAttribution\":\"Toggle attribution\",\"AttributionControl.MapFeedback\":\"Map feedback\",\"FullscreenControl.Enter\":\"Enter fullscreen\",\"FullscreenControl.Exit\":\"Exit fullscreen\",\"GeolocateControl.FindMyLocation\":\"Find my location\",\"GeolocateControl.LocationNotAvailable\":\"Location not available\",\"LogoControl.Title\":\"MapLibre logo\",\"Map.Title\":\"Map\",\"Marker.Title\":\"Map marker\",\"NavigationControl.ResetBearing\":\"Drag to rotate map, click to reset north\",\"NavigationControl.ZoomIn\":\"Zoom in\",\"NavigationControl.ZoomOut\":\"Zoom out\",\"Popup.Close\":\"Close popup\",\"ScaleControl.Feet\":\"ft\",\"ScaleControl.Meters\":\"m\",\"ScaleControl.Kilometers\":\"km\",\"ScaleControl.Miles\":\"mi\",\"ScaleControl.NauticalMiles\":\"nm\",\"GlobeControl.Enable\":\"Enable globe\",\"GlobeControl.Disable\":\"Disable globe\",\"TerrainControl.Enable\":\"Enable terrain\",\"TerrainControl.Disable\":\"Disable terrain\",\"CooperativeGesturesHandler.WindowsHelpText\":\"Use Ctrl + scroll to zoom the map\",\"CooperativeGesturesHandler.MacHelpText\":\"Use \\u2318 + scroll to zoom the map\",\"CooperativeGesturesHandler.MobileHelpText\":\"Use two fingers to move the map\"},F5=T0,w0={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:L1,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:\"high-performance\",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:Tr.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:\"sans-serif\",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:\"auto\",zoomLevelsToOverscale:4,anisotropicFilterPitch:20},B1=class extends wt{get _ownerWindow(){return this._container?.ownerDocument?.defaultView||window}constructor(e){super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new C5,this._controls=[],this._mapId=mh(),this._renderWindow=null,this._tileManagersPausedForRenderWindow=[],this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=a=>{if(a.preventDefault(),this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style){this.fire(new Ac(\"webglcontextlost\",{originalEvent:a}));return}for(let n of Object.values(this.style._layers))if(n.type===\"custom\"&&console.warn(`Custom layer with id '${n.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),n._listeners)for(let[s]of Object.entries(n._listeners))console.warn(`Custom layer with id '${n.id}' had event listeners for event '${s}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new Ac(\"webglcontextlost\",{originalEvent:a}))},this._contextRestored=a=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style){this.style.imageManager.images=this._lostContextStyle.images;for(let n in this._lostContextStyle.images){let s=this._lostContextStyle.images[n];s.isWebGLImage&&this.style.imageManager.updateImage(n,s,!1)}}this._lostContextStyle={style:null,images:null},this._setupPainter(),this.painter&&(this.resize(),this._update(),this._resizeInternal(),this.fire(new Ac(\"webglcontextrestored\",{originalEvent:a})))},this._onMapScroll=a=>{if(a.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let t={...w0,...e,canvasContextAttributes:{...w0.canvasContextAttributes,...e.canvasContextAttributes}};if(t.minZoom!=null&&t.maxZoom!=null&&t.minZoom>t.maxZoom)throw Error(\"maxZoom must be greater than or equal to minZoom\");if(t.minPitch!=null&&t.maxPitch!=null&&t.minPitch>t.maxPitch)throw Error(\"maxPitch must be greater than or equal to minPitch\");if(t.minPitch!=null&&t.minPitch<0)throw Error(\"minPitch must be greater than or equal to 0\");if(t.maxPitch!=null&&t.maxPitch>180)throw Error(\"maxPitch must be less than or equal to 180\");if(this._camera=new A5({minZoom:t.minZoom,maxZoom:t.maxZoom,minPitch:t.minPitch,maxPitch:t.maxPitch,bearingSnap:t.bearingSnap,zoomSnap:t.zoomSnap,renderWorldCopies:t.renderWorldCopies,centerClampedToGround:t.centerClampedToGround,terrain:this.terrain,transformConstrain:t.transformConstrain,requestRenderFrame:a=>this._requestRenderFrame(a),cancelRenderFrame:a=>this._cancelRenderFrame(a),transformCameraUpdate:t.transformCameraUpdate,stopHandlers:()=>this._handlers?.stop(!1)}),this._camera.setEventedParent(this),this._interactive=t.interactive,this._maxTileCacheSize=t.maxTileCacheSize,this._maxTileCacheZoomLevels=t.maxTileCacheZoomLevels,this._canvasContextAttributes={...t.canvasContextAttributes},this._trackResize=t.trackResize===!0,this._terrainSkirtLength=t.terrainSkirtLength,this._refreshExpiredTiles=t.refreshExpiredTiles===!0,this._fadeDuration=t.fadeDuration,this._crossSourceCollisions=t.crossSourceCollisions===!0,this._collectResourceTiming=t.collectResourceTiming===!0,this._locale={...D5,...t.locale},this._clickTolerance=t.clickTolerance,this._overridePixelRatio=t.pixelRatio,this._maxCanvasSize=t.maxCanvasSize,this._zoomLevelsToOverscale=t.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=t.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(t.anisotropicFilterPitch),t.reduceMotion!==void 0&&(zt.prefersReducedMotion=t.reduceMotion),this._imageQueueHandle=Mr.addThrottleControl(()=>this.isMoving()),this._requestManager=new yA(t.transformRequest),this._container=this._resolveContainer(t.container),t.maxBounds&&this.setMaxBounds(t.maxBounds),this._setupContainer(),this._setupPainter(),!this.painter)return;this.on(\"move\",()=>this._update(!1)),this.on(\"moveend\",()=>this._update(!1)),this.on(\"zoom\",()=>this._update(!0)),this.on(\"terrain\",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once(\"idle\",()=>this._idleTriggered=!0),this._handlers=new I5(this,this._camera,t),typeof window<\"u\"&&(this._ownerWindow.addEventListener(\"online\",this._onWindowOnline,!1),this._setupResizeObserver());let r=typeof t.hash==\"string\"&&t.hash||void 0;this._hash=t.hash?new Gk(r).addTo(this):void 0,this._hash?._onHashChange()||(this.jumpTo({center:t.center,elevation:t.elevation,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch,roll:t.roll}),t.bounds&&(this.resize(),this.fitBounds(t.bounds,j({},t.fitBoundsOptions,{duration:0}))));let i=typeof t.style==\"string\"||t.style?.projection?.type!==\"globe\";this.resize(null,i),this._localIdeographFontFamily=t.localIdeographFontFamily,this._validateStyle=t.validateStyle,t.style&&this.setStyle(t.style,{localIdeographFontFamily:t.localIdeographFontFamily}),t.attributionControl&&this.addControl(new M5(typeof t.attributionControl==\"boolean\"?void 0:t.attributionControl)),t.maplibreLogo&&this.addControl(new P5,t.logoPosition),this.on(\"style.load\",()=>{if(i||this._resizeTransform(),this._camera.transform.unmodified){let a=ka(this.style.stylesheet,[\"center\",\"zoom\",\"bearing\",\"pitch\",\"roll\"]);this.jumpTo(a)}}),this.on(\"data\",a=>{this._update(a.dataType===\"style\"),this.fire(a.dataType===\"style\"?new fr(\"styledata\",a):new Ie(\"sourcedata\",a))}),this.on(\"dataloading\",a=>{this.fire(a.dataType===\"style\"?new fr(\"styledataloading\",a):new Ie(\"sourcedataloading\",a))}),this.on(\"dataabort\",a=>{this.fire(new Ie(\"sourcedataabort\",a))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,t){return this.style.setGlobalStateProperty(e,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,t){if(t===void 0&&(t=e.getDefaultPosition?e.getDefaultPosition():\"top-right\"),!e?.onAdd)return this.fire(new X(Error(\"Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.\")));let r=e.onAdd(this);this._controls.push(e);let i=this._controlPositions[t];return t.includes(\"bottom\")?i.insertBefore(r,i.firstChild):i.appendChild(r),this}removeControl(e){if(!e?.onRemove)return this.fire(new X(Error(\"Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.\")));let t=this._controls.indexOf(e);return t>-1&&this._controls.splice(t,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return Za(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new K(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(e,t){return this._camera.setCenter(e,t),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(e,t){return this._camera.setCenterElevation(e,t),this}setCenterClampedToGround(e){this._camera.setCenterClampedToGround(e)}panBy(e,t,r){return this._camera.panBy(e,t,r),this}panTo(e,t,r){return this._camera.panTo(e,t,r),this}getZoom(){return this._camera.transform.zoom}setZoom(e,t){return this._camera.setZoom(e,t),this}zoomTo(e,t,r){return this._camera.zoomTo(e,t,r),this}zoomIn(e,t){return this._camera.zoomIn(e,t),this}zoomOut(e,t){return this._camera.zoomOut(e,t),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(e,t){return this._camera.setVerticalFieldOfView(e,t),this}getBearing(){return this._camera.transform.bearing}setBearing(e,t){return this._camera.setBearing(e,t),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(e){return this._camera.setZoomSnap(e),this}getPadding(){return this._camera.transform.padding}setPadding(e,t){return this._camera.setPadding(e,t),this}rotateTo(e,t,r){return this._camera.rotateTo(e,t,r),this}resetNorth(e,t){return this._camera.resetNorth(e,t),this}resetNorthPitch(e,t){return this._camera.resetNorthPitch(e,t),this}snapToNorth(e,t){return this._camera.snapToNorth(e,t),this}getPitch(){return this._camera.transform.pitch}setPitch(e,t){return this._camera.setPitch(e,t),this}getRoll(){return this._camera.transform.roll}setRoll(e,t){return this._camera.setRoll(e,t),this}cameraForBounds(e,t){return this._camera.cameraForBounds(e,t)}fitBounds(e,t,r){return this._camera.fitBounds(e,t,r),this}fitScreenCoordinates(e,t,r,i,a){return this._camera.fitScreenCoordinates(e,t,r,i,a),this}jumpTo(e,t){return this._camera.jumpTo(e,t),this}calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,t,r,i,a)}easeTo(e,t){return this._camera.easeTo(e,t),this}flyTo(e,t){return this._camera.flyTo(e,t),this}stop(){return this._camera.stop(),this}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(K.convert(e),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,t,r,i){return i==null&&this.terrain&&(i=this.terrain.getElevationForLngLat(r,this._camera.transform)),this._camera.calculateCameraOptionsFromTo(e,t,r,i)}resize(e,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);let r=!this._camera._moving;return r&&(this.stop(),this.fire(new W(\"movestart\",e)).fire(new W(\"move\",e))),this.fire(new lt(\"resize\",e)),r&&this.fire(new W(\"moveend\",e)),this}_resizeInternal(e=!0){if(this._renderWindow){this._resizeTransform(e),this._reapplyRenderWindow();return}let[t,r]=this._containerDimensions(),i=this._getClampedPixelRatio(t,r);if(this._resizeCanvas(t,r,i),this.painter.resize(t,r,i),this.painter.overLimit()){let a=this.painter.context.gl;this._maxCanvasSize=[a.drawingBufferWidth,a.drawingBufferHeight];let n=this._getClampedPixelRatio(t,r);this._resizeCanvas(t,r,n),this.painter.resize(t,r,n)}this._resizeTransform(e)}_resizeTransform(e=!0){let[t,r]=this._containerDimensions();this._camera.transform.resize(t,r,e),this._camera._requestedCameraState?.resize(t,r,e)}_getClampedPixelRatio(e,t){let{0:r,1:i}=this._maxCanvasSize,a=this.getPixelRatio(),n=e*a,s=t*a,o=n>r?r/n:1,l=s>i?i/s:1;return Math.min(o,l)*a}getPixelRatio(){return this._overridePixelRatio??devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}setRenderWindow(e){if(!e)return this._renderWindow&&this._clearRenderWindow(),this;if(!this.style||this.isContextLost())throw Error(\"setRenderWindow needs a style and a WebGL context: restart after `webglcontextrestored` and `idle`.\");if(!this._renderWindow&&(!this.loaded()||this.style.hasTransitions()||this.isMoving()))throw new jk;if(this.style.projection?.name!==\"mercator\"||this.style.projection.transitionState>0)throw Error(\"setRenderWindow supports only the mercator projection.\");let[t,r]=this._containerDimensions(),i=this.getPixelRatio(),a=this._createRenderWindowCrop(e,Math.floor(t*i),Math.floor(r*i)),n=this._renderWindow;if(n||this._freezeScene(),this._renderWindow=a.window,this._applyRenderWindowCrop(a),this.painter.overLimit()){let{drawingBufferWidth:s,drawingBufferHeight:o}=this.painter.context.gl;throw n?(this._renderWindow=n,this._reapplyRenderWindow()):this._clearRenderWindow(),new y0(a.window.width,a.window.height,s,o)}return this.triggerRepaint(),this}isContextLost(){return!this.painter||this.painter.context.gl.isContextLost()}getRenderWindow(){return this._renderWindow?{...this._renderWindow}:null}_freezeScene(){this._placementDirty&&(this._placementDirty=(this.style._releaseSymbolFadeTiles(),this.style._updatePlacement(this._camera.transform,this.showCollisionBoxes,0,this._crossSourceCollisions,!0))),this._tileManagersPausedForRenderWindow=Object.values(this.style.tileManagers).filter(e=>!e._paused);for(let e of this._tileManagersPausedForRenderWindow)e.pause()}_thawScene(){let e=Object.values(this.style?.tileManagers??{});for(let t of this._tileManagersPausedForRenderWindow)e.includes(t)&&t.resume();this._tileManagersPausedForRenderWindow=[],this.terrain?.tileManager.releaseAllRTT(),this._update()}_createRenderWindowCrop(e,t,r){let{x:i,y:a,width:n,height:s}=e;if(![i,a,n,s].every(Number.isInteger))throw Error(\"The render window's x, y, width and height must be integers.\");if(n<1||s<1||i<0||a<0||i+n>t||a+s>r)throw Error(`The render window must lie inside the ${t}\\xD7${r} full drawing buffer.`);let o=this.painter.context.gl,l=o.getParameter(o.MAX_RENDERBUFFER_SIZE),u=o.getParameter(o.MAX_VIEWPORT_DIMS),h=Math.min(l,u[0]),c=Math.min(l,u[1]);if(n>h||s>c)throw new y0(n,s,Math.min(n,h),Math.min(s,c));return new E1(e,t,r)}_applyRenderWindowCrop(e){let[t,r]=this._containerDimensions();this._canvas.width=e.window.width,this._canvas.height=e.window.height,this._canvas.style.width=`${t}px`,this._canvas.style.height=`${r}px`,this.painter.resizeDrawingBuffer(e.window.width,e.window.height,this.getPixelRatio()),this._camera.transform.setRenderWindowCrop(e),this.painter.terrainFacilitator.depthDirty=!0}_reapplyRenderWindow(){let[e,t]=this._containerDimensions(),r=this.getPixelRatio(),i=Math.floor(e*r),a=Math.floor(t*r),n=this._camera.transform.renderWindowCrop;if(n&&(n.fullWidth!==i||n.fullHeight!==a)){pe(\"Clearing the render window: the container size or pixel ratio changed.\"),this._clearRenderWindow();return}let s;try{s=this._createRenderWindowCrop(this._renderWindow,i,a)}catch(o){pe(`Clearing the render window: ${it(o).message}`),this._clearRenderWindow();return}this._applyRenderWindowCrop(s),this.painter.overLimit()&&(pe(\"Clearing the render window: the browser no longer provides a drawing buffer of its size.\"),this._clearRenderWindow())}_clearRenderWindow(){this._renderWindow=null,this._camera.transform.setRenderWindowCrop(null),this._resizeInternal(),this.painter.terrainFacilitator.depthDirty=!0,this._thawScene()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(e){return this._camera.transform.setMaxBounds(Kr.convert(e)),this._update()}setMinZoom(e){if(e??(e=-2),e>=-2&&e<=this._camera.transform.maxZoom){let t=this._camera.transform.zoom,r=this._camera.getTransformForUpdate();return r.setMinZoom(e),this._camera.applyUpdatedTransform(r),this._update(),t!==this._camera.transform.zoom&&this.fire(new W(\"zoomstart\")).fire(new W(\"zoom\")).fire(new W(\"zoomend\")).fire(new W(\"movestart\")).fire(new W(\"move\")).fire(new W(\"moveend\")),this}throw Error(\"minZoom must be between -2 and the current maxZoom, inclusive\")}getMinZoom(){return this._camera.transform.minZoom}setMaxZoom(e){if(e??(e=22),e>=this._camera.transform.minZoom){let t=this._camera.transform.zoom,r=this._camera.getTransformForUpdate();return r.setMaxZoom(e),this._camera.applyUpdatedTransform(r),this._update(),t!==this._camera.transform.zoom&&this.fire(new W(\"zoomstart\")).fire(new W(\"zoom\")).fire(new W(\"zoomend\")).fire(new W(\"movestart\")).fire(new W(\"move\")).fire(new W(\"moveend\")),this}throw Error(\"maxZoom must be greater than the current minZoom\")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(e){if(e??(e=0),e<0)throw Error(\"minPitch must be greater than or equal to 0\");if(e>=0&&e<=this._camera.transform.maxPitch){let t=this._camera.transform.pitch,r=this._camera.getTransformForUpdate();return r.setMinPitch(e),this._camera.applyUpdatedTransform(r),this._update(),t!==this._camera.transform.pitch&&this.fire(new W(\"pitchstart\")).fire(new W(\"pitch\")).fire(new W(\"pitchend\")).fire(new W(\"movestart\")).fire(new W(\"move\")).fire(new W(\"moveend\")),this}throw Error(\"minPitch must be between 0 and the current maxPitch, inclusive\")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(e){if(e??(e=60),e>180)throw Error(\"maxPitch must be less than or equal to 180\");if(e>=this._camera.transform.minPitch){let t=this._camera.transform.pitch,r=this._camera.getTransformForUpdate();return r.setMaxPitch(e),this._camera.applyUpdatedTransform(r),this._update(),t!==this._camera.transform.pitch&&this.fire(new W(\"pitchstart\")).fire(new W(\"pitch\")).fire(new W(\"pitchend\")).fire(new W(\"movestart\")).fire(new W(\"move\")).fire(new W(\"moveend\")),this}throw Error(\"maxPitch must be greater than the current minPitch\")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if(e??(e=20),e>180)throw Error(\"anisotropicFilterPitch must be less than or equal to 180\");if(e<0)throw Error(\"anisotropicFilterPitch must be greater than or equal to 0\");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(e){return this._camera.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this._camera.transform.setConstrainOverride(e),this._update()}project(e){return this._camera.transform.locationToScreenPoint(K.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.transform.screenPointToLocation(C.convert(e),this.terrain)}isMoving(){return this._camera.isMoving()||this._handlers?.isMoving()||!1}isZooming(){return this._camera.isZooming()||this._handlers?.isZooming()||!1}isRotating(){return this._camera.isRotating()||this._handlers?.isRotating()||!1}_createDelegatedListener(e,t,r){if(e===\"mouseenter\"||e===\"mouseover\"){let i=!1;return{layers:t,listener:r,delegates:{mousemove:a=>{let n=t.filter(o=>this.getLayer(o)),s=n.length===0?[]:this.queryRenderedFeatures(a.point,{layers:n});s.length?i||(i=!0,r.call(this,new tr(e,this,a.originalEvent,{features:s}))):i=!1},mouseout:()=>{i=!1}}}}if(e===\"mouseleave\"||e===\"mouseout\"){let i=!1;return{layers:t,listener:r,delegates:{mousemove:a=>{let n=t.filter(s=>this.getLayer(s));(n.length===0?[]:this.queryRenderedFeatures(a.point,{layers:n})).length?i=!0:i&&(i=!1,r.call(this,new tr(e,this,a.originalEvent)))},mouseout:a=>{i&&(i=!1,r.call(this,new tr(e,this,a.originalEvent)))}}}}{let i=a=>{let n=t.filter(o=>this.getLayer(o)),s=n.length===0?[]:this.queryRenderedFeatures(a.point,{layers:n});s.length&&(a.features=s,r.call(this,a),delete a.features)};return{layers:t,listener:r,delegates:{[e]:i}}}}_saveDelegatedListener(e,t){var r;this._delegatedListeners||(this._delegatedListeners={}),(r=this._delegatedListeners)[e]||(r[e]=[]),this._delegatedListeners[e].push(t)}_removeDelegatedListener(e,t,r){if(!this._delegatedListeners?.[e])return;let i=this._delegatedListeners[e];for(let a=0;a<i.length;a++){let n=i[a];if(n.listener===r&&n.layers.length===t.length&&n.layers.every(s=>t.includes(s))){for(let s in n.delegates)this.off(s,n.delegates[s]);i.splice(a,1);return}}}on(e,t,r){if(r===void 0)return super.on(e,t);let i=typeof t==\"string\"?[t]:t,a=this._createDelegatedListener(e,i,r);this._saveDelegatedListener(e,a);for(let n in a.delegates)this.on(n,a.delegates[n]);return{unsubscribe:()=>{this._removeDelegatedListener(e,i,r)}}}once(e,t,r){if(r===void 0)return super.once(e,t);let i=typeof t==\"string\"?[t]:t,a=this._createDelegatedListener(e,i,r);for(let n in a.delegates){let s=a.delegates[n];a.delegates[n]=(...o)=>{this._removeDelegatedListener(e,i,r),s(...o)}}this._saveDelegatedListener(e,a);for(let n in a.delegates)this.once(n,a.delegates[n]);return this}off(e,t,r){if(r===void 0)return super.off(e,t);let i=typeof t==\"string\"?[t]:t;return this._removeDelegatedListener(e,i,r),this}queryRenderedFeatures(e,t){if(!this.style)return[];let r,i=e instanceof C||Array.isArray(e),a=i?e:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(t||(t=(i?{}:e)||{}),a instanceof C||typeof a[0]==\"number\")r=[C.convert(a)];else{let n=C.convert(a[0]),s=C.convert(a[1]);r=[n,new C(s.x,n.y),s,new C(n.x,s.y),n]}return this.style.queryRenderedFeatures(r,t,this._camera.transform)}querySourceFeatures(e,t){return this.style.querySourceFeatures(e,t)}setStyle(e,t){return t=j({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},t),t.diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(e,t))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let t=this._locale[e];if(t==null)throw Error(`Missing UI string '${e}'`);return t}_updateStyle(e,t){if(this._diffStyleRequest?.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded){this.style.once(\"style.load\",()=>this._updateStyle(e,t));return}this._renderWindow&&(pe(\"Clearing the render window: the style was replaced.\"),this._clearRenderWindow());let r=this.style&&t.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new a0(this,t||{});else return this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this.style?.projection?.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e==\"string\"?this.style.loadURL(e,t,r):this.style.loadJSON(e,t,r),this}_lazyInitEmptyStyle(){this.style||(this.style=new a0(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}async _diffStyle(e,t){if(this._diffStyleRequest?.abort(),typeof e==\"string\"){let r=e;this._diffStyleRequest=new AbortController;let i=this._diffStyleRequest;try{let a=await this._requestManager.transformRequest(r,\"Style\");if(i.signal.aborted){this._diffStyleRequest=null;return}let n=await jn(a,i);this._diffStyleRequest=null,this._updateDiff(n.data,t)}catch(a){this._diffStyleRequest=null,$r(a)||this.fire(new X(it(a)))}}else typeof e==\"object\"&&(this._diffStyleRequest=null,this._updateDiff(e,t))}_updateDiff(e,t){try{this.style.setState(e,t)&&this._update(!0)}catch(r){pe(`Unable to perform style diff: ${it(r).message}.  Rebuilding the style from scratch.`),this._updateStyle(e,t)}}getStyle(){if(this.style)return this.style.serialize()}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(!this.style){pe(\"There is no style added to the map.\");return}return this.style.loaded()}addSource(e,t){return this._lazyInitEmptyStyle(),this.style.addSource(e,t),this._update(!0)}isSourceLoaded(e){let t=this.style?.tileManagers[e];if(t===void 0){this.fire(new X(Error(`There is no tile manager with ID '${e}'`)));return}return t.loaded()}setTerrain(e,t={}){if(this.style._checkLoaded(),this._renderWindow&&(e||this.terrain)&&(pe(\"Clearing the render window: the terrain changed.\"),this._clearRenderWindow()),e&&Ba(this,It.terrain,{value:e},t))return this;if(this._terrainDataCallback&&this.style.off(\"data\",this._terrainDataCallback),!e)this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);else{let r=this.style.tileManagers[e.source];if(!r)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain===null&&r.reload();for(let i in this.style._layers){let a=this.style._layers[i];a.type===\"hillshade\"&&a.source===e.source&&pe(\"You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.\"),a.type===\"color-relief\"&&a.source===e.source&&pe(\"You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.\")}this.terrain&&this.terrain.destroy(),this.terrain=new DP(this.painter,r,e,this._terrainSkirtLength),this.painter.renderToTexture=new k5(this.painter,this.terrain),this._camera.terrain=this.terrain,this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._camera.transform.setElevation(this.terrain.getElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._terrainDataCallback=i=>this._handleTerrainDataEvent(i,e.source),this.style.on(\"data\",this._terrainDataCallback)}return this.fire(new xA({terrain:e})),this}_handleTerrainDataEvent(e,t){if(this._renderWindow)return;if(e.dataType===\"style\"){this.terrain.tileManager.releaseAllRTT();return}let r=e.sourceId===t;if(r&&this.terrain.resetElevationCache(),r&&e.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom))),e.tile){if(e.source?.type===\"image\"){this.terrain.tileManager.releaseAllRTT();return}this.terrain.tileManager.releaseRTT(e.tile.tileID)}}getTerrain(){return this.terrain?.options??null}areTilesLoaded(){let e=this.style?.tileManagers;for(let t of Object.values(e))if(!t.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style?.getSource(e)}setSourceTileLodParams(e,t,r){if(r){let i=this.getSource(r);if(!i)throw Error(`There is no source with ID \"${r}\", cannot set LOD parameters`);i.calculateTileZoom=Zc(Math.max(1,e),Math.max(1,t))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=Zc(Math.max(1,e),Math.max(1,t));return this._update(!0),this}refreshTiles(e,t){let r=this.style.tileManagers[e];if(!r)throw Error(`There is no tile manager with ID \"${e}\", cannot refresh tile`);t===void 0?r.reload(!0):r.refreshTiles(t.map(i=>new as(i.z,i.x,i.y)))}addImage(e,t,r={}){this._lazyInitEmptyStyle();let i=this._createStyleImage(t,r);return i?(this.style.addImage(e,i),i.userImage?.onAdd&&i.userImage.onAdd(this,e),this):this}setMissingStyleImageResolver(e){return this._missingStyleImageResolver=e,this.style?.setMissingImageResolver(e),this}_createStyleImage(e,t={}){let{pixelRatio:r=1,sdf:i=!1,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l}=t;if(e instanceof HTMLImageElement||mi(e)){let{width:u,height:h,data:c}=zt.getImageData(e);return{data:new xe({width:u,height:h},c),pixelRatio:r,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l,sdf:i,version:0}}if(e.width===void 0||e.height===void 0)return this.fire(new X(Error(\"Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`\"))),null;{let{width:u,height:h,data:c}=e,p=e,d=Qn(p.data);return{data:d?new xe({width:u,height:h}):new xe({width:u,height:h},new Uint8Array(c)),pixelRatio:r,stretchX:a,stretchY:n,content:s,textFitWidth:o,textFitHeight:l,sdf:i,version:0,isWebGLImage:d,userImage:p}}}updateImage(e,t){let r=this.style.getImage(e);if(!r)return this.fire(new X(Error(\"The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.\")));let{width:i,height:a,data:n}=t instanceof HTMLImageElement||mi(t)?zt.getImageData(t):t;if(i===void 0||a===void 0)return this.fire(new X(Error(\"Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`\")));if(i!==r.data.width||a!==r.data.height)return this.fire(new X(Error(\"The width and height of the updated image must be that same as the previous version of the image\")));if(r.isWebGLImage=Qn(n),r.isWebGLImage)r.userImage=t;else{let s=!(t instanceof HTMLImageElement||mi(t));r.data.replace(n,s)}return this.style.updateImage(e,r),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new X(Error(\"Missing required image id\"))),!1)}removeImage(e){this.style.removeImage(e)}async loadImage(e){return Mr.getImage(await this._requestManager.transformRequest(e,\"Image\"),new AbortController)}listImages(){return this.style?.listImages()??[]}addLayer(e,t){return this._lazyInitEmptyStyle(),this.style.addLayer(e,t),this._update(!0)}moveLayer(e,t){return this.style.moveLayer(e,t),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style?.getLayer(e)}getLayersOrder(){return this.style?.getLayersOrder()??[]}setLayerZoomRange(e,t,r){return this.style.setLayerZoomRange(e,t,r),this._update(!0)}setFilter(e,t,r={}){return this.style?.setFilter(e,t,r),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,t,r,i={}){return this.style?.setPaintProperty(e,t,r,i),this._update(!0)}getPaintProperty(e,t){return this.style.getPaintProperty(e,t)}setLayoutProperty(e,t,r,i={}){return this.style.setLayoutProperty(e,t,r,i),this._update(!0)}getLayoutProperty(e,t){return this.style.getLayoutProperty(e,t)}setGlyphs(e,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,t,r={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,t,r,i=>{i||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,t,r=>{r||this._update(!0)}),this}setLight(e,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,t){return this.style.setFeatureState(e,t),this._update()}removeFeatureState(e,t){return this.style.removeFeatureState(e,t),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,t=0;return this._container&&(e=this._container.clientWidth||400,t=this._container.clientHeight||300),[e,t]}_setupResizeObserver(){let e=!1,t=R1(i=>{this._trackResize&&!this._removed&&(this.resize(i),this.redraw())},50),r=this._ownerWindow.ResizeObserver??ResizeObserver;this._resizeObserver=new r(i=>{if(!e){e=!0;return}t(i)}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if(typeof e==\"string\"){let t=document.getElementById(e);if(!t)throw Error(`Container '${e}' not found.`);return t}if(e instanceof HTMLElement||e&&typeof e==\"object\"&&e.nodeType===1)return e;throw Error(\"Invalid type: 'container' must be a String or HTMLElement.\")}_setupContainer(){let e=this._container;e.classList.add(\"maplibregl-map\");let t=this._canvasContainer=Ne.create(\"div\",\"maplibregl-canvas-container\",e);this._interactive&&t.classList.add(\"maplibregl-interactive\"),this._canvas=Ne.create(\"canvas\",\"maplibregl-canvas\",t),this._canvas.addEventListener(\"webglcontextlost\",this._contextLost,!1),this._canvas.addEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.setAttribute(\"tabindex\",this._interactive?\"0\":\"-1\"),this._canvas.setAttribute(\"aria-label\",this._getUIString(\"Map.Title\")),this._canvas.setAttribute(\"role\",\"region\");let r=this._containerDimensions(),i=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],i);let a=this._controlContainer=Ne.create(\"div\",\"maplibregl-control-container\",e),n=this._controlPositions={};for(let s of[\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"])n[s]=Ne.create(\"div\",`maplibregl-ctrl-${s} `,a);this._container.addEventListener(\"scroll\",this._onMapScroll,!1)}_resizeCanvas(e,t,r){this._canvas.width=Math.floor(r*e),this._canvas.height=Math.floor(r*t),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${t}px`}_setupPainter(){let e={...this._canvasContextAttributes,alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0},t=null;this._canvas.addEventListener(\"webglcontextcreationerror\",i=>{t=i},{once:!0});let r=this._canvas.getContext(\"webgl2\",e);if(!r){this.fire(new X(new z1(e,t)));return}this.painter=new $k(r,this._camera.transform)}migrateProjection(e,t){this._renderWindow&&(pe(\"Clearing the render window: the map's transform was replaced by a projection change.\"),this._clearRenderWindow()),this._camera.migrateProjection(e,t),this.painter.transform=e,this.fire(new vA({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return this.style?._loaded?(this._styleDirty||(this._styleDirty=e),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){let t=this._idleTriggered?this._fadeDuration:0,r=this.style.projection?.transitionState>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let i=!1,a=!!this._renderWindow;if(this.style&&this._styleDirty&&!a){this._styleDirty=!1;let o=this._camera.transform.zoom,l=ye();this.style.zoomHistory.update(o,l);let u=new Te(o,{now:l,fadeDuration:t,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),h=u.crossFadingFactor();(h!==1||h!==this._crossFadingFactor)&&(i=!0,this._crossFadingFactor=h),this.style.update(u)}let n=this.style.projection?.transitionState>0!==r;this._camera.transform.setTransitionState(this.style.projection?.transitionState),this.style&&(this._sourcesDirty||n)&&!a&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),a||(this._updateTerrainAndElevation(),this._placementDirty=this.style?._updatePlacement(this._camera.transform,this.showCollisionBoxes,t,this._crossSourceCollisions,n)),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:t,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new lt(\"render\")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new lt(\"load\"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let s=!a&&(this._sourcesDirty||this._styleDirty||this._placementDirty);return s||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new lt(\"idle\")),this._loaded&&!this._fullyLoaded&&!s&&(this._fullyLoaded=!0),this}_updateTerrainAndElevation(){this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain),this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0))}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(let t of this._controls)t.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._renderTaskQueue.clear(),this._diffStyleRequest?.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<\"u\"&&this._ownerWindow.removeEventListener(\"online\",this._onWindowOnline,!1),Mr.removeThrottleControl(this._imageQueueHandle),this._resizeObserver?.disconnect();let e=this.painter.context.gl.getExtension(\"WEBGL_lose_context\");e?.loseContext&&e.loseContext(),this._canvas.removeEventListener(\"webglcontextrestored\",this._contextRestored,!1),this._canvas.removeEventListener(\"webglcontextlost\",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener(\"scroll\",this._onMapScroll,!1),this._container.classList.remove(\"maplibregl-map\"),this._removed=!0,this.fire(new lt(\"remove\"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,zt.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(t){if(!$r(t))throw t}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return F5}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}};var _R=[\"a[href]\",\"[tabindex]:not([tabindex='-1'])\",\"[contenteditable]:not([contenteditable='false'])\",\"button:not([disabled])\",\"input:not([disabled])\",\"select:not([disabled])\",\"textarea:not([disabled])\"].join(\", \");var z5=T0;function O1(){return z5}function V1(){return Tr.WORKER_URL}function N1(e){Tr.WORKER_URL=e}var pp=\"6.6.0-atlas.5\",U1='(()=>{/**\\n* MapLibre GL JS\\n* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.6.0/LICENSE.txt\\n*/var Tf=Object.create,Ou=Object.defineProperty,kf=Object.getOwnPropertyDescriptor,If=Object.getOwnPropertyNames,Ef=Object.getPrototypeOf,Ru=Object.prototype.hasOwnProperty,Ds=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),Mf=(t,e,r,i)=>{if(e&&typeof e==\"object\"||typeof e==\"function\")for(var n=If(e),a=0,s=n.length,o;a<s;a++)o=n[a],!Ru.call(t,o)&&o!==r&&Ou(t,o,{get:(l=>e[l]).bind(null,o),enumerable:!(i=kf(e,o))||i.enumerable});return t},Df=(t,e,r)=>(r=t==null?{}:Tf(Ef(t)),Mf(e||!t||!t.__esModule||!Ru.call(t,\"default\")?Ou(r,\"default\",{value:t,enumerable:!0}):r,t));function F(t,e){this.x=t,this.y=e}F.prototype={clone(){return new F(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){let e=t.x-this.x,r=t.y-this.y;return e*e+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){let e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let e=Math.cos(t),r=Math.sin(t),i=e*this.x-r*this.y,n=r*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround(t,e){let r=Math.cos(t),i=Math.sin(t),n=e.x+r*(this.x-e.x)-i*(this.y-e.y),a=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=n,this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:F},F.convert=function(t){if(t instanceof F)return t;if(Array.isArray(t))return new F(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new F(+t.x,+t.y);throw Error(\"Expected [x, y] or {x, y} point format\")};function Ff(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)<c)return((u*p+l)*p+o)*p;let g=(3*s*p+2*a)*p+n;if(Math.abs(g)<1e-6)break;p-=m/g}let f=0,d=1;p=h;for(let y=0;y<20;y++){let m=((s*p+a)*p+n)*p;if(Math.abs(m-h)<c)break;h>m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var Yo;function Pf(){return Yo??=typeof OffscreenCanvas<\"u\"&&new OffscreenCanvas(1,1).getContext(\"2d\")&&typeof createImageBitmap==\"function\",Yo}var Ii;function Cf(){if(Ii==null&&(Ii=!1,Pf())){let t=new OffscreenCanvas(5,5).getContext(\"2d\",{willReadFrequently:!0});if(t){for(let r=0;r<25;r++){let i=r*4;t.fillStyle=`rgb(${i},${i+1},${i+2})`,t.fillRect(r%5,Math.floor(r/5),1,1)}let e=t.getImageData(0,0,5,5).data;for(let r=0;r<100;r++)if(r%4!=3&&e[r]!==r){Ii=!0;break}}}return Ii||!1}var Ut=typeof Float32Array<\"u\"?Float32Array:Array;Math.PI/180,180/Math.PI;function zf(){var t=new Ut(9);return Ut!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function $u(){var t=new Ut(3);return Ut!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function Bf(t){var e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function Xo(t,e,r){var i=new Ut(3);return i[0]=t,i[1]=e,i[2]=r,i}function Lf(t,e){var r=e[0],i=e[1],n=e[2],a=r*r+i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t}function Vf(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Yn(t,e,r){var i=e[0],n=e[1],a=e[2],s=r[0],o=r[1],l=r[2];return t[0]=n*l-a*o,t[1]=a*s-i*l,t[2]=i*o-n*s,t}var Of=Bf;(function(){var t=$u();return function(e,r,i,n,a,s){var o,l;for(r||=3,i||=0,l=n?Math.min(n*r+i,e.length):e.length,o=i;o<l;o+=r)t[0]=e[o],t[1]=e[o+1],t[2]=e[o+2],a(t,t,s),e[o]=t[0],e[o+1]=t[1],e[o+2]=t[2];return e}})();function Rf(){var t=new Ut(4);return Ut!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function $f(t,e){var r=e[0],i=e[1],n=e[2],a=e[3],s=r*r+i*i+n*n+a*a;return s>0&&(s=1/Math.sqrt(s)),t[0]=r*s,t[1]=i*s,t[2]=n*s,t[3]=a*s,t}function Nf(t,e,r){var i=e[0],n=e[1],a=e[2],s=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*s,t[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*s,t[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*s,t[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*s,t}(function(){var t=Rf();return function(e,r,i,n,a,s){var o,l;for(r||=4,i||=0,l=n?Math.min(n*r+i,e.length):e.length,o=i;o<l;o+=r)t[0]=e[o],t[1]=e[o+1],t[2]=e[o+2],t[3]=e[o+3],a(t,t,s),e[o]=t[0],e[o+1]=t[1],e[o+2]=t[2],e[o+3]=t[3];return e}})();function Zo(){var t=new Ut(4);return Ut!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Uf(t,e,r){r*=.5;var i=Math.sin(r);return t[0]=i*e[0],t[1]=i*e[1],t[2]=i*e[2],t[3]=Math.cos(r),t}function Xn(t,e,r,i){var n=e[0],a=e[1],s=e[2],o=e[3],l=r[0],u=r[1],h=r[2],c=r[3],p,f=n*l+a*u+s*h+o*c,d,y,m;return f<0&&(f=-f,l=-l,u=-u,h=-h,c=-c),1-f>1e-6?(p=Math.acos(f),d=Math.sin(p),y=Math.sin((1-i)*p)/d,m=Math.sin(i*p)/d):(y=1-i,m=i),t[0]=y*n+m*l,t[1]=y*a+m*u,t[2]=y*s+m*h,t[3]=y*o+m*c,t}function qf(t,e){var r=e[0]+e[4]+e[8],i;if(r>0)i=Math.sqrt(r+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var n=0;e[4]>e[0]&&(n=1),e[8]>e[n*3+n]&&(n=2);var a=(n+1)%3,s=(n+2)%3;i=Math.sqrt(e[n*3+n]-e[a*3+a]-e[s*3+s]+1),t[n]=.5*i,i=.5/i,t[3]=(e[a*3+s]-e[s*3+a])*i,t[a]=(e[a*3+n]+e[n*3+a])*i,t[s]=(e[s*3+n]+e[n*3+s])*i}return t}var Wo=$f;(function(){var t=$u(),e=Xo(1,0,0),r=Xo(0,1,0);return function(i,n,a){var s=Vf(n,a);return s<-.999999?(Yn(t,e,n),Of(t)<1e-6&&Yn(t,r,n),Lf(t,t),Uf(i,t,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(Yn(t,n,a),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+s,Wo(i,i))}})(),(function(){var t=Zo(),e=Zo();return function(r,i,n,a,s,o){return Xn(t,i,s,o),Xn(e,n,a,o),Xn(r,t,e,2*o*(1-o)),r}})(),(function(){var t=zf();return function(e,r,i,n){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=n[0],t[4]=n[1],t[7]=n[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],Wo(e,qf(e,t))}})();function Gf(){var t=new Ut(2);return Ut!=Float32Array&&(t[0]=0,t[1]=0),t}(function(){var t=Gf();return function(e,r,i,n,a,s){var o,l;for(r||=2,i||=0,l=n?Math.min(n*r+i,e.length):e.length,o=i;o<l;o+=r)t[0]=e[o],t[1]=e[o+1],a(t,t,s),e[o]=t[0],e[o+1]=t[1];return e}})();var nt=8192;var Nu=\"__$json__:\";function Yr(t){return t instanceof Error?t:Error(typeof t==\"string\"?t:String(t))}function jf(t){if(t<=0)return 0;if(t>=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function Yf(t,e,r,i){return Ff(t,e,r,i)}var Hb=Yf(.25,.1,.25,1);function Xr(t,e,r){return Math.min(r,Math.max(e,t))}function Xf(t,e,r){let i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function Mt(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function Zf(t){return Math.log(t)/Math.LN2%1==0}function fn(t,e,r){let i={};for(let n in t)i[n]=e.call(r||this,t[n],n,t);return i}function Wf(t,e,r){let i={};for(let n in t)e.call(r||this,t[n],n,t)&&(i[n]=t[n]);return i}function fe(t){return Array.isArray(t)?t.map(fe):typeof t==\"object\"&&t?fn(t,fe):t}var Ho={};function mt(t){Ho[t]||(typeof console<\"u\"&&console.warn(t),Ho[t]=!0)}function de(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function Fe(t){return typeof WorkerGlobalScope<\"u\"&&t!==void 0&&t instanceof WorkerGlobalScope}function dn(t){return typeof ImageBitmap<\"u\"&&t instanceof ImageBitmap}function Hf(t,e,r,i,n){let a=Math.max(-e,0)*4,s=(Math.max(0,r)-r)*i*4+a,o=i*4,l=Math.max(0,e),u=Math.max(0,r),h=Math.min(t.width,e+i),c=Math.min(t.height,r+n);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:s,stride:o}]}}async function Kf(t,e,r,i,n){if(typeof VideoFrame>\"u\")throw Error(\"VideoFrame not supported\");let a=new VideoFrame(t,{timestamp:0});try{let s=a?.format;if(!s||!(s.startsWith(\"BGR\")||s.startsWith(\"RGB\")))throw Error(`Unrecognized format ${s}`);let o=s.startsWith(\"BGR\"),l=new Uint8ClampedArray(i*n*4);if(await a.copyTo(l,Hf(t,e,r,i,n)),o)for(let u=0;u<l.length;u+=4){let h=l[u];l[u]=l[u+2],l[u+2]=h}return l}finally{a.close()}}var br,wr;function Jf(t,e,r,i,n){let a=t.width,s=t.height;(!br||!wr)&&(br=new OffscreenCanvas(a,s),wr=br.getContext(\"2d\",{willReadFrequently:!0})),br.width=a,br.height=s,wr.drawImage(t,0,0,a,s);let o=wr.getImageData(e,r,i,n);return wr.clearRect(0,0,a,s),o.data}async function Uu(t,e,r,i,n){if(Cf())try{return await Kf(t,e,r,i,n)}catch{}return Jf(t,e,r,i,n)}function Ko(t,e,r,i){return t.addEventListener(e,r,i),{unsubscribe:()=>{t.removeEventListener(e,r,i)}}}function Jo(t){return t*Math.PI/180}var Qo=\"AbortError\",Fs=class extends Error{constructor(t=Qo){super(t instanceof Error?t.message:t),this.name=Qo,t instanceof Error&&t.stack&&(this.stack=t.stack)}};function Ps(t){return t instanceof Error&&t.name===\"AbortError\"}function Qf(t){if(t.aborted)throw new Fs(t.reason)}var Cs={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:\"\"};function td(t){return Cs.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf(\"://\"))]}function qu(t,e){Cs.REGISTERED_PROTOCOLS[t]=e}function Gu(t){delete Cs.REGISTERED_PROTOCOLS[t]}var tl=\"global-dispatcher\",Ki=class extends Error{constructor(t,e,r,i){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=i}};function ju(){if(Fe(self))return self.worker?.referrer;if(window.location.protocol===\"blob:\")try{return window.parent.location.href}catch{}return window.location.href}var ed=t=>t.startsWith(\"file:\")||ju()?.startsWith(\"file:\")&&!/^\\\\w+:/.test(t);async function rd(t,e){let r=new Request(t.url,{method:t.method||\"GET\",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:ju(),referrerPolicy:t.referrerPolicy,signal:e.signal});t.type===\"json\"&&!r.headers.has(\"Accept\")&&r.headers.set(\"Accept\",\"application/json\");let i;try{i=await fetch(r)}catch(s){throw Ps(s)?s:new Ki(0,Yr(s).message,t.url,new Blob)}if(!i.ok){let s=await i.blob();throw new Ki(i.status,i.statusText,t.url,s)}let n;n=t.type===\"arrayBuffer\"||t.type===\"image\"?i.arrayBuffer():t.type===\"json\"?i.json():i.text();let a=await n;return Qf(e.signal),{data:a,cacheControl:i.headers.get(\"Cache-Control\"),expires:i.headers.get(\"Expires\"),etag:i.headers.get(\"ETag\")}}function id(t,e){return new Promise((r,i)=>{let n=new XMLHttpRequest;n.open(t.method||\"GET\",t.url,!0),(t.type===\"arrayBuffer\"||t.type===\"image\")&&(n.responseType=\"arraybuffer\");for(let a in t.headers)n.setRequestHeader(a,t.headers[a]);t.type===\"json\"&&(n.responseType=\"text\",t.headers?.Accept||n.setRequestHeader(\"Accept\",\"application/json\")),n.withCredentials=t.credentials===\"include\",n.onerror=()=>{i(Error(n.statusText))},n.onload=()=>{if(!e.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let a=n.response;if(t.type===\"json\")try{a=JSON.parse(n.response)}catch(s){i(s);return}r({data:a,cacheControl:n.getResponseHeader(\"Cache-Control\"),expires:n.getResponseHeader(\"Expires\"),etag:n.getResponseHeader(\"ETag\")})}else{let a=new Blob([n.response],{type:n.getResponseHeader(\"Content-Type\")});i(new Ki(n.status,n.statusText,t.url,a))}},e.signal.addEventListener(\"abort\",()=>{n.abort(),i(new Fs(e.signal.reason))}),n.send(t.body)})}var yn=async function(t,e){if(t.url.includes(\"://\")&&!/^https?:|^file:/.test(t.url)){let r=td(t.url);if(r){let i=await r(t,e);return!i.data&&t.type===\"arrayBuffer\"?Mt(i,{data:new ArrayBuffer(0)}):i}if(Fe(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:\"GR\",data:t,targetMapId:tl},e)}if(!ed(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,\"signal\"))return rd(t,e);if(Fe(self)&&self.worker?.actor)return self.worker.actor.sendAsync({type:\"GR\",data:t,mustQueue:!0,targetMapId:tl},e)}return id(t,e)},Yu=(t,e)=>yn(Mt(t,{type:\"json\"}),e),Xu=(t,e)=>yn(Mt(t,{type:\"arrayBuffer\"}),e);function el(t,e,r){r[t]?.includes(e)||(r[t]||=[],r[t].push(e))}function Zn(t,e,r){if(r?.[t]){let i=r[t].indexOf(e);i!==-1&&r[t].splice(i,1)}}var Zu=class{constructor(t,e={}){Mt(this,e),this.type=t}},Ji=class extends Zu{constructor(t,e={}){super(\"error\",Mt({error:t},e))}},nd=class{on(t,e){return this._listeners||={},el(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return Zn(t,e,this._listeners),Zn(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||={},el(t,e,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,e){let r=typeof t==\"string\"?new Zu(t,e||{}):t,i=r.type;if(this.listens(i)){r.target=this;let n=this._listeners?.[i]?.slice()??[];for(let o of n)o.call(this,r);let a=this._oneTimeListeners?.[i]?.slice()??[];for(let o of a)Zn(i,o,this._oneTimeListeners),o.call(this,r);let s=this._eventedParent;s&&(Mt(r,typeof this._eventedParentData==\"function\"?this._eventedParentData():this._eventedParentData),s.fire(r))}else r instanceof Ji&&console.error(r.error);return this}listens(t){return!!(this._listeners?.[t]?.length||this._oneTimeListeners?.[t]?.length||this._eventedParent?.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}},Wu={$version:8,$root:{version:{required:!0,type:\"enum\",values:[8]},name:{type:\"string\"},metadata:{type:\"*\"},center:{type:\"array\",value:\"number\",length:2},centerAltitude:{type:\"number\"},zoom:{type:\"number\"},bearing:{type:\"number\",default:0,period:360,units:\"degrees\"},pitch:{type:\"number\",default:0,units:\"degrees\"},roll:{type:\"number\",default:0,units:\"degrees\"},state:{type:\"state\",default:{}},light:{type:\"light\"},sky:{type:\"sky\"},projection:{type:\"projection\"},terrain:{type:\"terrain\"},sources:{required:!0,type:\"sources\"},sprite:{type:\"sprite\"},glyphs:{type:\"string\"},\"font-faces\":{type:\"fontFaces\"},transition:{type:\"transition\"},layers:{required:!0,type:\"array\",value:\"layer\"}},sources:{\"*\":{type:\"source\"}},source:[\"source_vector\",\"source_raster\",\"source_raster_dem\",\"source_geojson\",\"source_video\",\"source_image\"],source_vector:{type:{required:!0,type:\"enum\",values:{vector:{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:\"enum\",values:{xyz:{},tms:{}},default:\"xyz\"},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},attribution:{type:\"string\"},promoteId:{type:\"promoteId\"},volatile:{type:\"boolean\",default:!1},encoding:{type:\"enum\",values:{mvt:{},mlt:{}},default:\"mvt\"},\"*\":{type:\"*\"}},source_raster:{type:{required:!0,type:\"enum\",values:{raster:{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},tileSize:{type:\"number\",default:512,units:\"pixels\"},scheme:{type:\"enum\",values:{xyz:{},tms:{}},default:\"xyz\"},attribution:{type:\"string\"},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_raster_dem:{type:{required:!0,type:\"enum\",values:{\"raster-dem\":{}}},url:{type:\"string\"},tiles:{type:\"array\",value:\"string\"},bounds:{type:\"array\",value:\"number\",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:\"number\",default:0},maxzoom:{type:\"number\",default:22},tileSize:{type:\"number\",default:512,units:\"pixels\"},attribution:{type:\"string\"},encoding:{type:\"enum\",values:{terrarium:{},mapbox:{},custom:{}},default:\"mapbox\"},redFactor:{type:\"number\",default:1},blueFactor:{type:\"number\",default:1},greenFactor:{type:\"number\",default:1},baseShift:{type:\"number\",default:0},volatile:{type:\"boolean\",default:!1},\"*\":{type:\"*\"}},source_geojson:{type:{required:!0,type:\"enum\",values:{geojson:{}}},data:{required:!0,type:\"*\"},maxzoom:{type:\"number\",default:18},attribution:{type:\"string\"},buffer:{type:\"number\",default:128,maximum:512,minimum:0},filter:{type:\"filter\"},tolerance:{type:\"number\",default:.375},cluster:{type:\"boolean\",default:!1},clusterRadius:{type:\"number\",default:50,minimum:0},clusterMaxZoom:{type:\"number\"},clusterMinPoints:{type:\"number\"},clusterProperties:{type:\"*\"},lineMetrics:{type:\"boolean\",default:!1},generateId:{type:\"boolean\",default:!1},promoteId:{type:\"promoteId\"}},source_video:{type:{required:!0,type:\"enum\",values:{video:{}}},urls:{required:!0,type:\"array\",value:\"string\"},coordinates:{required:!0,type:\"array\",length:4,value:{type:\"array\",length:2,value:\"number\"}}},source_image:{type:{required:!0,type:\"enum\",values:{image:{}}},url:{type:\"string\"},coordinates:{required:!0,type:\"array\",length:4,value:{type:\"array\",length:2,value:\"number\"}}},layer:{id:{type:\"string\",required:!0},type:{type:\"enum\",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},\"fill-extrusion\":{},raster:{},hillshade:{},\"color-relief\":{},background:{}},required:!0},metadata:{type:\"*\"},source:{type:\"string\"},\"source-layer\":{type:\"string\"},minzoom:{type:\"number\",minimum:0,maximum:24},maxzoom:{type:\"number\",minimum:0,maximum:24},filter:{type:\"filter\"},layout:{type:\"layout\"},paint:{type:\"paint\"}},layout:[\"layout_fill\",\"layout_line\",\"layout_circle\",\"layout_heatmap\",\"layout_fill-extrusion\",\"layout_symbol\",\"layout_raster\",\"layout_hillshade\",\"layout_color-relief\",\"layout_background\"],layout_background:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_fill:{\"fill-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_circle:{\"circle-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_heatmap:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},\"layout_fill-extrusion\":{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-rounded-corner-distance\":{type:\"number\",default:0,minimum:0,units:\"meters\",\"property-type\":\"constant\"}},layout_line:{\"line-cap\":{type:\"enum\",values:{butt:{},round:{},square:{}},default:\"butt\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-join\":{type:\"enum\",values:{bevel:{},round:{},miter:{}},default:\"miter\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-miter-limit\":{type:\"number\",default:2,requires:[{\"line-join\":\"miter\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-round-limit\":{type:\"number\",default:1.05,requires:[{\"line-join\":\"round\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"line-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_symbol:{\"symbol-placement\":{type:\"enum\",values:{point:{},line:{},\"line-center\":{}},default:\"point\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-spacing\":{type:\"number\",default:250,minimum:1,units:\"pixels\",requires:[{\"symbol-placement\":\"line\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-avoid-edges\":{type:\"boolean\",default:!1,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-sort-key\":{type:\"number\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"symbol-z-order\":{type:\"enum\",values:{auto:{},\"viewport-y\":{},source:{}},default:\"auto\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-allow-overlap\":{type:\"boolean\",default:!1,requires:[\"icon-image\",{\"!\":\"icon-overlap\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-overlap\":{type:\"enum\",values:{never:{},always:{},cooperative:{}},requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-ignore-placement\":{type:\"boolean\",default:!1,requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-optional\":{type:\"boolean\",default:!1,requires:[\"icon-image\",\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-rotation-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-size\":{type:\"number\",default:1,minimum:0,units:\"factor of the original icon size\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-text-fit\":{type:\"enum\",values:{none:{},width:{},height:{},both:{}},default:\"none\",requires:[\"icon-image\",\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-text-fit-padding\":{type:\"array\",value:\"number\",length:4,default:[0,0,0,0],units:\"pixels\",requires:[\"icon-image\",\"text-field\",{\"icon-text-fit\":[\"both\",\"width\",\"height\"]}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-image\":{type:\"resolvedImage\",tokens:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-rotate\":{type:\"number\",default:0,period:360,units:\"degrees\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-padding\":{type:\"padding\",default:[2],units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-keep-upright\":{type:\"boolean\",default:!1,requires:[\"icon-image\",{\"icon-rotation-alignment\":\"map\"},{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-offset\":{type:\"array\",value:\"number\",length:2,default:[0,0],requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-anchor\":{type:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},default:\"center\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"icon-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{},auto:{}},default:\"auto\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotation-alignment\":{type:\"enum\",values:{map:{},viewport:{},\"viewport-glyph\":{},auto:{}},default:\"auto\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-field\":{type:\"formatted\",default:\"\",tokens:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-font\":{type:\"array\",value:\"string\",default:[\"Open Sans Regular\",\"Arial Unicode MS Regular\"],requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-size\":{type:\"number\",default:16,minimum:0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-width\":{type:\"number\",default:10,minimum:0,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-line-height\":{type:\"number\",default:1.2,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-letter-spacing\":{type:\"number\",default:0,units:\"ems\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-justify\":{type:\"enum\",values:{auto:{},left:{},center:{},right:{}},default:\"center\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-radial-offset\":{type:\"number\",units:\"ems\",default:0,requires:[\"text-field\"],\"property-type\":\"data-driven\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]}},\"text-variable-anchor\":{type:\"array\",value:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-variable-anchor-offset\":{type:\"variableAnchorOffsetCollection\",requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-anchor\":{type:\"enum\",values:{center:{},left:{},right:{},top:{},bottom:{},\"top-left\":{},\"top-right\":{},\"bottom-left\":{},\"bottom-right\":{}},default:\"center\",requires:[\"text-field\",{\"!\":\"text-variable-anchor\"}],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-max-angle\":{type:\"number\",default:45,units:\"degrees\",requires:[\"text-field\",{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-writing-mode\":{type:\"array\",value:\"enum\",values:{horizontal:{},vertical:{}},requires:[\"text-field\",{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-rotate\":{type:\"number\",default:0,period:360,units:\"degrees\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-padding\":{type:\"number\",default:2,minimum:0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-keep-upright\":{type:\"boolean\",default:!0,requires:[\"text-field\",{\"text-rotation-alignment\":\"map\"},{\"symbol-placement\":[\"line\",\"line-center\"]}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-transform\":{type:\"enum\",values:{none:{},uppercase:{},lowercase:{}},default:\"none\",requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-offset\":{type:\"array\",value:\"number\",units:\"ems\",length:2,default:[0,0],requires:[\"text-field\",{\"!\":\"text-radial-offset\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"text-allow-overlap\":{type:\"boolean\",default:!1,requires:[\"text-field\",{\"!\":\"text-overlap\"}],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-overlap\":{type:\"enum\",values:{never:{},always:{},cooperative:{}},requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-ignore-placement\":{type:\"boolean\",default:!1,requires:[\"text-field\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-optional\":{type:\"boolean\",default:!1,requires:[\"text-field\",\"icon-image\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"symbol-height-offset\":{type:\"number\",default:0,units:\"meters\",requires:[{\"symbol-placement\":[\"point\"]}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},\"symbol-height-anchor\":{type:\"enum\",values:{ground:{},absolute:{}},default:\"ground\",requires:[\"symbol-height-offset\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_raster:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},layout_hillshade:{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},\"layout_color-relief\":{visibility:{type:\"enum\",values:{visible:{},none:{}},default:\"visible\",expression:{interpolated:!1,parameters:[\"global-state\"]},\"property-type\":\"data-constant\"}},filter:{type:\"boolean\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"data-driven\"},filter_operator:{type:\"enum\",values:{\"==\":{},\"!=\":{},\">\":{},\">=\":{},\"<\":{},\"<=\":{},in:{},\"!in\":{},all:{},any:{},none:{},has:{},\"!has\":{}}},geometry_type:{type:\"enum\",values:{Point:{},LineString:{},Polygon:{}}},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:{},exponential:{},interval:{},categorical:{}},default:\"exponential\"},colorSpace:{type:\"enum\",values:{rgb:{},lab:{},hcl:{}},default:\"rgb\"},default:{type:\"*\",required:!1}},function_stop:{type:\"array\",minimum:0,maximum:24,value:[\"number\",\"color\"],length:2},expression:{type:\"array\",value:\"expression_name\",minimum:1},light:{anchor:{type:\"enum\",default:\"viewport\",values:{map:{},viewport:{}},\"property-type\":\"data-constant\",transition:!1,expression:{interpolated:!1,parameters:[\"zoom\"]}},position:{type:\"array\",default:[1.15,210,30],length:3,value:\"number\",\"property-type\":\"data-constant\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]}},color:{type:\"color\",\"property-type\":\"data-constant\",default:\"#ffffff\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},intensity:{type:\"number\",\"property-type\":\"data-constant\",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0}},sky:{\"sky-color\":{type:\"color\",\"property-type\":\"data-constant\",default:\"#88C6FC\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"horizon-color\":{type:\"color\",\"property-type\":\"data-constant\",default:\"#ffffff\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"fog-color\":{type:\"color\",\"property-type\":\"data-constant\",default:\"#ffffff\",expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"fog-ground-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"horizon-fog-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"sky-horizon-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0},\"atmosphere-blend\":{type:\"number\",\"property-type\":\"data-constant\",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:[\"zoom\"]},transition:!0}},terrain:{source:{type:\"string\",required:!0},exaggeration:{type:\"number\",minimum:0,default:1}},projection:{type:{type:\"projectionDefinition\",default:\"mercator\",\"property-type\":\"data-constant\",transition:!1,expression:{interpolated:!0,parameters:[\"zoom\"]}}},paint:[\"paint_fill\",\"paint_line\",\"paint_circle\",\"paint_heatmap\",\"paint_fill-extrusion\",\"paint_symbol\",\"paint_raster\",\"paint_hillshade\",\"paint_color-relief\",\"paint_background\"],paint_fill:{\"fill-antialias\":{type:\"boolean\",default:!0,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-layer-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"global-state\"]},\"property-type\":\"data-constant\"},\"fill-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-outline-color\":{type:\"color\",transition:!0,requires:[{\"!\":\"fill-pattern\"},{\"fill-antialias\":!0}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"fill-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"}},\"paint_fill-extrusion\":{\"fill-extrusion-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"fill-extrusion-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"fill-extrusion-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"fill-extrusion-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"fill-extrusion-height\":{type:\"number\",default:0,minimum:0,units:\"meters\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-base\":{type:\"number\",default:0,minimum:0,units:\"meters\",transition:!0,requires:[\"fill-extrusion-height\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"fill-extrusion-vertical-gradient\":{type:\"boolean\",default:!0,transition:!1,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_line:{\"line-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-layer-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"global-state\"]},\"property-type\":\"data-constant\"},\"line-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"line-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"line-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"line-width\":{type:\"number\",default:1,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-gap-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-offset\":{type:\"number\",default:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"line-dasharray\":{type:\"array\",value:\"number\",minimum:0,transition:!0,units:\"line widths\",requires:[{\"!\":\"line-pattern\"}],expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"line-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]},\"property-type\":\"cross-faded-data-driven\"},\"line-gradient\":{type:\"color\",transition:!1,requires:[{\"!\":\"line-dasharray\"},{\"!\":\"line-pattern\"},{source:\"geojson\",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:[\"line-progress\"]},\"property-type\":\"color-ramp\"}},paint_circle:{\"circle-radius\":{type:\"number\",default:5,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-blur\":{type:\"number\",default:0,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"circle-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-scale\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-pitch-alignment\":{type:\"enum\",values:{map:{},viewport:{}},default:\"viewport\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"circle-stroke-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"circle-stroke-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"}},paint_heatmap:{\"heatmap-radius\":{type:\"number\",default:30,minimum:1,transition:!0,units:\"pixels\",expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-weight\":{type:\"number\",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"heatmap-intensity\":{type:\"number\",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"heatmap-color\":{type:\"color\",default:[\"interpolate\",[\"linear\"],[\"heatmap-density\"],0,\"rgba(0, 0, 255, 0)\",.1,\"royalblue\",.3,\"cyan\",.5,\"lime\",.7,\"yellow\",1,\"red\"],transition:!1,expression:{interpolated:!0,parameters:[\"heatmap-density\"]},\"property-type\":\"color-ramp\"},\"heatmap-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_symbol:{\"icon-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-color\":{type:\"color\",default:\"rgba(0, 0, 0, 0)\",transition:!0,requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-halo-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"icon-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",requires:[\"icon-image\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"icon-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"icon-image\",\"icon-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-color\":{type:\"color\",default:\"#000000\",transition:!0,overridable:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-color\":{type:\"color\",default:\"rgba(0, 0, 0, 0)\",transition:!0,requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-width\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-halo-blur\":{type:\"number\",default:0,minimum:0,transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\",\"feature\",\"feature-state\"]},\"property-type\":\"data-driven\"},\"text-translate\":{type:\"array\",value:\"number\",length:2,default:[0,0],transition:!0,units:\"pixels\",requires:[\"text-field\"],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"text-translate-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"map\",requires:[\"text-field\",\"text-translate\"],expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_raster:{\"raster-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-hue-rotate\":{type:\"number\",default:0,period:360,transition:!0,units:\"degrees\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-min\":{type:\"number\",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-brightness-max\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-saturation\":{type:\"number\",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-contrast\":{type:\"number\",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},resampling:{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-resampling\":{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-fade-duration\":{type:\"number\",default:300,minimum:0,transition:!1,units:\"milliseconds\",expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"raster-color\":{type:\"color\",transition:!1,expression:{interpolated:!0,parameters:[\"raster-value\"]},\"property-type\":\"color-ramp\"},\"raster-color-mix\":{type:\"array\",default:[1,0,0,0],length:4,value:\"number\",\"property-type\":\"data-constant\",transition:!0,requires:[\"raster-color\"],expression:{interpolated:!0,parameters:[\"zoom\"]}},\"raster-color-range\":{type:\"array\",default:[0,1],length:2,value:\"number\",\"property-type\":\"data-constant\",transition:!0,requires:[\"raster-color\"],expression:{interpolated:!0,parameters:[\"zoom\"]}}},paint_hillshade:{\"hillshade-illumination-direction\":{type:\"numberArray\",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-illumination-altitude\":{type:\"numberArray\",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-illumination-anchor\":{type:\"enum\",values:{map:{},viewport:{}},default:\"viewport\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-exaggeration\":{type:\"number\",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-shadow-color\":{type:\"colorArray\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-highlight-color\":{type:\"colorArray\",default:\"#FFFFFF\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-accent-color\":{type:\"color\",default:\"#000000\",transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"hillshade-method\":{type:\"enum\",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:\"standard\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},resampling:{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},\"paint_color-relief\":{\"color-relief-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"color-relief-color\":{type:\"color\",transition:!1,expression:{interpolated:!0,parameters:[\"elevation\"]},\"property-type\":\"color-ramp\"},resampling:{type:\"enum\",values:{linear:{},nearest:{}},default:\"linear\",expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},paint_background:{\"background-color\":{type:\"color\",default:\"#000000\",transition:!0,requires:[{\"!\":\"background-pattern\"}],expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"},\"background-pattern\":{type:\"resolvedImage\",transition:!0,expression:{interpolated:!1,parameters:[\"zoom\"]},\"property-type\":\"cross-faded\"},\"background-opacity\":{type:\"number\",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:[\"zoom\"]},\"property-type\":\"data-constant\"}},transition:{duration:{type:\"number\",default:300,minimum:0,units:\"milliseconds\"},delay:{type:\"number\",default:0,minimum:0,units:\"milliseconds\"}},\"property-type\":{\"data-driven\":{type:\"property-type\"},\"cross-faded\":{type:\"property-type\"},\"cross-faded-data-driven\":{type:\"property-type\"},\"color-ramp\":{type:\"property-type\"},\"data-constant\":{type:\"property-type\"},constant:{type:\"property-type\"}},promoteId:{\"*\":{type:\"string\"}},interpolation:{type:\"array\",value:\"interpolation_name\",minimum:1},interpolation_name:{type:\"enum\",values:{linear:{syntax:{overloads:[{parameters:[],\"output-type\":\"interpolation\"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:[\"base\"],\"output-type\":\"interpolation\"}],parameters:[{name:\"base\",type:\"number literal\"}]}},\"cubic-bezier\":{syntax:{overloads:[{parameters:[\"x1\",\"y1\",\"x2\",\"y2\"],\"output-type\":\"interpolation\"}],parameters:[{name:\"x1\",type:\"number literal\"},{name:\"y1\",type:\"number literal\"},{name:\"x2\",type:\"number literal\"},{name:\"y2\",type:\"number literal\"}]}}}}},w=Wu,Hu=[\"type\",\"source\",\"source-layer\",\"minzoom\",\"maxzoom\",\"filter\",\"layout\"],I=class{constructor(t,e,r,i,n=\"error\"){this.message=(t?`${t}: `:\"\")+r,i&&(this.identifier=i),this.severity=n,e!=null&&e.__line__&&(this.line=e.__line__)}},fr={kind:\"null\"},M={kind:\"number\"},U={kind:\"string\"},j={kind:\"boolean\"},Nt={kind:\"color\"},mn={kind:\"projectionDefinition\"},Me={kind:\"object\"},q={kind:\"value\"},ad={kind:\"error\"},gn={kind:\"collator\"},li={kind:\"formatted\"},xn={kind:\"padding\"},Zr={kind:\"colorArray\"},vn={kind:\"numberArray\"},ui={kind:\"resolvedImage\"},bn={kind:\"variableAnchorOffsetCollection\"};function _t(t,e){return{kind:\"array\",itemType:t,N:e}}function K(t){if(t.kind===\"array\"){let e=K(t.itemType);return typeof t.N==\"number\"?`array<${e}, ${t.N}>`:t.itemType.kind===\"value\"?\"array\":`array<${e}>`}return t.kind}var sd=[fr,M,U,j,Nt,mn,li,Me,_t(q),xn,vn,Zr,ui,bn];function Wr(t,e){if(e.kind===\"error\")return null;if(t.kind===\"array\"){if(e.kind===\"array\"&&(e.N===0&&e.itemType.kind===\"value\"||!Wr(t.itemType,e.itemType))&&(typeof t.N!=\"number\"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind===\"value\"){for(let r of sd)if(!Wr(r,e))return null}}return`Expected ${K(t)} but found ${K(e)} instead.`}function wn(t,e){return e.some(r=>r.kind===t.kind)}function ye(t,e){return e.some(r=>r===\"null\"?t===null:r===\"array\"?Array.isArray(t):r===\"object\"?t&&!Array.isArray(t)&&typeof t==\"object\":r===typeof t)}function le(t,e){return t.kind===\"array\"&&e.kind===\"array\"?t.itemType.kind===e.itemType.kind&&typeof t.N==\"number\":t.kind===e.kind}var Ku=.96422,Ju=.82521,Qu=4/29,ga=6/29,th=3*ga*ga,od=Math.PI/180,ld=180/Math.PI;function eh(t){return t%=360,t<0&&(t+=360),t}function rh([t,e,r,i]){t=Wn(t),e=Wn(e),r=Wn(r);let n,a,s=Hn((.2225045*t+.7168786*e+.0606169*r)/1);t===e&&e===r?n=a=s:(n=Hn((.4360747*t+.3850649*e+.1430804*r)/Ku),a=Hn((.0139322*t+.0971045*e+.7141733*r)/Ju));let o=116*s-16;return[o<0?0:o,500*(n-s),200*(s-a),i]}function Wn(t){return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Hn(t){return t>.008856451679035631?t**(1/3):t/th+Qu}function ih([t,e,r,i]){let n=(t+16)/116,a=isNaN(e)?n:n+e/500,s=isNaN(r)?n:n-r/200;return n=1*Jn(n),a=Ku*Jn(a),s=Ju*Jn(s),[Kn(3.1338561*a-1.6168667*n-.4906146*s),Kn(-.9787684*a+1.9161415*n+.033454*s),Kn(.0719453*a-.2289914*n+1.4052427*s),i]}function Kn(t){return t=t<=.00304?12.92*t:1.055*t**(1/2.4)-.055,t<0?0:t>1?1:t}function Jn(t){return t>ga?t*t*t:th*(t-Qu)}function ud(t){let[e,r,i,n]=rh(t),a=Math.sqrt(r*r+i*i);return[Math.round(a*1e4)?eh(Math.atan2(i,r)*ld):NaN,a,e,n]}function hd([t,e,r,i]){return t=isNaN(t)?0:t*od,ih([r,Math.cos(t)*e,Math.sin(t)*e,i])}function cd([t,e,r,i]){t=eh(t),e/=100,r/=100;function n(a){let s=(a+t/30)%12,o=e*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(s-3,9-s,1))}return[n(0),n(8),n(4),i]}var pd=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function Rr(t,e){return pd(t,e)?t[e]:void 0}function fd(t){if(t=t.toLowerCase().trim(),t===\"transparent\")return[0,0,0,0];let e=Rr(dd,t);if(e){let[i,n,a]=e;return[i/255,n/255,a/255,1]}if(t.startsWith(\"#\")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let i=t.length<6?1:2,n=1;return[Ei(t.slice(n,n+=i)),Ei(t.slice(n,n+=i)),Ei(t.slice(n,n+=i)),Ei(t.slice(n,n+i)||\"ff\")]}if(t.startsWith(\"rgb\")){let i=t.match(/^rgba?\\\\(\\\\s*([\\\\de.+-]+)(%)?(?:\\\\s+|\\\\s*(,)\\\\s*)([\\\\de.+-]+)(%)?(?:\\\\s+|\\\\s*(,)\\\\s*)([\\\\de.+-]+)(%)?(?:\\\\s*([,\\\\/])\\\\s*([\\\\de.+-]+)(%)?)?\\\\s*\\\\)$/);if(i){let[n,a,s,o,l,u,h,c,p,f,d,y]=i,m=[o||\" \",h||\" \",f].join(\"\");if(m===\"  \"||m===\"  /\"||m===\",,\"||m===\",,,\"){let g=[s,u,p].join(\"\"),x=g===\"%%%\"?100:g===\"\"?255:0;if(x){let b=[je(+a/x,0,1),je(+l/x,0,1),je(+c/x,0,1),d?rl(+d,y):1];if(il(b))return b}}return}}let r=t.match(/^hsla?\\\\(\\\\s*([\\\\de.+-]+)(?:deg)?(?:\\\\s+|\\\\s*(,)\\\\s*)([\\\\de.+-]+)%(?:\\\\s+|\\\\s*(,)\\\\s*)([\\\\de.+-]+)%(?:\\\\s*([,\\\\/])\\\\s*([\\\\de.+-]+)(%)?)?\\\\s*\\\\)$/);if(r){let[i,n,a,s,o,l,u,h,c]=r,p=[a||\" \",o||\" \",u].join(\"\");if(p===\"  \"||p===\"  /\"||p===\",,\"||p===\",,,\"){let f=[+n,je(+s,0,100),je(+l,0,100),h?rl(+h,c):1];if(il(f))return cd(f)}}}function Ei(t){return parseInt(t.padEnd(2,t),16)/255}function rl(t,e){return je(e?t/100:t,0,1)}function je(t,e,r){return Math.min(Math.max(e,t),r)}function il(t){return!t.some(Number.isNaN)}var dd={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function me(t,e,r){return t+r*(e-t)}function ar(t,e,r){return t.map((i,n)=>me(i,e[n],r))}function yd(t){return t===\"rgb\"||t===\"hcl\"||t===\"lab\"}var at=class jt{constructor(e,r,i,n=1,a=!0){this.r=e,this.g=r,this.b=i,this.a=n,a||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter(\"rgb\",[e,r,i,n]))}static{this.black=new jt(0,0,0,1)}static{this.white=new jt(1,1,1,1)}static{this.transparent=new jt(0,0,0,0)}static{this.red=new jt(1,0,0,1)}static parse(e){if(e instanceof jt)return e;if(typeof e!=\"string\")return;let r=fd(e);if(r)return new jt(...r,!1)}get rgb(){let{r:e,g:r,b:i,a:n}=this,a=n||1/0;return this.overwriteGetter(\"rgb\",[e/a,r/a,i/a,n])}get hcl(){return this.overwriteGetter(\"hcl\",ud(this.rgb))}get lab(){return this.overwriteGetter(\"lab\",rh(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,i,n]=this.rgb;return`rgba(${[e,r,i].map(a=>Math.round(a*255)).join(\",\")},${n})`}static interpolate(e,r,i,n=\"rgb\"){switch(n){case\"rgb\":{let[a,s,o,l]=ar(e.rgb,r.rgb,i);return new jt(a,s,o,l,!1)}case\"hcl\":{let[a,s,o,l]=e.hcl,[u,h,c,p]=r.hcl,f,d;if(!isNaN(a)&&!isNaN(u)){let b=u-a;u>a&&b>180?b-=360:u<a&&a-u>180&&(b+=360),f=a+i*b}else isNaN(a)?isNaN(u)?f=NaN:(f=u,(o===1||o===0)&&(d=h)):(f=a,(c===1||c===0)&&(d=s));let[y,m,g,x]=hd([f,d??me(s,h,i),me(o,c,i),me(l,p,i)]);return new jt(y,m,g,x,!1)}case\"lab\":{let[a,s,o,l]=ih(ar(e.lab,r.lab,i));return new jt(a,s,o,l,!1)}}}},md=[\"bottom\",\"center\",\"top\"],xa=class{constructor(t,e,r,i,n,a){this.text=t,this.image=e,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=a}},se=class Gi{constructor(e){this.sections=e}static fromString(e){return new Gi([new xa(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Gi?e:Gi.fromString(e)}toString(){return this.sections.length===0?\"\":this.sections.map(e=>e.text).join(\"\")}},Jt=class Dr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Dr)return e;if(typeof e==\"number\")return new Dr([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!=\"number\")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Dr(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Dr(ar(e.values,r.values,i))}},Qt=class Fr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Fr)return e;if(typeof e==\"number\")return new Fr([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!=\"number\")return;return new Fr(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Fr(ar(e.values,r.values,i))}},Ot=class Pr{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Pr)return e;if(typeof e==\"string\"){let i=at.parse(e);return i?new Pr([i]):void 0}if(!Array.isArray(e))return;let r=[];for(let i of e){if(typeof i!=\"string\")return;let n=at.parse(i);if(!n)return;r.push(n)}return new Pr(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i,n=\"rgb\"){let a=[];if(e.values.length!=r.values.length)throw Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let s=0;s<e.values.length;s++)a.push(at.interpolate(e.values[s],r.values[s],i,n));return new Pr(a)}},Q=class extends Error{constructor(t,e){super(t),this.name=\"RuntimeError\",this.path=e}toJSON(){return this.message}},gd=new Set([\"center\",\"left\",\"right\",\"top\",\"bottom\",\"top-left\",\"top-right\",\"bottom-left\",\"bottom-right\"]),Wt=class ji{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ji)return e;if(!(!Array.isArray(e)||e.length<1||e.length%2!=0)){for(let r=0;r<e.length;r+=2){let i=e[r],n=e[r+1];if(typeof i!=\"string\"||!gd.has(i)||!Array.isArray(n)||n.length!==2||typeof n[0]!=\"number\"||typeof n[1]!=\"number\")return}return new ji(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i,n){let a=e.values,s=r.values;if(a.length!==s.length)throw new Q(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${r.toString()}`,n);let o=[];for(let l=0;l<a.length;l+=2){if(a[l]!==s[l])throw new Q(`Cannot interpolate values containing mismatched anchors. from[${l}]: ${a[l]}, to[${l}]: ${s[l]}`,n);o.push(a[l]);let[u,h]=a[l+1],[c,p]=s[l+1];o.push([me(u,c,i),me(h,p,i)])}return new ji(o)}},Ht=class nh{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new nh({name:e,available:!1}):null}},Le=class Ye{constructor(e,r,i){this.from=e,this.to=r,this.transition=i}toString(){return this.from===this.to&&this.transition===1?this.from:JSON.stringify([this.from,this.to,this.transition])}static interpolate(e,r,i){return new Ye(e,r,i)}static parse(e){if(e instanceof Ye)return e;if(Array.isArray(e)&&e.length===3&&typeof e[0]==\"string\"&&typeof e[1]==\"string\"&&typeof e[2]==\"number\")return new Ye(e[0],e[1],e[2]);if(typeof e==\"object\"&&typeof e.from==\"string\"&&typeof e.to==\"string\"&&typeof e.transition==\"number\")return new Ye(e.from,e.to,e.transition);if(typeof e==\"string\")return new Ye(e,e,1)}},zs=class{constructor(t,e,r){this.sensitivity=t?e?\"variant\":\"case\":e?\"accent\":\"base\",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:\"search\"})}compare(t,e){return this.collator.compare(t,e)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}};function ah(t,e,r,i){return typeof t==\"number\"&&t>=0&&t<=255&&typeof e==\"number\"&&e>=0&&e<=255&&typeof r==\"number\"&&r>=0&&r<=255?i===void 0||typeof i==\"number\"&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,r,i].join(\", \")}]: \\'a\\' must be between 0 and 1.`:`Invalid rgba value [${(typeof i==\"number\"?[t,e,r,i]:[t,e,r]).join(\", \")}]: \\'r\\', \\'g\\', and \\'b\\' must be between 0 and 255.`}function sr(t){if(t===null||typeof t==\"string\"||typeof t==\"boolean\"||typeof t==\"number\"||t instanceof Le||t instanceof at||t instanceof zs||t instanceof se||t instanceof Jt||t instanceof Qt||t instanceof Ot||t instanceof Wt||t instanceof Ht)return!0;if(Array.isArray(t)){for(let e of t)if(!sr(e))return!1;return!0}if(typeof t==\"object\"){for(let e in t)if(!sr(t[e]))return!1;return!0}return!1}function it(t){if(t===null)return fr;if(typeof t==\"string\")return U;if(typeof t==\"boolean\")return j;if(typeof t==\"number\")return M;if(t instanceof at)return Nt;if(t instanceof Le)return mn;if(t instanceof zs)return gn;if(t instanceof se)return li;if(t instanceof Jt)return xn;if(t instanceof Qt)return vn;if(t instanceof Ot)return Zr;if(t instanceof Wt)return bn;if(t instanceof Ht)return ui;if(Array.isArray(t)){let e=t.length,r;for(let i of t){let n=it(i);if(!r)r=n;else{if(r===n)continue;r=q;break}}return _t(r||q,e)}return Me}function $r(t){let e=typeof t;return t===null?\"\":e===\"string\"||e===\"number\"||e===\"boolean\"?String(t):t instanceof at||t instanceof Le||t instanceof se||t instanceof Jt||t instanceof Qt||t instanceof Ot||t instanceof Wt||t instanceof Ht?t.toString():JSON.stringify(t)}var or=class sh{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`\\'literal\\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!sr(e[1]))return r.error(`invalid value of type \"${typeof e[1]}\"`);let i=e[1],n=it(i),a=r.expectedType;return n.kind===\"array\"&&n.N===0&&a&&a.kind===\"array\"&&(typeof a.N!=\"number\"||a.N===0)&&(n=a),new sh(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},xd=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"],oh=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&\"id\"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type==\"number\"?xd[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&\"geometry\"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=at.parse(t),this._parseColorCache.set(t,e)),e}};function _n(t,e,r){let i=t.length-1,n=0,a=i,s=0,o,l;for(;n<=a;)if(s=Math.floor((n+a)/2),o=t[s],l=t[s+1],o<=e){if(s===i||e<l)return s;n=s+1}else if(o>e)a=s-1;else throw new Q(\"Input is not a number.\",r);return 0}var Bs=class lh{constructor(e,r,i,n){this.type=e,this.input=r,this.key=n,this.labels=[],this.outputs=[];for(let[a,s]of i)this.labels.push(a),this.outputs.push(s)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error(\"Expected an even number of arguments.\");let i=r.parse(e[1],1,M);if(!i)return null;let n=[],a=null;r.expectedType&&r.expectedType.kind!==\"value\"&&(a=r.expectedType);for(let s=1;s<e.length;s+=2){let o=s===1?-1/0:e[s],l=e[s+1],u=s,h=s+1;if(typeof o!=\"number\")return r.error(\\'Input/output pairs for \"step\" expressions must be defined using literal numeric values (not computed expressions) for the input values.\\',u);if(n.length&&n[n.length-1][0]>=o)return r.error(\\'Input/output pairs for \"step\" expressions must be arranged with input values in strictly ascending order.\\',u);let c=r.parse(l,h,a);if(!c)return null;a||=c.type,n.push([o,c])}return new lh(a,i,n,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;return n>=r[a-1]?i[a-1].evaluate(e):i[_n(r,n,this.key)].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function vd(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)<c)return((u*p+l)*p+o)*p;let g=(3*s*p+2*a)*p+n;if(Math.abs(g)<1e-6)break;p-=m/g}let f=0,d=1;p=h;for(let y=0;y<20;y++){let m=((s*p+a)*p+n)*p;if(Math.abs(m-h)<c)break;h>m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var Xt=class va{constructor(e,r,i,n,a,s){this.type=e,this.operator=r,this.interpolation=i,this.input=n,this.key=s,this.labels=[],this.outputs=[];for(let[o,l]of a)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(e,r,i,n){let a=0;if(e.name===\"exponential\")a=Qn(r,e.base,i,n);else if(e.name===\"linear\")a=Qn(r,1,i,n);else if(e.name===\"cubic-bezier\"){let s=e.controlPoints;a=vd(s[0],s[1],s[2],s[3])(Qn(r,1,i,n))}return a}static parse(e,r){let[i,n,a,...s]=e;if(!Array.isArray(n)||n.length===0)return r.error(\"Expected an interpolation type expression.\",1);if(n[0]===\"linear\")n={name:\"linear\"};else if(n[0]===\"exponential\"){let u=n[1];if(typeof u!=\"number\")return r.error(\"Exponential interpolation requires a numeric base.\",1,1);n={name:\"exponential\",base:u}}else if(n[0]===\"cubic-bezier\"){let u=n.slice(1);if(u.length!==4||u.some(h=>typeof h!=\"number\"||h<0||h>1))return r.error(\"Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.\",1);n={name:\"cubic-bezier\",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(n[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error(\"Expected an even number of arguments.\");if(a=r.parse(a,2,M),!a)return null;let o=[],l=null;(i===\"interpolate-hcl\"||i===\"interpolate-lab\")&&r.expectedType!=Zr?l=Nt:r.expectedType&&r.expectedType.kind!==\"value\"&&(l=r.expectedType);for(let u=0;u<s.length;u+=2){let h=s[u],c=s[u+1],p=u+3,f=u+4;if(typeof h!=\"number\")return r.error(\\'Input/output pairs for \"interpolate\" expressions must be defined using literal numeric values (not computed expressions) for the input values.\\',p);if(o.length&&o[o.length-1][0]>=h)return r.error(\\'Input/output pairs for \"interpolate\" expressions must be arranged with input values in strictly ascending order.\\',p);let d=r.parse(c,f,l);if(!d)return null;l||=d.type,o.push([h,d])}return!le(l,M)&&!le(l,mn)&&!le(l,Nt)&&!le(l,xn)&&!le(l,vn)&&!le(l,Zr)&&!le(l,bn)&&!le(l,_t(M))?r.error(`Type ${K(l)} is not interpolatable.`):new va(l,i,n,a,o,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;if(n>=r[a-1])return i[a-1].evaluate(e);let s=_n(r,n,this.key),o=r[s],l=r[s+1],u=va.interpolationFactor(this.interpolation,n,o,l),h=i[s].evaluate(e),c=i[s+1].evaluate(e);switch(this.operator){case\"interpolate\":switch(this.type.kind){case\"number\":return me(h,c,u);case\"color\":return at.interpolate(h,c,u);case\"padding\":return Jt.interpolate(h,c,u);case\"colorArray\":return Ot.interpolate(h,c,u);case\"numberArray\":return Qt.interpolate(h,c,u);case\"variableAnchorOffsetCollection\":return Wt.interpolate(h,c,u,this.key);case\"array\":return ar(h,c,u);case\"projectionDefinition\":return Le.interpolate(h,c,u)}case\"interpolate-hcl\":switch(this.type.kind){case\"color\":return at.interpolate(h,c,u,\"hcl\");case\"colorArray\":return Ot.interpolate(h,c,u,\"hcl\")}case\"interpolate-lab\":switch(this.type.kind){case\"color\":return at.interpolate(h,c,u,\"lab\");case\"colorArray\":return Ot.interpolate(h,c,u,\"lab\")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Qn(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}var Pe={color:at.interpolate,number:me,padding:Jt.interpolate,numberArray:Qt.interpolate,colorArray:Ot.interpolate,variableAnchorOffsetCollection:Wt.interpolate,array:ar},uh=class hh{constructor(e){this.type=li,this.sections=e}static parse(e,r){if(e.length<2)return r.error(\"Expected at least one argument.\");let i=e[1];if(!Array.isArray(i)&&typeof i==\"object\")return r.error(\"First argument must be an image or text section.\");let n=[],a=!1;for(let s=1;s<=e.length-1;++s){let o=e[s];if(a&&typeof o==\"object\"&&!Array.isArray(o)){a=!1;let l=null;if(o[\"font-scale\"]&&(l=r.parse(o[\"font-scale\"],1,M),!l))return null;let u=null;if(o[\"text-font\"]&&(u=r.parse(o[\"text-font\"],1,_t(U)),!u))return null;let h=null;if(o[\"text-color\"]&&(h=r.parse(o[\"text-color\"],1,Nt),!h))return null;let c=null;if(o[\"vertical-align\"]){if(typeof o[\"vertical-align\"]==\"string\"&&!md.includes(o[\"vertical-align\"]))return r.error(`\\'vertical-align\\' must be one of: \\'bottom\\', \\'center\\', \\'top\\' but found \\'${o[\"vertical-align\"]}\\' instead.`);if(c=r.parse(o[\"vertical-align\"],1,U),!c)return null}let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=r.parse(e[s],1,q);if(!l)return null;let u=l.type.kind;if(u!==\"string\"&&u!==\"value\"&&u!==\"null\"&&u!==\"resolvedImage\")return r.error(\"Formatted text type must be \\'string\\', \\'value\\', \\'image\\' or \\'null\\'.\");a=!0,n.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new hh(n)}evaluate(e){return new se(this.sections.map(r=>{let i=r.content.evaluate(e);return it(i)===ui?new xa(\"\",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(e):null):new xa($r(i),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(\",\"):null,r.textColor?r.textColor.evaluate(e):null,r.verticalAlign?r.verticalAlign.evaluate(e):null)}))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}};function ch(t,e,r=0,i=t.length-1,n=bd){for(;i>r;){if(i-r>600){let l=i-r+1,u=e-r+1,h=Math.log(l),c=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1);ch(t,e,Math.max(r,Math.floor(e-u*c/l+p)),Math.min(i,Math.floor(e+(l-u)*c/l+p)),n)}let a=t[e],s=r,o=i;for(_r(t,r,e),n(t[i],a)>0&&_r(t,r,i);s<o;){for(_r(t,s,o),s++,o--;n(t[s],a)<0;)s++;for(;n(t[o],a)>0;)o--}n(t[r],a)===0?_r(t,r,o):(o++,_r(t,o,i)),o<=e&&(r=o+1),e<=o&&(i=o-1)}}function _r(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function bd(t,e){return t<e?-1:+(t>e)}function Sn(t,e){if(t.length<=1)return[t];let r=[],i,n;for(let a of t){let s=_d(a);s!==0&&(a.area=Math.abs(s),n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[a]):i.push(a))}if(i&&r.push(i),e>1)for(let a=0;a<r.length;a++)r[a].length<=e||(ch(r[a],e,1,r[a].length-1,wd),r[a]=r[a].slice(0,e));return r}function wd(t,e){return e.area-t.area}function _d(t){let e=0;for(let r=0,i=t.length,n=i-1,a,s;r<i;n=r++)a=t[r],s=t[n],e+=(s.x-a.x)*(a.y+s.y);return e}var Mi={string:U,number:M,boolean:j,object:Me},re=class ph{constructor(e,r,i){this.type=e,this.args=r,this.key=i}static parse(e,r){if(e.length<2)return r.error(\"Expected at least one argument.\");let i=1,n,a=e[0];if(a===\"array\"){let o;if(e.length>2){let u=e[1];if(typeof u!=\"string\"||!(u in Mi)||u===\"object\")return r.error(\\'The item type argument of \"array\" must be one of string, number, boolean\\',1);o=Mi[u],i++}else o=q;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!=\"number\"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error(\\'The length argument to \"array\" must be a positive integer literal\\',2);l=e[2],i++}n=_t(o,l)}else{if(!Mi[a])throw Error(`Types doesn\\'t contain name = ${a}`);n=Mi[a]}let s=[];for(;i<e.length;i++){let o=r.parse(e[i],i,q);if(!o)return null;s.push(o)}return new ph(n,s,r.key)}evaluate(e){for(let r=0;r<this.args.length;r++){let i=this.args[r].evaluate(e);if(!Wr(this.type,it(i)))return i;if(r===this.args.length-1)throw new Q(`Expected value to be of type ${K(this.type)}, but found ${K(it(i))} instead.`,this.key)}throw Error()}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},nl={\"to-boolean\":j,\"to-color\":Nt,\"to-number\":M,\"to-string\":U},He=class fh{constructor(e,r,i){this.type=e,this.args=r,this.key=i}static parse(e,r){if(e.length<2)return r.error(\"Expected at least one argument.\");let i=e[0];if(!nl[i])throw Error(`Can\\'t parse ${i} as it is not part of the known types`);if((i===\"to-boolean\"||i===\"to-string\")&&e.length!==2)return r.error(\"Expected one argument.\");let n=nl[i],a=[];for(let s=1;s<e.length;s++){let o=r.parse(e[s],s,q);if(!o)return null;a.push(o)}return new fh(n,a,r.key)}evaluate(e){switch(this.type.kind){case\"boolean\":return!!this.args[0].evaluate(e);case\"color\":{let r,i;for(let n of this.args){if(r=n.evaluate(e),i=null,r instanceof at)return r;if(typeof r==\"string\"){let a=e.parseColor(r);if(a)return a}else if(Array.isArray(r)&&(i=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:ah(r[0],r[1],r[2],r[3]),!i))return new at(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Q(i||`Could not parse color from value \\'${typeof r==\"string\"?r:JSON.stringify(r)}\\'`,this.key)}case\"padding\":{let r;for(let i of this.args){r=i.evaluate(e);let n=Jt.parse(r);if(n)return n}throw new Q(`Could not parse padding from value \\'${typeof r==\"string\"?r:JSON.stringify(r)}\\'`,this.key)}case\"numberArray\":{let r;for(let i of this.args){r=i.evaluate(e);let n=Qt.parse(r);if(n)return n}throw new Q(`Could not parse numberArray from value \\'${typeof r==\"string\"?r:JSON.stringify(r)}\\'`,this.key)}case\"colorArray\":{let r;for(let i of this.args){r=i.evaluate(e);let n=Ot.parse(r);if(n)return n}throw new Q(`Could not parse colorArray from value \\'${typeof r==\"string\"?r:JSON.stringify(r)}\\'`,this.key)}case\"variableAnchorOffsetCollection\":{let r;for(let i of this.args){r=i.evaluate(e);let n=Wt.parse(r);if(n)return n}throw new Q(`Could not parse variableAnchorOffsetCollection from value \\'${typeof r==\"string\"?r:JSON.stringify(r)}\\'`,this.key)}case\"number\":{let r=null;for(let i of this.args){if(r=i.evaluate(e),r===null)return 0;let n=Number(r);if(!isNaN(n))return n}throw new Q(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case\"formatted\":return se.fromString($r(this.args[0].evaluate(e)));case\"resolvedImage\":return Ht.fromString($r(this.args[0].evaluate(e)));case\"projectionDefinition\":{let r=this.args[0].evaluate(e);if(Le.parse(r))return r;throw new Q(`Could not parse projectionDefinition from value \\'${typeof r==\"string\"?r:JSON.stringify(r)}\\'`,this.key)}default:return $r(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},dh=class yh{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let i=[];for(let a=1;a<e.length-1;a+=2){let s=e[a];if(typeof s!=\"string\")return r.error(`Expected string, but found ${typeof s} instead.`,a);if(/[^a-zA-Z0-9_]/.test(s))return r.error(\"Variable names must contain only alphanumeric characters or \\'_\\'.\",a);let o=r.parse(e[a+1],a+1);if(!o)return null;i.push([s,o])}let n=r.parse(e[e.length-1],e.length-1,r.expectedType,i);return n?new yh(i,n):null}outputDefined(){return this.result.outputDefined()}},mh=class gh{constructor(e,r){this.type=r.type,this.name=e,this.boundExpression=r}static parse(e,r){if(e.length!==2||typeof e[1]!=\"string\")return r.error(\"\\'var\\' expression requires exactly one string literal argument.\");let i=e[1];return r.scope.has(i)?new gh(i,r.scope.get(i)):r.error(`Unknown variable \"${i}\". Make sure \"${i}\" has been bound in an enclosing \"let\" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}},Sd=class xh{constructor(e,r,i,n){this.type=e,this.index=r,this.input=i,this.key=n}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,M),n=r.parse(e[2],2,_t(r.expectedType||q));if(!i||!n)return null;let a=n.type;return new xh(a.itemType,i,n,r.key)}evaluate(e){let r=this.index.evaluate(e),i=this.input.evaluate(e);if(r<0)throw new Q(`Array index out of bounds: ${r} < 0.`,this.key);if(r>=i.length)throw new Q(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new Q(`Array index must be an integer, but found ${r} instead.`,this.key);return i[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},Ad=class vh{constructor(e,r,i){this.needle=e,this.haystack=r,this.key=i,this.type=j}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,q),n=r.parse(e[2],2,q);return!i||!n?null:wn(i.type,[j,U,M,fr,q])?new vh(i,n,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${K(i.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!ye(r,[\"boolean\",\"string\",\"number\",\"null\"]))throw new Q(`Expected first argument to be of type boolean, string, number or null, but found ${K(it(r))} instead.`,this.key);if(!ye(i,[\"string\",\"array\"]))throw new Q(`Expected second argument to be of type array or string, but found ${K(it(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},Td=class bh{constructor(e,r,i){this.needle=e,this._set=r,this.key=i,this.type=j}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,q);if(!i)return null;if(!wn(i.type,[j,U,M,fr,q]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${K(i.type)} instead`);let n=e[2];if(!Array.isArray(n))return r.concat(2).error(\"Expected the second argument to be an array of boolean, string, or number values.\");let a=new Set;for(let s=0;s<n.length;s++){let o=n[s],l=typeof o;if(o===null)return r.concat(2).error(`null is not allowed in the haystack at index ${s}.`);if(l!==\"boolean\"&&l!==\"string\"&&l!==\"number\")return r.concat(2).error(`Expected boolean, string, or number in haystack at index ${s}, but found ${K(it(o))} instead.`);if(l===\"number\"&&Number.isNaN(o))return r.concat(2).error(`NaN is not allowed in the haystack at index ${s}.`);a.add(o)}return new bh(i,a,r.key)}evaluate(e){let r=this.needle.evaluate(e);if(!ye(r,[\"boolean\",\"string\",\"number\",\"null\"]))throw new Q(`Expected first argument to be of type boolean, string, number or null, but found ${K(it(r))} instead.`,this.key);return this._set.has(r)}eachChild(e){e(this.needle)}outputDefined(){return!0}},kd=class ba{constructor(e,r,i,n){this.needle=e,this.haystack=r,this.key=i,this.fromIndex=n,this.type=M}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,q),n=r.parse(e[2],2,q);if(!i||!n)return null;if(!wn(i.type,[j,U,M,fr,q]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${K(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,M);return a?new ba(i,n,r.key,a):null}return new ba(i,n,r.key)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!ye(r,[\"boolean\",\"string\",\"number\",\"null\"]))throw new Q(`Expected first argument to be of type boolean, string, number or null, but found ${K(it(r))} instead.`,this.key);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),ye(i,[\"string\"])){let a=i.indexOf(r,n);return a===-1?-1:[...i.slice(0,a)].length}if(ye(i,[\"array\"]))return i.indexOf(r,n);throw new Q(`Expected second argument to be of type array or string, but found ${K(it(i))} instead.`,this.key)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},Id=class wh{constructor(e,r,i,n,a,s){this.inputType=e,this.type=r,this.input=i,this.cases=n,this.outputs=a,this.otherwise=s}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error(\"Expected an even number of arguments.\");let i,n;r.expectedType&&r.expectedType.kind!==\"value\"&&(n=r.expectedType);let a={},s=[];for(let u=2;u<e.length-1;u+=2){let h=e[u],c=e[u+1];Array.isArray(h)||(h=[h]);let p=r.concat(u);if(h.length===0)return p.error(\"Expected at least one branch label.\");for(let d of h){if(typeof d!=\"number\"&&typeof d!=\"string\")return p.error(\"Branch labels must be numbers or strings.\");if(typeof d==\"number\"&&Math.abs(d)>2**53-1)return p.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof d==\"number\"&&Math.floor(d)!==d)return p.error(\"Numeric branch labels must be integer values.\");if(!i)i=it(d);else if(p.checkSubtype(i,it(d)))return null;if(a[String(d)]!==void 0)return p.error(\"Branch labels must be unique.\");a[String(d)]=s.length}let f=r.parse(c,u,n);if(!f)return null;n||=f.type,s.push(f)}let o=r.parse(e[1],1,q);if(!o)return null;let l=r.parse(e[e.length-1],e.length-1,n);return!l||o.type.kind!==\"value\"&&r.concat(1).checkSubtype(i,o.type)?null:new wh(i,n,o,a,s,l)}evaluate(e){let r=this.input.evaluate(e);return(it(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},Ed=class _h{constructor(e,r,i){this.type=e,this.branches=r,this.otherwise=i}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error(\"Expected an odd number of arguments.\");let i;r.expectedType&&r.expectedType.kind!==\"value\"&&(i=r.expectedType);let n=[];for(let s=1;s<e.length-1;s+=2){let o=r.parse(e[s],s,j);if(!o)return null;let l=r.parse(e[s+1],s+1,i);if(!l)return null;n.push([o,l]),i||=l.type}let a=r.parse(e[e.length-1],e.length-1,i);if(!a)return null;if(!i)throw Error(\"Can\\'t infer output type\");return new _h(i,n,a)}evaluate(e){for(let[r,i]of this.branches)if(r.evaluate(e))return i.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(let[r,i]of this.branches)e(r),e(i);e(this.otherwise)}outputDefined(){return this.branches.every(([e,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},Md=class wa{constructor(e,r,i,n,a){this.type=e,this.input=r,this.beginIndex=i,this.key=n,this.endIndex=a}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,q),n=r.parse(e[2],2,M);if(!i||!n)return null;if(!wn(i.type,[_t(q),U,q]))return r.error(`Expected first argument to be of type array or string, but found ${K(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,M);return a?new wa(i.type,i,n,r.key,a):null}return new wa(i.type,i,n,r.key)}evaluate(e){let r=this.input.evaluate(e),i=this.beginIndex.evaluate(e),n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),ye(r,[\"string\"]))return[...r].slice(i,n).join(\"\");if(ye(r,[\"array\"]))return r.slice(i,n);throw new Q(`Expected first argument to be of type array or string, but found ${K(it(r))} instead.`,this.key)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}},Sh=class _a{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error(\"Expected at least one argument.\");let i=null,n=r.expectedType;n&&n.kind!==\"value\"&&(i=n);let a=[];for(let s of e.slice(1)){let o=r.parse(s,1+a.length,i,void 0,{typeAnnotation:\"omit\"});if(!o)return null;i||=o.type,a.push(o)}if(!i)throw Error(\"No output type\");return n&&a.some(s=>Wr(n,s.type))?new _a(q,a):new _a(i,a)}evaluate(e){let r=null,i=0,n;for(let a of this.args)if(i++,r=a.evaluate(e),r&&r instanceof Ht&&!r.available&&(n||=r.name,r=null,i===this.args.length&&(r=n)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function al(t,e){return t===\"==\"||t===\"!=\"?e.kind===\"boolean\"||e.kind===\"string\"||e.kind===\"number\"||e.kind===\"null\"||e.kind===\"value\":e.kind===\"string\"||e.kind===\"number\"||e.kind===\"value\"}function Dd(t,e,r){return e===r}function Fd(t,e,r){return e!==r}function Pd(t,e,r){return e<r}function Cd(t,e,r){return e>r}function zd(t,e,r){return e<=r}function Bd(t,e,r){return e>=r}function Ah(t,e,r,i){return i.compare(e,r)===0}function Ld(t,e,r,i){return!Ah(t,e,r,i)}function Vd(t,e,r,i){return i.compare(e,r)<0}function Od(t,e,r,i){return i.compare(e,r)>0}function Rd(t,e,r,i){return i.compare(e,r)<=0}function $d(t,e,r,i){return i.compare(e,r)>=0}function dr(t,e,r){let i=t!==\"==\"&&t!==\"!=\";return class Th{constructor(a,s,o,l){this.lhs=a,this.rhs=s,this.key=o,this.collator=l,this.type=j,this.hasUntypedArgument=a.type.kind===\"value\"||s.type.kind===\"value\"}static parse(a,s){if(a.length!==3&&a.length!==4)return s.error(\"Expected two or three arguments.\");let o=a[0],l=s.parse(a[1],1,q);if(!l)return null;if(!al(o,l.type))return s.concat(1).error(`\"${o}\" comparisons are not supported for type \\'${K(l.type)}\\'.`);let u=s.parse(a[2],2,q);if(!u)return null;if(!al(o,u.type))return s.concat(2).error(`\"${o}\" comparisons are not supported for type \\'${K(u.type)}\\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!==\"value\"&&u.type.kind!==\"value\")return s.error(`Cannot compare types \\'${K(l.type)}\\' and \\'${K(u.type)}\\'.`);i&&(l.type.kind===\"value\"&&u.type.kind!==\"value\"?l=new re(u.type,[l],s.key):l.type.kind!==\"value\"&&u.type.kind===\"value\"&&(u=new re(l.type,[u],s.key)));let h=null;if(a.length===4){if(l.type.kind!==\"string\"&&u.type.kind!==\"string\"&&l.type.kind!==\"value\"&&u.type.kind!==\"value\")return s.error(\"Cannot use collator to compare non-string types.\");if(h=s.parse(a[3],3,gn),!h)return null}return new Th(l,u,s.key,h)}evaluate(a){let s=this.lhs.evaluate(a),o=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let l=it(s),u=it(o);if(l.kind!==u.kind||l.kind!==\"string\"&&l.kind!==\"number\")throw new Q(`Expected arguments for \"${t}\" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!i&&this.hasUntypedArgument){let l=it(s),u=it(o);if(l.kind!==\"string\"||u.kind!==\"string\")return e(a,s,o)}return this.collator?r(a,s,o,this.collator.evaluate(a)):e(a,s,o)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}var Nd=dr(\"==\",Dd,Ah),Ud=dr(\"!=\",Fd,Ld),qd=dr(\"<\",Pd,Vd),Gd=dr(\">\",Cd,Od),jd=dr(\"<=\",zd,Rd),Yd=dr(\">=\",Bd,$d),kh=class Ih{constructor(e,r,i){this.type=gn,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error(\"Expected one argument.\");let i=e[1];if(typeof i!=\"object\"||Array.isArray(i))return r.error(\"Collator options argument must be an object.\");let n=r.parse(i[\"case-sensitive\"]!==void 0&&i[\"case-sensitive\"],1,j);if(!n)return null;let a=r.parse(i[\"diacritic-sensitive\"]!==void 0&&i[\"diacritic-sensitive\"],1,j);if(!a)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,U),!s)?null:new Ih(n,a,s)}evaluate(e){return new zs(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},Xd=class Eh{constructor(e,r,i,n,a,s){this.type=U,this.number=e,this.locale=r,this.currency=i,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=s}static parse(e,r){if(e.length!==3)return r.error(\"Expected two arguments.\");let i=r.parse(e[1],1,M);if(!i)return null;let n=e[2];if(typeof n!=\"object\"||Array.isArray(n))return r.error(\"NumberFormat options argument must be an object.\");let a=null;if(n.locale&&(a=r.parse(n.locale,1,U),!a))return null;let s=null;if(n.currency&&(s=r.parse(n.currency,1,U),!s))return null;let o=null;if(n.unit&&(o=r.parse(n.unit,1,U),!o))return null;if(s&&o)return r.error(\"NumberFormat options `currency` and `unit` are mutually exclusive\");let l=null;if(n[\"min-fraction-digits\"]&&(l=r.parse(n[\"min-fraction-digits\"],1,M),!l))return null;let u=null;return n[\"max-fraction-digits\"]&&(u=r.parse(n[\"max-fraction-digits\"],1,M),!u)?null:new Eh(i,a,s,o,l,u)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?\"currency\":this.unit?\"unit\":\"decimal\",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},Zd=class Mh{constructor(e){this.type=ui,this.input=e}static parse(e,r){if(e.length!==2)return r.error(\"Expected two arguments.\");let i=r.parse(e[1],1,U);return i?new Mh(i):r.error(\"No image name provided.\")}evaluate(e){let r=this.input.evaluate(e),i=Ht.fromString(r);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(r)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}},Wd=class Dh{constructor(e,r){this.input=e,this.key=r,this.type=M}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=r.parse(e[1],1);return i?i.type.kind!==\"array\"&&i.type.kind!==\"string\"&&i.type.kind!==\"value\"?r.error(`Expected argument of type string or array, but found ${K(i.type)} instead.`):new Dh(i,r.key):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r==\"string\")return[...r].length;if(Array.isArray(r))return r.length;throw new Q(`Expected value to be of type string or array, but found ${K(it(r))} instead.`,this.key)}eachChild(e){e(this.input)}outputDefined(){return!1}},Zt=8192;function Hd(t,e){let r=Kd(t[0]),i=Qd(t[1]),n=2**e.z;return[Math.round(r*n*Zt),Math.round(i*n*Zt)]}function Ls(t,e){let r=2**e.z,i=(t[0]/Zt+e.x)/r,n=(t[1]/Zt+e.y)/r;return[Jd(i),ty(n)]}function Kd(t){return(180+t)/360}function Jd(t){return t*360-180}function Qd(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function ty(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function hi(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function Hr(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function ey(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function ry(t,e,r){let i=t[0]-e[0],n=t[1]-e[1],a=t[0]-r[0],s=t[1]-r[1];return i*s-a*n===0&&i*a<=0&&n*s<=0}function An(t,e,r,i){let n=[e[0]-t[0],e[1]-t[1]];return sy([i[0]-r[0],i[1]-r[1]],n)!==0&&!!(sl(t,e,r,i)&&sl(r,i,t,e))}function iy(t,e,r){for(let i of r)for(let n=0;n<i.length-1;++n)if(An(t,e,i[n],i[n+1]))return!0;return!1}function yr(t,e,r=!1){let i=!1;for(let n of e)for(let a=0;a<n.length-1;a++){if(ry(t,n[a],n[a+1]))return r;ey(t,n[a],n[a+1])&&(i=!i)}return i}function ny(t,e){for(let r of e)if(yr(t,r))return!0;return!1}function Fh(t,e){for(let r of t)if(!yr(r,e))return!1;for(let r=0;r<t.length-1;++r)if(iy(t[r],t[r+1],e))return!1;return!0}function ay(t,e){for(let r of e)if(Fh(t,r))return!0;return!1}function sy(t,e){return t[0]*e[1]-t[1]*e[0]}function sl(t,e,r,i){let n=t[0]-r[0],a=t[1]-r[1],s=e[0]-r[0],o=e[1]-r[1],l=i[0]-r[0],u=i[1]-r[1],h=n*u-l*a,c=s*u-l*o;return h>0&&c<0||h<0&&c>0}function Vs(t,e,r){let i=[];for(let n=0;n<t.length;n++){let a=[];for(let s=0;s<t[n].length;s++){let o=Hd(t[n][s],r);hi(e,o),a.push(o)}i.push(a)}return i}function Ph(t,e,r){let i=[];for(let n=0;n<t.length;n++){let a=Vs(t[n],e,r);i.push(a)}return i}function Ch(t,e,r,i){if(t[0]<r[0]||t[0]>r[2]){let n=i*.5,a=t[0]-r[0]>n?-i:r[0]-t[0]>n?i:0;a===0&&(a=t[0]-r[2]>n?-i:r[2]-t[0]>n?i:0),t[0]+=a}hi(e,t)}function oy(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function ol(t,e,r,i){let n=2**i.z*Zt,a=[i.x*Zt,i.y*Zt],s=[];for(let o of t)for(let l of o){let u=[l.x+a[0],l.y+a[1]];Ch(u,e,r,n),s.push(u)}return s}function ll(t,e,r,i){let n=2**i.z*Zt,a=[i.x*Zt,i.y*Zt],s=[];for(let o of t){let l=[];for(let u of o){let h=[u.x+a[0],u.y+a[1]];hi(e,h),l.push(h)}s.push(l)}if(e[2]-e[0]<=n/2){oy(e);for(let o of s)for(let l of o)Ch(l,e,r,n)}return s}function ly(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type===\"Polygon\"){let a=Vs(e.coordinates,i,n),s=ol(t.geometry(),r,i,n);if(!Hr(r,i))return!1;for(let o of s)if(!yr(o,a))return!1}if(e.type===\"MultiPolygon\"){let a=Ph(e.coordinates,i,n),s=ol(t.geometry(),r,i,n);if(!Hr(r,i))return!1;for(let o of s)if(!ny(o,a))return!1}return!0}function uy(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type===\"Polygon\"){let a=Vs(e.coordinates,i,n),s=ll(t.geometry(),r,i,n);if(!Hr(r,i))return!1;for(let o of s)if(!Fh(o,a))return!1}if(e.type===\"MultiPolygon\"){let a=Ph(e.coordinates,i,n),s=ll(t.geometry(),r,i,n);if(!Hr(r,i))return!1;for(let o of s)if(!ay(o,a))return!1}return!0}var Os=class Yi{constructor(e,r){this.type=j,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\\'within\\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(sr(e[1])){let i=e[1];if(i.type===\"FeatureCollection\"){let n=[];for(let a of i.features){let{type:s,coordinates:o}=a.geometry;s===\"Polygon\"&&n.push(o),s===\"MultiPolygon\"&&n.push(...o)}if(n.length)return new Yi(i,{type:\"MultiPolygon\",coordinates:n})}else if(i.type===\"Feature\"){let n=i.geometry.type;if(n===\"Polygon\"||n===\"MultiPolygon\")return new Yi(i,i.geometry)}else if(i.type===\"Polygon\"||i.type===\"MultiPolygon\")return new Yi(i,i)}return r.error(\"\\'within\\' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===\"Point\")return ly(e,this.geometries);if(e.geometryType()===\"LineString\")return uy(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},zh=class{constructor(t=[],e=(r,i)=>r<i?-1:+(r>i)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t<i;){let a=(t<<1)+1,s=a+1;if(s<this.length&&r(e[s],e[a])<0&&(a=s),r(e[a],n)>=0)break;e[t]=e[a],t=a}e[t]=n}},ul=Math.PI/180,Rs=class{constructor(t){let e=ul*6378.137*1e3,r=Math.cos(t*ul),i=1/(1-.0066943799901413165*(1-r*r)),n=Math.sqrt(i);this.kx=e*n*r,this.ky=e*n*i*.9933056200098587}distance(t,e){let r=this.wrap(t[0]-e[0])*this.kx,i=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(t,e){let r=1/0,i,n,a,s;for(let o=0;o<t.length-1;o++){let l=t[o][0],u=t[o][1],h=this.wrap(t[o+1][0]-l)*this.kx,c=(t[o+1][1]-u)*this.ky,p=0;(h!==0||c!==0)&&(p=(this.wrap(e[0]-l)*this.kx*h+(e[1]-u)*this.ky*c)/(h*h+c*c),p>1?(l=t[o+1][0],u=t[o+1][1]):p>0&&(l+=h/this.kx*p,u+=c/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,c=(e[1]-u)*this.ky;let f=h*h+c*c;f<r&&(r=f,i=l,n=u,a=o,s=p)}return{point:[i,n],index:a,t:Math.max(0,Math.min(1,s))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}};function Bh(t,e){return e[0]-t[0]}function Qi(t){return t[1]-t[0]+1}function oe(t,e){return t[1]>=t[0]&&t[1]<e}function Sa(t,e){if(t[0]>t[1])return[null,null];let r=Qi(t);if(e){if(r===2)return[t,null];let n=Math.floor(r/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}if(r===1)return[t,null];let i=Math.floor(r/2)-1;return[[t[0],t[0]+i],[t[0]+i+1,t[1]]]}function Aa(t,e){if(!oe(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)hi(r,t[i]);return r}function Ta(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let i of r)hi(e,i);return e}function hl(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function $s(t,e,r){if(!hl(t)||!hl(e))return NaN;let i=0,n=0;return t[2]<e[0]&&(i=e[0]-t[2]),t[0]>e[2]&&(i=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]<e[1]&&(n=e[1]-t[3]),r.distance([0,0],[i,n])}function ke(t,e,r){let i=r.pointOnLine(e,t);return r.distance(t,i.point)}function Ns(t,e,r,i,n){let a=Math.min(ke(t,[r,i],n),ke(e,[r,i],n)),s=Math.min(ke(r,[t,e],n),ke(i,[t,e],n));return Math.min(a,s)}function hy(t,e,r,i,n){if(!(oe(e,t.length)&&oe(i,r.length)))return 1/0;let a=1/0;for(let s=e[0];s<e[1];++s){let o=t[s],l=t[s+1];for(let u=i[0];u<i[1];++u){let h=r[u],c=r[u+1];if(An(o,l,h,c))return 0;a=Math.min(a,Ns(o,l,h,c,n))}}return a}function cy(t,e,r,i,n){if(!(oe(e,t.length)&&oe(i,r.length)))return NaN;let a=1/0;for(let s=e[0];s<=e[1];++s)for(let o=i[0];o<=i[1];++o)if(a=Math.min(a,n.distance(t[s],r[o])),a===0)return a;return a}function py(t,e,r){if(yr(t,e,!0))return 0;let i=1/0;for(let n of e){let a=n[0],s=n[n.length-1];if(a!==s&&(i=Math.min(i,ke(t,[s,a],r)),i===0))return i;let o=r.pointOnLine(n,t);if(i=Math.min(i,r.distance(t,o.point)),i===0)return i}return i}function fy(t,e,r,i){if(!oe(e,t.length))return NaN;for(let a=e[0];a<=e[1];++a)if(yr(t[a],r,!0))return 0;let n=1/0;for(let a=e[0];a<e[1];++a){let s=t[a],o=t[a+1];for(let l of r)for(let u=0,h=l.length,c=h-1;u<h;c=u++){let p=l[c],f=l[u];if(An(s,o,p,f))return 0;n=Math.min(n,Ns(s,o,p,f,i))}}return n}function cl(t,e){for(let r of t)for(let i of r)if(yr(i,e,!0))return!0;return!1}function dy(t,e,r,i=1/0){let n=Ta(t),a=Ta(e);if(i!==1/0&&$s(n,a,r)>=i)return i;if(Hr(n,a)){if(cl(t,e))return 0}else if(cl(e,t))return 0;let s=1/0;for(let o of t)for(let l=0,u=o.length,h=u-1;l<u;h=l++){let c=o[h],p=o[l];for(let f of e)for(let d=0,y=f.length,m=y-1;d<y;m=d++){let g=f[m],x=f[d];if(An(c,p,g,x))return 0;s=Math.min(s,Ns(c,p,g,x,r))}}return s}function pl(t,e,r,i,n,a){if(!a)return;let s=$s(Aa(i,a),n,r);s<e&&t.push([s,a,[0,0]])}function Di(t,e,r,i,n,a,s){if(!a||!s)return;let o=$s(Aa(i,a),Aa(n,s),r);o<e&&t.push([o,a,s])}function tn(t,e,r,i,n=1/0){let a=Math.min(i.distance(t[0],r[0][0]),n);if(a===0)return a;let s=new zh([[0,[0,t.length-1],[0,0]]],Bh),o=Ta(r);for(;s.length>0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],h=e?50:100;if(Qi(u)<=h){if(!oe(u,t.length))return NaN;if(e){let c=fy(t,u,r,i);if(isNaN(c)||c===0)return c;a=Math.min(a,c)}else for(let c=u[0];c<=u[1];++c){let p=py(t[c],r,i);if(a=Math.min(a,p),a===0)return 0}}else{let c=Sa(u,e);pl(s,a,i,t,o,c[0]),pl(s,a,i,t,o,c[1])}}return a}function en(t,e,r,i,n,a=1/0){let s=Math.min(a,n.distance(t[0],r[0]));if(s===0)return s;let o=new zh([[0,[0,t.length-1],[0,r.length-1]]],Bh);for(;o.length>0;){let l=o.pop();if(l[0]>=s)continue;let u=l[1],h=l[2],c=e?50:100,p=i?50:100;if(Qi(u)<=c&&Qi(h)<=p){if(!oe(u,t.length)&&oe(h,r.length))return NaN;let f;if(e&&i)f=hy(t,u,r,h,n),s=Math.min(s,f);else if(e&&!i){let d=t.slice(u[0],u[1]+1);for(let y=h[0];y<=h[1];++y)if(f=ke(r[y],d,n),s=Math.min(s,f),s===0)return s}else if(!e&&i){let d=r.slice(h[0],h[1]+1);for(let y=u[0];y<=u[1];++y)if(f=ke(t[y],d,n),s=Math.min(s,f),s===0)return s}else f=cy(t,u,r,h,n),s=Math.min(s,f)}else{let f=Sa(u,e),d=Sa(h,i);Di(o,s,n,t,r,f[0],d[0]),Di(o,s,n,t,r,f[0],d[1]),Di(o,s,n,t,r,f[1],d[0]),Di(o,s,n,t,r,f[1],d[1])}}return s}function yy(t,e){let r=t.geometry(),i=r.flat().map(s=>Ls([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new Rs(i[0][1]),a=1/0;for(let s of e){switch(s.type){case\"Point\":a=Math.min(a,en(i,!1,[s.coordinates],!1,n,a));break;case\"LineString\":a=Math.min(a,en(i,!1,s.coordinates,!0,n,a));break;case\"Polygon\":a=Math.min(a,tn(i,!1,s.coordinates,n,a))}if(a===0)return a}return a}function my(t,e){let r=t.geometry(),i=r.flat().map(s=>Ls([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new Rs(i[0][1]),a=1/0;for(let s of e){switch(s.type){case\"Point\":a=Math.min(a,en(i,!0,[s.coordinates],!1,n,a));break;case\"LineString\":a=Math.min(a,en(i,!0,s.coordinates,!0,n,a));break;case\"Polygon\":a=Math.min(a,tn(i,!0,s.coordinates,n,a))}if(a===0)return a}return a}function gy(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let i=Sn(r,0).map(s=>s.map(o=>o.map(l=>Ls([l.x,l.y],t.canonical)))),n=new Rs(i[0][0][0][1]),a=1/0;for(let s of e)for(let o of i){switch(s.type){case\"Point\":a=Math.min(a,tn([s.coordinates],!1,o,n,a));break;case\"LineString\":a=Math.min(a,tn(s.coordinates,!0,o,n,a));break;case\"Polygon\":a=Math.min(a,dy(o,s.coordinates,n,a))}if(a===0)return a}return a}function ta(t){return t.type===\"MultiPolygon\"?t.coordinates.map(e=>({type:\"Polygon\",coordinates:e})):t.type===\"MultiLineString\"?t.coordinates.map(e=>({type:\"LineString\",coordinates:e})):t.type===\"MultiPoint\"?t.coordinates.map(e=>({type:\"Point\",coordinates:e})):[t]}var Us=class Xi{constructor(e,r){this.type=M,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\\'distance\\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(sr(e[1])){let i=e[1];if(i.type===\"FeatureCollection\")return new Xi(i,i.features.map(n=>ta(n.geometry)).flat());if(i.type===\"Feature\")return new Xi(i,ta(i.geometry));if(\"type\"in i&&\"coordinates\"in i)return new Xi(i,ta(i))}return r.error(\"\\'distance\\' expression requires valid geojson object that contains polygon geometry type.\")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()===\"Point\")return yy(e,this.geometries);if(e.geometryType()===\"LineString\")return my(e,this.geometries);if(e.geometryType()===\"Polygon\")return gy(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},xy=class Lh{constructor(e){let r=null;for(let i of e)if(!r)r=i.type;else{if(r===i.type)continue;r=q;break}this.type=_t(r??q,e.length),this.arr=e}static parse(e,r){if(e.length!==2)return r.error(`\\'semiliteral\\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!sr(e[1]))return r.error(`invalid value of type \"${typeof e[1]}\"`);let i=e[1],n=it(i);if(n.kind===\"array\"){let a=i.map(s=>r.parse(s,null,q));return new Lh(a)}return new or(n,i)}evaluate(e){return this.arr.map(r=>r.evaluate(e))}eachChild(e){this.arr.forEach(e)}outputDefined(){return this.arr.every(e=>e.outputDefined())}},qs=class Vh{constructor(e){this.key=e,this.type=q}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=e[1];return i==null?r.error(\"Global state property must be defined.\"):typeof i==\"string\"?new Vh(i):r.error(`Global state property must be string, but found ${typeof e[1]} instead.`)}evaluate(e){let r=e.globals?.globalState;return!r||Object.keys(r).length===0?null:Rr(r,this.key)??null}eachChild(){}outputDefined(){return!1}},Je={\"==\":Nd,\"!=\":Ud,\">\":Gd,\"<\":qd,\">=\":Yd,\"<=\":jd,array:re,at:Sd,boolean:re,case:Ed,coalesce:Sh,collator:kh,format:uh,image:Zd,in:Ad,\"in-set\":Td,\"index-of\":kd,interpolate:Xt,\"interpolate-hcl\":Xt,\"interpolate-lab\":Xt,length:Wd,let:dh,literal:or,match:Id,number:re,\"number-format\":Xd,object:re,semiliteral:xy,slice:Md,step:Bs,string:re,\"to-boolean\":He,\"to-color\":He,\"to-number\":He,\"to-string\":He,var:mh,within:Os,distance:Us,\"global-state\":qs},Yt=class extends Error{constructor(t,e){super(e),this.message=e,this.key=t}},vy=class Oh{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[i,n]of r)this.bindings[i]=n}concat(e){return new Oh(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},Rh=class $h{constructor(e,r,i=[],n,a=new vy,s=[]){this.registry=e,this.path=i,this.key=i.map(o=>`[${o}]`).join(\"\"),this.scope=a,this.errors=s,this.expectedType=n,this._isConstant=r}parse(e,r,i,n,a={}){return r?this.concat(r,i,n)._parse(e,a):this._parse(e,a)}_parse(e,r){(e===null||typeof e==\"string\"||typeof e==\"boolean\"||typeof e==\"number\")&&(e=[\"literal\",e]);let i=this.key;function n(a,s,o){return o===\"assert\"?new re(s,[a],i):o===\"coerce\"?new He(s,[a],i):a}if(Array.isArray(e)){if(e.length===0)return this.error(\\'Expected an array with at least one element. If you wanted a literal array, use [\"literal\", []].\\');let a=e[0];if(typeof a!=\"string\")return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use [\"literal\", [...]].`,0),null;let s=this.registry[a];if(s){let o=s.parse(e,this);if(!o)return null;if(this.expectedType){let l=this.expectedType,u=o.type;if((l.kind===\"string\"||l.kind===\"number\"||l.kind===\"boolean\"||l.kind===\"object\"||l.kind===\"array\")&&u.kind===\"value\")o=n(o,l,r.typeAnnotation||\"assert\");else if(l.kind===\"projectionDefinition\"&&[\"string\",\"array\",\"value\"].includes(u.kind)||[\"color\",\"formatted\",\"resolvedImage\"].includes(l.kind)&&[\"value\",\"string\"].includes(u.kind)||[\"padding\",\"numberArray\"].includes(l.kind)&&[\"value\",\"number\",\"array\"].includes(u.kind)||l.kind===\"colorArray\"&&[\"value\",\"string\",\"array\"].includes(u.kind)||l.kind===\"variableAnchorOffsetCollection\"&&[\"value\",\"array\"].includes(u.kind))o=n(o,l,r.typeAnnotation||\"coerce\");else if(this.checkSubtype(l,u))return null}if(!(o instanceof or)&&o.type.kind!==\"resolvedImage\"&&this._isConstant(o)){let l=new oh;try{o=new or(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression \"${a}\". If you wanted a literal array, use [\"literal\", [...]].`,0)}return e===void 0?this.error(\"\\'undefined\\' value invalid. Use null instead.\"):typeof e==\"object\"?this.error(\\'Bare objects invalid. Use [\"literal\", {...}] instead.\\'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,i){let n=typeof e==\"number\"?this.path.concat(e):this.path,a=i?this.scope.concat(i):this.scope;return new $h(this.registry,this._isConstant,n,r||null,a,this.errors)}error(e,...r){let i=`${this.key}${r.map(n=>`[${n}]`).join(\"\")}`;this.errors.push(new Yt(i,e))}checkSubtype(e,r){let i=Wr(e,r);return i&&this.error(i),i}},Ve=class Cr{constructor(e,r,i,n,a){this.name=e,this.type=r,this._evaluate=i,this.args=n,this.key=a}evaluate(e){return this._evaluate(e,this.args,this.key)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let i=e[0],n=Cr.definitions[i];if(!n)return r.error(`Unknown expression \"${i}\". If you wanted a literal array, use [\"literal\", [...]].`,0);let a=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,h]of o){l=new Rh(r.registry,rn,r.path,null,r.scope);let c=[],p=!1;for(let f=1;f<e.length;f++){let d=e[f],y=Array.isArray(u)?u[f-1]:u.type,m=l.parse(d,1+c.length,y);if(!m){p=!0;break}c.push(m)}if(!p){if(Array.isArray(u)&&u.length!==c.length){l.error(`Expected ${u.length} arguments, but found ${c.length} instead.`);continue}for(let f=0;f<c.length;f++){let d=Array.isArray(u)?u[f]:u.type,y=c[f];l.concat(f+1).checkSubtype(d,y.type)}if(l.errors.length===0)return new Cr(i,a,h,c,r.key)}}if(o.length===1)r.errors.push(...l.errors);else{let u=(o.length?o:s).map(([c])=>wy(c)).join(\" | \"),h=[];for(let c=1;c<e.length;c++){let p=r.parse(e[c],1+h.length);if(!p)return null;h.push(K(p.type))}r.error(`Expected arguments of type ${u}, but found (${h.join(\", \")}) instead.`)}return null}static register(e,r){Cr.definitions=r;for(let i in r)e[i]=Cr}};function fl(t,[e,r,i,n],a){e=e.evaluate(t),r=r.evaluate(t),i=i.evaluate(t);let s=n?n.evaluate(t):1,o=ah(e,r,i,s);if(o)throw new Q(o,a);return new at(e/255,r/255,i/255,s,!1)}function dl(t,e){return t in e&&e[t]!==void 0}function ea(t,e){let r=e[t];return r===void 0?null:r}function by(t,e,r,i){for(;r<=i;){let n=r+i>>1;if(e[n]===t)return!0;e[n]>t?i=n-1:r=n+1}return!1}function _e(t){return{type:t}}Ve.register(Je,{error:[ad,[U],(t,[e],r)=>{throw new Q(e.evaluate(t),r)}],typeof:[U,[q],(t,[e])=>K(it(e.evaluate(t)))],\"to-rgba\":[_t(M,4),[Nt],(t,[e])=>{let[r,i,n,a]=e.evaluate(t).rgb;return[r*255,i*255,n*255,a]}],rgb:[Nt,[M,M,M],fl],rgba:[Nt,[M,M,M,M],fl],has:{type:j,overloads:[[[U],(t,[e])=>dl(e.evaluate(t),t.properties())],[[U,Me],(t,[e,r])=>dl(e.evaluate(t),r.evaluate(t))]]},get:{type:q,overloads:[[[U],(t,[e])=>ea(e.evaluate(t),t.properties())],[[U,Me],(t,[e,r])=>ea(e.evaluate(t),r.evaluate(t))]]},\"feature-state\":[q,[U],(t,[e])=>ea(e.evaluate(t),t.featureState||{})],properties:[Me,[],t=>t.properties()],\"geometry-type\":[U,[],t=>t.geometryType()],id:[q,[],t=>t.id()],zoom:[M,[],t=>t.globals.zoom],\"heatmap-density\":[M,[],t=>t.globals.heatmapDensity||0],elevation:[M,[],t=>t.globals.elevation||0],\"line-progress\":[M,[],t=>t.globals.lineProgress||0],accumulated:[q,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],pitch:[M,[],t=>t.globals.pitch||0],\"raster-value\":[M,[],t=>t.globals.rasterValue||0],\"+\":[M,_e(M),(t,e)=>{let r=0;for(let i of e)r+=i.evaluate(t);return r}],\"*\":[M,_e(M),(t,e)=>{let r=1;for(let i of e)r*=i.evaluate(t);return r}],\"-\":{type:M,overloads:[[[M,M],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[M],(t,[e])=>-e.evaluate(t)]]},\"/\":[M,[M,M],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],\"%\":[M,[M,M],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[M,[],()=>Math.LN2],pi:[M,[],()=>Math.PI],e:[M,[],()=>Math.E],\"^\":[M,[M,M],(t,[e,r])=>e.evaluate(t)**+r.evaluate(t)],sqrt:[M,[M],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[M,[M],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[M,[M],(t,[e])=>Math.log(e.evaluate(t))],log2:[M,[M],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[M,[M],(t,[e])=>Math.sin(e.evaluate(t))],cos:[M,[M],(t,[e])=>Math.cos(e.evaluate(t))],tan:[M,[M],(t,[e])=>Math.tan(e.evaluate(t))],asin:[M,[M],(t,[e])=>Math.asin(e.evaluate(t))],acos:[M,[M],(t,[e])=>Math.acos(e.evaluate(t))],atan:[M,[M],(t,[e])=>Math.atan(e.evaluate(t))],min:[M,_e(M),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[M,_e(M),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[M,[M],(t,[e])=>Math.abs(e.evaluate(t))],round:[M,[M],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[M,[M],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[M,[M],(t,[e])=>Math.ceil(e.evaluate(t))],\"filter-==\":[j,[U,q],(t,[e,r])=>t.properties()[e.value]===r.value],\"filter-id-==\":[j,[q],(t,[e])=>t.id()===e.value],\"filter-type-==\":[j,[U],(t,[e])=>t.geometryType()===e.value],\"filter-<\":[j,[U,q],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<n}],\"filter-id-<\":[j,[q],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<i}],\"filter->\":[j,[U,q],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>n}],\"filter-id->\":[j,[q],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>i}],\"filter-<=\":[j,[U,q],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<=n}],\"filter-id-<=\":[j,[q],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<=i}],\"filter->=\":[j,[U,q],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>=n}],\"filter-id->=\":[j,[q],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>=i}],\"filter-has\":[j,[q],(t,[e])=>{let r=e.value,i=t.properties();return r in i&&i[r]!==void 0}],\"filter-has-id\":[j,[],t=>t.id()!==null&&t.id()!==void 0],\"filter-type-in\":[j,[_t(U)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],\"filter-id-in\":[j,[_t(q)],(t,[e])=>e.value.indexOf(t.id())>=0],\"filter-in-small\":[j,[U,_t(q)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],\"filter-in-large\":[j,[U,_t(q)],(t,[e,r])=>by(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:j,overloads:[[[j,j],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[_e(j),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:j,overloads:[[[j,j],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[_e(j),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},\"!\":[j,[j],(t,[e])=>!e.evaluate(t)],\"is-supported-script\":[j,[U],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[U,[U],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[U,[U],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[U,_e(q),(t,e)=>e.map(r=>$r(r.evaluate(t))).join(\"\")],split:[_t(U),[U,U],(t,[e,r])=>e.evaluate(t).split(r.evaluate(t))],join:[U,[_t(U),U],(t,[e,r])=>e.evaluate(t).join(r.evaluate(t))],\"resolved-locale\":[U,[gn],(t,[e])=>e.evaluate(t).resolvedLocale()]});function wy(t){return Array.isArray(t)?`(${t.map(K).join(\", \")})`:`(${K(t.type)}...)`}function rn(t){if(t instanceof mh)return rn(t.boundExpression);if(t instanceof Ve&&t.name===\"error\"||t instanceof kh||t instanceof Os||t instanceof Us||t instanceof qs)return!1;let e=t instanceof He||t instanceof re,r=!0;return t.eachChild(i=>{r&&=e?rn(i):i instanceof or}),r?Tn(t)&&kn(t,[\"zoom\",\"heatmap-density\",\"elevation\",\"line-progress\",\"accumulated\",\"pitch\",\"raster-value\",\"is-supported-script\"]):!1}function Tn(t){if(t instanceof Ve&&(t.name===\"get\"&&t.args.length===1||t.name===\"feature-state\"||t.name===\"has\"&&t.args.length===1||t.name===\"properties\"||t.name===\"geometry-type\"||t.name===\"id\"||/^filter-/.test(t.name))||t instanceof Os||t instanceof Us)return!1;let e=!0;return t.eachChild(r=>{e&&!Tn(r)&&(e=!1)}),e}function Kr(t){if(t instanceof Ve&&t.name===\"feature-state\")return!1;let e=!0;return t.eachChild(r=>{e&&!Kr(r)&&(e=!1)}),e}function kn(t,e){if(t instanceof Ve&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(i=>{r&&!kn(i,e)&&(r=!1)}),r}function lr(t){return t[\"property-type\"]===\"data-driven\"||t[\"property-type\"]===\"cross-faded-data-driven\"}function Nh(t){return!!t.expression&&t.expression.parameters.indexOf(\"zoom\")>-1}function Gs(t){return!!t.expression&&t.expression.interpolated}function Jr(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function Y(t){return t instanceof Number?\"number\":t instanceof String?\"string\":t instanceof Boolean?\"boolean\":Array.isArray(t)?\"array\":t===null?\"null\":typeof t}function In(t){return typeof t==\"object\"&&!!t&&!Array.isArray(t)&&it(t)===Me}function _y(t){return t}function Sy(t){switch(t.type){case\"color\":return at.parse;case\"padding\":return Jt.parse;case\"numberArray\":return Qt.parse;case\"colorArray\":return Ot.parse;default:return null}}function Ay(t){switch(t){case\"exponential\":return qh;case\"interval\":return ky;case\"categorical\":return Ty;case\"identity\":return Iy;default:throw Error(`Unknown function type \"${t}\"`)}}function Uh(t,e){let r=t.stops&&typeof t.stops[0][0]==\"object\",i=r||t.property!==void 0,n=r||!i,a=t.type||(Gs(e)?\"exponential\":\"interval\"),s=Sy(e);if(s&&(t=Jr({},t),t.stops&&(t.stops=t.stops.map(h=>[h[0],s(h[1])])),t.default?t.default=s(t.default):t.default=s(e.default)),t.colorSpace&&!yd(t.colorSpace))throw Error(`Unknown color space: \"${t.colorSpace}\"`);let o=Ay(a),l,u;if(a===\"categorical\"){l=Object.create(null);for(let h of t.stops)l[h[0]]=h[1];u=typeof t.stops[0][0]}if(r){let h={},c=[];for(let d=0;d<t.stops.length;d++){let y=t.stops[d],m=y[0].zoom;h[m]===void 0&&(h[m]={zoom:m,type:t.type,property:t.property,default:t.default,stops:[]},c.push(m)),h[m].stops.push([y[0].value,y[1]])}let p=[];for(let d of c)p.push([h[d].zoom,Uh(h[d],e)]);let f={name:\"linear\"};return{kind:\"composite\",interpolationType:f,interpolationFactor:Xt.interpolationFactor.bind(void 0,f),zoomStops:p.map(d=>d[0]),evaluate({zoom:d},y){return qh({stops:p,base:t.base},e,d).evaluate(d,y)}}}if(n){let h=a===\"exponential\"?{name:\"exponential\",base:t.base===void 0?1:t.base}:null;return{kind:\"camera\",interpolationType:h,interpolationFactor:Xt.interpolationFactor.bind(void 0,h),zoomStops:t.stops.map(c=>c[0]),evaluate:({zoom:c})=>o(t,e,c,l,u)}}return{kind:\"source\",evaluate(h,c){let p=c&&c.properties?c.properties[t.property]:void 0;return p===void 0?ci(t.default,e.default):o(t,e,p,l,u)}}}function ci(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function Ty(t,e,r,i,n){return ci(typeof r===n?i[r]:void 0,t.default,e.default)}function ky(t,e,r){if(Y(r)!==\"number\")return ci(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let n=_n(t.stops.map(a=>a[0]),r,\"\");return t.stops[n][1]}function qh(t,e,r){let i=t.base===void 0?1:t.base;if(Y(r)!==\"number\")return ci(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let a=_n(t.stops.map(h=>h[0]),r,\"\"),s=Ey(r,i,t.stops[a][0],t.stops[a+1][0]),o=t.stops[a][1],l=t.stops[a+1][1],u=Pe[e.type]||_y;return typeof o.evaluate==\"function\"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(c!==void 0&&p!==void 0)return u(c,p,s,t.colorSpace)}}:u(o,l,s,t.colorSpace)}function Iy(t,e,r){switch(e.type){case\"color\":r=at.parse(r);break;case\"formatted\":r=se.fromString(r.toString());break;case\"resolvedImage\":r=Ht.fromString(r.toString());break;case\"padding\":r=Jt.parse(r);break;case\"colorArray\":r=Ot.parse(r);break;case\"numberArray\":r=Qt.parse(r);break;default:Y(r)!==e.type&&(e.type!==\"enum\"||!e.values[r])&&(r=void 0)}return ci(r,t.default,e.default)}function Ey(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}function ka(t){return{result:\"success\",value:t}}function Xe(t){return{result:\"error\",value:t}}var js=class{constructor(t,e,r,i){this.expression=t,this._warningHistory={},this._evaluator=new oh,this._defaultValue=r?Wh(r):null,this._enumValues=r&&r.type===\"enum\"?r.values:null,this._globalState=i,this._rootKey=e}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ur(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,i,n,a){this._globalState&&(t=ur(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s==\"number\"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new Q(`Expected value to be one of ${Object.keys(this._enumValues).map(o=>JSON.stringify(o)).join(\", \")}, but found ${JSON.stringify(s)} instead.`,\"\");return s}catch(s){let o=s instanceof Q?s.path:\"\",l=`${o}|${s.message}`;return this._warningHistory[l]||(this._warningHistory[l]=!0,typeof console<\"u\"&&console.warn(Gh(this._rootKey,o,s.message,this._defaultValue))),this._defaultValue}}};function Gh(t,e,r,i){return`${t}${e}: ${r}${i==null?\"\":` Falling back to ${String(i)}.`}`}function jh(t){if(!t)throw Error(\\'rootKey must identify the location of the expression in the style JSON, e.g. \"layers[3].paint.line-width\".\\')}function En(t){return Array.isArray(t)&&t.length>0&&typeof t[0]==\"string\"&&t[0]in Je}function ve(t,e,r,i){jh(e);let n=new Rh(Je,rn,[],r?Fy(r):void 0),a=n.parse(t,void 0,void 0,void 0,r&&r.type===\"string\"?{typeAnnotation:\"coerce\"}:void 0);return a?ka(new js(a,e,r,i)):Xe(n.errors)}var Qr=class{constructor(t,e,r){this.kind=t,this._styleExpression=e,this.isStateDependent=t!==\"constant\"&&!Kr(e.expression),this.globalStateRefs=pi(e.expression),this._globalState=r}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ur(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ur(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}},nn=class{constructor(t,e,r,i,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent=t!==\"camera\"&&!Kr(e.expression),this.globalStateRefs=pi(e.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ur(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ur(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}interpolationFactor(t,e,r){return this.interpolationType?Xt.interpolationFactor(this.interpolationType,t,e,r):0}};function My(t){return t._styleExpression!==void 0}function Yh(t,e,r,i){let n=ve(t,e,r,i);if(n.result===\"error\")return n;let a=n.value.expression,s=Tn(a);if(!s&&!lr(r))return Xe([new Yt(\"\",\"data expressions not supported\")]);let o=kn(a,[\"zoom\"]);if(!o&&!Nh(r))return Xe([new Yt(\"\",\"zoom expressions not supported\")]);let l=Zi(a);if(!l&&!o)return Xe([new Yt(\"\",\\'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.\\')]);if(l instanceof Yt)return Xe([l]);if(l instanceof Xt&&!Gs(r))return Xe([new Yt(\"\",\\'\"interpolate\" expressions cannot be used with this property\\')]);if(!l)return ka(s?new Qr(\"constant\",n.value,i):new Qr(\"source\",n.value,i));let u=l instanceof Xt?l.interpolation:void 0;return ka(s?new nn(\"camera\",n.value,l.labels,u,i):new nn(\"composite\",n.value,l.labels,u,i))}var Xh=class Zh{constructor(e,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,jh(r),this._parameters=e,this._specification=i,this._rootKey=r,this._defaultValue=Wh(i),this._warningHistory={};let n=Uh(this._parameters,this._specification);this.kind=n.kind,this.interpolationFactor=n.interpolationFactor,this.zoomStops=n.zoomStops,this.interpolationType=n.interpolationType,this._innerEvaluate=n.evaluate}evaluate(e,r){try{return this._innerEvaluate(e,r)}catch(i){let n=i instanceof Error?i.message:String(i),a=`|${n}`;return this._warningHistory[a]||(this._warningHistory[a]=!0,typeof console<\"u\"&&console.warn(Gh(this._rootKey,\"\",n,this._defaultValue))),this._defaultValue}}static deserialize(e){return new Zh(e._parameters,e._rootKey,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification,_rootKey:e._rootKey}}};function Dy(t,e,r,i){if(In(t))return new Xh(t,e,r);if(En(t)){let n=Yh(t,e,r,i);if(n.result===\"error\")throw Error(n.value.map(a=>`${a.key}: ${a.message}`).join(\", \"));return n.value}{let n=t;return r.type===\"color\"&&typeof t==\"string\"?n=at.parse(t):r.type===\"padding\"&&(typeof t==\"number\"||Array.isArray(t))?n=Jt.parse(t):r.type===\"numberArray\"&&(typeof t==\"number\"||Array.isArray(t))?n=Qt.parse(t):r.type===\"colorArray\"&&(typeof t==\"string\"||Array.isArray(t))?n=Ot.parse(t):r.type===\"variableAnchorOffsetCollection\"&&Array.isArray(t)?n=Wt.parse(t):r.type===\"projectionDefinition\"&&typeof t==\"string\"&&(n=Le.parse(t)),{globalStateRefs:new Set,_globalState:null,kind:\"constant\",evaluate:()=>n}}}function Zi(t){let e=null;if(t instanceof dh)e=Zi(t.result);else if(t instanceof Sh){for(let r of t.args)if(e=Zi(r),e)break}else(t instanceof Bs||t instanceof Xt)&&t.input instanceof Ve&&t.input.name===\"zoom\"&&(e=t);return e instanceof Yt||t.eachChild(r=>{let i=Zi(r);i instanceof Yt?e=i:!e&&i?e=new Yt(\"\",\\'\"zoom\" expression may only be used as input to a top-level \"step\" or \"interpolate\" expression.\\'):e&&i&&e!==i&&(e=new Yt(\"\",\\'Only one zoom-based \"step\" or \"interpolate\" subexpression may be used in an expression.\\'))}),e}function pi(t,e=new Set){return t instanceof qs&&e.add(t.key),t.eachChild(r=>{pi(r,e)}),e}function Fy(t){let e={color:Nt,string:U,number:M,enum:U,boolean:j,formatted:li,padding:xn,numberArray:vn,colorArray:Zr,projectionDefinition:mn,resolvedImage:ui,variableAnchorOffsetCollection:bn};return t.type===\"array\"?_t(e[t.value]||q,t.length):e[t.type]}function Wh(t){if(t.type===\"color\"&&In(t.default))return new at(0,0,0,0);switch(t.type){case\"color\":return at.parse(t.default)||null;case\"padding\":return Jt.parse(t.default)||null;case\"numberArray\":return Qt.parse(t.default)||null;case\"colorArray\":return Ot.parse(t.default)||null;case\"variableAnchorOffsetCollection\":return Wt.parse(t.default)||null;case\"projectionDefinition\":return Le.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function ur(t,e){let{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o,pitch:l,rasterValue:u}=t??{};return{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o,pitch:l,rasterValue:u,globalState:e}}function Py(t){let e=!1;for(let r of t){let i=Hh(r);if(i===\"expression\")return\"expression\";i===\"legacy\"&&(e=!0)}return e?\"legacy\":\"neutral\"}function Hh(t){if(typeof t==\"boolean\")return\"neutral\";if(!Array.isArray(t)||t.length===0)return\"legacy\";switch(t[0]){case\"has\":return t.length<2||t[1]===\"$id\"||t[1]===\"$type\"?\"legacy\":t.length===2?\"neutral\":\"expression\";case\"in\":return t.length>=3&&(typeof t[1]!=\"string\"||Array.isArray(t[2]))?\"expression\":\"legacy\";case\"!in\":case\"!has\":return\"legacy\";case\"==\":case\"!=\":case\">\":case\">=\":case\"<\":case\"<=\":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2])?\"expression\":\"legacy\";case\"none\":return\"legacy\";case\"any\":case\"all\":return Py(t.slice(1));default:return\"expression\"}}function Ys(t){return Hh(t)!==\"legacy\"}function yl(t){return t===\"$type\"?[\"geometry-type\"]:t===\"$id\"?[\"id\"]:[\"get\",t]}function Cy(t){switch(t[0]){case\"==\":case\"!=\":case\"<\":case\"<=\":case\">\":case\">=\":return t.length!==3||typeof t[1]!=\"string\"?null:[t[0],yl(t[1]),t[2]];case\"in\":case\"!in\":{if(t.length<2||typeof t[1]!=\"string\")return null;let e=[\"in\",yl(t[1]),[\"literal\",t.slice(2)]];return t[0]===\"!in\"?[\"!\",e]:e}case\"has\":case\"!has\":{if(t.length!==2||typeof t[1]!=\"string\"||t[1]===\"$type\"||t[1]===\"$id\")return null;let e=[\"has\",t[1]];return t[0]===\"!has\"?[\"!\",e]:e}default:return null}}function Kh(t){if((t[0]===\"<\"||t[0]===\"<=\"||t[0]===\">\"||t[0]===\">=\")&&t[1]===\"$type\")return`\"$type\" cannot be use with operator \"${t[0]}\"`;let e=Cy(t);return e?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(t)} with ${JSON.stringify(e)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(t)} to expression syntax.`}function ra(t,e,r){let i=r[t];return Array.isArray(i)?Ys(i)?Xs(i,e.concat(t)):{path:e.concat(t),legacyFilter:i}:null}function Xs(t,e=[]){if(!Array.isArray(t)||t.length<1)return null;switch(t[0]){case\"all\":case\"any\":case\"none\":for(let r=1;r<t.length;r++){let i=ra(r,e,t);if(i)return i}break;case\"!\":{let r=ra(1,e,t);if(r)return r;break}case\"case\":for(let r=1;r<t.length-1;r+=2){let i=ra(r,e,t);if(i)return i}}return null}function zy(t,e){let r=Xs(t);if(!r||typeof console>\"u\")return;let i=r.path.map(n=>`[${n}]`).join(\"\");console.warn(`${e}${i}: ${Kh(r.legacyFilter)}`)}var By={type:\"boolean\",default:!1,transition:!1,\"property-type\":\"data-driven\",expression:{interpolated:!1,parameters:[\"zoom\",\"feature\"]}};function hr(t,e,r){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Ys(t)?zy(t,e):t=an(t);let i=ve(t,e,By,r);if(i.result===\"error\")throw Error(i.value.map(n=>`${n.key}: ${n.message}`).join(\", \"));return{filter:(n,a,s)=>i.value.evaluate(n,a,{},s),needGeometry:Jh(t),getGlobalStateRefs:()=>pi(i.value.expression)}}function Ly(t,e){return t<e?-1:+(t>e)}function Jh(t){if(!Array.isArray(t))return!1;if(t[0]===\"within\"||t[0]===\"distance\")return!0;for(let e=1;e<t.length;e++)if(Jh(t[e]))return!0;return!1}function an(t){if(!t)return!0;let e=t[0];return t.length<=1?e!==\"any\":e===\"==\"?ia(t[1],t[2],\"==\"):e===\"!=\"?Fi(ia(t[1],t[2],\"==\")):e===\"<\"||e===\">\"||e===\"<=\"||e===\">=\"?ia(t[1],t[2],e):e===\"any\"?Vy(t.slice(1)):e===\"all\"?[\"all\"].concat(t.slice(1).map(an)):e===\"none\"?[\"all\"].concat(t.slice(1).map(an).map(Fi)):e===\"in\"?ml(t[1],t.slice(2)):e===\"!in\"?Fi(ml(t[1],t.slice(2))):e===\"has\"?gl(t[1]):e!==\"!has\"||Fi(gl(t[1]))}function ia(t,e,r){switch(t){case\"$type\":return[`filter-type-${r}`,e];case\"$id\":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function Vy(t){return[\"any\"].concat(t.map(an))}function ml(t,e){if(e.length===0)return!1;switch(t){case\"$type\":return[\"filter-type-in\",[\"literal\",e]];case\"$id\":return[\"filter-id-in\",[\"literal\",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?[\"filter-in-large\",t,[\"literal\",e.sort(Ly)]]:[\"filter-in-small\",t,[\"literal\",e]]}}function gl(t){switch(t){case\"$type\":return!0;case\"$id\":return[\"filter-has-id\"];default:return[\"filter-has\",t]}}function Fi(t){return[\"!\",t]}function Qh(t){let e=t.key,r=t.value;return r?[new I(e,r,\"constants have been deprecated as of v8\")]:[]}function lt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function Ce(t){if(Array.isArray(t))return t.map(Ce);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=Ce(t[r]);return e}return lt(t)}function Ft(t){let e=t.key,r=t.value,i=t.valueSpec||{},n=t.objectElementValidators||{},a=t.style,s=t.styleSpec,o=t.validateSpec,l=[],u=Y(r);if(u!==\"object\")return[new I(e,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(\".\")[0],p=Rr(i,c)||i[\"*\"],f;if(Rr(n,c))f=n[c];else if(Rr(i,c)){if(r[h]===void 0)continue;f=o}else if(n[\"*\"])f=n[\"*\"];else if(i[\"*\"])f=o;else{l.push(new I(e,r[h],`unknown property \"${h}\"`));continue}l=l.concat(f({key:(e&&`${e}.`)+h,value:r[h],valueSpec:p,style:a,styleSpec:s,object:r,objectKey:h,validateSpec:o},r))}for(let h in i)n[h]||i[h].required&&i[h].default===void 0&&r[h]===void 0&&l.push(new I(e,r,`missing required property \"${h}\"`));return l}function Zs(t){let e=t.value,r=t.valueSpec,i=t.validateSpec,n=t.style,a=t.styleSpec,s=t.key,o=t.arrayElementValidator||i;if(Y(e)!==\"array\")return[new I(s,e,`array expected, ${Y(e)} found`)];if(r.length&&e.length!==r.length)return[new I(s,e,`array length ${r.length} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),Y(r.value)===\"object\"&&(l=r.value);let u=[];for(let h=0;h<e.length;h++)u=u.concat(o({array:e,arrayIndex:h,value:e[h],valueSpec:l,validateSpec:t.validateSpec,style:n,styleSpec:a,key:`${s}[${h}]`}));return u}function Mn(t){let e=t.key,r=t.value,i=t.valueSpec,n=Y(r);return n===\"number\"&&r!==r&&(n=\"NaN\"),n===\"number\"?\"minimum\"in i&&r<i.minimum?[new I(e,r,`${r} is less than the minimum value ${i.minimum}`)]:\"maximum\"in i&&r>i.maximum?[new I(e,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new I(e,r,`number expected, ${n} found`)]}function tc(t){let e=t.valueSpec,r=lt(t.value.type),i,n={},a,s,o=r!==\"categorical\"&&t.value.property===void 0,l=!o,u=Y(t.value.stops)===\"array\"&&Y(t.value.stops[0])===\"array\"&&Y(t.value.stops[0][0])===\"object\",h=Ft({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:c,default:d}});return r===\"identity\"&&o&&h.push(new I(t.key,t.value,\\'missing required property \"property\"\\')),r!==\"identity\"&&!t.value.stops&&h.push(new I(t.key,t.value,\\'missing required property \"stops\"\\')),r===\"exponential\"&&t.valueSpec.expression&&!Gs(t.valueSpec)&&h.push(new I(t.key,t.value,\"exponential functions not supported\")),t.styleSpec.$version>=8&&(l&&!lr(t.valueSpec)?h.push(new I(t.key,t.value,\"property functions not supported\")):o&&!Nh(t.valueSpec)&&h.push(new I(t.key,t.value,\"zoom functions not supported\"))),(r===\"categorical\"||u)&&t.value.property===void 0&&h.push(new I(t.key,t.value,\\'\"property\" property is required\\')),h;function c(y){if(r===\"identity\")return[new I(y.key,y.value,\\'identity function may not have a \"stops\" property\\')];let m=[],g=y.value;return m=m.concat(Zs({key:y.key,value:g,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:p})),Y(g)===\"array\"&&g.length===0&&m.push(new I(y.key,g,\"array must have at least one stop\")),m}function p(y){let m=[],g=y.value,x=y.key;if(Y(g)!==\"array\")return[new I(x,g,`array expected, ${Y(g)} found`)];if(g.length!==2)return[new I(x,g,`array length 2 expected, length ${g.length} found`)];if(u){if(Y(g[0])!==\"object\")return[new I(x,g,`object expected, ${Y(g[0])} found`)];if(g[0].zoom===void 0)return[new I(x,g,\"object stop key must have zoom\")];if(g[0].value===void 0)return[new I(x,g,\"object stop key must have value\")];if(s&&s>lt(g[0].zoom))return[new I(x,g[0].zoom,\"stop zoom values must appear in ascending order\")];lt(g[0].zoom)!==s&&(s=lt(g[0].zoom),a=void 0,n={}),m=m.concat(Ft({key:`${x}[0]`,value:g[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Mn,value:f}}))}else m=m.concat(f({key:`${x}[0]`,value:g[0],valueSpec:{},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},g));return En(Ce(g[1]))?m.concat([new I(`${x}[1]`,g[1],\"expressions are not allowed in function stops.\")]):m.concat(y.validateSpec({key:`${x}[1]`,value:g[1],valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function f(y,m){let g=Y(y.value),x=lt(y.value),b=y.value===null?m:y.value;if(!i)i=g;else if(g!==i)return[new I(y.key,b,`${g} stop domain type must match previous stop domain type ${i}`)];if(g!==\"number\"&&g!==\"string\"&&g!==\"boolean\")return[new I(y.key,b,\"stop domain value must be a number, string, or boolean\")];if(g!==\"number\"&&r!==\"categorical\"){let v=`number expected, ${g} found`;return lr(e)&&r===void 0&&(v+=\\'\\\\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.\\'),[new I(y.key,b,v)]}return r===\"categorical\"&&g===\"number\"&&(!isFinite(x)||Math.floor(x)!==x)?[new I(y.key,b,`integer expected, found ${x}`)]:r!==\"categorical\"&&g===\"number\"&&a!==void 0&&x<a?[new I(y.key,b,\"stop domain values must appear in ascending order\")]:(a=x,r===\"categorical\"&&x in n?[new I(y.key,b,\"stop domain values must be unique\")]:(n[x]=!0,[]))}function d(y){return y.validateSpec({key:y.key,value:y.value,valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec})}}function cr(t){let e=(t.expressionContext===\"property\"?Yh:ve)(Ce(t.value),t.key,t.valueSpec);if(e.result===\"error\")return e.value.map(i=>new I(`${t.key}${i.key}`,t.value,i.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext===\"property\"&&t.propertyKey===\"text-font\"&&!r.outputDefined())return[new I(t.key,t.value,`Invalid data expression for \"${t.propertyKey}\". Output values must be contained as literals within the expression.`)];if(t.expressionContext===\"property\"&&t.propertyType===\"layout\"&&!Kr(r))return[new I(t.key,t.value,\\'\"feature-state\" data expressions are not supported with layout properties.\\')];if(t.expressionContext===\"filter\"&&!Kr(r))return[new I(t.key,t.value,\\'\"feature-state\" data expressions are not supported with filters.\\')];if(t.expressionContext&&t.expressionContext.indexOf(\"cluster\")===0){if(!kn(r,[\"zoom\",\"feature-state\"]))return[new I(t.key,t.value,\\'\"zoom\" and \"feature-state\" expressions are not supported with cluster properties.\\')];if(t.expressionContext===\"cluster-initial\"&&!Tn(r))return[new I(t.key,t.value,\"Feature data expressions are not supported with initial expression part of cluster properties.\")]}return[]}function Oy(t){let e=t.value,r=t.key,i=Y(e);return i===\"boolean\"?[]:[new I(r,e,`boolean expected, ${i} found`)]}function Ia(t){let e=t.key,r=t.value,i=Y(r);return i===\"string\"?at.parse(String(r))?[]:[new I(e,r,`color expected, \"${r}\" found`)]:[new I(e,r,`color expected, ${i} found`)]}function ti(t){let e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(lt(r))===-1&&n.push(new I(e,r,`expected one of [${i.values.join(\", \")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(lt(r))===-1&&n.push(new I(e,r,`expected one of [${Object.keys(i.values).join(\", \")}], ${JSON.stringify(r)} found`)),n}function Ry(t,e){let r=t;for(let i of e)r=r[i];return r}function $y(t,e){let r=Xs(e);return r?[new I(`${t.key}${r.path.map(i=>`[${i}]`).join(\"\")}`,Ry(t.value,r.path),Kh(r.legacyFilter),null,\"warning\")]:[]}function Ws(t){let e=Ce(t.value);return Ys(e)?[...$y(t,e),...cr(Jr({},t,{expressionContext:\"filter\",valueSpec:{value:\"boolean\"}}))]:ec(t)}function ec(t){let e=t.value,r=t.key;if(Y(e)!==\"array\")return[new I(r,e,`array expected, ${Y(e)} found`)];let i=t.styleSpec,n,a=[];if(e.length<1)return[new I(r,e,\"filter array must have at least 1 element\")];switch(a=a.concat(ti({key:`${r}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),lt(e[0])){case\"<\":case\"<=\":case\">\":case\">=\":e.length>=2&&lt(e[1])===\"$type\"&&a.push(new I(r,e,`\"$type\" cannot be use with operator \"${e[0]}\"`));case\"==\":case\"!=\":e.length!==3&&a.push(new I(r,e,`filter array for operator \"${e[0]}\" must have 3 elements`));case\"in\":case\"!in\":e.length>=2&&(n=Y(e[1]),n!==\"string\"&&a.push(new I(`${r}[1]`,e[1],`string expected, ${n} found`)));for(let s=2;s<e.length;s++)n=Y(e[s]),lt(e[1])===\"$type\"?a=a.concat(ti({key:`${r}[${s}]`,value:e[s],valueSpec:i.geometry_type,style:t.style,styleSpec:t.styleSpec})):n!==\"string\"&&n!==\"number\"&&n!==\"boolean\"&&a.push(new I(`${r}[${s}]`,e[s],`string, number, or boolean expected, ${n} found`));break;case\"any\":case\"all\":case\"none\":for(let s=1;s<e.length;s++)a=a.concat(ec({key:`${r}[${s}]`,value:e[s],style:t.style,styleSpec:t.styleSpec}));break;case\"has\":case\"!has\":n=Y(e[1]),e.length===2?n!==\"string\"&&a.push(new I(`${r}[1]`,e[1],`string expected, ${n} found`)):a.push(new I(r,e,`filter array for \"${e[0]}\" operator must have 2 elements`))}return a}function rc(t,e){let r=t.key,i=t.validateSpec,n=t.style,a=t.styleSpec,s=t.value,o=t.objectKey,l=a[`${e}_${t.layerType}`];if(!l)return[];let u=o.match(/^(.*)-transition$/);if(e===\"paint\"&&u&&l[u[1]]&&l[u[1]].transition)return i({key:r,value:s,valueSpec:a.transition,style:n,styleSpec:a});let h=t.valueSpec||l[o];if(!h)return[new I(r,s,`unknown property \"${o}\"`)];let c;if(Y(s)===\"string\"&&lr(h)&&!h.tokens&&(c=/^{([^}]+)}$/.exec(s)))return[new I(r,s,`\"${o}\" does not support interpolation syntax\\nUse an identity property function instead: \\\\`{ \"type\": \"identity\", \"property\": ${JSON.stringify(c[1])} }\\\\`.`)];let p=[];return t.layerType===\"symbol\"&&o===\"text-font\"&&In(Ce(s))&&lt(s.type)===\"identity\"&&p.push(new I(r,s,\\'\"text-font\" does not support identity functions\\')),p.concat(i({key:t.key,value:s,valueSpec:h,style:n,styleSpec:a,expressionContext:\"property\",propertyType:e,propertyKey:o}))}function ic(t){return rc(t,\"paint\")}function nc(t){return rc(t,\"layout\")}function ac(t){let e=[],r=t.value,i=t.key,n=t.style,a=t.styleSpec;if(Y(r)!==\"object\")return[new I(i,r,`object expected, ${Y(r)} found`)];!r.type&&!r.ref&&e.push(new I(i,r,\\'either \"type\" or \"ref\" is required\\'));let s=lt(r.type),o=lt(r.ref);if(r.id){let l=lt(r.id);for(let u=0;u<t.arrayIndex;u++){let h=n.layers[u];lt(h.id)===l&&e.push(new I(i,r.id,`duplicate layer id \"${r.id}\", previously used at line ${h.id.__line__}`))}}if(\"ref\"in r){[\"type\",\"source\",\"source-layer\",\"filter\",\"layout\"].forEach(u=>{u in r&&e.push(new I(i,r[u],`\"${u}\" is prohibited for ref layers`))});let l;n.layers.forEach(u=>{lt(u.id)===o&&(l=u)}),l?l.ref?e.push(new I(i,r.ref,\"ref cannot reference another ref layer\")):s=lt(l.type):e.push(new I(i,r.ref,`ref layer \"${o}\" not found`))}else if(s!==\"background\")if(!r.source)e.push(new I(i,r,\\'missing required property \"source\"\\'));else{let l=n.sources&&n.sources[r.source],u=l&&lt(l.type);l?u===\"vector\"&&s===\"raster\"?e.push(new I(i,r.source,`layer \"${r.id}\" requires a raster source`)):u!==\"raster-dem\"&&s===\"hillshade\"||u!==\"raster-dem\"&&s===\"color-relief\"?e.push(new I(i,r.source,`layer \"${r.id}\" requires a raster-dem source`)):u===\"raster\"&&s!==\"raster\"?e.push(new I(i,r.source,`layer \"${r.id}\" requires a vector source`)):u===\"vector\"&&!r[\"source-layer\"]?e.push(new I(i,r,`layer \"${r.id}\" must specify a \"source-layer\"`)):u===\"raster-dem\"&&s!==\"hillshade\"&&s!==\"color-relief\"?e.push(new I(i,r.source,\"raster-dem source can only be used with layer type \\'hillshade\\' or \\'color-relief\\'.\")):s===\"line\"&&r.paint&&r.paint[\"line-gradient\"]&&(u!==\"geojson\"||!l.lineMetrics)&&e.push(new I(i,r,`layer \"${r.id}\" specifies a line-gradient, which requires a GeoJSON source with \\\\`lineMetrics\\\\` enabled.`)):e.push(new I(i,r.source,`source \"${r.source}\" not found`))}return s===\"raster\"&&r.paint?.resampling&&r.paint?.[\"raster-resampling\"]&&e.push(new I(i,r.paint,`layer \"${r.id}\" redundantly specifies \"resampling\" and \"raster-resampling\" paint properties, but only one is allowed. It is advised to use \"resampling\".`)),e=e.concat(Ft({key:i,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{\"*\"(){return[]},type(){return t.validateSpec({key:`${i}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:\"type\"})},filter:Ws,layout(l){return Ft({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{\"*\"(u){return nc(Jr({layerType:s},u))}}})},paint(l){return Ft({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{\"*\"(u){return ic(Jr({layerType:s},u))}}})}}})),e}function xe(t){let e=t.value,r=t.key,i=Y(e);return i===\"string\"?[]:[new I(r,e,`string expected, ${i} found`)]}function Ny(t){let e=t.sourceName??\"\",r=t.value,i=t.styleSpec,n=i.source_raster_dem,a=t.style,s=[],o=Y(r);if(r===void 0)return s;if(o!==\"object\")return s.push(new I(\"source_raster_dem\",r,`object expected, ${o} found`)),s;let l=lt(r.encoding)===\"custom\",u=[\"redFactor\",\"greenFactor\",\"blueFactor\",\"baseShift\"],h=t.value.encoding?`\"${t.value.encoding}\"`:\"Default\";for(let c in r)!l&&u.includes(c)?s.push(new I(c,r[c],`In \"${e}\": \"${c}\" is only valid when \"encoding\" is set to \"custom\". ${h} encoding found`)):n[c]?s=s.concat(t.validateSpec({key:c,value:r[c],valueSpec:n[c],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new I(c,r[c],`unknown property \"${c}\"`));return s}var xl={promoteId:Uy};function sc(t){let e=t.value,r=t.key,i=t.styleSpec,n=t.style,a=t.validateSpec;if(!e.type)return[new I(r,e,\\'\"type\" is required\\')];let s=lt(e.type),o;switch(s){case\"vector\":case\"raster\":return o=Ft({key:r,value:e,valueSpec:i[`source_${s.replace(\"-\",\"_\")}`],style:t.style,styleSpec:i,objectElementValidators:xl,validateSpec:a}),o;case\"raster-dem\":return o=Ny({sourceName:r,value:e,style:t.style,styleSpec:i,validateSpec:a}),o;case\"geojson\":if(o=Ft({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:a,objectElementValidators:xl}),e.cluster)for(let l in e.clusterProperties){let[u,h]=e.clusterProperties[l],c=typeof u==\"string\"?[u,[\"accumulated\"],[\"get\",l]]:u;o.push(...cr({key:`${r}.${l}.map`,value:h,validateSpec:a,expressionContext:\"cluster-map\"})),o.push(...cr({key:`${r}.${l}.reduce`,value:c,validateSpec:a,expressionContext:\"cluster-reduce\"}))}return o;case\"video\":return Ft({key:r,value:e,valueSpec:i.source_video,style:n,validateSpec:a,styleSpec:i});case\"image\":return Ft({key:r,value:e,valueSpec:i.source_image,style:n,validateSpec:a,styleSpec:i});case\"canvas\":return[new I(r,null,\"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.\",\"source.canvas\")];default:return ti({key:`${r}.type`,value:e.type,valueSpec:{values:[\"vector\",\"raster\",\"raster-dem\",\"geojson\",\"video\",\"image\"]},style:n,validateSpec:a,styleSpec:i})}}function Uy({key:t,value:e}){if(Y(e)===\"string\")return xe({key:t,value:e});{let r=[];for(let i in e)r.push(...xe({key:`${t}.${i}`,value:e[i]}));return r}}function oc(t){let e=t.value,r=t.styleSpec,i=r.light,n=t.style,a=[],s=Y(e);if(e===void 0)return a;if(s!==\"object\")return a=a.concat([new I(\"light\",e,`object expected, ${s} found`)]),a;for(let o in e){let l=o.match(/^(.*)-transition$/);a=l&&i[l[1]]&&i[l[1]].transition?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,validateSpec:t.validateSpec,style:n,styleSpec:r})):i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new I(o,e[o],`unknown property \"${o}\"`)])}return a}function lc(t){let e=t.value,r=t.styleSpec,i=r.sky,n=t.style,a=Y(e);if(e===void 0)return[];if(a!==\"object\")return[new I(\"sky\",e,`object expected, ${a} found`)];let s=[];for(let o in e)s=i[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r})):s.concat([new I(o,e[o],`unknown property \"${o}\"`)]);return s}function uc(t){let e=t.value,r=t.styleSpec,i=r.terrain,n=t.style,a=[],s=Y(e);if(e===void 0)return a;if(s!==\"object\")return a=a.concat([new I(\"terrain\",e,`object expected, ${s} found`)]),a;for(let o in e)a=i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new I(o,e[o],`unknown property \"${o}\"`)]);return a}function qy(t){return xe(t).length===0?[]:cr(t)}function Gy(t){return xe(t).length===0?[]:cr(t)}function jy(t){let e=t.key,r=t.value;if(Y(r)===\"array\"){if(r.length<1||r.length>4)return[new I(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:\"number\"},n=[];for(let a=0;a<r.length;a++)n=n.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return n}return Mn({key:e,value:r,valueSpec:{}})}function Yy(t){let e=t.key,r=t.value;if(Y(r)===\"array\"){let i={type:\"number\"};if(r.length<1)return[new I(e,r,\"array length at least 1 expected, length 0 found\")];let n=[];for(let a=0;a<r.length;a++)n=n.concat(t.validateSpec({key:`${e}[${a}]`,value:r[a],validateSpec:t.validateSpec,valueSpec:i}));return n}return Mn({key:e,value:r,valueSpec:{}})}function Xy(t){let e=t.key,r=t.value;if(Y(r)===\"array\"){if(r.length<1)return[new I(e,r,\"array length at least 1 expected, length 0 found\")];let i=[];for(let n=0;n<r.length;n++)i=i.concat(Ia({key:`${e}[${n}]`,value:r[n],valueSpec:{}}));return i}return Ia({key:e,value:r,valueSpec:{}})}function Zy(t){let e=t.key,r=t.value,i=Y(r),n=t.styleSpec;if(i!==\"array\"||r.length<1||r.length%2!=0)return[new I(e,r,\"variableAnchorOffsetCollection requires a non-empty array of even length\")];let a=[];for(let s=0;s<r.length;s+=2)a=a.concat(ti({key:`${e}[${s}]`,value:r[s],valueSpec:n.layout_symbol[\"text-anchor\"]})),a=a.concat(Zs({key:`${e}[${s+1}]`,value:r[s+1],valueSpec:{length:2,value:\"number\"},validateSpec:t.validateSpec,style:t.style,styleSpec:n}));return a}function hc(t){let e=[],r=t.value,i=t.key;if(Array.isArray(r)){let n=[],a=[];for(let s in r)r[s].id&&n.includes(r[s].id)&&e.push(new I(i,r,`all the sprites\\' ids must be unique, but ${r[s].id} is duplicated`)),n.push(r[s].id),r[s].url&&a.includes(r[s].url)&&e.push(new I(i,r,`all the sprites\\' URLs must be unique, but ${r[s].url} is duplicated`)),a.push(r[s].url),e=e.concat(Ft({key:`${i}[${s}]`,value:r[s],valueSpec:{id:{type:\"string\",required:!0},url:{type:\"string\",required:!0}},validateSpec:t.validateSpec}));return e}return xe({key:i,value:r})}function Wy(t){let e=t.value,r=t.styleSpec,i=r.projection,n=t.style,a=Y(e);if(e===void 0)return[];if(a!==\"object\")return[new I(\"projection\",e,`object expected, ${a} found`)];let s=[];for(let o in e)s=i[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r})):s.concat([new I(o,e[o],`unknown property \"${o}\"`)]);return s}function Hy(t){let e=t.key,r=t.value;r=r instanceof String?r.valueOf():r;let i=Y(r);return i===\"array\"&&!Jy(r)&&!Ky(r)?[new I(e,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]:[\"array\",\"string\"].includes(i)?[]:[new I(e,r,`projection expected, invalid type \"${i}\" found`)]}function Ky(t){return!![\"interpolate\",\"step\",\"literal\"].includes(t[0])}function Jy(t){return Array.isArray(t)&&t.length===3&&typeof t[0]==\"string\"&&typeof t[1]==\"string\"&&typeof t[2]==\"number\"}function Ea(t){return!!t&&t.constructor===Object}function cc(t){return Ea(t.value)?[]:[new I(t.key,t.value,`object expected, ${Y(t.value)} found`)]}var vl=1114111,Qy=/^u\\\\+(?:([0-9a-f]{1,6})(?:-([0-9a-f]{1,6}))?|([0-9a-f]{0,5}\\\\?{1,6}))$/i;function tm(t,e){if(Y(e)!==\"string\")return[];let r=`${e}`,i=()=>[new I(t,e,\\'invalid unicode range, expected a value such as \"U+26\", \"U+0-10FFFF\" or \"U+4??\"\\')],n=r.match(Qy);if(!n)return i();let[,a,s,o]=n;if(o!==void 0)return o.length>6?i():[];let l=parseInt(a,16),u=s===void 0?l:parseInt(s,16);return l>vl||u>vl?[new I(t,e,\"unicode range is out of bounds, the maximum code point is U+10FFFF\")]:l>u?[new I(t,e,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function pc(t){let e=t.key??\"font-faces\",r=t.value,i=t.validateSpec,n=t.styleSpec??Wu,a=t.style;if(!Ea(r))return[new I(e,r,`object expected, ${Y(r)} found`)];let s=[];for(let o in r){let l=r[o],u=Y(l);if(u===\"string\")s.push(...xe({key:`${e}.${o}`,value:l}));else if(u===\"array\"){let h={url:{type:\"string\",required:!0},\"unicode-range\":{type:\"array\",value:\"string\"}};for(let[c,p]of l.entries()){let f=`${e}.${o}[${c}]`;s.push(...Ft({key:f,value:p,valueSpec:h,styleSpec:n,style:a,validateSpec:i}));let d=Ea(p)?p[\"unicode-range\"]:void 0;if(Y(d)===\"array\")for(let[y,m]of d.entries())s.push(...tm(`${f}.unicode-range[${y}]`,m))}}else s.push(new I(`${e}.${o}`,l,`string or array expected, ${u} found`))}return s}var bl={\"*\"(){return[]},array:Zs,boolean:Oy,number:Mn,color:Ia,constants:Qh,enum:ti,filter:Ws,function:tc,layer:ac,object:Ft,source:sc,light:oc,sky:lc,terrain:uc,projection:Wy,projectionDefinition:Hy,string:xe,formatted:qy,resolvedImage:Gy,padding:jy,numberArray:Yy,colorArray:Xy,variableAnchorOffsetCollection:Zy,sprite:hc,state:cc,fontFaces:pc};function Nr(t){let e=t.value,r=t.valueSpec,i=t.styleSpec;return t.validateSpec=Nr,r.expression&&In(lt(e))?tc(t):r.expression&&En(Ce(e))?cr(t):r.type&&bl[r.type]?bl[r.type](t):Ft(Jr({},t,{valueSpec:r.type?i[r.type]:r}))}function fc(t){let e=t.value,r=t.key,i=xe(t);return i.length||(e.indexOf(\"{fontstack}\")===-1&&i.push(new I(r,e,\\'\"glyphs\" url must include a \"{fontstack}\" token\\')),e.indexOf(\"{range}\")===-1&&i.push(new I(r,e,\\'\"glyphs\" url must include a \"{range}\" token\\'))),i}function Dt(t,e=w){let r=[];return r=r.concat(Nr({key:\"\",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Nr,objectElementValidators:{glyphs:fc,\"*\"(){return[]}}})),t.constants&&(r=r.concat(Qh({key:\"constants\",value:t.constants,style:t,styleSpec:e,validateSpec:Nr}))),dc(r)}Dt.source=zt(Ct(sc)),Dt.sprite=zt(Ct(hc)),Dt.glyphs=zt(Ct(fc)),Dt.fontFaces=zt(Ct(pc)),Dt.light=zt(Ct(oc)),Dt.sky=zt(Ct(lc)),Dt.terrain=zt(Ct(uc)),Dt.state=zt(Ct(cc)),Dt.layer=zt(Ct(ac)),Dt.filter=zt(Ct(Ws)),Dt.paintProperty=zt(Ct(ic)),Dt.layoutProperty=zt(Ct(nc));function Ct(t){return function(e){return t(Object.assign({},e,{validateSpec:Nr}))}}function dc(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function zt(t){return function(...e){return dc(t.apply(this,e))}}var em={type:\"enum\",\"property-type\":\"data-constant\",expression:{interpolated:!1,parameters:[\"global-state\"]},values:{visible:{},none:{}},transition:!1,default:\"visible\"},rm=class{constructor(t,e,r){this._rootKey=e,this._globalState=r,this.setValue(t)}evaluate(){return this._literalValue??this._compiledValue.evaluate({})}setValue(t){if(t==null||t===\"visible\"||t===\"none\"){this._literalValue=t===\"none\"?\"none\":\"visible\",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let e=ve(t,this._rootKey,em,this._globalState);if(e.result===\"error\")throw this._literalValue=\"visible\",this._compiledValue=void 0,Error(e.value.map(r=>`${r.key}: ${r.message}`).join(\", \"));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=pi(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function im(t,e,r){return new rm(t,e,r)}var wl=Dt,Kb=new Set(Object.keys(w).filter(t=>t.startsWith(\"source_\")).map(t=>t.slice(7).replaceAll(\"_\",\"-\")));function nm(t,e){let r=!1;for(let i of e){if(i.severity===\"warning\"){mt(i.message);continue}t.fire(new Ji(Error(i.message))),r=!0}return r}function am(t,e,r,i){return i?.validate!==!1&&nm(t,e({styleSpec:w,...r}))}var Ma=class yc{constructor(e,r,i){let n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let s=new Int32Array(this.arrayBuffer);e=s[0],r=s[1],i=s[2],this.d=r+2*i;for(let u=0;u<this.d*this.d;u++){let h=s[3+u],c=s[3+u+1];n.push(h===c?null:s.subarray(h,c))}let o=s[3+n.length],l=s[3+n.length+1];this.keys=s.subarray(o,l),this.bboxes=s.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*i;for(let s=0;s<this.d*this.d;s++)n.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=e,this.padding=i,this.scale=r/e,this.uid=0;let a=i/r*e;this.min=-a,this.max=e+a}insert(e,r,i,n,a){this._forEachCell(r,i,n,a,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(a)}_insertReadonly(){throw Error(\"Cannot insert into a GridIndex created from an ArrayBuffer.\")}_insertCell(e,r,i,n,a,s){this.cells[a].push(s)}query(e,r,i,n,a){let s=this.min,o=this.max;if(e<=s&&r<=s&&o<=i&&o<=n&&!a)return[...this.keys];{let l=[];return this._forEachCell(e,r,i,n,this._queryCell,l,{},a),l}}_queryCell(e,r,i,n,a,s,o,l){let u=this.cells[a];if(u!==null){let h=this.keys,c=this.bboxes;for(let p of u)if(o[p]===void 0){let f=p*4;(l?l(c[f+0],c[f+1],c[f+2],c[f+3]):e<=c[f+2]&&r<=c[f+3]&&i>=c[f+0]&&n>=c[f+1])?(o[p]=!0,s.push(h[p])):o[p]=!1}}}_forEachCell(e,r,i,n,a,s,o,l){let u=this._convertToCellCoord(e),h=this._convertToCellCoord(r),c=this._convertToCellCoord(i),p=this._convertToCellCoord(n);for(let f=u;f<=c;f++)for(let d=h;d<=p;d++){let y=this.d*d+f;if(!(l&&!l(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&a.call(this,e,r,i,n,y,s,o,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=3+this.cells.length+1+1,i=0;for(let s of this.cells)i+=s.length;let n=new Int32Array(r+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let a=r;for(let s=0;s<e.length;s++){let o=e[s];n[3+s]=a,n.set(o,a),a+=o.length}return n[3+e.length]=a,n.set(this.keys,a),a+=this.keys.length,n[3+e.length+1]=a,n.set(this.bboxes,a),a+=this.bboxes.length,n.buffer}static serialize(e,r){let i=e.toArrayBuffer();return r&&r.push(i),{buffer:i}}static deserialize(e){return new yc(e.buffer)}},ie={};function D(t,e,r={}){if(ie[t])throw Error(`${t} is already registered.`);Object.defineProperty(e,\"_classRegistryKey\",{value:t,writeable:!1}),ie[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}D(\"Object\",Object),D(\"Set\",Set),D(\"TransferableGridIndex\",Ma),D(\"Color\",at),D(\"Error\",Error),D(\"AJAXError\",Ki),D(\"ResolvedImage\",Ht),D(\"StylePropertyFunction\",Xh),D(\"StyleExpression\",js,{omit:[\"_evaluator\"]}),D(\"ZoomDependentExpression\",nn),D(\"ZoomConstantExpression\",Qr),D(\"CompoundExpression\",Ve,{omit:[\"_evaluate\"]});for(let t in Je)Je[t]._classRegistryKey||D(`Expression_${t}`,Je[t]);function mc(t){return t&&typeof ArrayBuffer<\"u\"&&(t instanceof ArrayBuffer||t.constructor?.name===\"ArrayBuffer\")}function Hs(t){let e=t.constructor;return t.$name||e._classRegistryKey}function sm(t){if(typeof t!=\"object\"||!t)return!1;let e=Hs(t);return e&&e!==\"Object\"}function gc(t){return!sm(t)&&(t==null||typeof t==\"boolean\"||typeof t==\"number\"||typeof t==\"string\"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||t instanceof Blob||t instanceof Error||mc(t)||dn(t)||ArrayBuffer.isView(t)||t instanceof ImageData)}function Ur(t,e){if(gc(t))return(mc(t)||dn(t))&&e&&e.push(t),ArrayBuffer.isView(t)&&e&&e.push(t.buffer),t instanceof ImageData&&e&&e.push(t.data.buffer),t;if(Array.isArray(t)){let a=[];for(let s of t)a.push(Ur(s,e));return a}if(typeof t!=\"object\")throw Error(`can\\'t serialize object of type ${typeof t}`);let r=Hs(t);if(!r)throw Error(`can\\'t serialize object of unregistered class ${t.constructor.name}`);if(!ie[r])throw Error(`${r} is not registered.`);let{klass:i}=ie[r],n=i.serialize?i.serialize(t,e):{};if(i.serialize){if(n===e?.[e.length-1])throw Error(\"statically serialized object won\\'t survive transfer of $name property\")}else{for(let a in t){if(!t.hasOwnProperty(a)||ie[r].omit.includes(a))continue;let s=t[a];s!==void 0&&(n[a]=ie[r].shallow.includes(a)?s:Ur(s,e))}t instanceof Error&&(n.message=t.message)}if(n.$name)throw Error(\"$name property is reserved for worker serialization logic.\");return r!==\"Object\"&&(n.$name=r),n}function qr(t){if(gc(t))return t;if(Array.isArray(t))return t.map(qr);if(typeof t!=\"object\")throw Error(`can\\'t deserialize object of type ${typeof t}`);let e=Hs(t)||\"Object\";if(!ie[e])throw Error(`can\\'t deserialize unregistered class ${e}`);let{klass:r}=ie[e];if(!r)throw Error(`can\\'t deserialize unregistered class ${e}`);if(r.deserialize)return r.deserialize(t);let i=Object.create(r.prototype);for(let n of Object.keys(t)){if(n===\"$name\")continue;let a=t[n];i[n]=ie[e].shallow.includes(n)?a:qr(a)}return i}var _l=class{constructor(){this.first=!0}update(t,e){let r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=r,!0))}};function om(t){return/[\\\\u02EA\\\\u02EB\\\\u2E80-\\\\u2FDF\\\\u2FF0-\\\\u303F\\\\u3041-\\\\u3096\\\\u309D-\\\\u309F\\\\u30A1-\\\\u30FA\\\\u30FD-\\\\u30FF\\\\u3105-\\\\u312F\\\\u31A0-\\\\u4DBF\\\\u4E00-\\\\uA48C\\\\uA490-\\\\uA4C6\\\\uF900-\\\\uFA6D\\\\uFA70-\\\\uFAD9\\\\uFE10-\\\\uFE1F\\\\uFE30-\\\\uFE4F\\\\uFF00-\\\\uFFEF]|\\\\uD81B[\\\\uDFE0-\\\\uDFFF]|[\\\\uD81C-\\\\uD822\\\\uD840-\\\\uD868\\\\uD86A-\\\\uD86D\\\\uD86F-\\\\uD872\\\\uD874-\\\\uD879\\\\uD880-\\\\uD883\\\\uD885-\\\\uD88C][\\\\uDC00-\\\\uDFFF]|\\\\uD823[\\\\uDC00-\\\\uDCD5\\\\uDCFF-\\\\uDD1E\\\\uDD80-\\\\uDDF2]|\\\\uD82B[\\\\uDFF0-\\\\uDFFF]|\\\\uD82C[\\\\uDC00-\\\\uDEFB]|\\\\uD83C[\\\\uDE00-\\\\uDEFF]|\\\\uD869[\\\\uDC00-\\\\uDEDF\\\\uDF00-\\\\uDFFF]|\\\\uD86E[\\\\uDC00-\\\\uDC1D\\\\uDC20-\\\\uDFFF]|\\\\uD873[\\\\uDC00-\\\\uDEAD\\\\uDEB0-\\\\uDFFF]|\\\\uD87A[\\\\uDC00-\\\\uDFE0\\\\uDFF0-\\\\uDFFF]|\\\\uD87B[\\\\uDC00-\\\\uDE5D]|\\\\uD87E[\\\\uDC00-\\\\uDE1D]|\\\\uD884[\\\\uDC00-\\\\uDF4A\\\\uDF50-\\\\uDFFF]|\\\\uD88D[\\\\uDC00-\\\\uDC79]/gim.test(String.fromCodePoint(t))}function Ks(t){return/[\\\\u02EA\\\\u02EB\\\\u1100-\\\\u11FF\\\\u1400-\\\\u167F\\\\u18B0-\\\\u18F5\\\\u2E80-\\\\u2E99\\\\u2E9B-\\\\u2EF3\\\\u2F00-\\\\u2FD5\\\\u2FF0-\\\\u3007\\\\u3012\\\\u3013\\\\u3020-\\\\u302F\\\\u3031-\\\\u303F\\\\u3041-\\\\u3096\\\\u309D-\\\\u30FB\\\\u30FD-\\\\u30FF\\\\u3105-\\\\u312F\\\\u3131-\\\\u318E\\\\u3190-\\\\uA48C\\\\uA490-\\\\uA4C6\\\\uA960-\\\\uA97C\\\\uAC00-\\\\uD7A3\\\\uD7B0-\\\\uD7C6\\\\uD7CB-\\\\uD7FB\\\\uF900-\\\\uFA6D\\\\uFA70-\\\\uFAD9\\\\uFE10-\\\\uFE1F\\\\uFE30-\\\\uFE48\\\\uFE50-\\\\uFE57\\\\uFE5F-\\\\uFE62\\\\uFE67-\\\\uFE6F\\\\uFF00-\\\\uFF07\\\\uFF0A-\\\\uFF0C\\\\uFF0E-\\\\uFF19\\\\uFF1F-\\\\uFF3A\\\\uFF3C\\\\uFF3E\\\\uFF40-\\\\uFF5A\\\\uFFE0-\\\\uFFE2\\\\uFFE4-\\\\uFFE7]|\\\\uD802[\\\\uDD80-\\\\uDD9F]|\\\\uD805[\\\\uDD80-\\\\uDDFF]|\\\\uD806[\\\\uDE00-\\\\uDEBF]|\\\\uD811[\\\\uDC00-\\\\uDE7F]|\\\\uD81B[\\\\uDFE0-\\\\uDFE4\\\\uDFF0-\\\\uDFF6]|[\\\\uD81C-\\\\uD822\\\\uD83D\\\\uD840-\\\\uD868\\\\uD86A-\\\\uD86D\\\\uD86F-\\\\uD872\\\\uD874-\\\\uD879\\\\uD880-\\\\uD883\\\\uD885-\\\\uD88C][\\\\uDC00-\\\\uDFFF]|\\\\uD823[\\\\uDC00-\\\\uDCD5\\\\uDCFF-\\\\uDD1E\\\\uDD80-\\\\uDDF2]|\\\\uD82B[\\\\uDFF0-\\\\uDFF3\\\\uDFF5-\\\\uDFFB\\\\uDFFD\\\\uDFFE]|\\\\uD82C[\\\\uDC00-\\\\uDD22\\\\uDD30-\\\\uDEFB]|\\\\uD833[\\\\uDEC0-\\\\uDFCF]|\\\\uD834[\\\\uDC00-\\\\uDDFF\\\\uDEE0-\\\\uDF7F]|\\\\uD836[\\\\uDC00-\\\\uDEAF]|\\\\uD83C[\\\\uDC00-\\\\uDE00\\\\uDF00-\\\\uDFFF]|\\\\uD83E[\\\\uDD00-\\\\uDEFF]|\\\\uD869[\\\\uDC00-\\\\uDEDF\\\\uDF00-\\\\uDFFF]|\\\\uD86E[\\\\uDC00-\\\\uDC1D\\\\uDC20-\\\\uDFFF]|\\\\uD873[\\\\uDC00-\\\\uDEAD\\\\uDEB0-\\\\uDFFF]|\\\\uD87A[\\\\uDC00-\\\\uDFE0\\\\uDFF0-\\\\uDFFF]|\\\\uD87B[\\\\uDC00-\\\\uDE5D]|\\\\uD87E[\\\\uDC00-\\\\uDE1D]|\\\\uD884[\\\\uDC00-\\\\uDF4A\\\\uDF50-\\\\uDFFF]|\\\\uD88D[\\\\uDC00-\\\\uDC79]/gim.test(String.fromCodePoint(t))}function lm(t){return/[\\\\xA7\\\\xA9\\\\xAE\\\\xB1\\\\xBC-\\\\xBE\\\\xD7\\\\xF7\\\\u2016\\\\u2020\\\\u2021\\\\u2030\\\\u2031\\\\u203B\\\\u203C\\\\u2042\\\\u2047-\\\\u2049\\\\u2051\\\\u2100-\\\\u218F\\\\u221E\\\\u2234\\\\u2235\\\\u2300-\\\\u2307\\\\u230C-\\\\u231F\\\\u2324-\\\\u2328\\\\u232B\\\\u237D-\\\\u239A\\\\u23BE-\\\\u23CD\\\\u23CF\\\\u23D1-\\\\u23DB\\\\u23E2-\\\\u2422\\\\u2424-\\\\u24FF\\\\u25A0-\\\\u2619\\\\u2620-\\\\u2767\\\\u2776-\\\\u2793\\\\u2B12-\\\\u2B2F\\\\u2B50-\\\\u2B59\\\\u2BB8-\\\\u2BEB\\\\u3000-\\\\u303F\\\\u30A0-\\\\u30FF\\\\uE000-\\\\uF8FF\\\\uFE30-\\\\uFE6F\\\\uFF00-\\\\uFFEF\\\\uFFFC\\\\uFFFD]|[\\\\uDB80-\\\\uDBFF][\\\\uDC00-\\\\uDFFF]/gim.test(String.fromCodePoint(t))}function um(t){return/[\\\\u0900-\\\\u0DFF\\\\u0F00-\\\\u109F\\\\u1780-\\\\u17FF]/gim.test(String.fromCodePoint(t))}function xc(t){return/\\\\s/u.test(String.fromCodePoint(t))}function Da(t){for(let e of t)if(Ks(e.codePointAt(0)))return!0;return!1}function hm(t){for(let e of t)if(!pm(e.codePointAt(0)))return!1;return!0}function vc(t){let e=t.map(r=>{try{return RegExp(`\\\\\\\\p{sc=${r}}`,\"u\").source}catch{return null}}).filter(r=>r);return new RegExp(e.join(\"|\"),\"u\")}var cm=vc([\"Arab\",\"Dupl\",\"Mong\",\"Ougr\",\"Syrc\"]);function pm(t){return!cm.test(String.fromCodePoint(t))}function Sl(t){return!(Ks(t)||lm(t))}function fm(t){return/\\\\p{sc=Arab}/u.test(String.fromCodePoint(t))}var dm=vc(\"Adlm.Arab.Armi.Avst.Chrs.Cprt.Egyp.Elym.Gara.Hatr.Hebr.Hung.Khar.Lydi.Mand.Mani.Mend.Merc.Mero.Narb.Nbat.Nkoo.Orkh.Palm.Phli.Phlp.Phnx.Prti.Rohg.Samr.Sarb.Sogo.Syrc.Thaa.Todr.Yezi\".split(\".\"));function bc(t){return dm.test(String.fromCodePoint(t))}function ym(t,e){return!e&&bc(t)?!1:!um(t)}function mm(t){for(let e of t)if(bc(e.codePointAt(0)))return!0;return!1}function gm(t,e){for(let r of t)if(!ym(r.codePointAt(0),e))return!1;return!0}var Kt=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus=\"unavailable\",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(Kt.isParsed())throw Error(\"RTL text plugin already registered.\");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}async syncState(t,e){if(this.isParsed())return this.getState();if(t.pluginStatus!==\"loading\")return this.setState(t),t;let r=t.pluginURL,i=new Promise(a=>{this.loadScriptResolve=a}),n=new Promise(a=>setTimeout(()=>a(),this.TIMEOUT));if(await e(r),await Promise.race([i,n]),this.isParsed()){let a={pluginStatus:\"loaded\",pluginURL:r};return this.setState(a),a}throw this.setState({pluginStatus:\"error\",pluginURL:\"\"}),Error(`RTL Text Plugin failed to import scripts from ${r}`)}},H=class{constructor(t,e){this.isSupportedScript=xm,this.zoom=t,e?(this.now=e.now||0,this.fadeDuration=e.fadeDuration||0,this.zoomHistory=e.zoomHistory||new _l,this.transition=e.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new _l,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}};function xm(t){return gm(t,Kt.getRTLTextPluginStatus()===\"loaded\")}var vm=\"-transition\",Dn=class{constructor(t,e,r,i){this.property=t,this.value=e,this.expression=Dy(e===void 0?t.specification.default:e,r,t.specification,i)}isDataDriven(){return this.expression.kind===\"source\"||this.expression.kind===\"composite\"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}},Fa=class{constructor(t,e,r){this.property=t,this.value=new Dn(t,void 0,e,r)}transitioned(t,e){return new Al(this.property,this.value,e,Mt({},t.transition,this.transition),t.now)}untransitioned(){return new Al(this.property,this.value,null,{},0)}},bm=class{constructor(t,e,r){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=e}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return fe(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new Fa(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new Dn(this._values[t].property,e===null?void 0:fe(e),this._propertyRootKey(t),this._globalState)}getTransition(t){return fe(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new Fa(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=fe(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r);let i=this.getTransition(e);i!==void 0&&(t[`${e}${vm}`]=i)}return t}transitioned(t,e){let r=new Tl(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){let t=new Tl(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}},Al=class{constructor(t,e,r,i,n){this.property=t,this.value=e,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){let i=t.now||0,n=this.value.possiblyEvaluate(t,e,r),a=this.prior;if(!a)return n;if(i>this.end||this.value.isDataDriven())return this.prior=null,n;if(i<this.begin)return a.possiblyEvaluate(t,e,r);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(t,e,r),n,jf(s))}}},Tl=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){let i=new Fn(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}},wm=class{constructor(t,e,r){this._properties=t,this._values=Object.create(t.defaultPropertyValues),this._globalState=r,this._rootKey=e}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasValue(t){return this._values[t].value!==void 0}hasProperty(t){return t in this._properties.defaultPropertyValues}getValue(t){return fe(this._values[t].value)}setValue(t,e){this._values[t]=new Dn(this._values[t].property,e===null?void 0:fe(e),this._propertyRootKey(t),this._globalState)}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){let i=new Fn(this._properties);for(let n of Object.keys(this._values))i._values[n]=this._values[n].possiblyEvaluate(t,e,r);return i}},Vt=class{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return this.value.kind===\"constant\"}constantOr(t){return this.value.kind===\"constant\"?this.value.value:t}evaluate(t,e,r,i){return this.property.evaluate(this.value,this.parameters,t,e,r,i)}},Fn=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}};function kl(t){if(Array.isArray(t))return t.length;let e=t?.values;return Array.isArray(e)?e.length:void 0}function wc(t,e){let r=kl(t),i=kl(e);return r!==void 0&&i!==void 0&&r!==i}var P=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e){if(t.isDataDriven())throw Error(\"Value should not be data driven\");return t.expression.evaluate(e)}interpolate(t,e,r){if(wc(t,e))return mt(`Property \"${this.name}\" is trying to interpolate arrays of different lengths. Rendering may \\'jump\\'.`),e;let i=this.specification.type,n=Pe[i];return n?n(t,e,r):t}},R=class{constructor(t,e,r){this.specification=t,this.name=e,this.overrides=r}possiblyEvaluate(t,e,r,i){return t.expression.kind===\"constant\"||t.expression.kind===\"camera\"?new Vt(this,{kind:\"constant\",value:t.expression.evaluate(e,null,{},r,i)},e):new Vt(this,t.expression,e)}interpolate(t,e,r){if(t.value.kind!==\"constant\"||e.value.kind!==\"constant\")return t;if(t.value.value===void 0||e.value.value===void 0)return new Vt(this,{kind:\"constant\",value:void 0},t.parameters);if(wc(t.value.value,e.value.value))return mt(`Property \"${this.name}\" is trying to interpolate arrays of different lengths. Rendering may \\'jump\\'.`),e;let i=this.specification.type,n=Pe[i];if(n){let a=n(t.value.value,e.value.value,r);return new Vt(this,{kind:\"constant\",value:a},t.parameters)}return t}evaluate(t,e,r,i,n,a){return t.kind===\"constant\"?t.value:t.evaluate(e,r,i,n,a)}},ei=class extends R{possiblyEvaluate(t,e,r,i){if(t.value===void 0)return new Vt(this,{kind:\"constant\",value:void 0},e);if(t.expression.kind===\"constant\"){let n=t.expression.evaluate(e,null,{},r,i),a=t.property.specification.type===\"resolvedImage\"&&typeof n!=\"string\"?n.name:n,s=this._calculate(a,a,a,e);return new Vt(this,{kind:\"constant\",value:s},e)}if(t.expression.kind===\"camera\"){let n=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new Vt(this,{kind:\"constant\",value:n},e)}return new Vt(this,t.expression,e)}evaluate(t,e,r,i,n,a){if(t.kind===\"source\"){let s=t.evaluate(e,r,i,n,a);return this._calculate(s,s,s,e)}return t.kind===\"composite\"?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,i),t.evaluate({zoom:Math.floor(e.zoom)},r,i),t.evaluate({zoom:Math.floor(e.zoom)+1},r,i),e):t.value}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},_c=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){if(t.value!==void 0){if(t.expression.kind===\"constant\"){let n=t.expression.evaluate(e,null,{},r,i);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new H(Math.floor(e.zoom-1),e)),t.expression.evaluate(new H(Math.floor(e.zoom),e)),t.expression.evaluate(new H(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},fi=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}},kt=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let r=t[e];r.specification.overridable&&this.overridableProperties.push(e);let i=this.defaultPropertyValues[e]=new Dn(r,void 0,r.name,void 0),n=this.defaultTransitionablePropertyValues[e]=new Fa(r,r.name,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}};D(\"DataDrivenProperty\",R),D(\"DataConstantProperty\",P),D(\"CrossFadedDataDrivenProperty\",ei),D(\"CrossFadedProperty\",_c),D(\"ColorRampProperty\",fi);var Il=\" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?\",na=\" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?\",Gt=class extends nd{constructor(t,e,r){if(super(),this.id=t.id,this.type=t.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=im(this.visibility,`layers[${this.id}].layout.visibility`,r),t.type!==\"custom\"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!==\"background\"&&(this.source=t.source,this.sourceLayer=t[\"source-layer\"],this.filter=t.filter,this._featureFilter=hr(t.filter,`layers[${this.id}].filter`,r)),e.layout&&(this._unevaluatedLayout=new wm(e.layout,`layers[${this.id}].layout`,r)),e.paint)){this._transitionablePaint=new bm(e.paint,`layers[${this.id}].paint`,r);for(let i in t.paint)this.setPaintProperty(i,t.paint[i],{validate:!1});for(let i in t.layout)this.setLayoutProperty(i,t.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Fn(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=hr(t,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){if(t===\"visibility\")return this.visibility;if(this._transitionablePaint?.hasProperty(t))throw Error(t+Il);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property \"${t}\" on layer type \"${this.type}\" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(let e in this._unevaluatedLayout._values){let r=this._unevaluatedLayout._values[e];for(let i of r.getGlobalStateRefs())t.add(i)}for(let e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){let t=new globalThis.Map;if(this._transitionablePaint)for(let e in this._transitionablePaint._values){let r=this._transitionablePaint._values[e].value;for(let i of r.getGlobalStateRefs()){let n=t.get(i)??[];n.push({name:e,value:r.value}),t.set(i,n)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,r={}){if(t===\"visibility\"){this.visibility=e,this._visibilityExpression.setValue(e),this.recalculateVisibility();return}if(this._transitionablePaint?.hasProperty(t)){this.fire(new Ji(Error(t+Il)));return}e!=null&&this._validate(wl.layoutProperty,`layers.${this.id}.layout.${t}`,t,e,r)||this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){if(t.endsWith(\"-transition\")){let e=t.slice(0,-11);if(e===\"visibility\"||this._unevaluatedLayout?.hasProperty(e))throw Error(t+na);return this._transitionablePaint.getTransition(e)}if(t===\"visibility\"||this._unevaluatedLayout?.hasProperty(t))throw Error(t+na);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){if(t===\"visibility\"||this._unevaluatedLayout?.hasProperty(t))return this.fire(new Ji(Error(t+na))),!1;if(e!=null&&this._validate(wl.paintProperty,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith(\"-transition\"))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{let i=this._transitionablePaint._values[t],n=i.property.specification[\"property-type\"]===\"cross-faded-data-driven\",a=i.value.isDataDriven(),s=i.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);let o=this._transitionablePaint._values[t].value;return o.isDataDriven()||a||n||this._handleOverridablePaintPropertyUpdate(t,s,o)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t=this.minzoom,e=!1){return this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&t>=this.maxzoom?!0:this._evaluatedVisibility===\"none\"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){let t={id:this.id,type:this.type,source:this.source,\"source-layer\":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout?.serialize(),paint:this._transitionablePaint?.serialize()};return this.visibility&&(t.layout||={},t.layout.visibility=this.visibility),Wf(t,(e,r)=>e!==void 0&&!(r===\"layout\"&&!Object.keys(e).length)&&!(r===\"paint\"&&!Object.keys(e).length))}_validate(t,e,r,i,n={}){return am(this,t,{key:e,layerType:this.type,objectKey:r,value:i},n)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let e=this.paint.get(t);if(!(!(e instanceof Vt)||!lr(e.property.specification))&&(e.value.kind===\"source\"||e.value.kind===\"composite\")&&e.value.isStateDependent)return!0}return!1}},_m,Sm=()=>_m||=new kt({\"raster-opacity\":new P(w.paint_raster[\"raster-opacity\"],\"raster-opacity\"),\"raster-hue-rotate\":new P(w.paint_raster[\"raster-hue-rotate\"],\"raster-hue-rotate\"),\"raster-brightness-min\":new P(w.paint_raster[\"raster-brightness-min\"],\"raster-brightness-min\"),\"raster-brightness-max\":new P(w.paint_raster[\"raster-brightness-max\"],\"raster-brightness-max\"),\"raster-saturation\":new P(w.paint_raster[\"raster-saturation\"],\"raster-saturation\"),\"raster-contrast\":new P(w.paint_raster[\"raster-contrast\"],\"raster-contrast\"),resampling:new P(w.paint_raster.resampling,\"resampling\"),\"raster-resampling\":new P(w.paint_raster[\"raster-resampling\"],\"raster-resampling\"),\"raster-fade-duration\":new P(w.paint_raster[\"raster-fade-duration\"],\"raster-fade-duration\"),\"raster-color\":new fi(w.paint_raster[\"raster-color\"],\"raster-color\"),\"raster-color-mix\":new P(w.paint_raster[\"raster-color-mix\"],\"raster-color-mix\"),\"raster-color-range\":new P(w.paint_raster[\"raster-color-range\"],\"raster-color-range\")}),Am={get paint(){return Sm()}};function Js(t,{width:e,height:r},i,n){if(!n)n=new Uint8Array(e*r*i);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*r*i)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${e*r*i}`);return t.width=e,t.height=r,t.data=n,t}function Sc(t,{width:e,height:r},i){if(e===t.width&&r===t.height)return;let n=Js({},{width:e,height:r},i);Qs(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},i),t.width=e,t.height=r,t.data=n.data}function Qs(t,e,r,i,n,a){if(n.width===0||n.height===0)return e;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw RangeError(\"out of range source coordinates for image copy\");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw RangeError(\"out of range destination coordinates for image copy\");let s=t.data,o=e.data;if(s===o)throw Error(\"srcData equals dstData, so image is already copied\");for(let l=0;l<n.height;l++){let u=((r.y+l)*t.width+r.x)*a,h=((i.y+l)*e.width+i.x)*a;for(let c=0;c<n.width*a;c++)o[h+c]=s[u+c]}return e}var Pn=class Ac{constructor(e,r){Js(this,e,1,r)}resize(e){Sc(this,e,1)}clone(){return new Ac({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,i,n,a){Qs(e,r,i,n,a,1)}},Et=class Tc{constructor(e,r){Js(this,e,4,r)}resize(e){Sc(this,e,4)}replace(e,r){r?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Tc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,r,i,n,a){Qs(e,r,i,n,a,4)}setPixel(e,r,i){let n=(e*this.width+r)*4;this.data[n+0]=Math.round(i.r*255/i.a),this.data[n+1]=Math.round(i.g*255/i.a),this.data[n+2]=Math.round(i.b*255/i.a),this.data[n+3]=Math.round(i.a*255)}};function aa(t){let e=new Uint8Array(t.length);for(let r=0;r<t.length;r+=4){let i=t[r+3];e[r+0]=Math.round(t[r+0]*i/255),e[r+1]=Math.round(t[r+1]*i/255),e[r+2]=Math.round(t[r+2]*i/255),e[r+3]=i}return e}D(\"AlphaImage\",Pn),D(\"RGBAImage\",Et);function kc(t){let e={},r=t.resolution||256,i=t.clips?t.clips.length:1,n=t.image||new Et({width:r,height:i});if(!Zf(r))throw Error(`width is not a power of 2 - ${r}`);let a=(s,o,l)=>{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);n.setPixel(s/4/r,o/4,u)};if(t.clips)for(let s=0,o=0;s<i;++s,o+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let h=l/(r-1),{start:c,end:p}=t.clips[s],f=c*(1-h)+p*h;a(o,u,f)}else for(let s=0,o=0;s<r;s++,o+=4){let l=s/(r-1);a(0,o,l)}return n}var Tm=class extends Gt{constructor(t,e){super(t,Am,e),this._updateColorRamp()}hasColorMap(){return!!this._transitionablePaint._values[\"raster-color\"].value.value}_handleSpecialPaintPropertyUpdate(t){(t===\"raster-color\"||t===\"raster-color-range\")&&this._updateColorRamp()}_updateColorRamp(){if(!this.hasColorMap())return;let t=this._transitionablePaint._values[\"raster-color\"].value.expression,[e,r]=this._transitionablePaint._values[\"raster-color-range\"].value.expression.evaluate({zoom:0});this.colorRamp=kc({expression:t,evaluationKey:\"rasterValue\",image:this.colorRamp,clips:[{start:e,end:r}]}),this.colorRampTexture=null}},km={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},di=class{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},st=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_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(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*5),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw Error(\"_refreshViews() must be implemented by each concrete StructArray layout\")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function ut(t,e=1){let r=0,i=0;return{members:t.map(n=>{let a=Im(n.type),s=r=El(r,Math.max(e,a)),o=n.components||1;return i=Math.max(i,a),r+=a*o,{name:n.name,type:n.type,components:o,offset:s}}),size:El(r,Math.max(i,e)),alignment:e}}function Im(t){return km[t].BYTES_PER_ELEMENT}function El(t,e){return Math.ceil(t/e)*e}var ri=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.int16[i+0]=e,this.int16[i+1]=r,t}};ri.prototype.bytesPerElement=4,D(\"StructArrayLayout2i4\",ri);var Pa=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.int16[n+0]=e,this.int16[n+1]=r,this.int16[n+2]=i,t}};Pa.prototype.bytesPerElement=6,D(\"StructArrayLayout3i6\",Pa);var Ml=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=i,this.int16[a+3]=n,t}};Ml.prototype.bytesPerElement=8,D(\"StructArrayLayout4i8\",Ml);var Ca=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};Ca.prototype.bytesPerElement=12,D(\"StructArrayLayout2i4i12\",Ca);var za=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*4,l=t*8;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=s,t}};za.prototype.bytesPerElement=8,D(\"StructArrayLayout2i4ub8\",za);var ii=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.float32[i+0]=e,this.float32[i+1]=r,t}};ii.prototype.bytesPerElement=8,D(\"StructArrayLayout2f8\",ii);var Ba=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,i,n,a,s,o,l,u)}emplace(t,e,r,i,n,a,s,o,l,u,h){let c=t*10;return this.uint16[c+0]=e,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=n,this.uint16[c+4]=a,this.uint16[c+5]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,t}};Ba.prototype.bytesPerElement=20,D(\"StructArrayLayout10ui20\",Ba);var La=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o){let l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,i,n,a,s,o)}emplace(t,e,r,i,n,a,s,o,l){let u=t*8;return this.uint16[u+0]=e,this.uint16[u+1]=r,this.uint16[u+2]=i,this.uint16[u+3]=n,this.uint16[u+4]=a,this.uint16[u+5]=s,this.uint16[u+6]=o,this.uint16[u+7]=l,t}};La.prototype.bytesPerElement=16,D(\"StructArrayLayout8ui16\",La);var Va=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p){let f=this.length;return this.resize(f+1),this.emplace(f,t,e,r,i,n,a,s,o,l,u,h,c,p)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f){let d=t*14,y=t*7;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=i,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=s,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=h,this.int16[d+10]=c,this.int16[d+11]=p,this.float32[y+6]=f,t}};Va.prototype.bytesPerElement=28,D(\"StructArrayLayout4i4ui4i1f28\",Va);var Oa=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.float32[n+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}};Oa.prototype.bytesPerElement=12,D(\"StructArrayLayout3f12\",Oa);var Ra=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint32[r+0]=e,t}};Ra.prototype.bytesPerElement=4,D(\"StructArrayLayout1ul4\",Ra);var $a=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,i,n,a,s,o,l)}emplace(t,e,r,i,n,a,s,o,l,u){let h=t*10,c=t*5;return this.int16[h+0]=e,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=s,this.uint32[c+3]=o,this.uint16[h+8]=l,this.uint16[h+9]=u,t}};$a.prototype.bytesPerElement=20,D(\"StructArrayLayout6i1ul2ui20\",$a);var Na=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};Na.prototype.bytesPerElement=12,D(\"StructArrayLayout2i2i2i12\",Na);var Dl=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n)}emplace(t,e,r,i,n,a){let s=t*4,o=t*8;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=i,this.int16[o+6]=n,this.int16[o+7]=a,t}};Dl.prototype.bytesPerElement=16,D(\"StructArrayLayout2f1f2i16\",Dl);var Ua=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*16,l=t*4,u=t*8;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[u+6]=a,this.int16[u+7]=s,t}};Ua.prototype.bytesPerElement=16,D(\"StructArrayLayout2ub2f2i16\",Ua);var qa=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.uint16[n+0]=e,this.uint16[n+1]=r,this.uint16[n+2]=i,t}};qa.prototype.bytesPerElement=6,D(\"StructArrayLayout3ui6\",qa);var Ga=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g){let x=this.length;return this.resize(x+1),this.emplace(x,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x){let b=t*26,v=t*13,_=t*52;return this.int16[b+0]=e,this.int16[b+1]=r,this.uint16[b+2]=i,this.uint16[b+3]=n,this.uint32[v+2]=a,this.uint32[v+3]=s,this.uint32[v+4]=o,this.uint16[b+10]=l,this.uint16[b+11]=u,this.uint16[b+12]=h,this.float32[v+7]=c,this.float32[v+8]=p,this.uint8[_+36]=f,this.uint8[_+37]=d,this.uint8[_+38]=y,this.uint32[v+10]=m,this.int16[b+22]=g,this.float32[v+12]=x,t}};Ga.prototype.bytesPerElement=52,D(\"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52\",Ga);var ja=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,_,A,S,k,T,L,V,z){let C=this.length;return this.resize(C+1),this.emplace(C,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,_,A,S,k,T,L,V,z)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,_,A,S,k,T,L,V,z,C){let E=t*34,O=t*17;return this.int16[E+0]=e,this.int16[E+1]=r,this.int16[E+2]=i,this.int16[E+3]=n,this.int16[E+4]=a,this.int16[E+5]=s,this.int16[E+6]=o,this.int16[E+7]=l,this.uint16[E+8]=u,this.uint16[E+9]=h,this.uint16[E+10]=c,this.uint16[E+11]=p,this.uint16[E+12]=f,this.uint16[E+13]=d,this.uint16[E+14]=y,this.uint16[E+15]=m,this.uint16[E+16]=g,this.uint16[E+17]=x,this.uint16[E+18]=b,this.uint16[E+19]=v,this.uint16[E+20]=_,this.uint16[E+21]=A,this.uint16[E+22]=S,this.uint32[O+12]=k,this.float32[O+13]=T,this.float32[O+14]=L,this.uint16[E+30]=V,this.uint16[E+31]=z,this.float32[O+16]=C,t}};ja.prototype.bytesPerElement=68,D(\"StructArrayLayout8i15ui1ul2f2ui1f68\",ja);var sn=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.float32[r+0]=e,t}};sn.prototype.bytesPerElement=4,D(\"StructArrayLayout1f4\",sn);var Ya=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*6,a=t*3;return this.uint16[n+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,t}};Ya.prototype.bytesPerElement=12,D(\"StructArrayLayout1ui2f12\",Ya);var Xa=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*2,a=t*4;return this.uint32[n+0]=e,this.uint16[a+2]=r,this.uint16[a+3]=i,t}};Xa.prototype.bytesPerElement=8,D(\"StructArrayLayout1ul2ui8\",Xa);var Za=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.uint16[i+0]=e,this.uint16[i+1]=r,t}};Za.prototype.bytesPerElement=4,D(\"StructArrayLayout2ui4\",Za);var Fl=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint16[r+0]=e,t}};Fl.prototype.bytesPerElement=2,D(\"StructArrayLayout1ui2\",Fl);var Wa=class extends st{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,this.float32[a+3]=n,t}};Wa.prototype.bytesPerElement=16,D(\"StructArrayLayout4f16\",Wa);var Ic=class extends di{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new F(this.anchorPointX,this.anchorPointY)}};Ic.prototype.size=20;var to=class extends $a{get(t){return new Ic(this,t)}};D(\"CollisionBoxArray\",to);var Ec=class extends di{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Ec.prototype.size=52;var Mc=class extends Ga{get(t){return new Ec(this,t)}};D(\"PlacedSymbolArray\",Mc);var Dc=class extends di{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};Dc.prototype.size=68;var Fc=class extends ja{get(t){return new Dc(this,t)}};D(\"SymbolInstanceArray\",Fc);var Pc=class extends sn{getoffsetX(t){return this.float32[t*1+0]}};D(\"GlyphOffsetArray\",Pc);var Cc=class extends Pa{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};D(\"SymbolLineVertexArray\",Cc);var zc=class extends di{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};zc.prototype.size=12;var Bc=class extends Ya{get(t){return new zc(this,t)}};D(\"TextAnchorOffsetArray\",Bc);var Lc=class extends di{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]}};Lc.prototype.size=8;var Vc=class extends Xa{get(t){return new Lc(this,t)}};D(\"FeatureIndexArray\",Vc);var Em=class extends ri{};var Mm=class extends ri{},Dm=class extends ri{},Fm=class extends Ca{},Pm=class extends za{},Cm=class extends ii{},qe=class extends Ba{},Pl=class extends La{},zm=class extends Va{},Bm=class extends Oa{},Lm=class extends Ra{},Cl=class extends Na{};var Vm=class extends Ua{};var yi=class extends qa{},Ha=class extends Za{};var Ka=ut([{name:\"a_pos\",components:2,type:\"Int16\"}],4),Om=Ka.members;Ka.size,Ka.alignment;var Pt=class Ze{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,r,i,n){let a=this.segments[this.segments.length-1];return e>Ze.MAX_VERTEX_ARRAY_LENGTH&&mt(`Max vertices per segment is ${Ze.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\\\`fillLargeMeshArrays\\\\` function if you require meshes with more than ${Ze.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+e>Ze.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n?this.createNewSegment(r,i,n):a}createNewSegment(e,r,i){let n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return i!==void 0&&(n.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(e,r,i){return this.prepareSegment(0,e,r,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,i,n){return new Ze([{vertexOffset:e,primitiveOffset:r,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};Pt.MAX_VERTEX_ARRAY_LENGTH=2**16-1,D(\"SegmentVector\",Pt);function zl(t,e){return t=Xr(Math.floor(t),0,255),e=Xr(Math.floor(e),0,255),256*t+e}var Rm=ut([{name:\"a_pattern_from\",components:4,type:\"Uint16\"},{name:\"a_pattern_to\",components:4,type:\"Uint16\"},{name:\"a_pixel_ratio_from\",components:1,type:\"Uint16\"},{name:\"a_pixel_ratio_to\",components:1,type:\"Uint16\"}]),$m=ut([{name:\"a_dasharray_from\",components:4,type:\"Uint16\"},{name:\"a_dasharray_to\",components:4,type:\"Uint16\"}]),Nm=Ds(((t,e)=>{function r(i,n){for(var a=i.length&3,s=i.length-a,o=n,l,u=3432918353,h=461845907,c,p=0;p<s;)c=i.charCodeAt(p)&255|(i.charCodeAt(++p)&255)<<8|(i.charCodeAt(++p)&255)<<16|(i.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c,o=o<<13|o>>>19,l=(o&65535)*5+(((o>>>16)*5&65535)<<16)&4294967295,o=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(c=0,a){case 3:c^=(i.charCodeAt(p+2)&255)<<16;case 2:c^=(i.charCodeAt(p+1)&255)<<8;case 1:c^=i.charCodeAt(p)&255,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c}return o^=i.length,o^=o>>>16,o=(o&65535)*2246822507+(((o>>>16)*2246822507&65535)<<16)&4294967295,o^=o>>>13,o=(o&65535)*3266489909+(((o>>>16)*3266489909&65535)<<16)&4294967295,o^=o>>>16,o>>>0}e!==void 0&&(e.exports=r)})),Um=Ds(((t,e)=>{function r(i,n){for(var a=i.length,s=n^a,o=0,l;a>=4;)l=i.charCodeAt(o)&255|(i.charCodeAt(++o)&255)<<8|(i.charCodeAt(++o)&255)<<16|(i.charCodeAt(++o)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^l,a-=4,++o;switch(a){case 3:s^=(i.charCodeAt(o+2)&255)<<16;case 2:s^=(i.charCodeAt(o+1)&255)<<8;case 1:s^=i.charCodeAt(o)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}e.exports=r})),Ja=Df(Ds(((t,e)=>{var r=Nm(),i=Um();e.exports=r,e.exports.murmur3=r,e.exports.murmur2=i}))(),1),Oc=class Rc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,i,n){this.ids.push(Bl(e)),this.positions.push(r,i,n)}getPositions(e){if(!this.indexed)throw Error(\"Trying to get index, but feature positions are not indexed\");let r=Bl(e),i=0,n=this.ids.length-1;for(;i<n;){let s=i+n>>1;this.ids[s]>=r?n=s:i=s+1}let a=[];for(;this.ids[i]===r;){let s=this.positions[3*i],o=this.positions[3*i+1],l=this.positions[3*i+2];a.push({index:s,start:o,end:l}),i++}return a}static serialize(e,r){let i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return Qa(i,n,0,i.length-1),r&&r.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){let r=new Rc;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function Bl(t){let e=+t;return!isNaN(e)&&e<=2**53-1?e:(0,Ja.default)(String(t))}function Qa(t,e,r,i){for(;r<i;){let n=t[r+i>>1],a=r-1,s=i+1;for(;;){do a++;while(t[a]<n);do s--;while(t[s]>n);if(a>=s)break;Pi(t,a,s),Pi(e,3*a,3*s),Pi(e,3*a+1,3*s+1),Pi(e,3*a+2,3*s+2)}s-r<i-s?(Qa(t,e,r,s),r=s+1):(Qa(t,e,s+1,i),i=s)}}function Pi(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}D(\"FeaturePositionMap\",Oc);var eo=class{constructor(t,e){this.gl=t.gl,this.location=e}};var ro=class extends eo{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}};var qm=class extends eo{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2]||t[3]!==this.current[3])&&(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}},Gm=class extends eo{constructor(t,e){super(t,e),this.current=at.transparent}set(t){(t.r!==this.current.r||t.g!==this.current.g||t.b!==this.current.b||t.a!==this.current.a)&&(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}};var Jb=new Float32Array(16);function ts(t){return[zl(255*t.r,255*t.g),zl(255*t.b,255*t.a)]}var zr=class{constructor(t,e,r){this.value=t,this.uniformNames=e.map(i=>`u_${i}`),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return this.type===\"color\"?new Gm(t,e):new ro(t,e)}},Te=class{constructor(t,e){this.uniformNames=e.map(r=>`u_${r}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width]}setUniform(t,e,r,i){let n=null;i===\"u_pattern_to\"?n=this.patternTo:i===\"u_pattern_from\"?n=this.patternFrom:i===\"u_dasharray_to\"?n=this.dashTo:i===\"u_dasharray_from\"?n=this.dashFrom:i===\"u_pixel_ratio_to\"?n=this.pixelRatioTo:i===\"u_pixel_ratio_from\"&&(n=this.pixelRatioFrom),n!==null&&t.set(n)}getBinding(t,e,r){return r.startsWith(\"u_pattern\")||r.startsWith(\"u_dasharray_\")?new qm(t,e):new ro(t,e)}},te=class{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map(n=>({name:`a_${n}`,type:\"Float32\",components:r===\"color\"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,r){let i=this.paintVertexArray.length,n=this.expression.evaluate(new H(0,r),e,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(i,t,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new H(0,n),r,i);this._setPaintValue(t,e,a)}_setPaintValue(t,e,r){if(this.type===\"color\"){let i=ts(r);for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,i[0],i[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray?.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},$t=class{constructor(t,e,r,i,n,a){this.expression=t,this.uniformNames=e.map(s=>`u_${s}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map(s=>({name:`a_${s}`,type:\"Float32\",components:r===\"color\"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,e,r){let i=this.expression.evaluate(new H(this.zoom,r),e,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new H(this.zoom+1,r),e,{},r.canonical,[],r.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,i,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new H(this.zoom,n),r,i),s=this.expression.evaluate(new H(this.zoom+1,n),r,i);this._setPaintValue(t,e,a,s)}_setPaintValue(t,e,r,i){if(this.type===\"color\"){let n=ts(r),a=ts(i);for(let s=t;s<e;s++)this.paintVertexArray.emplace(s,n[0],n[1],a[0],a[1])}else{for(let n=t;n<e;n++)this.paintVertexArray.emplace(n,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(t){this.paintVertexArray?.arrayBuffer.byteLength&&(this.paintVertexBuffer?.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){let r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,i=Xr(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new ro(t,e)}},he=class{constructor(t,e,r,i,n,a){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new n,this.zoomOutPaintVertexArray=new n}populatePaintArray(t,e,r){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,this.getPositionIds(e),r)}updatePaintArray(t,e,r,i,n){this._setPaintValues(t,e,this.getPositionIds(r),n)}_setPaintValues(t,e,r,i){let n=this.getPositions(i);if(!n||!r)return;let a=n[r.min],s=n[r.mid],o=n[r.max];if(!(!a||!s||!o))for(let l=t;l<e;l++)this.emplace(this.zoomInPaintVertexArray,l,a,s),this.emplace(this.zoomOutPaintVertexArray,l,o,s)}upload(t){if(this.zoomInPaintVertexArray?.arrayBuffer.byteLength&&this.zoomOutPaintVertexArray?.arrayBuffer.byteLength){let e=this.getVertexAttributes();this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,e,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,e,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},$c=class extends he{getPositions(t){return t.imagePositions}getPositionIds(t){return t.patterns?.[this.layerId]}getVertexAttributes(){return Rm.members}emplace(t,e,r,i){t.emplace(e,r.tlbr[0],r.tlbr[1],r.tlbr[2],r.tlbr[3],i.tlbr[0],i.tlbr[1],i.tlbr[2],i.tlbr[3],r.pixelRatio,i.pixelRatio)}},Nc=class extends he{getPositions(t){return t.dashPositions}getPositionIds(t){return t.dashes?.[this.layerId]}getVertexAttributes(){return $m.members}emplace(t,e,r,i){t.emplace(e,0,r.y,r.height,r.width,0,i.y,i.height,i.width)}},Uc=class{constructor(t,e,r){this.binders={},this._buffers=[];let i=[];for(let n in t.paint._values){if(!r(n))continue;let a=t.paint.get(n);if(!(a instanceof Vt)||!lr(a.property.specification))continue;let s=jm(n,t.type),o=a.value,l=a.property.specification.type,u=a.property.useIntegerZoom,h=a.property.specification[\"property-type\"],c=h===\"cross-faded\"||h===\"cross-faded-data-driven\";if(o.kind===\"constant\")this.binders[n]=c?new Te(o.value,s):new zr(o.value,s,l),i.push(`/u_${n}`);else if(o.kind===\"source\"||c){let p=Ll(n,l,\"source\");this.binders[n]=c?n===\"line-dasharray\"?new Nc(o,l,u,e,p,t.id):new $c(o,l,u,e,p,t.id):new te(o,s,l,p),i.push(`/a_${n}`)}else{let p=Ll(n,l,\"composite\");this.binders[n]=new $t(o,s,l,u,e,p),i.push(`/z_${n}`)}}this.cacheKey=i.sort().join(\"\")}getMaxValue(t){let e=this.binders[t];return e instanceof te||e instanceof $t?e.maxValue:0}populatePaintArrays(t,e,r){for(let i in this.binders){let n=this.binders[i];(n instanceof te||n instanceof $t||n instanceof he)&&n.populatePaintArray(t,e,r)}}setConstantPatternPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof Te&&i.setConstantPatternPositions(t,e)}}setConstantDashPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof Te&&i.setConstantDashPositions(t,e)}}updatePaintArrays(t,e,r,i,n){let a=!1;for(let s of t){let o=e.getPositions(s.id);for(let l of o){if(l.index>=r.length)continue;let u=r.feature(l.index);for(let h in this.binders){let c=this.binders[h];(c instanceof te||c instanceof $t||c instanceof he)&&c.expression.isStateDependent===!0&&(c.expression=i.paint.get(h).value,c.updatePaintArray(l.start,l.end,u,s.state,n),a=!0)}}}return a}defines(){let t=[];for(let e in this.binders){let r=this.binders[e];(r instanceof zr||r instanceof Te)&&t.push(...r.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof te||r instanceof $t)for(let i of r.paintVertexAttributes)t.push(i.name);else if(r instanceof he){let i=r.getVertexAttributes();for(let n of i)t.push(n.name)}}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof zr||r instanceof Te||r instanceof $t)for(let i of r.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let r=[];for(let i in this.binders){let n=this.binders[i];if(n instanceof zr||n instanceof Te||n instanceof $t){for(let a of n.uniformNames)if(e[a]){let s=n.getBinding(t,e[a],a);r.push({name:a,property:i,binding:s})}}}return r}setUniforms(t,e,r,i){for(let{name:n,property:a,binding:s}of e)this.binders[a].setUniform(s,i,r.get(a),n)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let r=this.binders[e];if(t&&r instanceof he){let i=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof te||r instanceof $t)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let e in this.binders){let r=this.binders[e];(r instanceof te||r instanceof $t||r instanceof he)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof te||e instanceof $t||e instanceof he)&&e.destroy()}}},ze=class{constructor(t,e,r=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new Uc(i,e,r);this.needsUpload=!1,this._featureMap=new Oc,this._bufferOffset=0}populatePaintArrays(t,e,r,i){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,i);e.id!==void 0&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function jm(t,e){return{\"text-opacity\":[\"opacity\"],\"icon-opacity\":[\"opacity\"],\"text-color\":[\"fill_color\"],\"icon-color\":[\"fill_color\"],\"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\"],\"line-gap-width\":[\"gapwidth\"],\"line-dasharray\":[\"dasharray_to\",\"dasharray_from\"],\"line-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"],\"fill-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"],\"fill-extrusion-pattern\":[\"pattern_to\",\"pattern_from\",\"pixel_ratio_to\",\"pixel_ratio_from\"]}[t]||[t.replace(`${e}-`,\"\").replace(/-/g,\"_\")]}function Ym(t){return{\"line-pattern\":{source:qe,composite:qe},\"fill-pattern\":{source:qe,composite:qe},\"fill-extrusion-pattern\":{source:qe,composite:qe},\"line-dasharray\":{source:Pl,composite:Pl}}[t]}function Ll(t,e,r){let i={color:{source:ii,composite:Wa},number:{source:sn,composite:ii}};return Ym(t)?.[r]||i[e][r]}D(\"ConstantBinder\",zr),D(\"CrossFadedConstantBinder\",Te),D(\"SourceExpressionBinder\",te),D(\"CrossFadedPatternBinder\",$c),D(\"CrossFadedDasharrayBinder\",Nc),D(\"CompositeExpressionBinder\",$t),D(\"ProgramConfiguration\",Uc,{omit:[\"_buffers\"]}),D(\"ProgramConfigurationSet\",ze);var es=2**14-1,Vl=-es-1;function Oe(t){let e=nt/t.extent,r=t.loadGeometry();for(let i of r)for(let n of i){let a=Math.round(n.x*e),s=Math.round(n.y*e);n.x=Xr(a,Vl,es),n.y=Xr(s,Vl,es),(a<n.x||a>n.x+1||s<n.y||s>n.y+1)&&mt(\"Geometry exceeds allowed extent, reduce your vector tile buffer size\")}return r}function mr(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Oe(t):[]}}var Ol=-32768;function Xm(t,e,r,i,n){t.emplaceBack(Ol+e*8+i,Ol+r*8+n)}var io=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Mm,this.indexArray=new yi,this.segments=new Pt,this.programConfigurations=new ze(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){let i=this.layers[0],n=[],a=null,s=!1,o=i.type===\"heatmap\";if(i.type===\"circle\"){let c=i;a=c.layout.get(\"circle-sort-key\"),s=!a.isConstant(),o||=c.paint.get(\"circle-pitch-alignment\")===\"map\"}let l=o?e.subdivisionGranularity.circle:1,u=new H(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:c,id:p,index:f,sourceLayerIndex:d}of t){let y=mr(c,h);if(!this.layers[0]._featureFilter.filter(u,y,r))continue;let m=s?a.evaluate(y,{},r):void 0,g={id:p,properties:c.properties,type:c.type,sourceLayerIndex:d,index:f,geometry:h?y.geometry:Oe(c),patterns:{},sortKey:m};n.push(g)}s&&n.sort((c,p)=>c.sortKey-p.sortKey);for(let c of n){let{geometry:p,index:f,sourceLayerIndex:d}=c,y=t[f].feature;this.addFeature(c,p,f,r,l),e.featureIndex.insert(y,p,f,d,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Om),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,i,n=1){let a;switch(n){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let o of e)for(let l of o){let u=l.x,h=l.y;if(u<0||u>=8192||h<0||h>=8192)continue;let c=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,t.sortKey),p=c.vertexLength;for(let f=0;f<s;f++)for(let d=0;d<s;d++)Xm(this.layoutVertexArray,u,h,a[d],a[f]);for(let f=0;f<s-1;f++)for(let d=0;d<s-1;d++){let y=p+f*s+d,m=p+(f+1)*s+d;this.indexArray.emplaceBack(y,m+1,y+1),this.indexArray.emplaceBack(y,m,m+1)}c.vertexLength+=s*s,c.primitiveLength+=(s-1)*(s-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:{},canonical:i})}};D(\"CircleBucket\",io,{omit:[\"layers\"]});function Zm(t,e){for(let r of t)if(pr(e,r))return!0;for(let r of e)if(pr(t,r))return!0;return no(t,e)}function Cn(t,e,r){return pr(t,e)?!0:rs(e,t,r)}function qc(t,e){if(t.length===1)return Rl(e,t[0]);for(let r of e)for(let i of r)if(pr(t,i))return!0;for(let r of t)if(Rl(e,r))return!0;for(let r of e)if(no(t,r))return!0;return!1}function Wm(t,e,r){for(let i of e){if(t.length>=3){for(let n of i)if(pr(t,n))return!0}if(Hm(t,i,r))return!0}return!1}function Hm(t,e,r){if(t.length>1){if(no(t,e))return!0;for(let i of e)if(rs(i,t,r))return!0}for(let i of t)if(rs(i,e,r))return!0;return!1}function no(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r<t.length-1;r++){let i=t[r],n=t[r+1];for(let a=0;a<e.length-1;a++){let s=e[a],o=e[a+1];if(Km(i,n,s,o))return!0}}return!1}function Km(t,e,r,i){return de(t,r,i)!==de(e,r,i)&&de(t,e,r)!==de(t,e,i)}function rs(t,e,r){let i=r*r;if(e.length===1)return t.distSqr(e[0])<i;for(let n=1;n<e.length;n++){let a=e[n-1],s=e[n];if(Gc(t,a,s)<i)return!0}return!1}function Gc(t,e,r){let i=e.distSqr(r);if(i===0)return t.distSqr(e);let n=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/i;return n<0?t.distSqr(e):n>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(n)._add(e))}function Rl(t,e){let r=!1,i,n,a;for(let s of t){i=s;for(let o=0,l=i.length-1;o<i.length;l=o++)n=i[o],a=i[l],n.y>e.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(r=!r)}return r}function pr(t,e){let r=!1;for(let i=0,n=t.length-1;i<t.length;n=i++){let a=t[i],s=t[n];a.y>e.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function Jm(t,e,r,i,n){for(let s of t)if(e<=s.x&&r<=s.y&&i>=s.x&&n>=s.y)return!0;let a=[new F(e,r),new F(e,n),new F(i,n),new F(i,r)];if(t.length>2){for(let s of a)if(pr(t,s))return!0}for(let s=0;s<t.length-1;s++){let o=t[s],l=t[s+1];if(Qm(o,l,a))return!0}return!1}function Qm(t,e,r){let i=r[0],n=r[2];if(t.x<i.x&&e.x<i.x||t.x>n.x&&e.x>n.x||t.y<i.y&&e.y<i.y||t.y>n.y&&e.y>n.y)return!1;let a=de(t,e,r[0]);return a!==de(t,e,r[1])||a!==de(t,e,r[2])||a!==de(t,e,r[3])}function Qe(t,e,r){let i=e.paint.get(t).value;return i.kind===\"constant\"?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function zn(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Bn(t,e,r,i,n){if(!e[0]&&!e[1])return t;let a=F.convert(e)._mult(n);r===\"viewport\"&&a._rotate(-i);let s=[];for(let o of t)s.push(o.sub(a));return s}function t1(t){let e=[];for(let r=0;r<t.length;r++){let i=t[r],n=e.at(-1);(r===0||n&&!i.equals(n))&&e.push(i)}return e}function e1(t,e){let r=[];for(let i of t){let n=t1(i),a=[];for(let s=0;s<n.length;s++){let o=n[s],l=n[s-1],u=n[s+1],h=s===0?new F(0,0):o.sub(l)._unit()._perp(),c=s===n.length-1?new F(0,0):u.sub(o)._unit()._perp(),p=h._add(c)._unit(),f=p.x*c.x+p.y*c.y;f!==0&&p._mult(1/f),a.push(p._mult(e)._add(o))}r.push(a)}return r}function r1({queryGeometry:t,size:e},r){return Cn(t,r,e)}function i1({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){return Cn(t,a,e*(r.projectTileCoordinates(a.x,a.y,i,n?.(a.x,a.y)).signedDistanceFromCamera/r.cameraToCenterDistance))}function n1({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){let s=r.projectTileCoordinates(a.x,a.y,i,n?.(a.x,a.y)).signedDistanceFromCamera,o=e*(r.cameraToCenterDistance/s);return Cn(t,ao(a,r,i,n),o)}function a1({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n},a){return Cn(t,ao(a,r,i,n),e)}function jc({queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n,pitchAlignment:a=\"map\",pitchScale:s=\"map\"},o){let l=a===\"map\"?s===\"map\"?r1:i1:s===\"map\"?n1:a1,u={queryGeometry:t,size:e,transform:r,unwrappedTileID:i,getElevation:n};for(let h of o)for(let c of h)if(l(u,c))return!0;return!1}function ao(t,e,r,i){let n=e.projectTileCoordinates(t.x,t.y,r,i?.(t.x,t.y)).point;return new F((n.x*.5+.5)*e.width,(-n.y*.5+.5)*e.height)}function s1(t,e,r,i){return t.map(n=>ao(n,e,r,i))}var o1,l1=()=>o1||=new kt({\"circle-sort-key\":new R(w.layout_circle[\"circle-sort-key\"],\"circle-sort-key\")}),u1,h1=()=>u1||=new kt({\"circle-radius\":new R(w.paint_circle[\"circle-radius\"],\"circle-radius\"),\"circle-color\":new R(w.paint_circle[\"circle-color\"],\"circle-color\"),\"circle-blur\":new R(w.paint_circle[\"circle-blur\"],\"circle-blur\"),\"circle-opacity\":new R(w.paint_circle[\"circle-opacity\"],\"circle-opacity\"),\"circle-translate\":new P(w.paint_circle[\"circle-translate\"],\"circle-translate\"),\"circle-translate-anchor\":new P(w.paint_circle[\"circle-translate-anchor\"],\"circle-translate-anchor\"),\"circle-pitch-scale\":new P(w.paint_circle[\"circle-pitch-scale\"],\"circle-pitch-scale\"),\"circle-pitch-alignment\":new P(w.paint_circle[\"circle-pitch-alignment\"],\"circle-pitch-alignment\"),\"circle-stroke-width\":new R(w.paint_circle[\"circle-stroke-width\"],\"circle-stroke-width\"),\"circle-stroke-color\":new R(w.paint_circle[\"circle-stroke-color\"],\"circle-stroke-color\"),\"circle-stroke-opacity\":new R(w.paint_circle[\"circle-stroke-opacity\"],\"circle-stroke-opacity\")}),c1={get paint(){return h1()},get layout(){return l1()}};var p1=class extends Gt{constructor(t,e){super(t,c1,e)}createBucket(t){return new io(t)}queryRadius(t){let e=t;return Qe(\"circle-radius\",this,e)+Qe(\"circle-stroke-width\",this,e)+zn(this.paint.get(\"circle-translate\"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){let l=Bn(t,this.paint.get(\"circle-translate\"),this.paint.get(\"circle-translate-anchor\"),-n.bearingInRadians,a),u=this.paint.get(\"circle-radius\").evaluate(e,r)+this.paint.get(\"circle-stroke-width\").evaluate(e,r),h=this.paint.get(\"circle-pitch-scale\"),c=this.paint.get(\"circle-pitch-alignment\"),p,f;return c===\"map\"?(p=l,f=u*a):(p=s1(l,n,s,o),f=u),jc({queryGeometry:p,size:f,transform:n,unwrappedTileID:s,getElevation:o,pitchAlignment:c,pitchScale:h},i)}},Yc=class extends io{};D(\"HeatmapBucket\",Yc,{omit:[\"layers\"]});var f1,d1=()=>f1||=new kt({\"heatmap-radius\":new R(w.paint_heatmap[\"heatmap-radius\"],\"heatmap-radius\"),\"heatmap-weight\":new R(w.paint_heatmap[\"heatmap-weight\"],\"heatmap-weight\"),\"heatmap-intensity\":new P(w.paint_heatmap[\"heatmap-intensity\"],\"heatmap-intensity\"),\"heatmap-color\":new fi(w.paint_heatmap[\"heatmap-color\"],\"heatmap-color\"),\"heatmap-opacity\":new P(w.paint_heatmap[\"heatmap-opacity\"],\"heatmap-opacity\")}),y1={get paint(){return d1()}},$l=\"big-fb\";var m1=class extends Gt{createBucket(t){return new Yc(t)}constructor(t,e){super(t,y1,e),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t===\"heatmap-color\"&&this._updateColorRamp()}_updateColorRamp(){let t=this._transitionablePaint._values[\"heatmap-color\"].value.expression;this.colorRamp=kc({expression:t,evaluationKey:\"heatmapDensity\",image:this.colorRamp}),this.colorRampTexture=null}resize(){let t=this.heatmapFbos.get($l);t&&(t.destroy(),this.heatmapFbos.delete($l))}queryRadius(t){return Qe(\"heatmap-radius\",this,t)}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){return jc({queryGeometry:t,size:this.paint.get(\"heatmap-radius\").evaluate(e,r)*a,transform:n,unwrappedTileID:s,getElevation:o},i)}hasOffscreenPass(){return this.paint.get(\"heatmap-opacity\")!==0&&!this.isHidden()}},g1,x1=()=>g1||=new kt({\"hillshade-illumination-direction\":new P(w.paint_hillshade[\"hillshade-illumination-direction\"],\"hillshade-illumination-direction\"),\"hillshade-illumination-altitude\":new P(w.paint_hillshade[\"hillshade-illumination-altitude\"],\"hillshade-illumination-altitude\"),\"hillshade-illumination-anchor\":new P(w.paint_hillshade[\"hillshade-illumination-anchor\"],\"hillshade-illumination-anchor\"),\"hillshade-exaggeration\":new P(w.paint_hillshade[\"hillshade-exaggeration\"],\"hillshade-exaggeration\"),\"hillshade-shadow-color\":new P(w.paint_hillshade[\"hillshade-shadow-color\"],\"hillshade-shadow-color\"),\"hillshade-highlight-color\":new P(w.paint_hillshade[\"hillshade-highlight-color\"],\"hillshade-highlight-color\"),\"hillshade-accent-color\":new P(w.paint_hillshade[\"hillshade-accent-color\"],\"hillshade-accent-color\"),\"hillshade-method\":new P(w.paint_hillshade[\"hillshade-method\"],\"hillshade-method\"),resampling:new P(w.paint_hillshade.resampling,\"resampling\")}),v1={get paint(){return x1()}};var b1=class extends Gt{constructor(t,e){super(t,v1,e),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get(\"hillshade-illumination-direction\").values,e=this.paint.get(\"hillshade-illumination-altitude\").values,r=this.paint.get(\"hillshade-highlight-color\").values,i=this.paint.get(\"hillshade-shadow-color\").values,n=Math.max(t.length,e.length,r.length,i.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));let a=e.map(Jo);return{directionRadians:t.map(Jo),altitudeRadians:a,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return this.paint.get(\"hillshade-exaggeration\")!==0&&!this.isHidden()}},w1,_1=()=>w1||=new kt({\"color-relief-opacity\":new P(w[\"paint_color-relief\"][\"color-relief-opacity\"],\"color-relief-opacity\"),\"color-relief-color\":new fi(w[\"paint_color-relief\"][\"color-relief-color\"],\"color-relief-color\"),resampling:new P(w[\"paint_color-relief\"].resampling,\"resampling\")}),S1={get paint(){return _1()}};function sa(t){return\"data\"in t}var Nl=class{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,i)}update(t,e,r){let{width:i,height:n}=t,a=(this.size?.[0]!==i||this.size[1]!==n)&&!r,{context:s}=this,{gl:o}=s;this.useMipmap=!!e?.useMipmap,a&&this.size&&this.format===o.RGBA&&(o.deleteTexture(this.texture),this.texture=o.createTexture(),this._ownedHandle=this.texture,this.filter=void 0,this.wrap=void 0),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1);let l=this.format===o.RGBA&&e?.premultiply!==!1;if(a)if(this.size=[i,n],this.format===o.RGBA&&i>0&&n>0){let u=this.useMipmap?Math.floor(Math.log2(Math.max(i,n)))+1:1;if(o.texStorage2D(o.TEXTURE_2D,u,o.RGBA8,i,n),sa(t)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:h}=t;l&&h&&(h=aa(h)),h&&o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,n,o.RGBA,o.UNSIGNED_BYTE,h)}else s.pixelStoreUnpackPremultiplyAlpha.set(l),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,t)}else sa(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,l,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(t,o));else{let{x:u,y:h}=r||{x:0,y:0};sa(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,l,u,h,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(t,u,h,o))}this.useMipmap&&o.generateMipmap(o.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t)}_uploadRawData(t,e,r,i,n){let{data:a}=t;e&&a&&(a=aa(a)),n.texImage2D(n.TEXTURE_2D,0,this.format,r,i,0,this.format,n.UNSIGNED_BYTE,a)}_updateDomImage(t,e,r,i){i.texSubImage2D(i.TEXTURE_2D,0,e,r,i.RGBA,i.UNSIGNED_BYTE,t)}_updateRawData(t,e,r,i,n,a,s){let{data:o}=t;e&&o&&(o=aa(o)),s.texSubImage2D(s.TEXTURE_2D,0,r,i,n,a,s.RGBA,s.UNSIGNED_BYTE,o)}bind(t,e,r){let{context:i}=this,{gl:n}=i;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),r===n.LINEAR_MIPMAP_NEAREST&&!this.useMipmap&&(r=n.LINEAR),t!==this.filter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},so=class Wi{static{this.byteViewCache=new WeakMap}constructor(e,r,i,n=1,a=1,s=1,o=0){if(this.uid=e,r.height!==r.width)throw RangeError(\"DEM tiles must be square\");if(i&&![\"mapbox\",\"terrarium\",\"custom\"].includes(i)){mt(`\"${i}\" is not a valid encoding type. Valid types include \"mapbox\", \"terrarium\" and \"custom\".`);return}this.stride=r.height;let l=this.dim=r.height-2;switch(this.data=new Uint32Array(r.data.buffer),Wi.byteViewCache.set(this,new Uint8Array(this.data.buffer)),i){case\"terrarium\":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case\"custom\":this.redFactor=n,this.greenFactor=a,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let h=0;h<l;h++)this.data[this._idx(-1,h)]=this.data[this._idx(0,h)],this.data[this._idx(l,h)]=this.data[this._idx(l-1,h)],this.data[this._idx(h,-1)]=this.data[this._idx(h,0)],this.data[this._idx(h,l)]=this.data[this._idx(h,l-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(l,-1)]=this.data[this._idx(l-1,0)],this.data[this._idx(-1,l)]=this.data[this._idx(0,l-1)],this.data[this._idx(l,l)]=this.data[this._idx(l-1,l-1)];let u=this._getByteView();this.min=2**53-1,this.max=-(2**53-1);for(let h=0;h<l;h++)for(let c=0;c<l;c++){let p=this._idx(h,c)*4,f=this._unpackAtIndex(u,p);f>this.max&&(this.max=f),f<this.min&&(this.min=f)}}get(e,r){let i=this._getByteView(),n=this._idx(e,r)*4;return this._unpackAtIndex(i,n)}sampleBilinear(e,r){let i=Math.floor(e),n=Math.floor(r);if(i<-1||i>=this.dim||n<-1||n>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);let a=this._getByteView(),s=((n+1)*this.stride+i+1)*4,o=this.stride*4,l=e-i,u=r-n,h=this._unpackAtIndex(a,s),c=this._unpackAtIndex(a,s+4),p=this._unpackAtIndex(a,s+o),f=this._unpackAtIndex(a,s+o+4);return h*(1-l)*(1-u)+c*l*(1-u)+p*(1-l)*u+f*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-1||e>=this.dim+1||r<-1||r>=this.dim+1)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);return(r+1)*this.stride+(e+1)}unpack(e,r,i){return e*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return Xc(e,this.getUnpackVector())}getPixels(){return new Et({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(e,r,i){if(this.dim!==e.dim)throw Error(\"dem dimension mismatch\");let n=r*this.dim,a=r*this.dim+this.dim,s=i*this.dim,o=i*this.dim+this.dim;switch(r){case-1:n=a-1;break;case 1:a=n+1}switch(i){case-1:s=o-1;break;case 1:o=s+1}let l=-r*this.dim,u=-i*this.dim;for(let h=s;h<o;h++)for(let c=n;c<a;c++)this.data[this._idx(c,h)]=e.data[this._idx(c+l,h+u)]}_getByteView(){let e=Wi.byteViewCache.get(this);return e?.buffer!==this.data.buffer&&(e=new Uint8Array(this.data.buffer),Wi.byteViewCache.set(this,e)),e}_unpackAtIndex(e,r){return this.unpack(e[r],e[r+1],e[r+2])}};function Xc(t,e){let r=e[0],i=e[1],n=e[2],a=e[3],s=Math.min(r,i,n),o=Math.round((t+a)/s);return{r:Math.floor(o*s/r)%256,g:Math.floor(o*s/i)%256,b:Math.floor(o*s/n)%256}}D(\"DEMData\",so);var A1=class extends Gt{constructor(t,e){super(t,S1,e)}_createColorRamp(t){let e={elevationStops:[],colorStops:[]},r=this._transitionablePaint._values[\"color-relief-color\"].value.expression;if(r instanceof Qr&&r._styleExpression.expression instanceof Xt){this.colorRampExpression=r;let a=r._styleExpression.expression;e.elevationStops=a.labels,e.colorStops=[];for(let s of e.elevationStops)e.colorStops.push(a.evaluate({globals:{elevation:s}}))}if(e.elevationStops.length<1&&(e.elevationStops=[0],e.colorStops=[at.transparent]),e.elevationStops.length<2&&(e.elevationStops.push(e.elevationStops[0]+1),e.colorStops.push(e.colorStops[0])),e.elevationStops.length<=t)return e;let i={elevationStops:[],colorStops:[]},n=(e.elevationStops.length-1)/(t-1);for(let a=0;a<e.elevationStops.length-.5;a+=n)i.elevationStops.push(e.elevationStops[Math.round(a)]),i.colorStops.push(e.colorStops[Math.round(a)]);return mt(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${t}, provided: ${e.elevationStops.length}`),i}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values[\"color-relief-color\"].value.expression}getColorRampTextures(t,e,r){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;let i=this._createColorRamp(e),n=new Et({width:i.colorStops.length,height:1}),a=new Et({width:i.colorStops.length,height:1});for(let s=0;s<i.elevationStops.length;s++){let o=Xc(i.elevationStops[s],r);a.setPixel(0,s,new at(o.r/255,o.g/255,o.b/255,1)),n.setPixel(0,s,i.colorStops[s])}return this.colorRampTextures={elevationTexture:new Nl(t,a,t.gl.RGBA),colorTexture:new Nl(t,n,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}},is=ut([{name:\"a_pos\",components:2,type:\"Int16\"}],4),T1=is.members;is.size,is.alignment;function on(t,e,r){let i=r.patternDependencies,n=!1;for(let a of e){let s=a.paint.get(`${t}-pattern`);s.isConstant()||(n=!0);let o=s.constantOr(null);o&&(n=!0,i[o.to]=!0,i[o.from]=!0)}return n}function oo(t,e,r,i,n){let{zoom:a}=i,s=n.patternDependencies;for(let o of e){let l=o.paint.get(`${t}-pattern`).value;if(l.kind!==\"constant\"){let u=l.evaluate({zoom:a-1},r,{},n.availableImages),h=l.evaluate({zoom:a},r,{},n.availableImages),c=l.evaluate({zoom:a+1},r,{},n.availableImages);u=u?.name?u.name:u,h=h?.name?h.name:h,c=c?.name?c.name:c,s[u]=!0,s[h]=!0,s[c]=!0,r.patterns[o.id]={min:u,mid:h,max:c}}}return r}var ni=new Set,ns=!1;function k1(t,e,r=2){let i=e&&e.length,n=i?e[0]*r:t.length;ni.size&&ni.clear();let a=Zc(t,0,n,r,!0),s=[];if(!a||a.next===a.prev)return s;let o=0,l=0,u=0;if(i&&(a=F1(t,e,a,r)),t.length>80*r){o=t[0],l=t[1];let h=o,c=l;for(let p=r;p<n;p+=r){let f=t[p],d=t[p+1];f<o&&(o=f),d<l&&(l=d),f>h&&(h=f),d>c&&(c=d)}u=Math.max(h-o,c-l),u=u===0?0:32767/u}return as(a,s,o,l,u),s}function Zc(t,e,r,i,n){let a=null;if(n===G1(t,e,r,i)>0)for(let s=e;s<r;s+=i)a=Gl(s/i|0,t[s],t[s+1],a);else for(let s=r-i;s>=e;s-=i)a=Gl(s/i|0,t[s],t[s+1],a);return a&&ai(a,a.next)&&(oi(a),a=a.next),a}function Be(t,e=t){let r=e===t,i=t,n;do n=!1,i!==i.next&&(ni.size===0||!ni.has(i))&&(ai(i,i.next)||ct(i.prev,i,i.next)===0)?((r||i===e)&&(e=i.prev),ns=!0,oi(i),i=i.prev,n=!0):(r||i!==e)&&(i=i.next,n=!r);while(n||i!==e);return e}function as(t,e,r,i,n){n&&O1(t,r,i,n);let a=t,s=!1;for(;t.prev!==t.next;){let o=t.prev,l=t.next;if(ct(o,t,l)<0&&(n?E1(t,r,i,n):I1(t))){e.push(o.i,t.i,l.i),oi(t),t=l,a=l;continue}if(t=l,t===a){if(ns=!1,t=Be(t),ns){a=t;continue}if(!s){t=M1(t,e),a=t,s=!0;continue}D1(t,e,r,i,n);break}}}function I1(t){let e=t.prev,r=t,i=t.next,n=e.x,a=r.x,s=i.x,o=e.y,l=r.y,u=i.y,h=Math.min(n,a,s),c=Math.min(o,l,u),p=Math.max(n,a,s),f=Math.max(o,l,u),d=i.next;for(;d!==e;){if(d.x>=h&&d.x<=p&&d.y>=c&&d.y<=f&&(n!==d.x||o!==d.y)&&un(n,o,a,l,s,u,d.x,d.y)&&ct(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function E1(t,e,r,i){let n=t.prev,a=t,s=t.next,o=n.x,l=a.x,u=s.x,h=n.y,c=a.y,p=s.y,f=Math.min(o,l,u),d=Math.min(h,c,p),y=Math.max(o,l,u),m=Math.max(h,c,p),g=us(f,d,e,r,i),x=us(y,m,e,r,i),b=t.prevZ;for(;b&&b.z>=g;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==s&&(o!==b.x||h!==b.y)&&un(o,h,l,c,u,p,b.x,b.y)&&ct(b.prev,b,b.next)>=0)return!1;b=b.prevZ}let v=t.nextZ;for(;v&&v.z<=x;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==s&&(o!==v.x||h!==v.y)&&un(o,h,l,c,u,p,v.x,v.y)&&ct(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function M1(t,e){let r=t,i=!1;do{let n=r.prev,a=r.next.next;Hc(n,r,r.next,a,!1)&&si(n,a)&&si(a,n)&&(e.push(n.i,r.i,a.i),oi(r),oi(r.next),r=t=a,i=!0),r=r.next}while(r!==t);return i?Be(r):r}function D1(t,e,r,i,n){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&N1(a,s)){let o=Kc(a,s);a=Be(a,a.next),o=Be(o,o.next),as(a,e,r,i,n),as(o,e,r,i,n);return}s=s.next}a=a.next}while(a!==t)}var ss=!1;function F1(t,e,r,i){let n=[];for(let a=0,s=e.length;a<s;a++){let o=Zc(t,e[a]*i,a<s-1?e[a+1]*i:t.length,i,!1);o===o.next&&ni.add(o),n.push($1(o))}n.sort(P1),z1(t.length/i,e.length),Wc(r,r),ss=!0;for(let a=0;a<n.length;a++)r=C1(n[a],r);return ss=!1,Be(r)}function P1(t,e){return t.x-e.x||t.y-e.y||(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}function C1(t,e){let r=L1(t,e);if(!r)return e;let i=Kc(r,t),n=i.next;return Wc(r,n.next),Be(i,i.next),Be(r,r.next)}var ot=new Float64Array,ln=0,os=[],ls=[];function z1(t,e){let r=Math.ceil((t+2*e)/16)+e+2;ot.length<r*4&&(ot=new Float64Array(r*4)),ln=0}function Wc(t,e){let r=t;do{let i=ln++;os[i]=r;let n=1/0,a=1/0,s=-1/0,o=-1/0,l=0;do{let h=r.next;r.z=i,r.x<n&&(n=r.x),r.x>s&&(s=r.x),r.y<a&&(a=r.y),r.y>o&&(o=r.y),h.x<n&&(n=h.x),h.x>s&&(s=h.x),h.y<a&&(a=h.y),h.y>o&&(o=h.y),r=h}while(++l<16&&r!==e);ls[i]=r;let u=i*4;ot[u]=n,ot[u+1]=a,ot[u+2]=s,ot[u+3]=o}while(r!==e)}function B1(t,e){let r=t.z*4;e.x<ot[r]&&(ot[r]=e.x),e.y<ot[r+1]&&(ot[r+1]=e.y),e.x>ot[r+2]&&(ot[r+2]=e.x),e.y>ot[r+3]&&(ot[r+3]=e.y)}function Ul(t){let e=ls[t];for(;e.prev.next!==e;)e=e.next;return ls[t]=e,e}function ql(t){let e=os[t];for(;e.prev.next!==e;)e=e.next;return os[t]=e,e}function L1(t,e){let r=e,i=t.x,n=t.y,a=-1/0,s;if(ai(t,r))return r;for(let p=0,f=0;p<ln;p++,f+=4){if(n<ot[f+1]||n>ot[f+3]||ot[f]>i||ot[f+2]<=a)continue;let d=Ul(p);r=ql(p);do{if(r.prev.next===r){if(ai(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let y=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(y<=i&&y>a&&(a=y,s=r.x<r.next.x?r:r.next,y===i))return s}}r=r.next}while(r!==d)}if(!s)return null;let o=s.x,l=s.y,u=Math.min(n,l),h=Math.max(n,l),c=1/0;for(let p=0,f=0;p<ln;p++,f+=4){if(ot[f+2]<o||ot[f]>i||ot[f+3]<u||ot[f+1]>h)continue;let d=Ul(p);r=ql(p);do{if(r.prev.next===r&&i>=r.x&&r.x>=o&&i!==r.x&&un(n<l?i:a,n,o,l,n<l?a:i,n,r.x,r.y)){let y=Math.abs(n-r.y)/(i-r.x);(si(r,t)||r.y===n&&r.next.y===n&&r.next.x>i)&&(y<c||y===c&&(r.x>s.x||r.x===s.x&&V1(s,r)))&&(s=r,c=y)}r=r.next}while(r!==d)}return s}function V1(t,e){return ct(t.prev,t,e.prev)<0&&ct(e.next,t,t.next)<0}var Lt=[],Sr=[],Se=new Uint32Array,Ar=new Uint32Array,Tr=new Uint32Array(256);function O1(t,e,r,i){let n=t,a=0;do n.z=us(n.x,n.y,e,r,i),Lt[a++]=n,n=n.next;while(n!==t);R1(a);let s=null;for(let o=0;o<a;o++){let l=Lt[o];l.prevZ=s,s&&(s.nextZ=l),s=l}s.nextZ=null}function R1(t){if(t<=32){for(let e=1;e<t;e++){let r=Lt[e],i=r.z,n=e-1;for(;n>=0&&Lt[n].z>i;)Lt[n+1]=Lt[n],n--;Lt[n+1]=r}return}Se.length<t&&(Se=new Uint32Array(t),Ar=new Uint32Array(t),Sr=Array(t));for(let e=0;e<t;e++)Se[e]=Lt[e].z;Ci(t,Lt,Se,Sr,Ar,0),Ci(t,Sr,Ar,Lt,Se,8),Ci(t,Lt,Se,Sr,Ar,16),Ci(t,Sr,Ar,Lt,Se,24)}function Ci(t,e,r,i,n,a){Tr.fill(0);for(let o=0;o<t;o++)Tr[r[o]>>>a&255]++;let s=0;for(let o=0;o<256;o++){let l=Tr[o];Tr[o]=s,s+=l}for(let o=0;o<t;o++){let l=r[o],u=Tr[l>>>a&255]++;i[u]=e[o],n[u]=l}}function us(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function $1(t){let e=t,r=t;do(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next;while(e!==t);return r}function un(t,e,r,i,n,a,s,o){return(n-s)*(e-o)>=(t-s)*(a-o)&&(t-s)*(i-o)>=(r-s)*(e-o)&&(r-s)*(a-o)>=(n-s)*(i-o)}function N1(t,e){let r=ai(t,e)&&ct(t.prev,t,t.next)>0&&ct(e.prev,e,e.next)>0;return t.next.i!==e.i&&(r||si(t,e)&&si(e,t)&&(ct(t.prev,t,e.prev)!==0||ct(t,e.prev,e)!==0))&&!U1(t,e)&&(r||q1(t,e))}function ct(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function ai(t,e){return t.x===e.x&&t.y===e.y}function Hc(t,e,r,i,n=!0){let a=ct(t,e,r),s=ct(t,e,i),o=ct(r,i,t),l=ct(r,i,e);return(a>0&&s<0||a<0&&s>0)&&(o>0&&l<0||o<0&&l>0)?!0:n?!!(a===0&&zi(t,r,e)||s===0&&zi(t,i,e)||o===0&&zi(r,t,i)||l===0&&zi(r,e,i)):!1}function zi(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function U1(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),a=Math.max(t.y,e.y),s=t;do{let o=s.next;if(s.x>i&&o.x>i||s.x<r&&o.x<r||s.y>a&&o.y>a||s.y<n&&o.y<n){s=o;continue}if(s.i!==t.i&&o.i!==t.i&&s.i!==e.i&&o.i!==e.i&&Hc(s,o,t,e))return!0;s=o}while(s!==t);return!1}function si(t,e){return ct(t.prev,t,t.next)<0?ct(t,e,t.next)>=0&&ct(t,t.prev,e)>=0:ct(t,e,t.prev)<0||ct(t,t.next,e)<0}function q1(t,e){let r=t,i=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{let s=r.next;r.y>a!=s.y>a&&n<(s.x-r.x)*(a-r.y)/(s.y-r.y)+r.x&&(i=!i),r=s}while(r!==t);return i}function Kc(t,e){let r=hs(t.i,t.x,t.y),i=hs(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function Gl(t,e,r,i){let n=hs(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function oi(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),ss&&B1(t.prev,t.next)}function hs(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function G1(t,e,r,i){let n=0;for(let a=e,s=r-i;a<r;a+=i)n+=(t[s]-t[a])*(t[a+1]+t[s+1]),s=a;return n}var Br=class{constructor(t,e){if(e>t)throw Error(\"Min granularity must not be greater than base granularity.\");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){let e=1<<t;return Math.max(Math.floor(this._baseZoomGranularity/e),this._minGranularity,1)}},j1=class Jc{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}static{this.noSubdivision=new Jc({fill:new Br(0,0),line:new Br(0,0),tile:new Br(0,0),stencil:new Br(0,0),circle:1})}};D(\"SubdivisionGranularityExpression\",Br),D(\"SubdivisionGranularitySetting\",j1);var oa=-32768,la=32767,Y1=class{constructor(t,e){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=nt/t,this._canonical=e}_getKey(t,e){return t+=32768,e+=32768,t<<16|e<<0}_vertexToIndex(t,e){if(t<-32768||e<-32768||t>32767||e>32767)throw Error(\"Vertex coordinates are out of signed 16 bit integer range.\");let r=Math.round(t)|0,i=Math.round(e)|0,n=this._getKey(r,i);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,a),this._vertexBuffer.push(r,i),a}_subdivideTrianglesScanline(t){if(this._granularity<2)return Z1(this._vertexBuffer,t);let e=[],r=t.length;for(let i=0;i<r;i+=3){let n=[t[i+0],t[i+1],t[i+2]],a=[this._vertexBuffer[t[i+0]*2+0],this._vertexBuffer[t[i+0]*2+1],this._vertexBuffer[t[i+1]*2+0],this._vertexBuffer[t[i+1]*2+1],this._vertexBuffer[t[i+2]*2+0],this._vertexBuffer[t[i+2]*2+1]],s=1/0,o=1/0,l=-1/0,u=-1/0;for(let d=0;d<3;d++){let y=a[d*2],m=a[d*2+1];s=Math.min(s,y),l=Math.max(l,y),o=Math.min(o,m),u=Math.max(u,m)}if(s===l||o===u)continue;let h=Math.floor(s/this._granularityCellSize),c=Math.ceil(l/this._granularityCellSize),p=Math.floor(o/this._granularityCellSize),f=Math.ceil(u/this._granularityCellSize);if(h===c&&p===f){e.push(...n);continue}for(let d=p;d<f;d++){let y=this._scanlineGenerateVertexRingForCellRow(d,a,n);W1(this._vertexBuffer,y,e)}}return e}_scanlineGenerateVertexRingForCellRow(t,e,r){let i=t*this._granularityCellSize,n=i+this._granularityCellSize,a=[];for(let s=0;s<3;s++){let o=e[s*2],l=e[s*2+1],u=e[(s+1)*2%6],h=e[((s+1)*2+1)%6],c=e[(s+2)*2%6],p=e[((s+2)*2+1)%6],f=u-o,d=h-l,y=f===0,m=d===0,g=(i-l)/d,x=(n-l)/d,b=Math.min(g,x),v=Math.max(g,x);if(!m&&(b>=1||v<=0)||m&&(l<i||l>n)){h>=i&&h<=n&&a.push(r[(s+1)%3]);continue}if(!m&&b>0){let S=o+f*b,k=l+d*b;a.push(this._vertexToIndex(S,k))}let _=o+f*Math.max(b,0),A=o+f*Math.min(v,1);if(y||this._generateIntraEdgeVertices(a,o,l,u,h,_,A),!m&&v<1){let S=o+f*v,k=l+d*v;a.push(this._vertexToIndex(S,k))}(m||h>=i&&h<=n)&&a.push(r[(s+1)%3]),!m&&(h<=i||h>=n)&&this._generateInterEdgeVertices(a,o,l,u,h,c,p,A,i,n)}return a}_generateIntraEdgeVertices(t,e,r,i,n,a,s){let o=i-e,l=n-r,u=l===0,h=u?Math.min(e,i):Math.min(a,s),c=u?Math.max(e,i):Math.max(a,s),p=Math.floor(h/this._granularityCellSize)+1,f=Math.ceil(c/this._granularityCellSize)-1;if(u?e<i:a<s)for(let d=p;d<=f;d++){let y=d*this._granularityCellSize,m=r+l*(y-e)/o;t.push(this._vertexToIndex(y,m))}else for(let d=f;d>=p;d--){let y=d*this._granularityCellSize,m=r+l*(y-e)/o;t.push(this._vertexToIndex(y,m))}}_generateInterEdgeVertices(t,e,r,i,n,a,s,o,l,u){let h=n-r,c=a-i,p=s-n,f=(l-n)/p,d=(u-n)/p,y=Math.min(f,d),m=Math.max(f,d),g=i+c*y,x=Math.floor(Math.min(g,o)/this._granularityCellSize)+1,b=Math.ceil(Math.max(g,o)/this._granularityCellSize)-1,v=o<g,_=p===0;if(_&&(s===l||s===u))return;if(_||y>=1||m<=0){let S=e-a,k=r-s,T=(l-s)/k,L=(u-s)/k,V=a+S*Math.min(T,L);x=Math.floor(Math.min(V,o)/this._granularityCellSize)+1,b=Math.ceil(Math.max(V,o)/this._granularityCellSize)-1,v=o<V}let A=h>0?u:l;if(v)for(let S=x;S<=b;S++){let k=S*this._granularityCellSize;t.push(this._vertexToIndex(k,A))}else for(let S=b;S>=x;S--){let k=S*this._granularityCellSize;t.push(this._vertexToIndex(k,A))}}_generateOutline(t){let e=[];for(let r of t){let i=Ie(r,this._granularity,!0),n=this._pointArrayToIndices(i),a=[];for(let s=1;s<n.length;s++)a.push(n[s-1]),a.push(n[s]);e.push(a)}return e}_handlePoles(t){let e=!1,r=!1;this._canonical&&(this._canonical.y===0&&(e=!0),this._canonical.y===(1<<this._canonical.z)-1&&(r=!0)),(e||r)&&this._fillPoles(t,e,r)}_ensureNoPoleVertices(){let t=this._vertexBuffer;for(let e=0;e<t.length;e+=2){let r=t[e+1];r===-32768&&(t[e+1]=-32767),r===32767&&(t[e+1]=32766)}}_generatePoleQuad(t,e,r,i,n,a){i>n==(a===-32768)?(t.push(r),t.push(e),t.push(this._vertexToIndex(i,a)),t.push(this._vertexToIndex(n,a)),t.push(r),t.push(this._vertexToIndex(i,a))):(t.push(e),t.push(r),t.push(this._vertexToIndex(i,a)),t.push(r),t.push(this._vertexToIndex(n,a)),t.push(this._vertexToIndex(i,a)))}_fillPoles(t,e,r){let i=this._vertexBuffer,n=nt,a=t.length;for(let s=2;s<a;s+=3){let o=t[s-2],l=t[s-1],u=t[s],h=i[o*2],c=i[o*2+1],p=i[l*2],f=i[l*2+1],d=i[u*2],y=i[u*2+1];e&&(c===0&&f===0&&this._generatePoleQuad(t,o,l,h,p,oa),f===0&&y===0&&this._generatePoleQuad(t,l,u,p,d,oa),y===0&&c===0&&this._generatePoleQuad(t,u,o,d,h,oa)),r&&(c===n&&f===n&&this._generatePoleQuad(t,o,l,h,p,la),f===n&&y===n&&this._generatePoleQuad(t,l,u,p,d,la),y===n&&c===n&&this._generatePoleQuad(t,u,o,d,h,la))}}_initializeVertices(t){for(let e=0;e<t.length;e+=2)this._vertexToIndex(t[e],t[e+1])}subdividePolygonInternal(t,e){if(this._used)throw Error(\"Subdivision: multiple use not allowed.\");this._used=!0;let{flattened:r,holeIndices:i}=X1(t);this._initializeVertices(r);let n;try{let s=k1(r,i),o=this._convertIndices(r,s);n=this._subdivideTrianglesScanline(o)}catch(s){console.error(s)}let a=[];return e&&(a=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(n),this._granularity>=2&&this._canonical?.z===0&&(n=this._removeTrianglesOutsideTileX(n),a=a.map(s=>this._removeLinesOutsideTileX(s))),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:a}}_vertexOutsideTileX(t){let e=this._vertexBuffer[t*2];return e<0||e>8192}_removeTrianglesOutsideTileX(t){let e=[];for(let r=0;r<t.length;r+=3)this._vertexOutsideTileX(t[r])||this._vertexOutsideTileX(t[r+1])||this._vertexOutsideTileX(t[r+2])||e.push(t[r],t[r+1],t[r+2]);return e}_removeLinesOutsideTileX(t){let e=[];for(let r=0;r<t.length;r+=2)this._vertexOutsideTileX(t[r])||this._vertexOutsideTileX(t[r+1])||e.push(t[r],t[r+1]);return e}_convertIndices(t,e){let r=[];for(let i of e){let n=t[i*2],a=t[i*2+1];r.push(this._vertexToIndex(n,a))}return r}_pointArrayToIndices(t){let e=[];for(let r of t)e.push(this._vertexToIndex(r.x,r.y));return e}};function Qc(t,e,r,i=!0){return new Y1(r,e).subdividePolygonInternal(t,i)}function Ie(t,e,r=!1){if(!t||t.length<1||t.length<2)return[];let i=t[0],n=t[t.length-1],a=r&&(i.x!==n.x||i.y!==n.y);if(e<2)return a?[...t,t[0]]:[...t];let s=Math.floor(nt/e),o=[];o.push(new F(t[0].x,t[0].y));let l=t.length,u=a?l:l-1;for(let h=0;h<u;h++){let c=t[h],p=h<l-1?t[h+1]:t[0],f=c.x,d=c.y,y=p.x,m=p.y,g=f!==y,x=d!==m;if(!g&&!x)continue;let b=y-f,v=m-d,_=Math.abs(b),A=Math.abs(v),S=f,k=d;for(;;){let L=b>0?(Math.floor(S/s)+1)*s:(Math.ceil(S/s)-1)*s,V=v>0?(Math.floor(k/s)+1)*s:(Math.ceil(k/s)-1)*s,z=Math.abs(S-L),C=Math.abs(k-V),E=Math.abs(S-y),O=Math.abs(k-m),$=g?z/_:1/0,B=x?C/A:1/0;if((E<=z||!g)&&(O<=C||!x))break;if($<B&&g||!x){S=L,k+=v*$;let N=new F(S,Math.round(k));(o[o.length-1].x!==N.x||o[o.length-1].y!==N.y)&&o.push(N)}else{S+=b*B,k=V;let N=new F(Math.round(S),k);(o[o.length-1].x!==N.x||o[o.length-1].y!==N.y)&&o.push(N)}}let T=new F(y,m);(o[o.length-1].x!==T.x||o[o.length-1].y!==T.y)&&o.push(T)}return o}function X1(t){let e=[],r=[];for(let i of t)if(i.length!==0){i!==t[0]&&e.push(r.length/2);for(let n of i)r.push(n.x),r.push(n.y)}return{flattened:r,holeIndices:e}}function Z1(t,e){let r=[];for(let i=0;i<e.length;i+=3){let n=e[i],a=e[i+1],s=e[i+2],o=t[n*2],l=t[n*2+1],u=t[a*2],h=t[a*2+1],c=t[s*2],p=t[s*2+1],f=u-o,d=h-l,y=c-o;f*(p-l)-d*y>0?(r.push(n),r.push(s),r.push(a)):(r.push(n),r.push(a),r.push(s))}return r}function W1(t,e,r){if(e.length===0)throw Error(\"Subdivision vertex ring is empty.\");let i=0,n=t[e[0]*2];for(let l=1;l<e.length;l++){let u=t[e[l]*2];u<n&&(n=u,i=l)}let a=e.length,s=i,o=(s+1)%a;for(;;){let l=s-1>=0?s-1:a-1,u=(o+1)%a,h=t[e[l]*2],c=t[e[l]*2+1],p=t[e[u]*2],f=t[e[u]*2+1],d=t[e[s]*2],y=t[e[s]*2+1],m=t[e[o]*2],g=t[e[o]*2+1],x=!1;if(h<p)x=!0;else if(h>p)x=!1;else{let b=g-y,v=-(m-d),_=y<g?1:-1;((h-d)*b+(c-y)*v)*_>((p-d)*b+(f-y)*v)*_&&(x=!0)}if(x){let b=e[l],v=e[s],_=e[o];b!==v&&b!==_&&v!==_&&r.push(_,v,b),s--,s<0&&(s=a-1)}else{let b=e[u],v=e[s],_=e[o];b!==v&&b!==_&&v!==_&&r.push(_,v,b),o++,o>=a&&(o=0)}if(l===u)break}}function tp(t,e,r,i,n,a,s,o,l){let u=n.length/2,h=s&&o&&l;if(u<Pt.MAX_VERTEX_ARRAY_LENGTH){let c=e.prepareSegment(u,r,i),p=c.vertexLength;for(let y=0;y<a.length;y+=3)i.emplaceBack(p+a[y],p+a[y+1],p+a[y+2]);c.vertexLength+=u,c.primitiveLength+=a.length/3;let f,d;h&&(d=s.prepareSegment(u,r,o),f=d.vertexLength,d.vertexLength+=u);for(let y=0;y<n.length;y+=2)t(n[y],n[y+1]);if(h)for(let y of l){for(let m=1;m<y.length;m+=2)o.emplaceBack(f+y[m-1],f+y[m]);d.primitiveLength+=y.length/2}}else H1(e,r,i,n,a,t),h&&K1(s,r,o,n,l,t),e.forceNewSegmentOnNextPrepare(),s?.forceNewSegmentOnNextPrepare()}function Gr(t,e,r,i,n,a,s){if(a){let o=i.count;return r(e[n*2],e[n*2+1]),t[n]=i.count,i.count++,s.vertexLength++,o}return t[n]}function H1(t,e,r,i,n,a){let s=[];for(let c=0;c<i.length/2;c++)s.push(-1);let o={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),h=u.vertexLength;for(let c=2;c<n.length;c+=3){let p=n[c-2],f=n[c-1],d=n[c],y=s[p]<l,m=s[f]<l,g=s[d]<l,x=+!!y+ +!!m+ +!!g;u.vertexLength+x>Pt.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,g=!0,h=0);let b=Gr(s,i,a,o,p,y,u),v=Gr(s,i,a,o,f,m,u),_=Gr(s,i,a,o,d,g,u);r.emplaceBack(h+b-l,h+v-l,h+_-l),u.primitiveLength++}}function K1(t,e,r,i,n,a){let s=[];for(let c=0;c<i.length/2;c++)s.push(-1);let o={count:0},l=0,u=t.getOrCreateLatestSegment(e,r),h=u.vertexLength;for(let c of n)for(let p=1;p<c.length;p+=2){let f=c[p-1],d=c[p],y=s[f]<l,m=s[d]<l,g=+!!y+ +!!m;u.vertexLength+g>Pt.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,h=0);let x=Gr(s,i,a,o,f,y,u),b=Gr(s,i,a,o,d,m,u);r.emplaceBack(h+x-l,h+b-l),u.primitiveLength++}}var Ln=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new Dm,this.indexArray=new yi,this.indexArray2=new Ha,this.programConfigurations=new ze(t.layers,t.zoom),this.segments=new Pt,this.segments2=new Pt,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=on(\"fill\",this.layers,e);let i=this.layers[0].layout.get(\"fill-sort-key\"),n=!i.isConstant(),a=[],s=new H(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=mr(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r,e.availableImages):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Oe(l),patterns:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;if(this.hasDependencies){let f=oo(\"fill\",this.layers,l,{zoom:this.zoom},e);this.patternFeatures.push(f)}else this.addFeature(l,u,h,r,{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures(t,e,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,T1),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,i,n,a){for(let s of Sn(e,500)){let o=Qc(s,i,a.fill.getGranularityForZoomLevel(i.z)),l=this.layoutVertexArray;tp((u,h)=>{l.emplaceBack(u,h)},this.segments,this.layoutVertexArray,this.indexArray,o.verticesFlattened,o.indicesTriangles,this.segments2,this.indexArray2,o.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}};D(\"FillBucket\",Ln,{omit:[\"layers\",\"patternFeatures\"]});var J1,Q1=()=>J1||=new kt({\"fill-sort-key\":new R(w.layout_fill[\"fill-sort-key\"],\"fill-sort-key\")}),tg,eg=()=>tg||=new kt({\"fill-antialias\":new P(w.paint_fill[\"fill-antialias\"],\"fill-antialias\"),\"fill-opacity\":new R(w.paint_fill[\"fill-opacity\"],\"fill-opacity\"),\"fill-layer-opacity\":new P(w.paint_fill[\"fill-layer-opacity\"],\"fill-layer-opacity\"),\"fill-color\":new R(w.paint_fill[\"fill-color\"],\"fill-color\"),\"fill-outline-color\":new R(w.paint_fill[\"fill-outline-color\"],\"fill-outline-color\"),\"fill-translate\":new P(w.paint_fill[\"fill-translate\"],\"fill-translate\"),\"fill-translate-anchor\":new P(w.paint_fill[\"fill-translate-anchor\"],\"fill-translate-anchor\"),\"fill-pattern\":new ei(w.paint_fill[\"fill-pattern\"],\"fill-pattern\")}),rg={get paint(){return eg()},get layout(){return Q1()}};var ig=class extends Gt{constructor(t,e){super(t,rg,e)}recalculate(t,e){super.recalculate(t,e);let r=this.paint._values[\"fill-outline-color\"];r.value.kind===\"constant\"&&r.value.value===void 0&&(this.paint._values[\"fill-outline-color\"]=this.paint._values[\"fill-color\"])}createBucket(t){return new Ln(t)}queryRadius(){return zn(this.paint.get(\"fill-translate\"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:i}){return qc(Bn(t,this.paint.get(\"fill-translate\"),this.paint.get(\"fill-translate-anchor\"),-r.bearingInRadians,i),e)}isTileClipped(){return!0}},cs=ut([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_normal_ed\",components:4,type:\"Int16\"}],4),ng=ut([{name:\"a_centroid\",components:2,type:\"Int16\"}],4),ag=cs.members;cs.size,cs.alignment;var hn=class ps{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let r=new ps;return r.extend(e(new F(this.minX,this.minY))),r.extend(e(new F(this.maxX,this.minY))),r.extend(e(new F(this.minX,this.maxY))),r.extend(e(new F(this.maxX,this.maxY))),r}static fromPoints(e){let r=new ps;for(let i of e)r.extend(i);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}},Qb=hn.fromPoints([new F(0,0),new F(nt,nt)]);function fs(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function jl(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var mi=class{constructor(t,e,r,i,n){for(this.properties=Object.create(null),this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=n;t.pos<e;){let a=t.readVarint();if(a===8)this.id=t.readVarint();else if(a===18){let s=t.readVarint()+t.pos;for(;t.pos<s;){let o=i[t.readVarint()],l=n[t.readVarint()];this.properties[o]=l}}else a===24?this.type=t.readVarint():(a===34&&(this._geometry=t.pos),t.skip(a))}}loadGeometry(){if(this._geometry<0)throw Error(\"feature has no geometry\");let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,r=[],i,n=1,a=0,s=0,o=0;for(;t.pos<e;){if(a<=0){let l=t.readVarint();if(n=l&7,a=l>>3,a===0)continue}if(a--,n===1)s+=t.readSVarint(),o+=t.readSVarint(),i&&r.push(i),i=[new F(s,o)];else if(n===2)s+=t.readSVarint(),o+=t.readSVarint(),i&&i.push(new F(s,o));else if(n===7)i&&i.push(i[0].clone());else throw Error(`unknown command ${n}`)}return i&&r.push(i),r}bbox(){if(this._geometry<0)throw Error(\"feature has no geometry\");let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,r=1,i=0,n=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;for(;t.pos<e;){if(i<=0){let h=t.readVarint();if(r=h&7,i=h>>3,i===0)continue}if(i--,r===1||r===2)n+=t.readSVarint(),a+=t.readSVarint(),n<s&&(s=n),n>o&&(o=n),a<l&&(l=a),a>u&&(u=a);else if(r!==7)throw Error(`unknown command ${r}`)}return[s,l,o,u]}toGeoJSON(t,e,r){let i=this.extent*2**r,n=this.extent*t,a=this.extent*e,s=this.loadGeometry();function o(c){return[(c.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(c.y+a)*2/i)*Math.PI))-90]}function l(c){return c.map(o)}let u;if(this.type===1){let c=[];for(let f of s)c.push(f[0]);let p=l(c);u=c.length===1?{type:\"Point\",coordinates:p[0]}:{type:\"MultiPoint\",coordinates:p}}else if(this.type===2){let c=s.map(l);u=c.length===1?{type:\"LineString\",coordinates:c[0]}:{type:\"MultiLineString\",coordinates:c}}else if(this.type===3){let c=ep(s),p=[];for(let f of c)p.push(f.map(l));u=p.length===1?{type:\"Polygon\",coordinates:p[0]}:{type:\"MultiPolygon\",coordinates:p}}else throw Error(\"unknown feature type\");let h={type:\"Feature\",geometry:u,properties:this.properties};return this.id!=null&&(h.id=this.id),h}};mi.types=[\"Unknown\",\"Point\",\"LineString\",\"Polygon\"];function ep(t){let e=t.length;if(e<=1)return[t];let r=[],i,n;for(let a=0;a<e;a++){let s=sg(t[a]);s!==0&&(n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[t[a]]):i&&i.push(t[a]))}return i&&r.push(i),r}function sg(t){let e=0;for(let r=0,i=t.length,n=i-1,a,s;r<i;n=r++)a=t[r],s=t[n],e+=(s.x-a.x)*(a.y+s.y);return e}var og=class{constructor(t,e){for(this.version=1,this.name=\"\",this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],e===void 0&&(e=t.length);t.pos<e;){let r=t.readVarint();r===10?this.name=t.readString():r===18?(this._features.push(t.pos),t.skip(r)):r===26?this._keys.push(t.readString()):r===34?this._values.push(lg(t)):r===40?this.extent=t.readVarint():r===120?this.version=t.readVarint():t.skip(r)}this.length=this._features.length}feature(t){if(t<0||t>=this._features.length)throw Error(\"feature index out of bounds\");this._pbf.pos=this._features[t];let e=this._pbf.readVarint()+this._pbf.pos;return new mi(this._pbf,e,this.extent,this._keys,this._values)}};function lg(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){let i=t.readVarint();e=i===10?t.readString():i===21?t.readFloat():i===25?t.readDouble():i===32?t.readVarint(!0):i===40?t.readVarint():i===48?t.readSVarint():i===56?t.readBoolean():(t.skip(i),null)}if(e==null)throw Error(\"unknown feature value\");return e}var lo=class{constructor(t,e=t.length){let r=Object.create(null);for(;t.pos<e;){let i=t.readVarint();if(i===26){let n=new og(t,t.readVarint()+t.pos);n.length&&(r[n.name]=n)}else t.skip(i)}this.layers=r}},rp=63710088e-1,Yl=class Lr{constructor(e,r){if(isNaN(e)||isNaN(r))throw Error(`Invalid LngLat object: (${e}, ${r})`);if(this.lng=+e,this.lat=+r,this.lat>90||this.lat<-90)throw Error(\"Invalid LngLat latitude value: must be between -90 and 90\")}wrap(){return new Lr(Xf(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,i=this.lat*r,n=e.lat*r,a=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*r);return rp*Math.acos(Math.min(a,1))}static convert(e){if(e instanceof Lr)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Lr(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e==\"object\"&&e)return new Lr(Number(\"lng\"in e?e.lng:e.lon),Number(e.lat));throw Error(\"`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]\")}},ip=2*Math.PI*rp;function np(t){return ip*Math.cos(t*Math.PI/180)}function ug(t){return(180+t)/360}function hg(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function cg(t,e){return t/np(e)}function pg(t){return t*360-180}function ds(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function fg(t,e){return t*np(ds(e))}function dg(t){return 1/Math.cos(t*Math.PI/180)}var uo=class ap{constructor(e,r,i=0){this.x=+e,this.y=+r,this.z=+i}static fromLngLat(e,r=0){let i=Yl.convert(e);return new ap(ug(i.lng),hg(i.lat),cg(r,i.lat))}toLngLat(){return new Yl(pg(this.x),ds(this.y))}toAltitude(){return fg(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/ip*dg(ds(this.y))}};function yg(t,e,r){let i=1/(1<<r.z);return new uo(t/nt*i+r.x*i,e/nt*i+r.y*i)}function mg(t,e,r){return yg(t,e,r).toLngLat()}function Xl(t,e,r){if(e<=0||!t||t.length===0)return t;let i=gg(e,r);return t.map(n=>xg(n,i))}function gg(t,e){let r=mg(nt/2,nt/2,e),i=uo.fromLngLat(r).meterInMercatorCoordinateUnits(),n=(1<<e.z)*nt;return t*i*n}function xg(t,e){if(!t||t.length<3)return t;let r=t[0].x===t[t.length-1].x&&t[0].y===t[t.length-1].y,i=r?t.length-1:t.length;if(i<3)return t;let n=[];for(let s=0;s<i;s++){let o=t[(s-1+i)%i],l=t[s],u=t[(s+1)%i];if(fs(o,l)||fs(l,u)){n.push(l.clone());continue}bg(n,o,l,u,e)}let a=vg(n);return a.length<3?t:(r&&a.push(a[0].clone()),a)}function vg(t){let e=[];for(let r of t){let i=r.round(),n=e[e.length-1];(n?.x!==i.x||n?.y!==i.y)&&e.push(i)}for(;e.length>1&&e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;)e.pop();return e}function bg(t,e,r,i,n){let a=e.sub(r),s=i.sub(r),o=a.mag(),l=s.mag();if(o<1e-6||l<1e-6){t.push(r.clone());return}a._div(o),s._div(l);let u=a.x*s.x+a.y*s.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){t.push(r.clone());return}let h=.2,c=Math.min(n,o*h,l*h),p=r.add(a.mult(c)),f=r.add(s.mult(c)),d=Math.sqrt((1+u)/2),y=r.add(a.add(s)._unit()._mult(c/d)),m=p.sub(y).angleWith(f.sub(y)),g=Math.max(2,Math.ceil(Math.abs(m)/(Math.PI/6)-1e-6));for(let x=0;x<=g;x++)t.push(p.rotateAround(x/g*m,y))}var ua=8192;function kr(t,e,r,i,n,a,s,o){t.emplaceBack(e,r,Math.floor(i*ua)*2+s,n*ua*2,a*ua*2,Math.round(o))}var Vn=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Fm,this.centroidVertexArray=new Em,this.indexArray=new yi,this.programConfigurations=new ze(t.layers,t.zoom),this.segments=new Pt,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.features=[],this.hasDependencies=on(\"fill-extrusion\",this.layers,e);let i=new H(this.zoom),n=this.layers[0],a=n.layout.get(\"fill-extrusion-rounded-corner-distance\"),s=n._featureFilter.needGeometry;for(let{feature:o,id:l,index:u,sourceLayerIndex:h}of t){let c=mr(o,s);if(!n._featureFilter.filter(i,c,r))continue;let p=s?c.geometry:Oe(o),f={id:l,sourceLayerIndex:h,index:u,geometry:a>0?Xl(p,a,r):p,properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(oo(\"fill-extrusion\",this.layers,f,{zoom:this.zoom},e)):this.addFeature(f,f.geometry,u,r,{},e.subdivisionGranularity),e.featureIndex.insert(o,f.geometry,u,h,this.index,!0)}}addFeatures(t,e,r){for(let i of this.features){let{geometry:n}=i;this.addFeature(i,n,i.index,e,r,t.subdivisionGranularity)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ag),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,ng.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,n,a){let s=this.layers[0],o=s.layout?s.layout.get(\"fill-extrusion-rounded-corner-distance\"):0,l=o>0?Xl(e,o,i):e;for(let u of Sn(l,500)){let h={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(h,i,t,u,a);let p=this.layoutVertexArray.length-c,f=Math.floor(h.x/h.sampleCount),d=Math.floor(h.y/h.sampleCount);for(let y=0;y<p;y++)this.centroidVertexArray.emplaceBack(f,d)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}processPolygon(t,e,r,i,n){if(i.length<1||jl(i[0]))return;for(let h of i)h.length!==0&&wg(t,h);let a={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},s=n.fill.getGranularityForZoomLevel(e.z),o=mi.types[r.type]===\"Polygon\";for(let h of i){if(h.length===0||jl(h))continue;let c=Ie(h,s,o);this._generateSideFaces(c,a)}if(!o)return;let l=Qc(i,e,s,!1),u=this.layoutVertexArray;tp((h,c)=>{kr(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let r=0;for(let i=1;i<t.length;i++){let n=t[i],a=t[i-1];if(fs(n,a))continue;e.segment.vertexLength+4>Pt.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=n.sub(a)._perp()._unit(),o=a.dist(n);r+o>32768&&(r=0),kr(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,r),kr(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,r),r+=o,kr(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,r),kr(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,r);let l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}};function wg(t,e){for(let r=0;r<e.length;r++){let i=e[r];(r!==e.length-1||e[0].x!==i.x||e[0].y!==i.y)&&(t.x+=i.x,t.y+=i.y,t.sampleCount++)}}D(\"FillExtrusionBucket\",Vn,{omit:[\"layers\",\"features\"]});var _g,Sg=()=>_g||=new kt({\"fill-extrusion-rounded-corner-distance\":new P(w[\"layout_fill-extrusion\"][\"fill-extrusion-rounded-corner-distance\"],\"fill-extrusion-rounded-corner-distance\")}),Ag,Tg=()=>Ag||=new kt({\"fill-extrusion-opacity\":new P(w[\"paint_fill-extrusion\"][\"fill-extrusion-opacity\"],\"fill-extrusion-opacity\"),\"fill-extrusion-color\":new R(w[\"paint_fill-extrusion\"][\"fill-extrusion-color\"],\"fill-extrusion-color\"),\"fill-extrusion-translate\":new P(w[\"paint_fill-extrusion\"][\"fill-extrusion-translate\"],\"fill-extrusion-translate\"),\"fill-extrusion-translate-anchor\":new P(w[\"paint_fill-extrusion\"][\"fill-extrusion-translate-anchor\"],\"fill-extrusion-translate-anchor\"),\"fill-extrusion-pattern\":new ei(w[\"paint_fill-extrusion\"][\"fill-extrusion-pattern\"],\"fill-extrusion-pattern\"),\"fill-extrusion-height\":new R(w[\"paint_fill-extrusion\"][\"fill-extrusion-height\"],\"fill-extrusion-height\"),\"fill-extrusion-base\":new R(w[\"paint_fill-extrusion\"][\"fill-extrusion-base\"],\"fill-extrusion-base\"),\"fill-extrusion-vertical-gradient\":new P(w[\"paint_fill-extrusion\"][\"fill-extrusion-vertical-gradient\"],\"fill-extrusion-vertical-gradient\")}),kg={get paint(){return Tg()},get layout(){return Sg()}};var Ig=class extends Gt{constructor(t,e){super(t,kg,e)}createBucket(t){return new Vn(t)}queryRadius(){return zn(this.paint.get(\"fill-extrusion-translate\"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,pixelPosMatrix:s}){let o=Bn(t,this.paint.get(\"fill-extrusion-translate\"),this.paint.get(\"fill-extrusion-translate-anchor\"),-n.bearingInRadians,a),l=this.paint.get(\"fill-extrusion-height\").evaluate(e,r),u=this.paint.get(\"fill-extrusion-base\").evaluate(e,r),h=Dg(o,s,0),c=Mg(i,u,l,s),p=c[0],f=c[1];return Eg(p,f,h)}};function Ir(t,e){return t.x*e.x+t.y*e.y}function Zl(t,e){if(t.length===1){let r=0,i=e[r++],n;for(;!n||i.equals(n);)if(n=e[r++],!n)return 1/0;for(;r<e.length;r++){let a=e[r],s=t[0],o=n.sub(i),l=a.sub(i),u=s.sub(i),h=Ir(o,o),c=Ir(o,l),p=Ir(l,l),f=Ir(u,o),d=Ir(u,l),y=h*p-c*c,m=(p*f-c*d)/y,g=(h*d-c*f)/y,x=1-m-g,b=i.z*x+n.z*m+a.z*g;if(isFinite(b))return b}return 1/0}{let r=1/0;for(let i of e)r=Math.min(r,i.z);return r}}function Eg(t,e,r){let i=1/0;qc(r,e)&&(i=Zl(r,e[0]));for(let n=0;n<e.length;n++){let a=e[n],s=t[n];for(let o=0;o<a.length-1;o++){let l=a[o],u=a[o+1],h=s[o],c=[l,u,s[o+1],h,l];Zm(r,c)&&(i=Math.min(i,Zl(r,c)))}}return i!==1/0&&i}function Mg(t,e,r,i){let n=[],a=[],s=i[8]*e,o=i[9]*e,l=i[10]*e,u=i[11]*e,h=i[8]*r,c=i[9]*r,p=i[10]*r,f=i[11]*r;for(let d of t){let y=[],m=[];for(let g of d){let x=g.x,b=g.y,v=i[0]*x+i[4]*b+i[12],_=i[1]*x+i[5]*b+i[13],A=i[2]*x+i[6]*b+i[14],S=i[3]*x+i[7]*b+i[15],k=v+s,T=_+o,L=A+l,V=S+u,z=v+h,C=_+c,E=A+p,O=S+f,$=new F(k/V,T/V);$.z=L/V,y.push($);let B=new F(z/O,C/O);B.z=E/O,m.push(B)}n.push(y),a.push(m)}return[n,a]}function Dg(t,e,r){let i=[];for(let n of t){let a=[n.x,n.y,r,1];Nf(a,a,e),i.push(new F(a[0]/a[3],a[1]/a[3]))}return i}function ys(t,e,r,i){let n=i,a=e+(r-e>>1),s=r-e,o,l=t[e],u=t[e+1],h=t[r],c=t[r+1];for(let p=e+3;p<r;p+=3){let f=Fg(t[p],t[p+1],l,u,h,c);if(f>n){o=p,n=f;continue}if(f===n){let d=Math.abs(p-a);d<s&&(o=p,s=d)}}n>i&&(o-e>3&&ys(t,e,o,i),t[o+2]=n,r-o>3&&ys(t,o,r,i))}function Fg(t,e,r,i,n,a){let s=n-r,o=a-i;if(s!==0||o!==0){let l=((t-r)*s+(e-i)*o)/(s*s+o*o);l>1?(r=n,i=a):l>0&&(r+=s*l,i+=o*l)}return s=t-r,o=e-i,s*s+o*o}function yt(t,e,r,i){let n={type:e,geom:r},a={id:t??null,type:n.type,geometry:n.geom,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(n.type){case\"Point\":case\"MultiPoint\":Er(a,n.geom);break;case\"LineString\":Er(a,n.geom.points);break;case\"Polygon\":Er(a,n.geom[0].points);break;case\"MultiLineString\":for(let s of n.geom)Er(a,s.points);break;case\"MultiPolygon\":for(let s of n.geom)Er(a,s[0].points)}return a}function ho(t){let e=t;t.points.length>64&&(e.points=new Float64Array(t.points))}function Er(t,e){for(let r=0;r<e.length;r+=3)t.minX=Math.min(t.minX,e[r]),t.minY=Math.min(t.minY,e[r+1]),t.maxX=Math.max(t.maxX,e[r]),t.maxY=Math.max(t.maxY,e[r+1])}function co(t,e){let r=[];switch(t.type){case\"FeatureCollection\":for(let i=0;i<t.features.length;i++)Hi(r,t.features[i],e,i);break;case\"Feature\":Hi(r,t,e);break;default:Hi(r,{type:\"Feature\",geometry:t,properties:void 0},e)}return r}function Hi(t,e,r,i,n=0){if(!e.geometry)return;if(n>1024)throw Error(\"GeometryCollection nesting exceeds supported depth: 1024\");if(e.geometry.type===\"GeometryCollection\"){Cg(t,e,e.geometry,r,i,n+1);return}if(!e.geometry.coordinates?.length)return;let a=Pg(e,r,i),s=(r.tolerance/((1<<r.maxZoom)*r.extent))**2;switch(e.geometry.type){case\"Point\":zg(t,a,e.geometry,e.properties);return;case\"MultiPoint\":Bg(t,a,e.geometry,e.properties);return;case\"LineString\":Lg(t,a,e.geometry,s,e.properties);return;case\"MultiLineString\":Vg(t,a,e.geometry,s,r,e.properties);return;case\"Polygon\":Og(t,a,e.geometry,s,e.properties);return;case\"MultiPolygon\":Rg(t,a,e.geometry,s,e.properties);return;default:throw Error(\"Input data is not a valid GeoJSON object.\")}}function Pg(t,e,r){return e.promoteId?t.properties?.[e.promoteId]:e.generateId?r||0:t.id}function Cg(t,e,r,i,n,a=0){for(let s of r.geometries)Hi(t,{id:e.id,type:\"Feature\",geometry:s,properties:e.properties},i,n,a)}function zg(t,e,r,i){let n=[];n.push(tr(r.coordinates[0]),er(r.coordinates[1]),0),t.push(yt(e,\"Point\",n,i))}function Bg(t,e,r,i){let n=[];for(let a of r.coordinates)n.push(tr(a[0]),er(a[1]),0);t.push(yt(e,\"MultiPoint\",n,i))}function Lg(t,e,r,i,n){let a={points:[]};po(r.coordinates,a,i,!1),t.push(yt(e,\"LineString\",a,n))}function Vg(t,e,r,i,n,a){if(n.lineMetrics)for(let s of r.coordinates){let o={points:[]};po(s,o,i,!1),t.push(yt(e,\"LineString\",o,a))}else{let s=[];fo(r.coordinates,s,i,!1),t.push(yt(e,\"MultiLineString\",s,a))}}function Og(t,e,r,i,n){let a=[];fo(r.coordinates,a,i,!0),t.push(yt(e,\"Polygon\",a,n))}function Rg(t,e,r,i,n){let a=[];for(let s of r.coordinates){let o=[];fo(s,o,i,!0),a.push(o)}t.push(yt(e,\"MultiPolygon\",a,n))}function po(t,e,r,i){let n,a,s=0;for(let l=0;l<t.length;l++){let u=tr(t[l][0]),h=er(t[l][1]);e.points.push(u,h,0),l>0&&(s+=i?(n*h-u*a)/2:Math.sqrt((u-n)**2+(h-a)**2)),n=u,a=h}let o=e.points.length-3;e.points[2]=1,r>0&&ys(e.points,0,o,r),e.points[o+2]=1,ho(e),e.size=Math.abs(s),e.start=0,e.end=e.size}function fo(t,e,r,i){for(let n=0;n<t.length;n++){let a={points:[]};po(t[n],a,r,i),e.push(a)}}function tr(t){return t/360+.5}function er(t){let e=Math.sin(t*Math.PI/180),r=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return r<0?0:r>1?1:r}function $g(t){return{type:\"FeatureCollection\",features:t.map(e=>cn(e))}}function cn(t){let e={type:\"Feature\",geometry:Ng(t),properties:t.tags};return t.id!=null&&(e.id=t.id),e}function Ng(t){let{type:e,geometry:r}=t;switch(e){case\"Point\":return{type:e,coordinates:sp(r[0],r[1])};case\"MultiPoint\":return{type:e,coordinates:Bi(r)};case\"LineString\":return{type:e,coordinates:Bi(r.points)};case\"MultiLineString\":case\"Polygon\":return{type:e,coordinates:r.map(i=>Bi(i.points))};case\"MultiPolygon\":return{type:e,coordinates:r.map(i=>i.map(n=>Bi(n.points)))}}}function Bi(t){let e=[];for(let r=0;r<t.length;r+=3)e.push(sp(t[r],t[r+1]));return e}function sp(t,e){return[op(t),lp(e)]}function op(t){return(t-.5)*360}function lp(t){let e=(180-t*360)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}function ee(t,e,r,i,n,a,s,o){if(r/=e,i/=e,a>=r&&s<i)return t;if(s<r||a>=i)return null;let l=[];for(let u of t){let h=n===0?u.minX:u.minY,c=n===0?u.maxX:u.maxY;if(h>=r&&c<i){l.push(u);continue}if(!(c<r||h>=i))switch(u.type){case\"Point\":case\"MultiPoint\":Ug(u,l,r,i,n);continue;case\"LineString\":qg(u,l,r,i,n,o);continue;case\"MultiLineString\":Gg(u,l,r,i,n);continue;case\"Polygon\":jg(u,l,r,i,n);continue;case\"MultiPolygon\":Yg(u,l,r,i,n);continue}}return l.length?l:null}function Ug(t,e,r,i,n){let a=[];if(Xg(t.geometry,a,r,i,n),!a.length)return;let s=a.length===3?\"Point\":\"MultiPoint\";e.push(yt(t.id,s,a,t.tags))}function qg(t,e,r,i,n,a){let s=[];if(up(t.geometry,s,r,i,n,!1,a.lineMetrics),s.length){if(a.lineMetrics){for(let o of s)e.push(yt(t.id,\"LineString\",o,t.tags));return}if(s.length>1){e.push(yt(t.id,\"MultiLineString\",s,t.tags));return}e.push(yt(t.id,\"LineString\",s[0],t.tags))}}function Gg(t,e,r,i,n){let a=[];if(yo(t.geometry,a,r,i,n,!1),a.length){if(a.length===1){e.push(yt(t.id,\"LineString\",a[0],t.tags));return}e.push(yt(t.id,\"MultiLineString\",a,t.tags))}}function jg(t,e,r,i,n){let a=[];yo(t.geometry,a,r,i,n,!0),a.length&&e.push(yt(t.id,\"Polygon\",a,t.tags))}function Yg(t,e,r,i,n){let a=[];for(let s of t.geometry){let o=[];yo(s,o,r,i,n,!0),o.length&&a.push(o)}a.length&&e.push(yt(t.id,\"MultiPolygon\",a,t.tags))}function Xg(t,e,r,i,n){for(let a=0;a<t.length;a+=3){let s=t[a+n];s>=r&&s<=i&&rr(e,t[a],t[a+1],t[a+2])}}function up(t,e,r,i,n,a,s){let o=Wl(t),l=n===0?Zg:Wg,u=t.start,h,c;for(let g=0;g<t.points.length-3;g+=3){let x=t.points[g],b=t.points[g+1],v=t.points[g+2],_=t.points[g+3],A=t.points[g+4],S=n===0?x:b,k=n===0?_:A,T=!1;s&&(h=Math.sqrt((x-_)**2+(b-A)**2)),S<r?k>r&&(c=l(o,x,b,_,A,r),s&&(o.start=u+h*c)):S>i?k<i&&(c=l(o,x,b,_,A,i),s&&(o.start=u+h*c)):rr(o.points,x,b,v),k<r&&S>=r&&(c=l(o,x,b,_,A,r),T=!0),k>i&&S<=i&&(c=l(o,x,b,_,A,i),T=!0),!a&&T&&(s&&(o.end=u+h*c),e.push(o),o=Wl(t)),s&&(u+=h)}let p=t.points.length-3,f=t.points[p],d=t.points[p+1],y=t.points[p+2],m=n===0?f:d;m>=r&&m<=i&&rr(o.points,f,d,y),p=o.points.length-3,a&&p>=3&&(o.points[p]!==o.points[0]||o.points[p+1]!==o.points[1])&&rr(o.points,o.points[0],o.points[1],o.points[2]),o.points.length&&(ho(o),e.push(o))}function Wl(t){return{points:[],size:t.size,start:t.start,end:t.end}}function yo(t,e,r,i,n,a){for(let s of t)up(s,e,r,i,n,a,!1)}function rr(t,e,r,i){t.push(e,r,i)}function Zg(t,e,r,i,n,a){let s=(a-e)/(i-e);return rr(t.points,a,r+(n-r)*s,1),s}function Wg(t,e,r,i,n,a){let s=(a-r)/(n-r);return rr(t.points,e+(i-e)*s,a,1),s}function mo(t,e){let r=e.buffer/e.extent,i=t,n=ee(t,1,-1-r,r,0,-1,2,e),a=ee(t,1,1-r,2+r,0,-1,2,e);return!n&&!a||(i=ee(t,1,-r,1+r,0,-1,2,e)||[],n&&(i=Hl(n,1).concat(i)),a&&(i=i.concat(Hl(a,-1)))),i}function Hl(t,e){let r=[];for(let i of t)switch(i.type){case\"Point\":case\"MultiPoint\":{let n=Hg(i.geometry,e);r.push(yt(i.id,i.type,n,i.tags));continue}case\"LineString\":{let n=ha(i.geometry,e);r.push(yt(i.id,i.type,n,i.tags));continue}case\"MultiLineString\":case\"Polygon\":{let n=[];for(let a of i.geometry)n.push(ha(a,e));r.push(yt(i.id,i.type,n,i.tags));continue}case\"MultiPolygon\":{let n=[];for(let a of i.geometry){let s=[];for(let o of a)s.push(ha(o,e));n.push(s)}r.push(yt(i.id,i.type,n,i.tags));continue}}return r}function Hg(t,e){let r=[];for(let i=0;i<t.length;i+=3)r.push(t[i]+e,t[i+1],t[i+2]);return r}function ha(t,e){let r={points:[],size:t.size};t.start!==void 0&&(r.start=t.start,r.end=t.end);for(let i=0;i<t.points.length;i+=3)r.points.push(t.points[i]+e,t.points[i+1],t.points[i+2]);return ho(r),r}function Kg(t,e,r){let i=Qg(e,r),n=[];if(i.removeAll&&(n=t,t=[]),i.remove.size||i.add.size){let a=[];for(let s of t)(i.remove.has(s.id)||i.add.has(s.id))&&a.push(s);if(a.length){n=n.concat(a);let s=new Set(a.map(o=>o.id));t=t.filter(o=>!s.has(o.id))}if(i.add.size){let s=co({type:\"FeatureCollection\",features:Array.from(i.add.values())},r);s=mo(s,r),n=n.concat(s),t=t.concat(s)}}if(i.update.size){let a=new Map,s=[];for(let o of t)i.update.has(o.id)?a.set(o.id,[...a.get(o.id)||[],o]):s.push(o);for(let[o,l]of i.update){let u=a.get(o);if(!u||u.length===0)continue;let h=Jg(u,l,r);n=n.concat(u,h),s=s.concat(h)}t=s}return{affected:n,source:t}}function Jg(t,e,r){let i=!!e.newGeometry,n=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(i){let a=t[0],s=co({type:\"FeatureCollection\",features:[{type:\"Feature\",id:a.id,geometry:e.newGeometry,properties:n?Kl(a.tags,e):a.tags}]},r);return s=mo(s,r),s}if(n){let a=[];for(let s of t){let o={...s};o.tags=Kl(o.tags,e),a.push(o)}return a}return t}function Kl(t,e){if(e.removeAllProperties)return{};let r={...t||{}};if(e.removeProperties)for(let i of e.removeProperties)delete r[i];if(e.addOrUpdateProperties)for(let{key:i,value:n}of e.addOrUpdateProperties)r[i]=n;return r}function Qg(t,e){return t?{removeAll:t.removeAll,remove:new Set(t.remove||[]),add:new Map(t.add?.map(r=>[e.promoteId?r.properties[e.promoteId]:r.id,r])),update:new Map(t.update?.map(r=>[r.id,r]))}:{remove:new Set,add:new Map,update:new Map}}var Jl=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],rt=new Uint32Array(96),t0=class hp{static from(e){if(!e||e.byteLength===void 0||e.buffer)throw Error(\"Data must be an instance of ArrayBuffer or SharedArrayBuffer.\");let[r,i]=new Uint8Array(e,0,2);if(r!==219)throw Error(\"Data does not appear to be in a KDBush format.\");let n=i>>4;if(n!==1)throw Error(`Got v${n} data when expected v1.`);let a=Jl[i&15];if(!a)throw Error(\"Unrecognized array type.\");let[s]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new hp(o,s,a,void 0,e)}constructor(e,r=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let s=Jl.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+l+u,e*2),this._pos=e*2,this._finished=!0;else{let h=this.data=new n(8+o+l+u);this.ids=new this.IndexArrayType(h,8,e),this.coords=new i(h,8+l+u,e*2),this._pos=0,this._finished=!1,new Uint8Array(h,0,2).set([219,16+s]),new Uint16Array(h,2,1)[0]=r,new Uint32Array(h,4,1)[0]=e}}add(e,r){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=r,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return ms(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,i,n){if(!this._finished)throw Error(\"Data not yet indexed - call index.finish().\");let{ids:a,coords:s,nodeSize:o}=this;rt[0]=0,rt[1]=a.length-1,rt[2]=0;let l=3,u=[];for(;l>0;){let h=rt[--l],c=rt[--l],p=rt[--l];if(c-p<=o){for(let m=p;m<=c;m++){let g=s[2*m],x=s[2*m+1];g>=e&&g<=i&&x>=r&&x<=n&&u.push(a[m])}continue}let f=p+c>>1,d=s[2*f],y=s[2*f+1];d>=e&&d<=i&&y>=r&&y<=n&&u.push(a[f]),(h===0?e<=d:r<=y)&&(rt[l++]=p,rt[l++]=f-1,rt[l++]=1-h),(h===0?i>=d:n>=y)&&(rt[l++]=f+1,rt[l++]=c,rt[l++]=1-h)}return u}within(e,r,i){let n=[];return this.withinInto(e,r,i,n),n}withinInto(e,r,i,n){if(!this._finished)throw Error(\"Data not yet indexed - call index.finish().\");let{ids:a,coords:s,nodeSize:o}=this;rt[0]=0,rt[1]=a.length-1,rt[2]=0;let l=3,u=0,h=i*i;for(;l>0;){let c=rt[--l],p=rt[--l],f=rt[--l];if(p-f<=o){for(let g=f;g<=p;g++)Ql(s[2*g],s[2*g+1],e,r)<=h&&(n[u++]=a[g]);continue}let d=f+p>>1,y=s[2*d],m=s[2*d+1];Ql(y,m,e,r)<=h&&(n[u++]=a[d]),(c===0?e-i<=y:r-i<=m)&&(rt[l++]=f,rt[l++]=d-1,rt[l++]=1-c),(c===0?e+i>=y:r+i>=m)&&(rt[l++]=d+1,rt[l++]=p,rt[l++]=1-c)}return u}};function ms(t,e,r,i,n,a){if(n-i<=r)return;let s=i+n>>1;cp(t,e,s,i,n,a),ms(t,e,r,i,s-1,1-a),ms(t,e,r,s+1,n,1-a)}function cp(t,e,r,i,n,a){for(;n>i;){if(n-i>600){let u=n-i+1,h=r-i+1,c=Math.log(u),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1);cp(t,e,r,Math.max(i,Math.floor(r-h*p/u+f)),Math.min(n,Math.floor(r+(u-h)*p/u+f)),a)}let s=e[2*r+a],o=i,l=n;for(Mr(t,e,i,r),e[2*n+a]>s&&Mr(t,e,i,n);o<l;){for(Mr(t,e,o,l),o++,l--;e[2*o+a]<s;)o++;for(;e[2*l+a]>s;)l--}e[2*i+a]===s?Mr(t,e,i,l):(l++,Mr(t,e,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function Mr(t,e,r,i){ca(t,r,i),ca(e,2*r,2*i),ca(e,2*r+1,2*i+1)}function ca(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function Ql(t,e,r,i){let n=t-r,a=e-i;return n*n+a*a}var gs={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},e0=class{constructor(t){this.options=Object.assign(Object.create(gs),t),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(t){let e=[];for(let r of t){if(!r.geometry)continue;let[i,n]=r.geometry.coordinates,[a,s]=[tr(i),er(n)],o={id:r.id,type:\"Point\",geometry:[a,s],tags:r.properties};e.push(o)}this.createIndex(e)}initialize(t){let e=[];for(let r of t)r.type===\"Point\"&&e.push(r);this.createIndex(e)}updateIndex(t,e,r){this.options=Object.assign(Object.create(gs),r.clusterOptions),this.initialize(t)}createIndex(t){let{log:e,minZoom:r,maxZoom:i}=this.options;e&&console.time(\"total time\");let n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;let a=[];for(let o=0;o<t.length;o++){let l=t[o];if(!l?.geometry)continue;let[u,h]=l.geometry;u=Math.fround(u),h=Math.fround(h),a.push(u,h,1/0,o,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this.createTree(a);e&&console.timeEnd(n);for(let o=i;o>=r;o--){let l=Date.now();s=this.trees[o]=this.createTree(this.cluster(s,o)),e&&console.log(\"z%d: %d clusters in %dms\",o,s.numItems,Date.now()-l)}e&&console.timeEnd(\"total time\")}getClusters(t,e){return this.getClustersInternal(t,e).map(r=>cn(r))}getClustersInternal(t,e){let r=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),n=t[2]===180?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){let h=this.getClustersInternal([r,i,180,a],e),c=this.getClustersInternal([-180,i,n,a],e);return h.concat(c)}let s=this.trees[this.limitZoom(e)],o=s.range(tr(r),er(a),tr(n),er(i)),l=s.flatData,u=[];for(let h of o){let c=this.stride*h;u.push(l[c+5]>1?r0(l,c,this.clusterProps):this.points[l[c+3]])}return u}getChildren(t){let e=this.getOriginId(t),r=this.getOriginZoom(t),i=Error(\"No cluster with the specified id: \"+t),n=this.trees[r];if(!n)throw i;let a=n.flatData;if(e*this.stride>=a.length)throw i;let s=this.options.radius/(this.options.extent*2**(r-1)),o=a[e*this.stride],l=a[e*this.stride+1],u=n.within(o,l,s),h=[];for(let c of u){let p=c*this.stride;a[p+4]===t&&h.push(a[p+5]>1?i0(a,p,this.clusterProps):cn(this.points[a[p+3]]))}if(h.length===0)throw i;return h}getLeaves(t,e,r){e||=10,r||=0;let i=[];return this.appendLeaves(i,t,e,r,0),i}getTile(t,e,r){let i=this.trees[this.limitZoom(t)];if(!i)return null;let n=2**t,{extent:a,radius:s}=this.options,o=s/a,l=(r-o)/n,u=(r+1+o)/n,h={transformed:!0,features:[],source:null,x:e,y:r,z:t};return this.addTileFeatures(i.range((e-o)/n,l,(e+1+o)/n,u),i.flatData,e,r,n,h),e===0&&this.addTileFeatures(i.range(1-o/n,l,1,u),i.flatData,n,r,n,h),e===n-1&&this.addTileFeatures(i.range(0,l,o/n,u),i.flatData,-1,r,n,h),h}getClusterExpansionZoom(t){return this.getOriginZoom(t)}appendLeaves(t,e,r,i,n){let a=this.getChildren(e);for(let s of a){let o=s.properties;if(o?.cluster?n+o.point_count<=i?n+=o.point_count:n=this.appendLeaves(t,o.cluster_id,r,i,n):n<i?n++:t.push(s),t.length===r)break}return n}createTree(t){let e=new t0(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<t.length;r+=this.stride)e.add(t[r],t[r+1]);return e.finish(),e.flatData=t,e.data=null,e}addTileFeatures(t,e,r,i,n,a){for(let s of t){let o=s*this.stride,l=e[o+5]>1,u,h,c;if(l)u=go(e,o,this.clusterProps),h=e[o],c=e[o+1];else{let d=this.points[e[o+3]];u=d.tags,[h,c]=d.geometry}let p={type:1,geometry:[[Math.round(this.options.extent*(h*n-r)),Math.round(this.options.extent*(c*n-i))]],tags:u},f;f=l||this.options.generateId?e[o+3]:this.points[e[o+3]].id,f!==void 0&&(p.id=f),a.features.push(p)}}limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}cluster(t,e){let{radius:r,extent:i,reduce:n,minPoints:a}=this.options,s=r/(i*2**e),o=t.flatData,l=[],u=this.stride;for(let h=0;h<o.length;h+=u){if(o[h+2]<=e)continue;o[h+2]=e;let c=o[h],p=o[h+1],f=t.within(o[h],o[h+1],s),d=o[h+5],y=d;for(let m of f){let g=m*u;o[g+2]>e&&(y+=o[g+5])}if(y>d&&y>=a){let m=c*d,g=p*d,x,b=-1,v=((h/u|0)<<5)+(e+1)+this.points.length;for(let _ of f){let A=_*u;if(o[A+2]<=e)continue;o[A+2]=e;let S=o[A+5];m+=o[A]*S,g+=o[A+1]*S,o[A+4]=v,n&&(x||(x=this.map(o,h,!0),b=this.clusterProps.length,this.clusterProps.push(x)),n(x,this.map(o,A)))}o[h+4]=v,l.push(m/y,g/y,1/0,v,-1,y),n&&l.push(b)}else{for(let m=0;m<u;m++)l.push(o[h+m]);if(y>1)for(let m of f){let g=m*u;if(!(o[g+2]<=e)){o[g+2]=e;for(let x=0;x<u;x++)l.push(o[g+x])}}}}return l}getOriginId(t){return t-this.points.length>>5}getOriginZoom(t){return(t-this.points.length)%32}map(t,e,r){if(t[e+5]>1){let a=this.clusterProps[t[e+6]];return r?Object.assign({},a):a}let i=this.points[t[e+3]].tags,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}};function r0(t,e,r){return{id:t[e+3],type:\"Point\",tags:go(t,e,r),geometry:[t[e],t[e+1]]}}function i0(t,e,r){return{type:\"Feature\",id:t[e+3],properties:go(t,e,r),geometry:{type:\"Point\",coordinates:[op(t[e]),lp(t[e+1])]}}}function go(t,e,r){let i=t[e+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${Math.round(i/100)/10}k`:i,a=t[e+6],s=a===-1?{}:Object.assign({},r[a]);return Object.assign(s,{cluster:!0,cluster_id:t[e+3],point_count:i,point_count_abbreviated:n})}var pp=\"geojsonvt_clip_start\",fp=\"geojsonvt_clip_end\";function tu(t,e,r,i,n){let a=e===n.maxZoom?0:n.tolerance/((1<<e)*n.extent),s={transformed:!1,features:[],source:null,x:r,y:i,z:e,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:t.length};for(let o of t)n0(s,o,a,n);return s}function n0(t,e,r,i){switch(t.minX=Math.min(t.minX,e.minX),t.minY=Math.min(t.minY,e.minY),t.maxX=Math.max(t.maxX,e.maxX),t.maxY=Math.max(t.maxY,e.maxY),e.type){case\"Point\":case\"MultiPoint\":a0(t,e);return;case\"LineString\":s0(t,e,r,i);return;case\"MultiLineString\":case\"Polygon\":o0(t,e,r);return;case\"MultiPolygon\":l0(t,e,r);return}}function a0(t,e){let r=[];for(let n=0;n<e.geometry.length;n+=3)r.push(e.geometry[n],e.geometry[n+1]),t.numPoints++,t.numSimplified++;if(!r.length)return;let i={type:1,tags:e.tags||null,geometry:r};e.id!==null&&(i.id=e.id),t.features.push(i)}function s0(t,e,r,i){let n=[];if(xo(n,e.geometry,t,r,!1,!1),!n.length)return;let a=e.tags||null;if(i.lineMetrics){a={};for(let o in e.tags)a[o]=e.tags[o];a[pp]=e.geometry.start/e.geometry.size,a[fp]=e.geometry.end/e.geometry.size}let s={type:2,tags:a,geometry:n};e.id!==null&&(s.id=e.id),t.features.push(s)}function o0(t,e,r){let i=[];for(let a=0;a<e.geometry.length;a++)xo(i,e.geometry[a],t,r,e.type===\"Polygon\",a===0);if(!i.length)return;let n={type:e.type===\"Polygon\"?3:2,tags:e.tags||null,geometry:i};e.id!==null&&(n.id=e.id),t.features.push(n)}function l0(t,e,r){let i=[];for(let a=0;a<e.geometry.length;a++){let s=e.geometry[a];for(let o=0;o<s.length;o++)xo(i,s[o],t,r,!0,o===0)}if(!i.length)return;let n={type:3,tags:e.tags||null,geometry:i};e.id!==null&&(n.id=e.id),t.features.push(n)}function xo(t,e,r,i,n,a){let s=i*i;if(i>0&&e.size<(n?s:i)){r.numPoints+=e.points.length/3;return}let o=[];for(let l=0;l<e.points.length;l+=3)(i===0||e.points[l+2]>s)&&(r.numSimplified++,o.push(e.points[l],e.points[l+1])),r.numPoints++;n&&u0(o,a),t.push(o)}function u0(t,e){let r=0;for(let i=0,n=t.length,a=n-2;i<n;a=i,i+=2)r+=(t[i]-t[a])*(t[i+1]+t[a+1]);if(r>0===e)for(let i=0,n=t.length;i<n/2;i+=2){let a=t[i],s=t[i+1];t[i]=t[n-2-i],t[i+1]=t[n-1-i],t[n-2-i]=a,t[n-1-i]=s}}function eu(t,e){if(t.transformed)return t;let r=1<<t.z,i=t.x,n=t.y;for(let a of t.features)a.type===1?h0(a,e,r,i,n):c0(a,e,r,i,n);return t.transformed=!0,t}function h0(t,e,r,i,n){let a=t,s=t.geometry,o=[];for(let l=0;l<s.length;l+=2)o.push(dp(s[l],s[l+1],e,r,i,n));return a.geometry=o,a}function c0(t,e,r,i,n){let a=t,s=t.geometry,o=[];for(let l of s){let u=[];for(let h=0;h<l.length;h+=2)u.push(dp(l[h],l[h+1],e,r,i,n));o.push(u)}return a.geometry=o,a}function dp(t,e,r,i,n,a){return[Math.round(r*(t*i-n)),Math.round(r*(e*i-a))]}var p0=class{constructor(t){this.options=t,this.total=0,this.stats={},this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(t){this.splitTile(t,0,0,0),this.options.debug&&(t.length&&console.log(\"features: %d, points: %d\",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd(\"generate tiles\"),console.log(\"tiles generated:\",this.total,JSON.stringify(this.stats)))}updateIndex(t,e,r){r.debug>1&&(console.log(\"invalidating tiles\"),console.time(\"invalidating\")),this.invalidateTiles(e),r.debug>1&&console.timeEnd(\"invalidating\");let[i,n,a]=[0,0,0],s=tu(t,i,n,a,r);s.source=t;let o=Li(i,n,a);if(this.tiles[o]=s,this.tileCoords.push({z:i,x:n,y:a,id:o}),r.debug){let l=`z${i}`;this.stats[l]=(this.stats[l]||0)+1,this.total++}}getClusterExpansionZoom(t){return null}getChildren(t){return null}getLeaves(t,e,r){return null}getTile(t,e,r){let{extent:i,debug:n}=this.options,a=1<<t;e=e+a&a-1;let s=Li(t,e,r);if(this.tiles[s])return eu(this.tiles[s],i);n>1&&console.log(\"drilling down to z%d-%d-%d\",t,e,r);let o=t,l=e,u=r,h;for(;!h&&o>0;)o--,l>>=1,u>>=1,h=this.tiles[Li(o,l,u)];return!h?.source||(n>1&&(console.log(\"found parent tile z%d-%d-%d\",o,l,u),console.time(\"drilling down\")),this.splitTile(h.source,o,l,u,t,e,r),n>1&&console.timeEnd(\"drilling down\"),!this.tiles[s])?null:eu(this.tiles[s],i)}splitTile(t,e,r,i,n,a,s){let o=[t,e,r,i],l=this.options,u=l.debug;for(;o.length;){i=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();let h=1<<e,c=Li(e,r,i),p=this.tiles[c];if(!p&&(u>1&&console.time(\"creation\"),p=this.tiles[c]=tu(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i,id:c}),u)){u>1&&(console.log(\"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\",e,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd(\"creation\"));let S=`z${e}`;this.stats[S]=(this.stats[S]||0)+1,this.total++}if(p.source=t,n==null){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(n!=null){let S=n-e;if(r!==a>>S||i!==s>>S)continue}}if(p.source=null,!t.length)continue;u>1&&console.time(\"clipping\");let f=.5*l.buffer/l.extent,d=.5-f,y=.5+f,m=1+f,g=null,x=null,b=null,v=null,_=ee(t,h,r-f,r+y,0,p.minX,p.maxX,l),A=ee(t,h,r+d,r+m,0,p.minX,p.maxX,l);_&&(g=ee(_,h,i-f,i+y,1,p.minY,p.maxY,l),x=ee(_,h,i+d,i+m,1,p.minY,p.maxY,l)),A&&(b=ee(A,h,i-f,i+y,1,p.minY,p.maxY,l),v=ee(A,h,i+d,i+m,1,p.minY,p.maxY,l)),u>1&&console.timeEnd(\"clipping\"),o.push(g||[],e+1,r*2,i*2),o.push(x||[],e+1,r*2,i*2+1),o.push(b||[],e+1,r*2+1,i*2),o.push(v||[],e+1,r*2+1,i*2+1)}}invalidateTiles(t){if(!t.length)return;let e=this.options,{debug:r}=e,i=1/0,n=-1/0,a=1/0,s=-1/0;for(let u of t)i=Math.min(i,u.minX),n=Math.max(n,u.maxX),a=Math.min(a,u.minY),s=Math.max(s,u.maxY);let o=e.buffer/e.extent,l=new Set;for(let u in this.tiles){let h=this.tiles[u],c=1<<h.z,p=(h.x-o)/c,f=(h.x+1+o)/c,d=(h.y-o)/c,y=(h.y+1+o)/c;if(n<p||i>=f||s<d||a>=y)continue;let m=!1;for(let g of t)if(g.maxX>=p&&g.minX<f&&g.maxY>=d&&g.minY<y){m=!0;break}if(m){if(r){r>1&&console.log(\"invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\",h.z,h.x,h.y,h.numFeatures,h.numPoints,h.numSimplified);let g=`z${h.z}`;this.stats[g]=(this.stats[g]||0)-1,this.total--}delete this.tiles[u],l.add(u)}}l.size&&(this.tileCoords=this.tileCoords.filter(u=>!l.has(u.id)))}};function Li(t,e,r){return((1<<t)*r+e)*32+t}var f0={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:gs,debug:0},yp=class{constructor(t,e){e=this.options=Object.assign({},f0,e);let r=e.debug;if(r&&console.time(\"preprocess data\"),e.maxZoom<0||e.maxZoom>24)throw Error(\"maxZoom should be in the 0-24 range\");if(e.promoteId&&e.generateId)throw Error(\"promoteId and generateId cannot be used together.\");let i=co(t,e);r&&(console.timeEnd(\"preprocess data\"),console.log(\"index: maxZoom: %d, maxPoints: %d\",e.indexMaxZoom,e.indexMaxPoints),console.time(\"generate tiles\")),i=mo(i,e),e.updateable&&(this.source=i),this.initializeIndex(i,e)}initializeIndex(t,e){this.tileIndex=e.cluster?new e0(e.clusterOptions):new p0(e),t.length&&this.tileIndex.initialize(t)}getTile(t,e,r){return t=+t,e=+e,r=+r,t<0||t>24?null:this.tileIndex.getTile(t,e,r)}updateData(t,e){let r=this.options;if(!r.updateable)throw Error(\"to update tile geojson `updateable` option must be set to true\");let{affected:i,source:n}=Kg(this.source,t,r);e&&({affected:i,source:n}=this.filterUpdate(n,i,e)),i.length&&(this.source=n,this.tileIndex.updateIndex(n,i,r))}filterUpdate(t,e,r){let i=new Set;for(let n of t)n.id!=null&&(r(cn(n))||(e.push(n),i.add(n.id)));return t=t.filter(n=>!i.has(n.id)),{affected:e,source:t}}getData(){if(!this.options.updateable)throw Error(\"to retrieve data the `updateable` option must be set to true\");return $g(this.source)}updateClusterOptions(t,e){let r=this.options.cluster;if(this.options.cluster=t,this.options.clusterOptions=e,r==t){this.tileIndex.updateIndex(this.source,[],this.options);return}this.initializeIndex(this.source,this.options)}getClusterExpansionZoom(t){return this.tileIndex.getClusterExpansionZoom(t)}getClusterChildren(t){return this.tileIndex.getChildren(t)}getClusterLeaves(t,e,r){return this.tileIndex.getLeaves(t,e,r)}},xs=ut([{name:\"a_pos_normal\",components:2,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint8\"}],4),d0=xs.members;xs.size,xs.alignment;var vs=ut([{name:\"a_uv_x\",components:1,type:\"Float32\"},{name:\"a_split_index\",components:1,type:\"Float32\"}]),y0=vs.members;vs.size,vs.alignment;var m0=Math.cos(75/2*(Math.PI/180)),mp=1/2,ru=2**14/mp,On=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new Pm,this.layoutVertexArray2=new Cm,this.indexArray=new yi,this.programConfigurations=new ze(t.layers,t.zoom),this.segments=new Pt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=on(\"line\",this.layers,e)||this.hasLineDasharray(this.layers);let i=this.layers[0].layout.get(\"line-sort-key\"),n=!i.isConstant(),a=[],s=new H(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=mr(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Oe(l),patterns:{},dashes:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;this.hasDependencies?(on(\"line\",this.layers,e)?oo(\"line\",this.layers,l,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,e),this.patternFeatures.push(l)):this.addFeature(l,u,h,r,{},{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures(t,e,r,i){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,i,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,y0)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,d0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,\"geojsonvt_clip_start\")&&Object.hasOwn(t.properties,\"geojsonvt_clip_end\"))return{start:+t.properties[pp],end:+t.properties[fp]}}addFeature(t,e,r,i,n,a,s){let o=this.layers[0].layout,l=o.get(\"line-join\").evaluate(t,{}),u=o.get(\"line-cap\").evaluate(t,{}),h=o.get(\"line-miter-limit\").evaluate(t,{}),c=o.get(\"line-round-limit\").evaluate(t,{});this.lineClips=this.lineFeatureClips(t);for(let p of e)this.addLine(p,t,l,u,h,c,i,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,dashPositions:a,canonical:i})}addLine(t,e,r,i,n,a,s,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=s?o.line.getGranularityForZoomLevel(s.z):1;if(t=Ie(t,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let b=0;b<t.length-1;b++)this.totalDistance+=t[b].dist(t[b+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let u=mi.types[e.type]===\"Polygon\",h=t.length;for(;h>=2&&t[h-1].equals(t[h-2]);)h--;let c=0;for(;c<h-1&&t[c].equals(t[c+1]);)c++;if(h-c<(u?3:2))return;r===\"bevel\"&&(n=1.05);let p=this.overscaling<=16?15*nt/(512*this.overscaling):0,f=this.segments.prepareSegment(h*10,this.layoutVertexArray,this.indexArray),d,y,m,g,x;this.e1=this.e2=-1,u&&(d=t[h-2],x=t[c].sub(d)._unit()._perp());for(let b=c;b<h;b++){if(m=b===h-1?u?t[c+1]:void 0:t[b+1],m&&t[b].equals(m))continue;x&&(g=x),d&&(y=d),d=t[b],x=m?m.sub(d)._unit()._perp():g,g||=x;let v=g.add(x);(v.x!==0||v.y!==0)&&v._unit();let _=g.x*x.x+g.y*x.y,A=v.x*x.x+v.y*x.y,S=A===0?1/0:1/A,k=2*Math.sqrt(2-2*A),T=A<m0&&y&&m,L=g.x*x.y-g.y*x.x>0;if(T&&b>c){let C=d.dist(y);if(C>2*p){let E=d.sub(d.sub(y)._mult(p/C)._round());this.updateDistance(y,E),this.addCurrentVertex(E,g,0,0,f),y=E}}let V=y&&m,z=V?r:u?\"butt\":i;if(V&&z===\"round\"&&(S<a?z=\"miter\":S<=2&&(z=\"fakeround\")),z===\"miter\"&&S>n&&(z=\"bevel\"),z===\"bevel\"&&(S>2&&(z=\"flipbevel\"),S<n&&(z=\"miter\")),y&&this.updateDistance(y,d),z===\"miter\")v._mult(S),this.addCurrentVertex(d,v,0,0,f);else if(z===\"flipbevel\"){if(S>100)v=x.mult(-1);else{let C=S*g.add(x).mag()/g.sub(x).mag();v._perp()._mult(C*(L?-1:1))}this.addCurrentVertex(d,v,0,0,f),this.addCurrentVertex(d,v.mult(-1),0,0,f)}else if(z===\"bevel\"||z===\"fakeround\"){let C=-Math.sqrt(S*S-1),E=L?C:0,O=L?0:C;if(y&&this.addCurrentVertex(d,g,E,O,f),z===\"fakeround\"){let $=Math.round(k*180/Math.PI/20);for(let B=1;B<$;B++){let N=B/$;if(N!==.5){let pt=N-.5,et=1.0904+_*(-3.2452+_*(3.55645-_*1.43519)),It=.848013+_*(-1.06021+_*.215638);N+=N*pt*(N-1)*(et*pt*pt+It)}let W=x.sub(g)._mult(N)._add(g)._unit()._mult(L?-1:1);this.addHalfVertex(d,W.x,W.y,!1,L,0,f)}}m&&this.addCurrentVertex(d,x,-E,-O,f)}else if(z===\"butt\")this.addCurrentVertex(d,v,0,0,f);else if(z===\"square\"){let C=y?1:-1;this.addCurrentVertex(d,v,C,C,f)}else z===\"round\"&&(y&&(this.addCurrentVertex(d,g,0,0,f),this.addCurrentVertex(d,g,1,1,f,!0)),m&&(this.addCurrentVertex(d,x,-1,-1,f,!0),this.addCurrentVertex(d,x,0,0,f)));if(T&&b<h-1){let C=d.dist(m);if(C>2*p){let E=d.add(m.sub(d)._mult(p/C)._round());this.updateDistance(d,E),this.addCurrentVertex(E,x,0,0,f),d=E}}}}addCurrentVertex(t,e,r,i,n,a=!1){let s=e.x+e.y*r,o=e.y-e.x*r,l=-e.x+e.y*i,u=-e.y-e.x*i;this.addHalfVertex(t,s,o,a,!1,r,n),this.addHalfVertex(t,l,u,a,!0,-i,n),this.distance>ru/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,n,a))}addHalfVertex({x:t,y:e},r,i,n,a,s,o){let l=(this.lineClips?this.scaledDistance*(ru-1):this.scaledDistance)*mp;if(this.layoutVertexArray.emplaceBack((t<<1)+ +!!n,(e<<1)+ +!!a,Math.round(63*r)+128,Math.round(63*i)+128,(s===0?0:s<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}hasLineDasharray(t){for(let e of t){let r=e.paint.get(\"line-dasharray\");if(r&&!r.isConstant())return!0}return!1}addLineDashDependencies(t,e,r,i){for(let n of t){let a=n.paint.get(\"line-dasharray\");if(!a||a.value.kind===\"constant\")continue;let s=n.layout.get(\"line-cap\").evaluate(e,{})===\"round\",o={dasharray:a.value.evaluate({zoom:r-1},e,{}),round:s},l={dasharray:a.value.evaluate({zoom:r},e,{}),round:s},u={dasharray:a.value.evaluate({zoom:r+1},e,{}),round:s},h=`${o.dasharray.join(\",\")},${o.round}`,c=`${l.dasharray.join(\",\")},${l.round}`,p=`${u.dasharray.join(\",\")},${u.round}`;i.dashDependencies[h]=o,i.dashDependencies[c]=l,i.dashDependencies[p]=u,e.dashes[n.id]={min:h,mid:c,max:p}}}};D(\"LineBucket\",On,{omit:[\"layers\",\"patternFeatures\"]});var g0,x0=()=>g0||=new kt({\"line-cap\":new R(w.layout_line[\"line-cap\"],\"line-cap\"),\"line-join\":new R(w.layout_line[\"line-join\"],\"line-join\"),\"line-miter-limit\":new R(w.layout_line[\"line-miter-limit\"],\"line-miter-limit\"),\"line-round-limit\":new R(w.layout_line[\"line-round-limit\"],\"line-round-limit\"),\"line-sort-key\":new R(w.layout_line[\"line-sort-key\"],\"line-sort-key\")}),v0,b0=()=>v0||=new kt({\"line-opacity\":new R(w.paint_line[\"line-opacity\"],\"line-opacity\"),\"line-layer-opacity\":new P(w.paint_line[\"line-layer-opacity\"],\"line-layer-opacity\"),\"line-color\":new R(w.paint_line[\"line-color\"],\"line-color\"),\"line-translate\":new P(w.paint_line[\"line-translate\"],\"line-translate\"),\"line-translate-anchor\":new P(w.paint_line[\"line-translate-anchor\"],\"line-translate-anchor\"),\"line-width\":new R(w.paint_line[\"line-width\"],\"line-width\"),\"line-gap-width\":new R(w.paint_line[\"line-gap-width\"],\"line-gap-width\"),\"line-offset\":new R(w.paint_line[\"line-offset\"],\"line-offset\"),\"line-blur\":new R(w.paint_line[\"line-blur\"],\"line-blur\"),\"line-dasharray\":new ei(w.paint_line[\"line-dasharray\"],\"line-dasharray\"),\"line-pattern\":new ei(w.paint_line[\"line-pattern\"],\"line-pattern\"),\"line-gradient\":new fi(w.paint_line[\"line-gradient\"],\"line-gradient\")}),iu={get paint(){return b0()},get layout(){return x0()}},w0=class extends R{possiblyEvaluate(t,e){return e=new H(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=Mt({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}},Vi;var _0=class extends Gt{constructor(t,e){super(t,iu,e),this.gradientVersion=0,Vi||(Vi=new w0(iu.paint.properties[\"line-width\"].specification,\"line-floorwidth\"),Vi.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t===\"line-gradient\"){let e=this.gradientExpression();this.stepInterpolant=My(e)?e._styleExpression.expression instanceof Bs:!1,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values[\"line-gradient\"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values[\"line-floorwidth\"]=Vi.possiblyEvaluate(this._transitioningPaint._values[\"line-width\"].value,t)}createBucket(t){return new On(t)}queryRadius(t){let e=t,r=nu(Qe(\"line-width\",this,e),Qe(\"line-gap-width\",this,e)),i=Qe(\"line-offset\",this,e);return r/2+Math.abs(i)+zn(this.paint.get(\"line-translate\"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a}){let s=Bn(t,this.paint.get(\"line-translate\"),this.paint.get(\"line-translate-anchor\"),-n.bearingInRadians,a),o=a/2*nu(this.paint.get(\"line-width\").evaluate(e,r),this.paint.get(\"line-gap-width\").evaluate(e,r)),l=this.paint.get(\"line-offset\").evaluate(e,r);return l&&(i=e1(i,l*a)),Wm(s,i,o)}isTileClipped(){return!0}};function nu(t,e){return e>0?e+2*t:t}var S0=ut([{name:\"a_pos_offset\",components:4,type:\"Int16\"},{name:\"a_data\",components:4,type:\"Uint16\"},{name:\"a_pixeloffset\",components:4,type:\"Int16\"},{name:\"a_height_offset\",components:1,type:\"Float32\"}],4),A0=ut([{name:\"a_projected_pos\",components:3,type:\"Float32\"}],4);ut([{name:\"a_fade_opacity\",components:1,type:\"Uint32\"}],4);var T0=ut([{name:\"a_placed\",components:2,type:\"Uint8\"},{name:\"a_shift\",components:2,type:\"Float32\"},{name:\"a_box_real\",components:2,type:\"Int16\"}]);ut([{type:\"Int16\",name:\"anchorPointX\"},{type:\"Int16\",name:\"anchorPointY\"},{type:\"Int16\",name:\"x1\"},{type:\"Int16\",name:\"y1\"},{type:\"Int16\",name:\"x2\"},{type:\"Int16\",name:\"y2\"},{type:\"Uint32\",name:\"featureIndex\"},{type:\"Uint16\",name:\"sourceLayerIndex\"},{type:\"Uint16\",name:\"bucketIndex\"}]);var au=ut([{name:\"a_pos\",components:2,type:\"Int16\"},{name:\"a_anchor_pos\",components:2,type:\"Int16\"},{name:\"a_extrude\",components:2,type:\"Int16\"}],4),tw=ut([{name:\"a_pos\",components:2,type:\"Float32\"},{name:\"a_radius\",components:1,type:\"Float32\"},{name:\"a_flags\",components:2,type:\"Int16\"}],4);ut([{name:\"triangle\",components:3,type:\"Uint16\"}]),ut([{type:\"Int16\",name:\"anchorX\"},{type:\"Int16\",name:\"anchorY\"},{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:\"Float32\",name:\"heightOffset\"}]),ut([{type:\"Int16\",name:\"anchorX\"},{type:\"Int16\",name:\"anchorY\"},{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\",name:\"textBoxScale\"},{type:\"Float32\",name:\"collisionCircleDiameter\"},{type:\"Uint16\",name:\"textAnchorOffsetStartIndex\"},{type:\"Uint16\",name:\"textAnchorOffsetEndIndex\"},{type:\"Float32\",name:\"heightOffset\"}]),ut([{type:\"Float32\",name:\"offsetX\"}]),ut([{type:\"Int16\",name:\"x\"},{type:\"Int16\",name:\"y\"},{type:\"Int16\",name:\"tileUnitDistanceFromAnchor\"}]),ut([{type:\"Uint16\",name:\"textAnchor\"},{type:\"Float32\",components:2,name:\"textOffset\"}]);function k0(t,e,r){let i=e.layout.get(\"text-transform\").evaluate(r,{});return i===\"uppercase\"?t=t.toLocaleUpperCase():i===\"lowercase\"&&(t=t.toLocaleLowerCase()),Kt.applyArabicShaping&&(t=Kt.applyArabicShaping(t)),t}function I0(t,e,r){for(let i of t.sections)i.text=k0(i.text,e,r);return t}function E0(t){let e={},r={},i=[],n=0;function a(u){i.push(t[u]),n++}function s(u,h,c){let p=r[u];return delete r[u],r[h]=p,i[p].geometry[0].pop(),i[p].geometry[0]=i[p].geometry[0].concat(c[0]),p}function o(u,h,c){let p=e[h];return delete e[h],e[u]=p,i[p].geometry[0].shift(),i[p].geometry[0]=c[0].concat(i[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return`${u}:${p.x}:${p.y}`}for(let u=0;u<t.length;u++){let h=t[u],c=h.geometry,p=h.text?h.text.toString():null;if(!p){a(u);continue}let f=l(p,c),d=l(p,c,!0);if(f in r&&d in e&&r[f]!==e[d]){let y=o(f,d,c),m=s(f,d,i[y].geometry);delete e[f],delete r[d],r[l(p,i[m].geometry,!0)]=m,i[y].geometry=null}else f in r?s(f,d,c):d in e?o(f,d,c):(a(u),e[f]=n-1,r[d]=n-1)}return i.filter(u=>u.geometry)}var Vr={\"!\":\"\\\\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\",\"\\\\u22EF\":\"\\\\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\"};function M0(t){let e=\"\",r={premature:!0,value:void 0},i=t[Symbol.iterator](),n=i.next(),a=t[Symbol.iterator]();a.next();let s=a.next();for(;!n.done;)(s.done||!Sl(s.value.codePointAt(0))||Vr[s.value])&&(r.premature||!Sl(r.value.codePointAt(0))||Vr[r.value])&&Vr[n.value]?e+=Vr[n.value]:e+=n.value,r={value:n.value,premature:!1},n=i.next(),s=a.next();return e}var D0={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},F0={40:!0};function su(t,e,r,i,n,a){if(\"fontStack\"in e){let s=r[e.fontStack]?.[t];return s?s.metrics.advance*e.scale+n:0}{let s=i[e.imageName];return s?s.displaySize[0]*e.scale*24/a+n:0}}function ou(t,e,r,i){let n=(t-e)**2;return i?t<e?n/2:n*2:n+Math.abs(r)*r}function P0(t,e,r){let i=0;return t===10&&(i-=1e4),r&&(i+=150),(t===40||t===65288)&&(i+=50),(e===41||e===65289)&&(i+=50),i}function lu(t,e,r,i,n,a){let s=null,o=ou(e,r,n,a);for(let l of i){let u=ou(e-l.x,r,n,a)+l.badness;u<=o&&(s=l,o=u)}return{index:t,x:e,priorBreak:s,badness:o}}function gp(t){return t?gp(t.priorBreak).concat(t.index):[]}var pa=class bs{constructor(e=\"\",r=[],i=[]){this.text=e,this.sections=r,this.sectionIndex=i,this.imageSectionID=null}static fromFeature(e,r){let i=new bs;for(let n of e.sections)n.image?i.addImageSection(n):i.addTextSection(n,r);return i}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=M0(this.text)}hasZeroWidthSpaces(){return this.text.includes(\"\\\\u200B\")}trim(){let e=this.text.match(/^\\\\s*/),r=e?e[0].length:0,i=this.text.match(/\\\\S\\\\s*$/),n=i?i[0].length-1:0;this.text=this.text.substring(r,this.text.length-n),this.sectionIndex=this.sectionIndex.slice(r,this.sectionIndex.length-n)}substring(e,r){let i=[...this.text].slice(e,r).join(\"\"),n=this.sectionIndex.slice(e,r);return new bs(i,this.sections,n)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join(\"\").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}getMaxImageSize(e){let r=0,i=0;for(let n=0;n<this.length();n++){let a=this.getSection(n);if(\"imageName\"in a){let s=e[a.imageName];if(!s)continue;let o=s.displaySize;r=Math.max(r,o[0]),i=Math.max(i,o[1])}}return{maxImageWidth:r,maxImageHeight:i}}addTextSection(e,r){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||\"bottom\",fontStack:e.fontStack||r});let i=this.sections.length-1;this.sectionIndex.push(...[...e.text].map(()=>i))}addImageSection(e){let r=e.image?e.image.name:\"\";if(r.length===0){mt(\"Can\\'t add FormattedSection with an empty image.\");return}let i=this.getNextImageSectionCharCode();if(!i){mt(\"Reached maximum number of images 6401\");return}this.text+=String.fromCharCode(i),this.sections.push({scale:1,verticalAlign:e.verticalAlign||\"bottom\",imageName:r}),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,r,i,n,a){let s=[],o=this.determineAverageLineWidth(e,r,i,n,a),l=this.hasZeroWidthSpaces(),u=0,h=0,c=this.text[Symbol.iterator](),p=c.next(),f=this.text[Symbol.iterator]();f.next();let d=f.next(),y=this.text[Symbol.iterator]();y.next(),y.next();let m=y.next();for(;!p.done;){let g=this.getSection(h),x=p.value.codePointAt(0);if(xc(x)||(u+=su(x,g,i,n,e,a)),!d.done){let b=om(x),v=d.value.codePointAt(0);(D0[x]||b||\"imageName\"in g||!m.done&&F0[v])&&s.push(lu(h+1,u,o,s,P0(x,v,b&&l),!1))}h++,p=c.next(),d=f.next(),m=y.next()}return gp(lu(this.length(),u,o,s,0,!0))}determineAverageLineWidth(e,r,i,n,a){let s=0,o=0;for(let u of this.text){let h=this.getSection(o);s+=su(u.codePointAt(0),h,i,n,e,a),o++}let l=Math.max(1,Math.ceil(s/r));return s/l}},ws=4294967296,uu=1/ws,hu=typeof TextDecoder>\"u\"?null:new TextDecoder(\"utf-8\"),vo=class{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,e,r=this.length){let i;for(;i=this.nextField(r);)t(i,e,this);return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*ws;return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*ws;return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let e=this.buf,r=e[this.pos++];if(r<128)return r;let i=r&127,n;return n=e[this.pos++],i|=(n&127)<<7,n<128||(n=e[this.pos++],i|=(n&127)<<14,n<128)||(n=e[this.pos++],i|=(n&127)<<21,n<128)?i:(n=e[this.pos],i|=(n&15)<<28,z0(i,t,this))}readSVarint(){let t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){let t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&hu?hu.decode(this.buf.subarray(e,t)):Z0(this.buf,e,t)}readBytes(){let t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){let r=this.readPackedEnd();for(;this.pos<r;)t.push(this.readVarint(e));return t}readPackedSVarint(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSVarint());return t}readPackedBoolean(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readBoolean());return t}readPackedFloat(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFloat());return t}readPackedDouble(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readDouble());return t}readPackedFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed32());return t}readPackedSFixed32(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed32());return t}readPackedFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readFixed64());return t}readPackedSFixed64(t=[]){let e=this.readPackedEnd();for(;this.pos<e;)t.push(this.readSFixed64());return t}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(t=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=t)return 0;let e=this.readVarint();return this.type=e&7,this._valueStart=this.pos,e>>>3}skip(t){let e=t&7;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else if(e===1)this.pos+=8;else throw Error(`Unimplemented type: ${e}`)}},C0=class{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e<this.pos+t;)e*=2;if(e!==this.length){let r=new Uint8Array(e);r.set(this.buf),this.buf=r,this.dataView=new DataView(r.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeSFixed32(t){this.realloc(4),this.dataView.setInt32(this.pos,t,!0),this.pos+=4}writeFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*uu),!0),this.pos+=8}writeSFixed64(t){this.realloc(8),this.dataView.setInt32(this.pos,t&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(t*uu),!0),this.pos+=8}writeVarint(t){if(t=+t||0,t>=0&&t<128){this.pos>=this.length&&this.realloc(1),this.buf[this.pos++]=t;return}if(t>268435455||t<0){L0(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))}writeSVarint(t){this.writeVarint(t<0?-t*2-1:t*2)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(t.length*4),this.pos++;let e=this.pos;this.pos=W0(this.buf,t,this.pos);let r=this.pos-e;r>=128&&cu(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){let e=t.length;this.writeVarint(e),this.realloc(e),this.buf.set(t,this.pos),this.pos+=e}writeRawMessage(t,e){this.pos++;let r=this.pos;t(e,this);let i=this.pos-r;i>=128&&cu(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,R0,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,$0,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,q0,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,N0,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,U0,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,G0,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,j0,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,Y0,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,X0,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}};function z0(t,e,r){let i=r.buf,n,a;if(a=i[r.pos++],n=(a&112)>>4,a<128||(a=i[r.pos++],n|=(a&127)<<3,a<128)||(a=i[r.pos++],n|=(a&127)<<10,a<128)||(a=i[r.pos++],n|=(a&127)<<17,a<128)||(a=i[r.pos++],n|=(a&127)<<24,a<128)||(a=i[r.pos++],n|=(a&1)<<31,a<128))return B0(t,n,e);throw Error(\"Expected varint not more than 10 bytes\")}function B0(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function L0(t,e){let r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,i=i+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw Error(\"Given varint doesn\\'t fit into 10 bytes\");e.realloc(10),V0(r,i,e),O0(i,e)}function V0(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function O0(t,e){let r=(t&7)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function cu(t,e,r){let i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(i),r.buf.copyWithin(t+i,t,r.pos)}function R0(t,e){let r=t.length,i=e.buf,n=e.pos,a=e.length;for(let s=0;s<r;s++){let o=t[s];if(o<0||n+10>a){e.pos=n,e.writeVarint(o),i=e.buf,n=e.pos,a=e.length;continue}for(;o>127;)i[n++]=o%128|128,o=Math.floor(o/128);i[n++]=o}e.pos=n}function $0(t,e){for(let r=0;r<t.length;r++)e.writeSVarint(t[r])}function N0(t,e){for(let r=0;r<t.length;r++)e.writeFloat(t[r])}function U0(t,e){for(let r=0;r<t.length;r++)e.writeDouble(t[r])}function q0(t,e){for(let r=0;r<t.length;r++)e.writeBoolean(t[r])}function G0(t,e){for(let r=0;r<t.length;r++)e.writeFixed32(t[r])}function j0(t,e){for(let r=0;r<t.length;r++)e.writeSFixed32(t[r])}function Y0(t,e){for(let r=0;r<t.length;r++)e.writeFixed64(t[r])}function X0(t,e){for(let r=0;r<t.length;r++)e.writeSFixed64(t[r])}function Z0(t,e,r){let i=\"\",n=e;for(;n<r;){let a=t[n],s=null,o=a>239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function W0(t,e,r){for(let i=0,n,a;i<e.length;i++){if(n=e.charCodeAt(i),n>55295&&n<57344)if(a){if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else{n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}else a&&=(t[r++]=239,t[r++]=191,t[r++]=189,null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=n&63|128)}return r}function H0(t){return typeof t?.renderWithWebGL==\"function\"}function bo(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,o)=>o.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],n=0,a=0;for(let s of t)for(let o=i.length-1;o>=0;o--){let l=i[o];if(!(s.w>l.w||s.h>l.h)){if(s.x=l.x,s.y=l.y,a=Math.max(a,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===l.w&&s.h===l.h){let u=i.pop();u&&o<i.length&&(i[o]=u)}else s.h===l.h?(l.x+=s.w,l.w-=s.w):s.w===l.w?(l.y+=s.h,l.h-=s.h):(i.push({x:l.x+s.w,y:l.y,w:l.w-s.w,h:s.h}),l.y+=s.h,l.h-=s.h);break}}return{w:n,h:a,fill:e/(n*a)||0}}var xp=class{constructor(t,{pixelRatio:e,version:r,isWebGLImage:i=!1,stretchX:n,stretchY:a,content:s,textFitWidth:o,textFitHeight:l}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=n,this.stretchY=a,this.content=s,this.version=r,this.needsFirstWebGLRender=i,this.textFitWidth=o,this.textFitHeight=l}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}},wo=class{constructor(t,e){let r={},i={};this.haveRenderCallbacks=[],this.patchedUpdateVersion=-1;let n=[];this.addImages(t,r,n),this.addImages(e,i,n);let{w:a,h:s}=bo(n),o=new Et({width:a||1,height:s||1});for(let l in t){let u=t[l];if(u.isWebGLImage)continue;let h=r[l].paddedRect;Et.copy(u.data,o,{x:0,y:0},{x:h.x+1,y:h.y+1},u.data)}for(let l in e){let u=e[l],h=i[l].paddedRect,c=h.x+1,p=h.y+1,f=u.data.width,d=u.data.height;Et.copy(u.data,o,{x:0,y:0},{x:c,y:p},u.data),Et.copy(u.data,o,{x:0,y:d-1},{x:c,y:p-1},{width:f,height:1}),Et.copy(u.data,o,{x:0,y:0},{x:c,y:p+d},{width:f,height:1}),Et.copy(u.data,o,{x:f-1,y:0},{x:c-1,y:p},{width:1,height:d}),Et.copy(u.data,o,{x:0,y:0},{x:c+f,y:p},{width:1,height:d})}this.image=o,this.iconPositions=r,this.patternPositions=i}addImages(t,e,r){for(let i in t){let n=t[i],a={x:0,y:0,w:n.data.width+2,h:n.data.height+2};r.push(a),e[i]=new xp(a,n),n.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,e){if(t.dispatchRenderCallbacks(this.haveRenderCallbacks),this.patchedUpdateVersion!==t.updateVersion){this.patchedUpdateVersion=t.updateVersion;for(let r in this.iconPositions)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e);for(let r in this.patternPositions)this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}}patchUpdatedImage(t,e,r){if(!t||!e||!t.needsFirstWebGLRender&&t.version===e.version)return;t.needsFirstWebGLRender=!1,t.version=e.version;let[i,n]=t.tl,a=e.userImage?.data;if(!H0(a)){r.update(e.data,void 0,{x:i,y:n});return}let{width:s,height:o}=e.data;r.context.setCustomLayerDefaults(),a.renderWithWebGL({gl:r.context.gl,texture:r.texture,x:i,y:n,width:s,height:o}),r.context.setDirty()}};D(\"ImagePosition\",xp),D(\"ImageAtlas\",wo);var vp=(function(t){return t[t.none=0]=\"none\",t[t.horizontal=1]=\"horizontal\",t[t.vertical=2]=\"vertical\",t[t.horizontalOnly=3]=\"horizontalOnly\",t})(vp||{});function K0(t){for(let e of t)if(e.positionedGlyphs.length!==0)return!1;return!0}function J0(t,e){let r=[],i=0;for(let n of e)r.push(t.substring(i,n)),i=n;return i<t.length()&&r.push(t.substring(i,t.length())),r}function Oi(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d){let y=pa.fromFeature(t,n);c===2&&y.verticalizePunctuation();let m,g=y.determineLineBreaks(u,a,e,i,f),{processBidirectionalText:x,processStyledBidirectionalText:b}=Kt;if(x&&y.sections.length===1){m=[],g=g.map(S=>y.toCodeUnitIndex(S));let A=x(y.toString(),g);for(let S of A){let k=[...S].map(()=>0);m.push(new pa(S,y.sections,k))}}else if(b){m=[],g=g.map(T=>y.toCodeUnitIndex(T));let A=0,S=[];for(let T of y.text)S.push(...Array(T.length).fill(y.sectionIndex[A])),A++;let k=b(y.text,S,g);for(let T of k){let L=[],V=\"\";for(let z of T[0])L.push(T[1][V.length]),V+=z;m.push(new pa(T[0],y.sections,L))}}else m=J0(y,g);let v=[],_={positionedLines:v,text:y.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,iconsInText:!1,verticalizable:!1};return rx(_,e,r,i,m,s,o,l,c,u,p,d),!K0(v)&&_}function bp(t){let e=.5,r=.5;switch(t){case\"right\":case\"top-right\":case\"bottom-right\":e=1;break;case\"left\":case\"top-left\":case\"bottom-left\":e=0}switch(t){case\"bottom\":case\"bottom-right\":case\"bottom-left\":r=1;break;case\"top\":case\"top-right\":case\"top-left\":r=0}return{horizontalAlign:e,verticalAlign:r}}function Q0(t,e,r){let i=e.getMaxScale()*24,{maxImageWidth:n,maxImageHeight:a}=e.getMaxImageSize(t),s=Math.max(i,a*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:s}}function wp(t){switch(t){case\"top\":return 0;case\"center\":return .5;default:return 1}}function tx(t,e,r,i){if(t?.rect)return t;let n=e[r.fontStack]?.[i];return n?{rect:null,metrics:n.metrics}:null}function ex(t,e,r){return!(t===1||!e&&!Ks(r)||e&&(xc(r)||fm(r)))}function rx(t,e,r,i,n,a,s,o,l,u,h,c){let p=0,f=0,d=0,y=0,m=o===\"right\"?1:o===\"left\"?0:.5,g=24/c,x=0;for(let _ of n){_.trim();let A=_.getMaxScale(),S={positionedGlyphs:[],lineOffset:0};t.positionedLines[x]=S;let k=S.positionedGlyphs,T=0;if(!_.length()){f+=a,++x;continue}let L=Q0(i,_,g),V=0;for(let E of _.text){let O=_.getSection(V),$=E.codePointAt(0),B=ex(l,h,$),N={glyph:$,imageName:null,x:p,y:f+-17,vertical:B,scale:1,fontStack:\"\",sectionIndex:_.getSectionIndex(V),metrics:null,rect:null},W;if(\"fontStack\"in O){if(W=ix(O,$,B,L,e,r),!W)continue;N.fontStack=O.fontStack}else{if(t.iconsInText=!0,O.scale*=g,W=nx(O,B,A,L,i),!W)continue;T=Math.max(T,W.imageOffset),N.imageName=O.imageName}let{rect:pt,metrics:et,baselineOffset:It}=W;if(N.y+=It,N.scale=O.scale,N.metrics=et,N.rect=pt,k.push(N),!B)p+=et.advance*O.scale+u;else{t.verticalizable=!0;let Ue=\"imageName\"in O?et.advance:24;p+=Ue*O.scale+u}V++}if(k.length!==0){let E=p-u;d=Math.max(E,d),ax(k,0,k.length-1,m)}p=0;let z=(A-1)*24;S.lineOffset=Math.max(T,z);let C=a*A+T;f+=C,y=Math.max(C,y),++x}let{horizontalAlign:b,verticalAlign:v}=bp(s);sx(t.positionedLines,m,b,v,d,y,a,f,n.length),t.top+=-v*f,t.bottom=t.top+f,t.left+=-b*d,t.right=t.left+d}function ix(t,e,r,i,n,a){let s=a[t.fontStack]?.[e],o=tx(s,n,t,e);if(o===null)return null;let l;if(r)l=i.verticalLineContentWidth-t.scale*24;else{let u=wp(t.verticalAlign);l=(i.horizontalLineContentHeight-t.scale*24)*u}return{rect:o.rect,metrics:o.metrics,baselineOffset:l}}function nx(t,e,r,i,n){let a=n[t.imageName];if(!a)return null;let s=a.paddedRect,o=a.displaySize,l={width:o[0],height:o[1],left:1,top:-3,advance:e?o[1]:o[0]},u;if(e)u=i.verticalLineContentWidth-o[1]*t.scale;else{let c=wp(t.verticalAlign);u=(i.horizontalLineContentHeight-o[1]*t.scale)*c}let h=(e?o[0]:o[1])*t.scale-24*r;return{rect:s,metrics:l,baselineOffset:u,imageOffset:h}}function ax(t,e,r,i){if(i===0)return;let n=t[r],a=n.metrics.advance*n.scale,s=(t[r].x+a)*i;for(let o=e;o<=r;o++)t[o].x-=s}function sx(t,e,r,i,n,a,s,o,l){let u=(e-r)*n,h=0;h=a===s?-i*l*s+.5*s:-o*i- -17;for(let c of t)for(let p of c.positionedGlyphs)p.x+=u,p.y+=h}function ox(t,e,r){let{horizontalAlign:i,verticalAlign:n}=bp(r),a=e[0],s=e[1],o=a-t.displaySize[0]*i,l=o+t.displaySize[0],u=s-t.displaySize[1]*n;return{image:t,top:u,bottom:u+t.displaySize[1],left:o,right:l}}function _p(t){let e=t.left,r=t.top,i=t.right-e,n=t.bottom-r,a=t.image.content[2]-t.image.content[0],s=t.image.content[3]-t.image.content[1],o=t.image.textFitWidth??\"stretchOrShrink\",l=t.image.textFitHeight??\"stretchOrShrink\",u=a/s;if(l===\"proportional\"){if(o===\"stretchOnly\"&&i/n<u||o===\"proportional\"){let h=Math.ceil(n*u);e*=h/i,i=h}}else if(o===\"proportional\"&&l===\"stretchOnly\"&&u!==0&&i/n>u){let h=Math.ceil(i/u);r*=h/n,n=h}return{x1:e,y1:r,x2:e+i,y2:r+n}}function pu(t,e,r,i,n,a){let s=t.image,o;if(s.content){let m=s.content,g=s.pixelRatio||1;o=[m[0]/g,m[1]/g,s.displaySize[0]-m[2]/g,s.displaySize[1]-m[3]/g]}let l=e.left*a,u=e.right*a,h,c,p,f;r===\"width\"||r===\"both\"?(f=n[0]+l-i[3],c=n[0]+u+i[1]):(f=n[0]+(l+u-s.displaySize[0])/2,c=f+s.displaySize[0]);let d=e.top*a,y=e.bottom*a;return r===\"height\"||r===\"both\"?(h=n[1]+d-i[0],p=n[1]+y+i[2]):(h=n[1]+(d+y-s.displaySize[1])/2,p=h+s.displaySize[1]),{image:s,top:h,right:c,bottom:p,left:f,collisionPadding:o}}var fu=32640;function du(t,e){let{expression:r}=e;if(r.kind===\"constant\")return{kind:\"constant\",layoutSize:r.evaluate(new H(t+1))};if(r.kind===\"source\")return{kind:\"source\"};if(r.kind===\"composite\"){let{minZoom:i,maxZoom:n}=lx(r.zoomStops,t);return{kind:\"composite\",minZoom:i,maxZoom:n,interpolationType:r.interpolationType}}{let i=ux(r),n=r.evaluate(new H(t+1));return{kind:\"camera\",zoomStops:r.zoomStops,sizes:i,layoutSize:n,interpolationType:r.interpolationType}}}function lx(t,e){let r=0;for(;r<t.length&&t[r]<=e;)r++;r=Math.max(0,r-1);let i=r;for(;i<t.length&&t[i]<e+1;)i++;return i=Math.min(t.length-1,i),{minZoom:t[r],maxZoom:t[i]}}function ux(t){return t.zoomStops.map(e=>t.evaluate(new H(e===-1/0?t.zoomStops[1]-1:e)))}function yu(t,e,r){let i=\"never\",n=t.get(e);return n?i=n:t.get(r)&&(i=\"always\"),i}var hx=[{name:\"a_fade_opacity\",components:1,type:\"Uint8\",offset:0}];function Ri(t,e,r,i,n,a,s,o,l,u,h,c,p,f){let d=o?Math.min(fu,Math.round(o[0])):0,y=o?Math.min(fu,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(i*32),Math.round(n*32),a,s,(d<<1)+ +!!l,y,u*16,h*16,c*256,p*256,f)}function Sp(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}function cx(t){for(let e of t.sections)if(mm(e.text))return!0;return!1}var _s=class{constructor(t){this.layoutVertexArray=new zm,this.indexArray=new yi,this.programConfigurations=t,this.segments=new Pt,this.dynamicLayoutVertexArray=new Bm,this.opacityVertexArray=new Lm,this.hasVisibleVertices=!1,this.placedSymbolArray=new Mc}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,e,r,i){if(!this.isEmpty()){if(r){if(this.opacityVertexArray.length===0){let n=this.layoutVertexArray.length/4;for(let a=0;a<n;a++)this.opacityVertexArray.emplaceBack(0)}this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,S0.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,A0.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,hx,!0),this.opacityVertexBuffer.itemSize=1}(r||i)&&this.programConfigurations.upload(t)}}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};D(\"SymbolBuffers\",_s);var Ss=class{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new Pt,this.collisionVertexArray=new Vm}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,T0.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};D(\"CollisionBuffers\",Ss);var De=class{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(s=>s.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];let e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=du(this.zoom,e[\"text-size\"]),this.iconSizeData=du(this.zoom,e[\"icon-size\"]);let r=this.layers[0].layout,i=r.get(\"symbol-sort-key\"),n=r.get(\"symbol-z-order\");this.canOverlap=yu(r,\"text-overlap\",\"text-allow-overlap\")!==\"never\"||yu(r,\"icon-overlap\",\"icon-allow-overlap\")!==\"never\"||r.get(\"text-ignore-placement\")||r.get(\"icon-ignore-placement\"),this.sortFeaturesByKey=n!==\"viewport-y\"&&!i.isConstant();let a=n===\"viewport-y\"||n===\"auto\"&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,r.get(\"symbol-placement\")===\"point\"&&(this.writingModes=r.get(\"text-writing-mode\").map(s=>vp[s])),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id),this.sourceID=t.sourceID}createArrays(){this.text=new _s(new ze(this.layers,this.zoom,t=>t.startsWith(\"text\"))),this.icon=new _s(new ze(this.layers,this.zoom,t=>t.startsWith(\"icon\"))),this.glyphOffsetArray=new Pc,this.lineVertexArray=new Cc,this.symbolInstances=new Fc,this.textAnchorOffsets=new Bc}calculateGlyphDependencies(t,e,r,i,n){for(let a of t)if(e[a.codePointAt(0)]=!0,(r||i)&&n){let s=Vr[a];s&&(e[s.codePointAt(0)]=!0)}}populate(t,e,r){let i=this.layers[0],n=i.layout,a=n.get(\"text-font\"),s=n.get(\"text-field\"),o=n.get(\"icon-image\"),l=(s.value.kind!==\"constant\"||s.value.value instanceof se&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!==\"constant\"||a.value.value.length>0),u=o.value.kind!==\"constant\"||!!o.value.value||Object.keys(o.parameters).length>0,h=n.get(\"symbol-sort-key\");if(this.features=[],!l&&!u)return;let c=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new H(this.zoom);for(let{feature:y,id:m,index:g,sourceLayerIndex:x}of t){let b=i._featureFilter.needGeometry,v=mr(y,b);if(!i._featureFilter.filter(d,v,r))continue;b||(v.geometry=Oe(y));let _;if(l){let T=i.getValueAndResolveTokens(\"text-field\",v,r,f),L=se.factory(T);this.hasRTLText||=cx(L),(!this.hasRTLText||Kt.getRTLTextPluginStatus()===\"unavailable\"||this.hasRTLText&&Kt.isParsed())&&(_=I0(L,i,v))}let A;if(u){let T=i.getValueAndResolveTokens(\"icon-image\",v,r,f);A=T instanceof Ht?T:Ht.fromString(T)}if(!_&&!A)continue;let S=this.sortFeaturesByKey?h.evaluate(v,{},r):void 0,k={id:m,text:_,icon:A,index:g,sourceLayerIndex:x,geometry:v.geometry,properties:y.properties,type:mi.types[y.type],sortKey:S};if(this.features.push(k),A&&(c[A.name]=!0),_){let T=a.evaluate(v,{},r).join(\",\"),L=n.get(\"text-rotation-alignment\")!==\"viewport\"&&n.get(\"symbol-placement\")!==\"point\";this.allowVerticalPlacement=this.writingModes?.includes(2);for(let V of _.sections)if(V.image)c[V.image.name]=!0;else{let z=Da(_.toString()),C=V.fontStack||T;p[C]||={},this.calculateGlyphDependencies(V.text,p[C],L,this.allowVerticalPlacement,z)}}}n.get(\"symbol-placement\")===\"line\"&&(this.features=E0(this.features)),this.sortFeaturesByKey&&this.features.sort((y,m)=>y.sortKey-m.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let r=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]),a={};for(let s=t.segment+1;s<e.length;s++)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s<e.length-1&&(i+=e[s+1].dist(e[s]));for(let s=t.segment||0;s>=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(let s=0;s<e.length;s++){let o=a[s];this.lineVertexArray.emplaceBack(o.x,o.y,o.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,i,n,a,s,o,l,u,h,c,p){let f=t.indexArray,d=t.layoutVertexArray,y=t.segments.prepareSegment(4*e.length,d,f,this.canOverlap?a.sortKey:void 0),m=this.glyphOffsetArray.length,g=y.vertexLength,x=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let v=0;v<e.length;v++){let{tl:_,tr:A,bl:S,br:k,tex:T,pixelOffsetTL:L,pixelOffsetBR:V,minFontScaleX:z,minFontScaleY:C,glyphOffset:E,isSDF:O,sectionIndex:$}=e[v],B=y.vertexLength,N=E[1];Ri(d,o.x,o.y,_.x,N+_.y,T.x,T.y,r,O,L.x,L.y,z,C,p),Ri(d,o.x,o.y,A.x,N+A.y,T.x+T.w,T.y,r,O,V.x,L.y,z,C,p),Ri(d,o.x,o.y,S.x,N+S.y,T.x,T.y+T.h,r,O,L.x,V.y,z,C,p),Ri(d,o.x,o.y,k.x,N+k.y,T.x+T.w,T.y+T.h,r,O,V.x,V.y,z,C,p),Sp(t.dynamicLayoutVertexArray,o,x),f.emplaceBack(B,B+2,B+1),f.emplaceBack(B+1,B+2,B+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(E[0]),(v===e.length-1||$!==e[v+1].sectionIndex)&&t.programConfigurations.populatePaintArrays(d.length,a,a.index,{imagePositions:{},canonical:c,formattedSection:b?.[$]})}t.placedSymbolArray.emplaceBack(o.x,o.y,m,this.glyphOffsetArray.length-m,g,l,u,o.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,h,p)}_addCollisionDebugVertex(t,e,r,i,n,a){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,i,n,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(t,e,r,i,n,a,s){let o=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),l=o.vertexLength,u=n.layoutVertexArray,h=n.collisionVertexArray,c=s.anchorX,p=s.anchorY;this._addCollisionDebugVertex(u,h,a,c,p,new F(t,e)),this._addCollisionDebugVertex(u,h,a,c,p,new F(r,e)),this._addCollisionDebugVertex(u,h,a,c,p,new F(r,i)),this._addCollisionDebugVertex(u,h,a,c,p,new F(t,i)),o.vertexLength+=4;let f=n.indexArray;f.emplaceBack(l,l+1),f.emplaceBack(l+1,l+2),f.emplaceBack(l+2,l+3),f.emplaceBack(l+3,l),o.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,i){for(let n=t;n<e;n++){let a=this.collisionBoxArray.get(n),s=a.x1,o=a.y1,l=a.x2,u=a.y2;this.addCollisionDebugVertices(s,o,l,u,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Ss(Cl,au.members,Ha),this.iconCollisionBox=new Ss(Cl,au.members,Ha);for(let t=0;t<this.symbolInstances.length;t++){let e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,i,n,a,s,o,l){let u={};for(let h=e;h<r;h++){let c=t.get(h);u.textBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.textFeatureIndex=c.featureIndex;break}for(let h=i;h<n;h++){let c=t.get(h);u.verticalTextBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalTextFeatureIndex=c.featureIndex;break}for(let h=a;h<s;h++){let c=t.get(h);u.iconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.iconFeatureIndex=c.featureIndex;break}for(let h=o;h<l;h++){let c=t.get(h);u.verticalIconBox={x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,anchorPointX:c.anchorPointX,anchorPointY:c.anchorPointY},u.verticalIconFeatureIndex=c.featureIndex;break}return u}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){let r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+r.numGlyphs*4;for(let n=r.vertexStartIndex;n<i;n+=4)t.indexArray.emplaceBack(n,n+2,n+1),t.indexArray.emplaceBack(n+1,n+2,n+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let e=Math.sin(t),r=Math.cos(t),i=[],n=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let o=this.symbolInstances.get(s);i.push(Math.round(e*o.anchorX+r*o.anchorY)|0),n.push(o.featureIndex)}return a.sort((s,o)=>i[s]-i[o]||n[o]-n[s]),a}addToSortKeyRanges(t,e){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r?.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let r=this.symbolInstances.get(e);this.featureSortOrder.push(r.featureIndex);let i=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let n=0;n<i.length;n++){let a=i[n];a>=0&&i.indexOf(a)===n&&this.addIndicesForPlacedSymbol(this.text,a)}r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};D(\"SymbolBucket\",De,{omit:[\"layers\",\"collisionBoxArray\",\"features\",\"compareText\"]}),De.MAX_GLYPHS=65535,De.addDynamicAttributes=Sp;function px(t,e){return e.replace(/{([^{}]+)}/g,(r,i)=>t&&i in t?String(t[i]):\"\")}var fx,dx=()=>fx||=new kt({\"symbol-placement\":new P(w.layout_symbol[\"symbol-placement\"],\"symbol-placement\"),\"symbol-spacing\":new P(w.layout_symbol[\"symbol-spacing\"],\"symbol-spacing\"),\"symbol-avoid-edges\":new P(w.layout_symbol[\"symbol-avoid-edges\"],\"symbol-avoid-edges\"),\"symbol-sort-key\":new R(w.layout_symbol[\"symbol-sort-key\"],\"symbol-sort-key\"),\"symbol-z-order\":new P(w.layout_symbol[\"symbol-z-order\"],\"symbol-z-order\"),\"icon-allow-overlap\":new P(w.layout_symbol[\"icon-allow-overlap\"],\"icon-allow-overlap\"),\"icon-overlap\":new P(w.layout_symbol[\"icon-overlap\"],\"icon-overlap\"),\"icon-ignore-placement\":new P(w.layout_symbol[\"icon-ignore-placement\"],\"icon-ignore-placement\"),\"icon-optional\":new P(w.layout_symbol[\"icon-optional\"],\"icon-optional\"),\"icon-rotation-alignment\":new R(w.layout_symbol[\"icon-rotation-alignment\"],\"icon-rotation-alignment\"),\"icon-size\":new R(w.layout_symbol[\"icon-size\"],\"icon-size\"),\"icon-text-fit\":new P(w.layout_symbol[\"icon-text-fit\"],\"icon-text-fit\"),\"icon-text-fit-padding\":new P(w.layout_symbol[\"icon-text-fit-padding\"],\"icon-text-fit-padding\"),\"icon-image\":new R(w.layout_symbol[\"icon-image\"],\"icon-image\"),\"icon-rotate\":new R(w.layout_symbol[\"icon-rotate\"],\"icon-rotate\"),\"icon-padding\":new R(w.layout_symbol[\"icon-padding\"],\"icon-padding\"),\"icon-keep-upright\":new P(w.layout_symbol[\"icon-keep-upright\"],\"icon-keep-upright\"),\"icon-offset\":new R(w.layout_symbol[\"icon-offset\"],\"icon-offset\"),\"icon-anchor\":new R(w.layout_symbol[\"icon-anchor\"],\"icon-anchor\"),\"icon-pitch-alignment\":new P(w.layout_symbol[\"icon-pitch-alignment\"],\"icon-pitch-alignment\"),\"text-pitch-alignment\":new P(w.layout_symbol[\"text-pitch-alignment\"],\"text-pitch-alignment\"),\"text-rotation-alignment\":new P(w.layout_symbol[\"text-rotation-alignment\"],\"text-rotation-alignment\"),\"text-field\":new R(w.layout_symbol[\"text-field\"],\"text-field\"),\"text-font\":new R(w.layout_symbol[\"text-font\"],\"text-font\"),\"text-size\":new R(w.layout_symbol[\"text-size\"],\"text-size\"),\"text-max-width\":new R(w.layout_symbol[\"text-max-width\"],\"text-max-width\"),\"text-line-height\":new P(w.layout_symbol[\"text-line-height\"],\"text-line-height\"),\"text-letter-spacing\":new R(w.layout_symbol[\"text-letter-spacing\"],\"text-letter-spacing\"),\"text-justify\":new R(w.layout_symbol[\"text-justify\"],\"text-justify\"),\"text-radial-offset\":new R(w.layout_symbol[\"text-radial-offset\"],\"text-radial-offset\"),\"text-variable-anchor\":new P(w.layout_symbol[\"text-variable-anchor\"],\"text-variable-anchor\"),\"text-variable-anchor-offset\":new R(w.layout_symbol[\"text-variable-anchor-offset\"],\"text-variable-anchor-offset\"),\"text-anchor\":new R(w.layout_symbol[\"text-anchor\"],\"text-anchor\"),\"text-max-angle\":new P(w.layout_symbol[\"text-max-angle\"],\"text-max-angle\"),\"text-writing-mode\":new P(w.layout_symbol[\"text-writing-mode\"],\"text-writing-mode\"),\"text-rotate\":new R(w.layout_symbol[\"text-rotate\"],\"text-rotate\"),\"text-padding\":new P(w.layout_symbol[\"text-padding\"],\"text-padding\"),\"text-keep-upright\":new P(w.layout_symbol[\"text-keep-upright\"],\"text-keep-upright\"),\"text-transform\":new R(w.layout_symbol[\"text-transform\"],\"text-transform\"),\"text-offset\":new R(w.layout_symbol[\"text-offset\"],\"text-offset\"),\"text-allow-overlap\":new P(w.layout_symbol[\"text-allow-overlap\"],\"text-allow-overlap\"),\"text-overlap\":new P(w.layout_symbol[\"text-overlap\"],\"text-overlap\"),\"text-ignore-placement\":new P(w.layout_symbol[\"text-ignore-placement\"],\"text-ignore-placement\"),\"text-optional\":new P(w.layout_symbol[\"text-optional\"],\"text-optional\"),\"symbol-height-offset\":new R(w.layout_symbol[\"symbol-height-offset\"],\"symbol-height-offset\"),\"symbol-height-anchor\":new P(w.layout_symbol[\"symbol-height-anchor\"],\"symbol-height-anchor\")}),yx,mx=()=>yx||=new kt({\"icon-opacity\":new R(w.paint_symbol[\"icon-opacity\"],\"icon-opacity\"),\"icon-color\":new R(w.paint_symbol[\"icon-color\"],\"icon-color\"),\"icon-halo-color\":new R(w.paint_symbol[\"icon-halo-color\"],\"icon-halo-color\"),\"icon-halo-width\":new R(w.paint_symbol[\"icon-halo-width\"],\"icon-halo-width\"),\"icon-halo-blur\":new R(w.paint_symbol[\"icon-halo-blur\"],\"icon-halo-blur\"),\"icon-translate\":new P(w.paint_symbol[\"icon-translate\"],\"icon-translate\"),\"icon-translate-anchor\":new P(w.paint_symbol[\"icon-translate-anchor\"],\"icon-translate-anchor\"),\"text-opacity\":new R(w.paint_symbol[\"text-opacity\"],\"text-opacity\"),\"text-color\":new R(w.paint_symbol[\"text-color\"],\"text-color\",{runtimeType:Nt,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),\"text-halo-color\":new R(w.paint_symbol[\"text-halo-color\"],\"text-halo-color\"),\"text-halo-width\":new R(w.paint_symbol[\"text-halo-width\"],\"text-halo-width\"),\"text-halo-blur\":new R(w.paint_symbol[\"text-halo-blur\"],\"text-halo-blur\"),\"text-translate\":new P(w.paint_symbol[\"text-translate\"],\"text-translate\"),\"text-translate-anchor\":new P(w.paint_symbol[\"text-translate-anchor\"],\"text-translate-anchor\")}),fa={get paint(){return mx()},get layout(){return dx()}},Ap=class{constructor(t){if(t.property.overrides===void 0)throw Error(\"overrides must be provided to instantiate FormatSectionOverride class\");this.type=t.property.overrides?t.property.overrides.runtimeType:fr,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e?.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let e=this.defaultValue.value;t(e._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};D(\"FormatSectionOverride\",Ap,{omit:[\"defaultValue\"]});var gx=class As extends Gt{constructor(e,r){super(e,fa,r)}recalculate(e,r){super.recalculate(e,r);let i=this.layout.get(\"icon-rotation-alignment\");if((i.value.kind!==\"constant\"||i.value.value===\"auto\")&&(this.layout._values[\"icon-rotation-alignment\"]=new Vt(i.property,{kind:\"constant\",value:this.layout.get(\"symbol-placement\")===\"point\"?\"viewport\":\"map\"},i.parameters)),this.layout.get(\"text-rotation-alignment\")===\"auto\"&&(this.layout.get(\"symbol-placement\")===\"point\"?this.layout._values[\"text-rotation-alignment\"]=\"viewport\":this.layout._values[\"text-rotation-alignment\"]=\"map\"),this.layout.get(\"text-pitch-alignment\")===\"auto\"&&(this.layout._values[\"text-pitch-alignment\"]=this.layout.get(\"text-rotation-alignment\")===\"map\"?\"map\":\"viewport\"),this.layout.get(\"icon-pitch-alignment\")===\"auto\"&&(this.layout._values[\"icon-pitch-alignment\"]=this.layout.get(\"icon-rotation-alignment\").constantOr(\"viewport\")),this.layout.get(\"symbol-placement\")===\"point\"){let n=this.layout.get(\"text-writing-mode\");if(n){let a=[];for(let s of n)a.includes(s)||a.push(s);this.layout._values[\"text-writing-mode\"]=a}else this.layout._values[\"text-writing-mode\"]=[\"horizontal\"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,i,n){let a=this.layout.get(e).evaluate(r,{},i,n),s=this._unevaluatedLayout._values[e];return!s.isDataDriven()&&!En(s.value)&&a?px(r.properties,a):a}createBucket(e){return new De(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error(\"Should take a different path in FeatureIndex\")}_setPaintOverrides(){for(let e of fa.paint.overridableProperties){if(!As.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),i=new js(new Ap(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),n=null;n=r.value.kind===\"constant\"||r.value.kind===\"source\"?new Qr(\"source\",i):new nn(\"composite\",i,r.value.zoomStops),this.paint._values[e]=new Vt(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:As.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let i=e.get(\"text-field\"),n=fa.paint.properties[r],a=!1,s=o=>{for(let l of o)if(n.overrides?.hasOverride(l)){a=!0;return}};if(i.value.kind===\"constant\"&&i.value.value instanceof se)s(i.value.value.sections);else if(i.value.kind===\"source\"||i.value.kind===\"composite\"){let o=u=>{if(!a)if(u instanceof or&&it(u.value)===li){let h=u.value;s(h.sections)}else u instanceof uh?s(u.sections):u.eachChild(o)},l=i.value;l._styleExpression&&o(l._styleExpression.expression)}return a}};function xx(t,e,r,i=1){let n=t.get(\"icon-padding\").evaluate(e,{},r)?.values;return[n[0]*i,n[1]*i,n[2]*i,n[3]*i]}var vx,bx=()=>vx||=new kt({\"background-color\":new P(w.paint_background[\"background-color\"],\"background-color\"),\"background-pattern\":new _c(w.paint_background[\"background-pattern\"],\"background-pattern\"),\"background-opacity\":new P(w.paint_background[\"background-opacity\"],\"background-opacity\")}),wx={get paint(){return bx()}};var _x=class extends Gt{constructor(t,e){super(t,wx,e)}};var Sx=class extends Gt{constructor(t,e){super(t,{},e),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode===\"3d\"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error(\"Custom layers cannot be serialized\")}};function Tp(t,e){if(t.type===\"custom\")return new Sx(t,e);switch(t.type){case\"background\":return new _x(t,e);case\"circle\":return new p1(t,e);case\"color-relief\":return new A1(t,e);case\"fill\":return new ig(t,e);case\"fill-extrusion\":return new Ig(t,e);case\"heatmap\":return new m1(t,e);case\"hillshade\":return new b1(t,e);case\"line\":return new _0(t,e);case\"raster\":return new Tm(t,e);case\"symbol\":return new gx(t,e)}}var Ax=class{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){this._triggered||(this._triggered=!0,this._channel?.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}},Tx={once:!0},kp=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Ax(()=>this.process()),this.subscription=Ko(this.target,\"message\",r=>this.receive(r),!1),this.globalScope=Fe(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise((r,i)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=e?Ko(e.signal,\"abort\",()=>{a?.unsubscribe(),delete this.resolveRejects[n];let l={id:n,type:\"<cancel>\",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),i(new Fs(e.signal.reason))},Tx):null;this.resolveRejects[n]={resolve:l=>{a?.unsubscribe(),r(l)},reject:l=>{a?.unsubscribe(),i(l)}};let s=[],o={...t,id:n,sourceMapId:this.mapId,origin:location.origin,data:Ur(t.data,s)};this.target.postMessage(o,{transfer:s})})}receive(t){let e=t.data,r=e.id,i=[\"file://\",\"resource://android\",\"null\"],n=[e.origin,location.origin],a=e.origin===location.origin,s=n.some(o=>i.includes(o));if(!(!a&&!s)&&!(e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type===\"<cancel>\"){delete this.tasks[r];let o=this.abortControllers[r];delete this.abortControllers[r],o&&o.abort();return}if(Fe(self)||e.mustQueue){this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger();return}this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}async processTask(t,e){if(e.type===\"<response>\"){let n=this.resolveRejects[t];if(delete this.resolveRejects[t],!n)return;e.error?n.reject(Yr(qr(e.error))):n.resolve(qr(e.data));return}if(!this.messageHandlers[e.type]){this.completeTask(t,null,null);return}let r=qr(e.data),i=new AbortController;this.abortControllers[t]=i;try{let n=await this.messageHandlers[e.type](e.sourceMapId,r,i);this.completeTask(t,null,n)}catch(n){this.completeTask(t,Yr(n))}}completeTask(t,e,r){let i=[];delete this.abortControllers[t];let n={id:t,type:\"<response>\",sourceMapId:this.mapId,origin:location.origin,error:e?Ur(e):null,data:Ur(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},kx=class{constructor(t,e){this.feature=t,this.type=t.type,this.properties=t.tags?t.tags:{},this.extent=e,\"id\"in t&&(typeof t.id==\"string\"?this.id=parseInt(t.id,10):typeof t.id==\"number\"&&!isNaN(t.id)&&(this.id=t.id))}loadGeometry(){let t=[],e=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(let r of e){let i=[];for(let n of r)i.push(new F(n[0],n[1]));t.push(i)}return t}},Ts=\"_geojsonTileLayer\",Ip=class{constructor(t,e){this.layers={[Ts]:this},this.name=Ts,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=t.length,this.features=t}feature(t){return new kx(this.features[t],this.extent)}};function _o(t,e=\"\"){let r=new C0;return Ix(t,r,e),r.finish()}function Ix(t,e,r=\"\"){for(let i in t.layers)e.writeMessage(3,(n,a)=>Ex(n,a,r),t.layers[i])}function Ex(t,e,r=\"\"){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||\"\"),e.writeVarintField(5,t.extent||4096);let i={jsonPrefix:r,keys:[],values:[],keycache:{},valuecache:{}};for(let s=0;s<t.length;s++)i.feature=t.feature(s),e.writeMessage(2,Mx,i);let n=i.keys;for(let s of n)e.writeStringField(3,s);let a=i.values;for(let s of a)e.writeMessage(4,Px,s)}function Mx(t,e){if(!t.feature)return;let r=t.feature;r.id!==void 0&&e.writeVarintField(1,r.id),e.writeMessage(2,Dx,t),e.writeVarintField(3,r.type),e.writeMessage(4,Fx,r)}function Dx(t,e){for(let r in t.feature?.properties){let i=t.feature.properties[r],n=t.keycache[r];if(i==null)continue;n===void 0&&(t.keys.push(r),n=t.keys.length-1,t.keycache[r]=n),e.writeVarint(n),typeof i!=\"string\"&&typeof i!=\"boolean\"&&typeof i!=\"number\"&&(i=t.jsonPrefix+JSON.stringify(i));let a=typeof i+\":\"+i,s=t.valuecache[a];s===void 0&&(t.values.push(i),s=t.values.length-1,t.valuecache[a]=s),e.writeVarint(s)}}function da(t,e){return(e<<3)+(t&7)}function mu(t){return t<<1^t>>31}function Fx(t,e){let r=t.loadGeometry(),i=t.type,n=0,a=0;for(let s of r){let o=1;i===1&&(o=s.length),e.writeVarint(da(1,o));let l=i===3?s.length-1:s.length;for(let u=0;u<l;u++){u===1&&i!==1&&e.writeVarint(da(2,l-1));let h=s[u].x-n,c=s[u].y-a;e.writeVarint(mu(h)),e.writeVarint(mu(c)),n+=h,a+=c}t.type===3&&e.writeVarint(da(7,1))}}function Px(t,e){let r=typeof t;r===\"string\"?e.writeStringField(1,t):r===\"boolean\"?e.writeBooleanField(7,t):r===\"number\"&&(t%1==0?t<0?e.writeSVarintField(6,t):e.writeVarintField(5,t):e.writeDoubleField(3,t))}var So=class{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){let r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}get size(){return this._numberToString.length}decode(t){if(t>=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can\\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}},Cx=class{constructor(t,e,r,i,n){this.type=\"Feature\",this._vectorTileFeature=t,this._x=r,this._y=i,this._z=e;for(let a in t.properties)typeof t.properties[a]!=\"string\"||!t.properties[a].startsWith(\"__$json__:\")||(t.properties[a]=JSON.parse(t.properties[a].slice(10)));this.properties=t.properties,this.id=n}projectPoint(t,e,r,i){return[(t.x+e)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(t.y+r)*2/i)*Math.PI))-90]}projectLine(t,e,r,i){return t.map(n=>this.projectPoint(n,e,r,i))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,e=t.extent*2**this._z,r=t.extent*this._x,i=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let a=[];for(let o of n)a.push(o[0]);let s=this.projectLine(a,r,i,e);this._geometry=a.length===1?{type:\"Point\",coordinates:s[0]}:{type:\"MultiPoint\",coordinates:s};break}case 2:{let a=n.map(s=>this.projectLine(s,r,i,e));this._geometry=a.length===1?{type:\"LineString\",coordinates:a[0]}:{type:\"MultiLineString\",coordinates:a};break}case 3:{let a=ep(n),s=[];for(let o of a)s.push(o.map(l=>this.projectLine(l,r,i,e)));this._geometry=s.length===1?{type:\"Polygon\",coordinates:s[0]}:{type:\"MultiPolygon\",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e!==\"_geometry\"&&e!==\"_vectorTileFeature\"&&e!==\"_x\"&&e!==\"_y\"&&e!==\"_z\"&&(t[e]=this[e]);return t}},Re=class{constructor(t,e,r){this._name=t,this.dataBuffer=e,typeof r==\"number\"?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){return this.nullabilityBuffer?.get(t)||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},Rn=class extends Re{},Ao=class extends Rn{getValueFromBuffer(t){return this.dataBuffer[t]}},To=class extends Rn{getValueFromBuffer(t){return this.dataBuffer[t]}},Ep=class extends Re{constructor(t,e,r,i){super(t,e,i),this.delta=r}},ko=class extends Ep{constructor(t,e,r,i,n){super(t,n?Int32Array.of(e):Uint32Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}},Io=class extends Re{constructor(t,e,r,i){super(t,i?Int32Array.of(e):Uint32Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}},zx=class{constructor(t,e,r,i,n=4096){if(this._name=t,this._geometryVector=e,this._idVector=r,this._propertyVectors=i,this._extent=n,t.length===0)throw Error(\"Missing layer name\")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){return this._propertyVectors??[]}getPropertyVector(t){return this.propertyVectorsMap||=new Map(this.propertyVectors.map(e=>[e.name,e])),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],e=this.geometryVector.getGeometries();for(let r=0;r<this.numFeatures;r++){let i;if(this.idVector){let s=this.idVector.getValue(r);s!==null&&(i=this.containsMaxSafeIntegerValues(this.idVector)?Number(s):s)}let n={coordinates:e[r],type:this.geometryVector.geometryType(r)},a={};for(let s of this.propertyVectors){if(!s)continue;let o=s.name,l=s.getValue(r);l!==null&&(a[o]=l)}t.push({id:i,geometry:n,properties:a})}return t}containsMaxSafeIntegerValues(t){return t instanceof Ao||t instanceof Io||t instanceof ko||t instanceof To}},Or={FEATURE:0,VERTEX:1},Z={BOOLEAN:0,INT_8:1,UINT_8:2,INT_32:3,UINT_32:4,INT_64:5,UINT_64:6,FLOAT:7,DOUBLE:8,STRING:9},ge={GEOMETRY:0,STRUCT:1,MAP:2},Mp={ID:0},Dp=class{constructor(t){this.value=t}get(){return this.value}set(t){this.value=t}increment(){return this.value++}add(t){this.value+=t}},G;(function(t){t.NONE=\"NONE\",t.DELTA=\"DELTA\",t.COMPONENTWISE_DELTA=\"COMPONENTWISE_DELTA\",t.RLE=\"RLE\",t.MORTON=\"MORTON\",t.PDE=\"PDE\"})(G||={});var Rt;(function(t){t.NONE=\"NONE\",t.FAST_PFOR=\"FAST_PFOR\",t.VARINT=\"VARINT\"})(Rt||={});var Eo=new Uint32Array(33);Eo[0]=0;for(let t=1;t<=32;t++)Eo[t]=t===32?4294967295:4294967295>>>32-t;var ks=Eo,Fp=65536;function Mo(t,e){return t-t%e}function Bx(t){return Mo(t+31,32)}function Lx(t){if(!Number.isFinite(t)||t<=0)return Fp;let e=Mo(Math.floor(t),256);return e===0?256:e}function Vx(t){let e=t>>>0;return((e&255)<<24|(e&65280)<<8|e>>>8&65280|e>>>24&255)>>>0}function Ox(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0;r[n++]=a>>>0&3,r[n++]=a>>>2&3,r[n++]=a>>>4&3,r[n++]=a>>>6&3,r[n++]=a>>>8&3,r[n++]=a>>>10&3,r[n++]=a>>>12&3,r[n++]=a>>>14&3,r[n++]=a>>>16&3,r[n++]=a>>>18&3,r[n++]=a>>>20&3,r[n++]=a>>>22&3,r[n++]=a>>>24&3,r[n++]=a>>>26&3,r[n++]=a>>>28&3,r[n++]=a>>>30&3,r[n++]=s>>>0&3,r[n++]=s>>>2&3,r[n++]=s>>>4&3,r[n++]=s>>>6&3,r[n++]=s>>>8&3,r[n++]=s>>>10&3,r[n++]=s>>>12&3,r[n++]=s>>>14&3,r[n++]=s>>>16&3,r[n++]=s>>>18&3,r[n++]=s>>>20&3,r[n++]=s>>>22&3,r[n++]=s>>>24&3,r[n++]=s>>>26&3,r[n++]=s>>>28&3,r[n]=s>>>30&3}function Rx(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0;r[n++]=a>>>0&7,r[n++]=a>>>3&7,r[n++]=a>>>6&7,r[n++]=a>>>9&7,r[n++]=a>>>12&7,r[n++]=a>>>15&7,r[n++]=a>>>18&7,r[n++]=a>>>21&7,r[n++]=a>>>24&7,r[n++]=a>>>27&7,r[n++]=(a>>>30|(s&1)<<2)&7,r[n++]=s>>>1&7,r[n++]=s>>>4&7,r[n++]=s>>>7&7,r[n++]=s>>>10&7,r[n++]=s>>>13&7,r[n++]=s>>>16&7,r[n++]=s>>>19&7,r[n++]=s>>>22&7,r[n++]=s>>>25&7,r[n++]=s>>>28&7,r[n++]=(s>>>31|(o&3)<<1)&7,r[n++]=o>>>2&7,r[n++]=o>>>5&7,r[n++]=o>>>8&7,r[n++]=o>>>11&7,r[n++]=o>>>14&7,r[n++]=o>>>17&7,r[n++]=o>>>20&7,r[n++]=o>>>23&7,r[n++]=o>>>26&7,r[n]=o>>>29&7}function $x(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0;r[n++]=a>>>0&15,r[n++]=a>>>4&15,r[n++]=a>>>8&15,r[n++]=a>>>12&15,r[n++]=a>>>16&15,r[n++]=a>>>20&15,r[n++]=a>>>24&15,r[n++]=a>>>28&15,r[n++]=s>>>0&15,r[n++]=s>>>4&15,r[n++]=s>>>8&15,r[n++]=s>>>12&15,r[n++]=s>>>16&15,r[n++]=s>>>20&15,r[n++]=s>>>24&15,r[n++]=s>>>28&15,r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n]=l>>>28&15}function Nx(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0;r[n++]=a>>>0&31,r[n++]=a>>>5&31,r[n++]=a>>>10&31,r[n++]=a>>>15&31,r[n++]=a>>>20&31,r[n++]=a>>>25&31,r[n++]=(a>>>30|(s&7)<<2)&31,r[n++]=s>>>3&31,r[n++]=s>>>8&31,r[n++]=s>>>13&31,r[n++]=s>>>18&31,r[n++]=s>>>23&31,r[n++]=(s>>>28|(o&1)<<4)&31,r[n++]=o>>>1&31,r[n++]=o>>>6&31,r[n++]=o>>>11&31,r[n++]=o>>>16&31,r[n++]=o>>>21&31,r[n++]=o>>>26&31,r[n++]=(o>>>31|(l&15)<<1)&31,r[n++]=l>>>4&31,r[n++]=l>>>9&31,r[n++]=l>>>14&31,r[n++]=l>>>19&31,r[n++]=l>>>24&31,r[n++]=(l>>>29|(u&3)<<3)&31,r[n++]=u>>>2&31,r[n++]=u>>>7&31,r[n++]=u>>>12&31,r[n++]=u>>>17&31,r[n++]=u>>>22&31,r[n]=u>>>27&31}function Ux(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0;r[n++]=a>>>0&63,r[n++]=a>>>6&63,r[n++]=a>>>12&63,r[n++]=a>>>18&63,r[n++]=a>>>24&63,r[n++]=(a>>>30|(s&15)<<2)&63,r[n++]=s>>>4&63,r[n++]=s>>>10&63,r[n++]=s>>>16&63,r[n++]=s>>>22&63,r[n++]=(s>>>28|(o&3)<<4)&63,r[n++]=o>>>2&63,r[n++]=o>>>8&63,r[n++]=o>>>14&63,r[n++]=o>>>20&63,r[n++]=o>>>26&63,r[n++]=l>>>0&63,r[n++]=l>>>6&63,r[n++]=l>>>12&63,r[n++]=l>>>18&63,r[n++]=l>>>24&63,r[n++]=(l>>>30|(u&15)<<2)&63,r[n++]=u>>>4&63,r[n++]=u>>>10&63,r[n++]=u>>>16&63,r[n++]=u>>>22&63,r[n++]=(u>>>28|(h&3)<<4)&63,r[n++]=h>>>2&63,r[n++]=h>>>8&63,r[n++]=h>>>14&63,r[n++]=h>>>20&63,r[n]=h>>>26&63}function qx(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0;r[n++]=a>>>0&127,r[n++]=a>>>7&127,r[n++]=a>>>14&127,r[n++]=a>>>21&127,r[n++]=(a>>>28|(s&7)<<4)&127,r[n++]=s>>>3&127,r[n++]=s>>>10&127,r[n++]=s>>>17&127,r[n++]=s>>>24&127,r[n++]=(s>>>31|(o&63)<<1)&127,r[n++]=o>>>6&127,r[n++]=o>>>13&127,r[n++]=o>>>20&127,r[n++]=(o>>>27|(l&3)<<5)&127,r[n++]=l>>>2&127,r[n++]=l>>>9&127,r[n++]=l>>>16&127,r[n++]=l>>>23&127,r[n++]=(l>>>30|(u&31)<<2)&127,r[n++]=u>>>5&127,r[n++]=u>>>12&127,r[n++]=u>>>19&127,r[n++]=(u>>>26|(h&1)<<6)&127,r[n++]=h>>>1&127,r[n++]=h>>>8&127,r[n++]=h>>>15&127,r[n++]=h>>>22&127,r[n++]=(h>>>29|(c&15)<<3)&127,r[n++]=c>>>4&127,r[n++]=c>>>11&127,r[n++]=c>>>18&127,r[n]=c>>>25&127}function Gx(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0;r[n++]=a>>>0&255,r[n++]=a>>>8&255,r[n++]=a>>>16&255,r[n++]=a>>>24&255,r[n++]=s>>>0&255,r[n++]=s>>>8&255,r[n++]=s>>>16&255,r[n++]=s>>>24&255,r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n]=p>>>24&255}function jx(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0;r[n++]=a>>>0&511,r[n++]=a>>>9&511,r[n++]=a>>>18&511,r[n++]=(a>>>27|(s&15)<<5)&511,r[n++]=s>>>4&511,r[n++]=s>>>13&511,r[n++]=s>>>22&511,r[n++]=(s>>>31|(o&255)<<1)&511,r[n++]=o>>>8&511,r[n++]=o>>>17&511,r[n++]=(o>>>26|(l&7)<<6)&511,r[n++]=l>>>3&511,r[n++]=l>>>12&511,r[n++]=l>>>21&511,r[n++]=(l>>>30|(u&127)<<2)&511,r[n++]=u>>>7&511,r[n++]=u>>>16&511,r[n++]=(u>>>25|(h&3)<<7)&511,r[n++]=h>>>2&511,r[n++]=h>>>11&511,r[n++]=h>>>20&511,r[n++]=(h>>>29|(c&63)<<3)&511,r[n++]=c>>>6&511,r[n++]=c>>>15&511,r[n++]=(c>>>24|(p&1)<<8)&511,r[n++]=p>>>1&511,r[n++]=p>>>10&511,r[n++]=p>>>19&511,r[n++]=(p>>>28|(f&31)<<4)&511,r[n++]=f>>>5&511,r[n++]=f>>>14&511,r[n]=f>>>23&511}function Yx(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0;r[n++]=a>>>0&1023,r[n++]=a>>>10&1023,r[n++]=a>>>20&1023,r[n++]=(a>>>30|(s&255)<<2)&1023,r[n++]=s>>>8&1023,r[n++]=s>>>18&1023,r[n++]=(s>>>28|(o&63)<<4)&1023,r[n++]=o>>>6&1023,r[n++]=o>>>16&1023,r[n++]=(o>>>26|(l&15)<<6)&1023,r[n++]=l>>>4&1023,r[n++]=l>>>14&1023,r[n++]=(l>>>24|(u&3)<<8)&1023,r[n++]=u>>>2&1023,r[n++]=u>>>12&1023,r[n++]=u>>>22&1023,r[n++]=h>>>0&1023,r[n++]=h>>>10&1023,r[n++]=h>>>20&1023,r[n++]=(h>>>30|(c&255)<<2)&1023,r[n++]=c>>>8&1023,r[n++]=c>>>18&1023,r[n++]=(c>>>28|(p&63)<<4)&1023,r[n++]=p>>>6&1023,r[n++]=p>>>16&1023,r[n++]=(p>>>26|(f&15)<<6)&1023,r[n++]=f>>>4&1023,r[n++]=f>>>14&1023,r[n++]=(f>>>24|(d&3)<<8)&1023,r[n++]=d>>>2&1023,r[n++]=d>>>12&1023,r[n]=d>>>22&1023}function Xx(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0;r[n++]=a>>>0&2047,r[n++]=a>>>11&2047,r[n++]=(a>>>22|(s&1)<<10)&2047,r[n++]=s>>>1&2047,r[n++]=s>>>12&2047,r[n++]=(s>>>23|(o&3)<<9)&2047,r[n++]=o>>>2&2047,r[n++]=o>>>13&2047,r[n++]=(o>>>24|(l&7)<<8)&2047,r[n++]=l>>>3&2047,r[n++]=l>>>14&2047,r[n++]=(l>>>25|(u&15)<<7)&2047,r[n++]=u>>>4&2047,r[n++]=u>>>15&2047,r[n++]=(u>>>26|(h&31)<<6)&2047,r[n++]=h>>>5&2047,r[n++]=h>>>16&2047,r[n++]=(h>>>27|(c&63)<<5)&2047,r[n++]=c>>>6&2047,r[n++]=c>>>17&2047,r[n++]=(c>>>28|(p&127)<<4)&2047,r[n++]=p>>>7&2047,r[n++]=p>>>18&2047,r[n++]=(p>>>29|(f&255)<<3)&2047,r[n++]=f>>>8&2047,r[n++]=f>>>19&2047,r[n++]=(f>>>30|(d&511)<<2)&2047,r[n++]=d>>>9&2047,r[n++]=d>>>20&2047,r[n++]=(d>>>31|(y&1023)<<1)&2047,r[n++]=y>>>10&2047,r[n]=y>>>21&2047}function Zx(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0;r[n++]=a>>>0&4095,r[n++]=a>>>12&4095,r[n++]=(a>>>24|(s&15)<<8)&4095,r[n++]=s>>>4&4095,r[n++]=s>>>16&4095,r[n++]=(s>>>28|(o&255)<<4)&4095,r[n++]=o>>>8&4095,r[n++]=o>>>20&4095,r[n++]=l>>>0&4095,r[n++]=l>>>12&4095,r[n++]=(l>>>24|(u&15)<<8)&4095,r[n++]=u>>>4&4095,r[n++]=u>>>16&4095,r[n++]=(u>>>28|(h&255)<<4)&4095,r[n++]=h>>>8&4095,r[n++]=h>>>20&4095,r[n++]=c>>>0&4095,r[n++]=c>>>12&4095,r[n++]=(c>>>24|(p&15)<<8)&4095,r[n++]=p>>>4&4095,r[n++]=p>>>16&4095,r[n++]=(p>>>28|(f&255)<<4)&4095,r[n++]=f>>>8&4095,r[n++]=f>>>20&4095,r[n++]=d>>>0&4095,r[n++]=d>>>12&4095,r[n++]=(d>>>24|(y&15)<<8)&4095,r[n++]=y>>>4&4095,r[n++]=y>>>16&4095,r[n++]=(y>>>28|(m&255)<<4)&4095,r[n++]=m>>>8&4095,r[n]=m>>>20&4095}function Wx(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0,g=t[e+12]>>>0,x=t[e+13]>>>0,b=t[e+14]>>>0,v=t[e+15]>>>0;r[n++]=a>>>0&65535,r[n++]=a>>>16&65535,r[n++]=s>>>0&65535,r[n++]=s>>>16&65535,r[n++]=o>>>0&65535,r[n++]=o>>>16&65535,r[n++]=l>>>0&65535,r[n++]=l>>>16&65535,r[n++]=u>>>0&65535,r[n++]=u>>>16&65535,r[n++]=h>>>0&65535,r[n++]=h>>>16&65535,r[n++]=c>>>0&65535,r[n++]=c>>>16&65535,r[n++]=p>>>0&65535,r[n++]=p>>>16&65535,r[n++]=f>>>0&65535,r[n++]=f>>>16&65535,r[n++]=d>>>0&65535,r[n++]=d>>>16&65535,r[n++]=y>>>0&65535,r[n++]=y>>>16&65535,r[n++]=m>>>0&65535,r[n++]=m>>>16&65535,r[n++]=g>>>0&65535,r[n++]=g>>>16&65535,r[n++]=x>>>0&65535,r[n++]=x>>>16&65535,r[n++]=b>>>0&65535,r[n++]=b>>>16&65535,r[n++]=v>>>0&65535,r[n]=v>>>16&65535}function Hx(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0;r[n++]=o>>>0&1,r[n++]=o>>>1&1,r[n++]=o>>>2&1,r[n++]=o>>>3&1,r[n++]=o>>>4&1,r[n++]=o>>>5&1,r[n++]=o>>>6&1,r[n++]=o>>>7&1,r[n++]=o>>>8&1,r[n++]=o>>>9&1,r[n++]=o>>>10&1,r[n++]=o>>>11&1,r[n++]=o>>>12&1,r[n++]=o>>>13&1,r[n++]=o>>>14&1,r[n++]=o>>>15&1,r[n++]=o>>>16&1,r[n++]=o>>>17&1,r[n++]=o>>>18&1,r[n++]=o>>>19&1,r[n++]=o>>>20&1,r[n++]=o>>>21&1,r[n++]=o>>>22&1,r[n++]=o>>>23&1,r[n++]=o>>>24&1,r[n++]=o>>>25&1,r[n++]=o>>>26&1,r[n++]=o>>>27&1,r[n++]=o>>>28&1,r[n++]=o>>>29&1,r[n++]=o>>>30&1,r[n++]=o>>>31&1}}function Kx(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0;r[n++]=o>>>0&3,r[n++]=o>>>2&3,r[n++]=o>>>4&3,r[n++]=o>>>6&3,r[n++]=o>>>8&3,r[n++]=o>>>10&3,r[n++]=o>>>12&3,r[n++]=o>>>14&3,r[n++]=o>>>16&3,r[n++]=o>>>18&3,r[n++]=o>>>20&3,r[n++]=o>>>22&3,r[n++]=o>>>24&3,r[n++]=o>>>26&3,r[n++]=o>>>28&3,r[n++]=o>>>30&3,r[n++]=l>>>0&3,r[n++]=l>>>2&3,r[n++]=l>>>4&3,r[n++]=l>>>6&3,r[n++]=l>>>8&3,r[n++]=l>>>10&3,r[n++]=l>>>12&3,r[n++]=l>>>14&3,r[n++]=l>>>16&3,r[n++]=l>>>18&3,r[n++]=l>>>20&3,r[n++]=l>>>22&3,r[n++]=l>>>24&3,r[n++]=l>>>26&3,r[n++]=l>>>28&3,r[n++]=l>>>30&3}}function Jx(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0;r[n++]=o>>>0&7,r[n++]=o>>>3&7,r[n++]=o>>>6&7,r[n++]=o>>>9&7,r[n++]=o>>>12&7,r[n++]=o>>>15&7,r[n++]=o>>>18&7,r[n++]=o>>>21&7,r[n++]=o>>>24&7,r[n++]=o>>>27&7,r[n++]=(o>>>30|(l&1)<<2)&7,r[n++]=l>>>1&7,r[n++]=l>>>4&7,r[n++]=l>>>7&7,r[n++]=l>>>10&7,r[n++]=l>>>13&7,r[n++]=l>>>16&7,r[n++]=l>>>19&7,r[n++]=l>>>22&7,r[n++]=l>>>25&7,r[n++]=l>>>28&7,r[n++]=(l>>>31|(u&3)<<1)&7,r[n++]=u>>>2&7,r[n++]=u>>>5&7,r[n++]=u>>>8&7,r[n++]=u>>>11&7,r[n++]=u>>>14&7,r[n++]=u>>>17&7,r[n++]=u>>>20&7,r[n++]=u>>>23&7,r[n++]=u>>>26&7,r[n++]=u>>>29&7}}function Qx(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0;r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n++]=l>>>28&15,r[n++]=u>>>0&15,r[n++]=u>>>4&15,r[n++]=u>>>8&15,r[n++]=u>>>12&15,r[n++]=u>>>16&15,r[n++]=u>>>20&15,r[n++]=u>>>24&15,r[n++]=u>>>28&15,r[n++]=h>>>0&15,r[n++]=h>>>4&15,r[n++]=h>>>8&15,r[n++]=h>>>12&15,r[n++]=h>>>16&15,r[n++]=h>>>20&15,r[n++]=h>>>24&15,r[n++]=h>>>28&15}}function t2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0;r[n++]=o>>>0&31,r[n++]=o>>>5&31,r[n++]=o>>>10&31,r[n++]=o>>>15&31,r[n++]=o>>>20&31,r[n++]=o>>>25&31,r[n++]=(o>>>30|(l&7)<<2)&31,r[n++]=l>>>3&31,r[n++]=l>>>8&31,r[n++]=l>>>13&31,r[n++]=l>>>18&31,r[n++]=l>>>23&31,r[n++]=(l>>>28|(u&1)<<4)&31,r[n++]=u>>>1&31,r[n++]=u>>>6&31,r[n++]=u>>>11&31,r[n++]=u>>>16&31,r[n++]=u>>>21&31,r[n++]=u>>>26&31,r[n++]=(u>>>31|(h&15)<<1)&31,r[n++]=h>>>4&31,r[n++]=h>>>9&31,r[n++]=h>>>14&31,r[n++]=h>>>19&31,r[n++]=h>>>24&31,r[n++]=(h>>>29|(c&3)<<3)&31,r[n++]=c>>>2&31,r[n++]=c>>>7&31,r[n++]=c>>>12&31,r[n++]=c>>>17&31,r[n++]=c>>>22&31,r[n++]=c>>>27&31}}function e2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0;r[n++]=o>>>0&63,r[n++]=o>>>6&63,r[n++]=o>>>12&63,r[n++]=o>>>18&63,r[n++]=o>>>24&63,r[n++]=(o>>>30|(l&15)<<2)&63,r[n++]=l>>>4&63,r[n++]=l>>>10&63,r[n++]=l>>>16&63,r[n++]=l>>>22&63,r[n++]=(l>>>28|(u&3)<<4)&63,r[n++]=u>>>2&63,r[n++]=u>>>8&63,r[n++]=u>>>14&63,r[n++]=u>>>20&63,r[n++]=u>>>26&63,r[n++]=h>>>0&63,r[n++]=h>>>6&63,r[n++]=h>>>12&63,r[n++]=h>>>18&63,r[n++]=h>>>24&63,r[n++]=(h>>>30|(c&15)<<2)&63,r[n++]=c>>>4&63,r[n++]=c>>>10&63,r[n++]=c>>>16&63,r[n++]=c>>>22&63,r[n++]=(c>>>28|(p&3)<<4)&63,r[n++]=p>>>2&63,r[n++]=p>>>8&63,r[n++]=p>>>14&63,r[n++]=p>>>20&63,r[n++]=p>>>26&63}}function r2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0;r[n++]=o>>>0&127,r[n++]=o>>>7&127,r[n++]=o>>>14&127,r[n++]=o>>>21&127,r[n++]=(o>>>28|(l&7)<<4)&127,r[n++]=l>>>3&127,r[n++]=l>>>10&127,r[n++]=l>>>17&127,r[n++]=l>>>24&127,r[n++]=(l>>>31|(u&63)<<1)&127,r[n++]=u>>>6&127,r[n++]=u>>>13&127,r[n++]=u>>>20&127,r[n++]=(u>>>27|(h&3)<<5)&127,r[n++]=h>>>2&127,r[n++]=h>>>9&127,r[n++]=h>>>16&127,r[n++]=h>>>23&127,r[n++]=(h>>>30|(c&31)<<2)&127,r[n++]=c>>>5&127,r[n++]=c>>>12&127,r[n++]=c>>>19&127,r[n++]=(c>>>26|(p&1)<<6)&127,r[n++]=p>>>1&127,r[n++]=p>>>8&127,r[n++]=p>>>15&127,r[n++]=p>>>22&127,r[n++]=(p>>>29|(f&15)<<3)&127,r[n++]=f>>>4&127,r[n++]=f>>>11&127,r[n++]=f>>>18&127,r[n++]=f>>>25&127}}function i2(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0,d=t[a++]>>>0;r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n++]=p>>>24&255,r[n++]=f>>>0&255,r[n++]=f>>>8&255,r[n++]=f>>>16&255,r[n++]=f>>>24&255,r[n++]=d>>>0&255,r[n++]=d>>>8&255,r[n++]=d>>>16&255,r[n++]=d>>>24&255}}function n2(t,e,r,i){let n=i,a=e;for(let s=0;s<128;s++){let o=t[a++]>>>0;r[n++]=o&65535,r[n++]=o>>>16&65535}}function a2(t,e,r,i,n){let a=ks[n]>>>0,s=e,o=0,l=t[s]>>>0,u=i;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+n<=32){let p=l>>>o&a;r[u+c]=p|0,o+=n,o===32&&(o=0,s++,c!==31&&(l=t[s]>>>0))}else{let p=32-o,f=l>>>o;s++,l=t[s]>>>0;let d=n-p,y=-1>>>32-d>>>0,m=(f|(l&y)<<p)&a;r[u+c]=m|0,o=d}u+=32,o=0,h<7&&(l=t[s]>>>0)}}var Is=Lx(Fp),s2=3*Is/256+Is|0;function Pp(){let t=new Uint8Array(s2);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function o2(t=16){if(t<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);let e=Math.max(16,t|0);return{encodedWords:new Uint32Array(e),decoderWorkspace:Pp()}}function l2(t,e){if(e<=t.encodedWords.length)return t.encodedWords;let r=new Uint32Array(Math.max(16,e*2));return t.encodedWords=r,r}function u2(t,e,r,i){i.byteContainer.length<r&&(i.byteContainer=new Uint8Array(r*2),i.byteContainerI32=void 0);let n=i.byteContainer,a=r>>>2;if(n.byteOffset&3)for(let o=0;o<a;o=o+1|0){let l=t[e+o|0]|0,u=o<<2;n[u]=l&255,n[u+1|0]=l>>>8&255,n[u+2|0]=l>>>16&255,n[u+3|0]=l>>>24&255}else{let o=i.byteContainerI32;(!o||o.buffer!==n.buffer||o.byteOffset!==n.byteOffset||o.length<a)&&(o=i.byteContainerI32=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>>2)),o.set(t.subarray(e,e+a))}let s=r&3;if(s>0){let o=t[e+a|0]|0,l=a<<2;for(let u=0;u<s;u=u+1|0)n[l+u|0]=o>>>(u<<3)&255}return n}function h2(t,e,r){let i=t[e++]|0,n=r.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(i>>>a-1&1))continue;if(e>=t.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${e}, needWords=1, availableWords=${t.length-e}, encodedWords=${t.length})`);let s=t[e++]>>>0,o=Bx(s),l=s*a+31>>>5;if(e+l>t.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${s}, streamWordIndex=${e}, needWords=${l}, availableWords=${t.length-e}, encodedWords=${t.length})`);let u=n[a];(!u||u.length<o)&&(u=n[a]=new Uint32Array(o));let h=0;for(;h<s;h=h+32|0)b2(t,e,u,h,a),e=e+a|0;let c=h-s|0;e=e-(c*a>>>5)|0,r.exceptionSizes[a]=s}return e}function c2(t,e,r,i,n){switch(n){case 1:Hx(t,e,r,i);break;case 2:Kx(t,e,r,i);break;case 3:Jx(t,e,r,i);break;case 4:Qx(t,e,r,i);break;case 5:t2(t,e,r,i);break;case 6:e2(t,e,r,i);break;case 7:r2(t,e,r,i);break;case 8:i2(t,e,r,i);break;case 16:n2(t,e,r,i);break;default:a2(t,e,r,i,n)}return e+(n<<3)|0}function p2(t,e,r,i){if(r+2>e)throw Error(`FastPFOR decode: byteContainer underflow at block=${i} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${e})`);let n=t[r++],a=t[r++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${i} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:a,bytePosIn:r}}function f2(t,e,r,i,n,a){if(r+1>e)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${r}, byteSize=${e})`);let s=t[r++];if(s<i||s>32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${a} (bitWidth=${i}, expected ${i}..32)`);let o=s-i|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${a} (bitWidth=${i}, maxBits=${s})`);if(r+n>e)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${n}, have=${e-r})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:r}}function d2(t,e,r,i,n,a,s,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=f2(n,a,s,r,i,l);if(s=c,h===1){let m=1<<r;for(let g=0;g<i;g=g+1|0){let x=n[s++];t[x+e|0]|=m}return s}let p=o.dataToBePacked[h];if(!p)throw Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${h} (bitWidth=${r}, maxBits=${u}) at block ${l}`);let f=o.dataPointers,d=f[h]|0,y=o.exceptionSizes[h]|0;if(d+i>y)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${d}, need ${i}, size=${y}) at block ${l}`);for(let m=0;m<i;m=m+1|0){let g=n[s++],x=p[d++]|0;t[g+e|0]|=x<<r}return f[h]=d,s}function y2(t,e,r,i,n,a,s,o,l,u){let h=r|0,c=0;for(let p=0;p<s;p=p+1|0){let f=p2(o,l,c,p);c=f.bytePosIn;let d=f.bitWidth,y=f.exceptionCount,m=a+p*256|0;switch(d){case 0:n.fill(0,m,m+256);break;case 32:for(let g=0;g<256;g=g+1|0)n[m+g|0]=t[h+g|0]|0;h=h+256|0;break;default:h=c2(t,h,n,m,d)}y>0&&(c=d2(n,m,d,y,o,l,c,u,p))}if(h!==i)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${r}, consumedPackedEnd=${h}, expectedPackedEnd=${i}, packedWords=${i-r}, encoded.length=${t.length})`)}function m2(t,e,r,i,n,a){let s=r|0,o=t[s]|0;if(o<=0||s+o>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let l=s+1|0,u=s+o|0,h=t[u]>>>0,c=h+3>>>2,p=u+1,f=p+c;if(f>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${s}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${t.length})`);let d=u2(t,p,h,a),y=h,m=h2(t,f,a);return a.dataPointers.fill(0),y2(t,s,l,u,e,i|0,n/256|0,d,y,a),m}function g2(t,e,r,i,n,a){let s=i+Mo(n,256),o=i,l=r;for(;o!==s;){let u=Math.min(Is,s-o);l=m2(t,e,l,o,u,a),o=o+u|0}return l}function x2(t,e,r,i,n,a){if(a===0)return e;let s=0,o=e,l=e+r,u=n,h=n,c=n+a,p=0,f=0;for(;o<l&&h<c;){let d=t[o]>>>s&255;if(s+=8,o+=s>>>5,s&=31,p|=(d&127)<<f,d&128)i[h++]=p|0,p=0,f=0;else if(f+=7,f>28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-u}/${a}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${a}, consumedWords=${o-e}/${r}, vbyteStart=${e}, vbyteEnd=${l})`);return o}function v2(t,e,r){let i=0,n=0,a=new Uint32Array(e),s=r??Pp();if(t.length>0){let u=t[i]|0;if(i=i+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(n+u>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${u}, out.length=${a.length})`);i=g2(t,a,i,n,u,s),n=n+u|0}let o=t.length-i|0,l=e-n|0;return x2(t,i,o,a,n,l),a}function b2(t,e,r,i,n){switch(n){case 2:Ox(t,e,r,i);return;case 3:Rx(t,e,r,i);return;case 4:$x(t,e,r,i);return;case 5:Nx(t,e,r,i);return;case 6:Ux(t,e,r,i);return;case 7:qx(t,e,r,i);return;case 8:Gx(t,e,r,i);return;case 9:jx(t,e,r,i);return;case 10:Yx(t,e,r,i);return;case 11:Xx(t,e,r,i);return;case 12:Zx(t,e,r,i);return;case 16:Wx(t,e,r,i);return;case 32:for(let u=0;u<32;u=u+1|0)r[i+u|0]=t[e+u|0]|0;return}let a=ks[n]>>>0,s=e,o=0,l=t[s]>>>0;for(let u=0;u<32;u++)if(o+n<=32){let h=l>>>o&a;r[i+u]=h|0,o+=n,o===32&&(o=0,s++,u!==31&&(l=t[s]>>>0))}else{let h=32-o,c=l>>>o;s++,l=t[s]>>>0;let p=ks[n-h]>>>0,f=(c|(l&p)<<h)&a;r[i+u]=f|0,o=n-h}}function w2(t,e,r,i){if(e<0||r<0||e+r>t.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${r}, bytes.length=${t.length})`);let n=Math.floor(r/4),a=r%4!=0,s=a?n+1:n;if(i.length<s)throw RangeError(`decodeBigEndianInt32sInto: out.length=${i.length} < ${s}`);if(n>0){let o=t.byteOffset+e;if(o&3)for(let l=0;l<n;l++){let u=e+l*4;i[l]=t[u]<<24|t[u+1]<<16|t[u+2]<<8|t[u+3]|0}else{let l=new Uint32Array(t.buffer,o,n);for(let u=0;u<n;u++)i[u]=Vx(l[u])|0}}if(a){let o=e+n*4,l=r-n*4,u=0;for(let h=0;h<l;h++)u|=t[o+h]<<24-h*8;i[n]=u|0}return s}function wt(t,e,r){let i=new Uint32Array(r),n=0,a=e.get();for(let s=0;s<i.length;s++){let o=t[a++],l=o&127;if(o<128){i[n++]=l;continue}if(o=t[a++],l|=(o&127)<<7,o<128){i[n++]=l;continue}if(o=t[a++],l|=(o&127)<<14,o<128){i[n++]=l;continue}if(o=t[a++],l|=(o&127)<<21,o<128){i[n++]=l;continue}o=t[a++],l|=(o&15)<<28,i[n++]=l}return e.set(a),i}function Do(t,e,r){let i=new BigUint64Array(r);for(let n=0;n<i.length;n++)i[n]=_2(t,e);return i}function _2(t,e){let r=0n,i=0,n=e.get();for(;n<t.length;){let a=t[n++];if(r|=BigInt(a&127)<<BigInt(i),!(a&128))break;if(i+=7,i>=64)throw Error(\"Varint too long\")}return e.set(n),r}function S2(t,e,r){let i=new Float64Array(r);for(let n=0;n<r;n++)i[n]=A2(t,e);return i}function A2(t,e){let r,i;return i=t[e.get()],e.increment(),r=i&127,i<128||(i=t[e.get()],e.increment(),r|=(i&127)<<7,i<128)||(i=t[e.get()],e.increment(),r|=(i&127)<<14,i<128)||(i=t[e.get()],e.increment(),r|=(i&127)<<21,i<128)?r:(i=t[e.get()],r|=(i&15)<<28,T2(r,t,e))}function T2(t,e,r){let i,n;if(n=e[r.get()],r.increment(),i=(n&112)>>4,n<128||(n=e[r.get()],r.increment(),i|=(n&127)<<3,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<10,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<17,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<24,n<128)||(n=e[r.get()],r.increment(),i|=(n&1)<<31,n<128))return i*4294967296+(t>>>0);throw Error(\"Expected varint not more than 10 bytes\")}function k2(t,e,r,i){return I2(t,e,r,i,o2(r>>>2))}function I2(t,e,r,i,n){let a=i.get();if(r&3)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${a} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=r>>>2,o=l2(n,s);w2(t,a,r,o);let l=v2(o.subarray(0,s),e,n.decoderWorkspace);return i.add(r),l}function X(t){return t>>>1^-(t&1)}function vt(t){return t>>1n^-(t&1n)}function ce(t){return t%2==1?(t+1)/-2:t/2}function E2(t){let e=new Int32Array(t.length);for(let r=0;r<t.length;r++)e[r]=X(t[r]);return e}function M2(t){let e=new BigInt64Array(t.length);for(let r=0;r<t.length;r++)e[r]=vt(t[r]);return e}function D2(t){for(let e=0;e<t.length;e++)t[e]=ce(t[e])}function Es(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=t[a]}let i=new Uint32Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];i.fill(o,n,n+s),n+=s}return i}function Ms(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=Number(t[a])}let i=new BigUint64Array(r),n=0;for(let a=0;a<e;a++){let s=Number(t[a]),o=t[a+e];i.fill(o,n,n+s),n+=s}return i}function Cp(t,e,r){let i=new Float64Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];i.fill(o,n,n+s),n+=s}return i}function gu(t){let e=new Int32Array(t.length);e[0]=X(t[0]);let r=t.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let n=t[i],a=t[i+1],s=t[i+2],o=t[i+3];e[i]=X(n)+e[i-1],e[i+1]=X(a)+e[i],e[i+2]=X(s)+e[i+1],e[i+3]=X(o)+e[i+2]}for(;i!==t.length;++i)e[i]=X(t[i])+e[i-1];return e}function xu(t){let e=new BigInt64Array(t.length);e[0]=vt(t[0]);let r=t.length/4*4,i=1;if(r>=4)for(;i<r-4;i+=4){let n=t[i],a=t[i+1],s=t[i+2],o=t[i+3];e[i]=vt(n)+e[i-1],e[i+1]=vt(a)+e[i],e[i+2]=vt(s)+e[i+1],e[i+3]=vt(o)+e[i+2]}for(;i!==e.length;++i)e[i]=vt(t[i])+e[i-1];return e}function F2(t){t[0]=ce(t[0]);let e=t.length/4*4,r=1;if(e>=4)for(;r<e-4;r+=4){let i=t[r],n=t[r+1],a=t[r+2],s=t[r+3];t[r]=ce(i)+t[r-1],t[r+1]=ce(n)+t[r],t[r+2]=ce(a)+t[r+1],t[r+3]=ce(s)+t[r+2]}for(;r!==t.length;++r)t[r]=ce(t[r])+t[r-1]}function P2(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=t[a]}let i=new Int32Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];o=X(o),i.fill(o,n,n+s),n+=s}return i}function C2(t,e,r){if(r===void 0){r=0;for(let a=0;a<e;a++)r+=Number(t[a])}let i=new BigInt64Array(r),n=0;for(let a=0;a<e;a++){let s=Number(t[a]),o=t[a+e];o=vt(o),i.fill(o,n,n+s),n+=s}return i}function z2(t,e,r){let i=new Float64Array(r),n=0;for(let a=0;a<e;a++){let s=t[a],o=t[a+e];o=ce(o),i.fill(o,n,n+s),n+=s}return i}function Fo(t){let e=t.length/4*4,r=1;if(e>=4)for(let i=t[0];r<e-4;r+=4)i=t[r]+=i,i=t[r+1]+=i,i=t[r+2]+=i,i=t[r+3]+=i;for(;r!==t.length;)t[r]+=t[r-1],++r}function B2(t){let e=0;for(let r=0;r<t.length;r++)t[r]+=e,e=t[r]}function L2(t){if(t.length<2)return new Int32Array(t);let e=new Int32Array(t.length);e[0]=X(t[0]),e[1]=X(t[1]);let r=t.length/4*4,i=2;if(r>=4)for(;i<r-4;i+=4){let n=t[i],a=t[i+1],s=t[i+2],o=t[i+3];e[i]=X(n)+e[i-2],e[i+1]=X(a)+e[i-1],e[i+2]=X(s)+e[i],e[i+3]=X(o)+e[i+1]}for(;i!==t.length;i+=2)e[i]=X(t[i])+e[i-2],e[i+1]=X(t[i+1])+e[i-1];return e}function zp(t,e,r,i){if(t.length<2)return new Int32Array(t);let n=new Int32Array(t.length),a=X(t[0]),s=X(t[1]);n[0]=ue(Math.round(a*e),r,i),n[1]=ue(Math.round(s*e),r,i);let o=t.length/16,l=2;if(o>=4)for(;l<o-4;l+=4){let u=t[l],h=t[l+1],c=X(u)+a,p=X(h)+s;n[l]=ue(Math.round(c*e),r,i),n[l+1]=ue(Math.round(p*e),r,i);let f=t[l+2],d=t[l+3];a=X(f)+c,s=X(d)+p,n[l+2]=ue(Math.round(a*e),r,i),n[l+3]=ue(Math.round(s*e),r,i)}for(;l!==t.length;l+=2)a+=X(t[l]),s+=X(t[l+1]),n[l]=ue(Math.round(a*e),r,i),n[l+1]=ue(Math.round(s*e),r,i);return n}function ue(t,e,r){return Math.min(r,Math.max(e,t))}function V2(t){let e=new Int32Array(t.length+1);e[0]=0,e[1]=X(t[0]);let r=e[1];for(let i=2;i!==e.length;++i){let n=t[i-1],a=X(n);r+=a,e[i]=e[i-1]+r}return new Uint32Array(e)}function O2(t,e,r){let i=new Int32Array(r+1);i[0]=0;let n=1,a=i[0];for(let s=0;s<e;s++){let o=t[s],l=t[s+e];l=X(l);for(let u=n;u<n+o;u++)i[u]=l+a,a=i[u];n+=o}return i}function R2(t,e,r){let i=new Uint32Array(r+1);i[0]=0;let n=1,a=i[0];for(let s=0;s<e;s++){let o=t[s],l=t[s+e];for(let u=n;u<n+o;u++)i[u]=l+a,a=i[u];n+=o}return i}function $2(t,e,r){let i=new Int32Array(r),n=0,a=0;for(let s=0;s<e;s++){let o=t[s],l=t[s+e],u=X(l);for(let h=0;h<o;h++)a+=u,i[n++]=a}return i}function N2(t,e,r){let i=new BigInt64Array(r),n=0,a=0n;for(let s=0;s<e;s++){let o=Number(t[s]),l=t[s+e],u=vt(l);for(let h=0;h<o;h++)a+=u,i[n++]=a}return i}function vu(t){let e=new Uint32Array(t.length);e[0]=X(t[0])>>>0;for(let r=1;r<t.length;r++)e[r]=e[r-1]+X(t[r])>>>0;return e}function bu(t){let e=new BigUint64Array(t.length);e[0]=BigInt.asUintN(64,vt(t[0]));for(let r=1;r<t.length;r++)e[r]=BigInt.asUintN(64,e[r-1]+vt(t[r]));return e}function U2(t){if(t.length<2)return new Uint32Array(t);let e=new Uint32Array(t.length);e[0]=X(t[0])>>>0,e[1]=X(t[1])>>>0;for(let r=2;r<t.length;r+=2)e[r]=e[r-2]+X(t[r])>>>0,e[r+1]=e[r-1]+X(t[r+1])>>>0;return e}function q2(t,e,r,i){let n=zp(t,e,r,i);return new Uint32Array(n)}function G2(t){return t[1]}function j2(t){return X(t[1])}function Y2(t){if(t.length===2){let e=X(t[1]);return[e,e]}return[X(t[2]),X(t[3])]}function X2(t){return t[1]}function Z2(t){return vt(t[1])}function W2(t){if(t.length===2){let e=vt(t[1]);return[e,e]}return[vt(t[2]),vt(t[3])]}var ht;(function(t){t.PRESENT=\"PRESENT\",t.DATA=\"DATA\",t.OFFSET=\"OFFSET\",t.LENGTH=\"LENGTH\"})(ht||={});var Tt;(function(t){t.NONE=\"NONE\",t.SINGLE=\"SINGLE\",t.SHARED=\"SHARED\",t.VERTEX=\"VERTEX\",t.MORTON=\"MORTON\",t.FSST=\"FSST\"})(Tt||={});var ne;(function(t){t.VERTEX=\"VERTEX\",t.INDEX=\"INDEX\",t.STRING=\"STRING\",t.KEY=\"KEY\"})(ne||={});var dt;(function(t){t.VAR_BINARY=\"VAR_BINARY\",t.GEOMETRIES=\"GEOMETRIES\",t.PARTS=\"PARTS\",t.RINGS=\"RINGS\",t.TRIANGLES=\"TRIANGLES\",t.SYMBOL=\"SYMBOL\",t.DICTIONARY=\"DICTIONARY\"})(dt||={});var H2=[ht.PRESENT,ht.DATA,ht.OFFSET,ht.LENGTH],wu=[G.NONE,G.DELTA,G.COMPONENTWISE_DELTA,G.RLE,G.MORTON,G.PDE],K2=[Rt.NONE,Rt.FAST_PFOR,Rt.VARINT],J2=[Tt.NONE,Tt.SINGLE,Tt.SHARED,Tt.VERTEX,Tt.MORTON,Tt.FSST],Q2=[ne.VERTEX,ne.INDEX,ne.STRING,ne.KEY],tv=[dt.VAR_BINARY,dt.GEOMETRIES,dt.PARTS,dt.RINGS,dt.TRIANGLES,dt.SYMBOL,dt.DICTIONARY];function tt(t,e){let r=iv(t,e);return r.logicalLevelTechnique1===G.MORTON?ev(r,t,e):(G.RLE===r.logicalLevelTechnique1||G.RLE===r.logicalLevelTechnique2)&&Rt.NONE!==r.physicalLevelTechnique?rv(r,t,e):r}function ev(t,e,r){let i=wt(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:t.decompressedCount,numBits:i[0],coordinateShift:i[1]}}function rv(t,e,r){let i=wt(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}function iv(t,e){let r=t[e.get()],i=H2[r>>4],n={};switch(i){case ht.DATA:n={dictionaryType:J2[r&15]};break;case ht.OFFSET:n={offsetType:Q2[r&15]};break;case ht.LENGTH:n={lengthType:tv[r&15]}}e.increment();let a=t[e.get()],s=wu[a>>5],o=wu[a>>2&7],l=K2[a&3];e.increment();let u=wt(t,e,2),h=u[0],c=u[1];return{physicalStreamType:i,logicalStreamType:n,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var J;(function(t){t[t.FLAT=0]=\"FLAT\",t[t.CONST=1]=\"CONST\",t[t.SEQUENCE=2]=\"SEQUENCE\",t[t.DICTIONARY=3]=\"DICTIONARY\",t[t.FSST_DICTIONARY=4]=\"FSST_DICTIONARY\"})(J||={});var qt=class{constructor(t,e){this.values=t,this._size=e}get(t){let e=Math.floor(t/8),r=t%8;return(this.values[e]>>r&1)==1}set(t,e){let r=Math.floor(t/8),i=t%8;this.values[r]=this.values[r]|+!!e<<i}getInt(t){let e=Math.floor(t/8),r=t%8;return this.values[e]>>r&1}size(){return this._size}getBuffer(){return this.values}};function $e(t,e,r){if(!e)return t;let i=e.size(),n=t.constructor,a=new n(i),s=0;for(let o=0;o<i;o++)a[o]=e.get(o)?t[s++]:r;return a}function nv(t,e,r){if(!r)return t;let i=r.size(),n=new qt(t,e),a=new qt(new Uint8Array(Math.ceil(i/8)),i),s=0;for(let o=0;o<i;o++){let l=r.get(o)?n.get(s++):!1;a.set(o,l)}return a.getBuffer()}function Bp(t,e,r){for(let i=0;i<t;i++){let n=tt(e,r);r.add(n.byteLength)}}function gr(t,e,r,i,n){let a=av(t,Math.ceil(e/8),r,i);return n?nv(a,e,n):a}function av(t,e,r,i){let n=new Uint8Array(e),a=0,s=i.get()+r;for(;a<e&&!(i.get()>=s);){let o=t[i.increment()];if(o<=127){let l=o+3,u=t[i.increment()],h=Math.min(a+l,e);n.fill(u,a,h),a=h}else{let l=256-o;for(let u=0;u<l&&a<e;u++)n[a++]=t[i.increment()]}}return i.set(s),n}function Lp(t,e,r,i){let n=e.get(),a=n+r*Float32Array.BYTES_PER_ELEMENT,s=new Uint8Array(t.subarray(n,a)).buffer,o=new Float32Array(s);return e.set(a),i?$e(o,i,0):o}function Vp(t,e,r,i){let n=e.get(),a=n+r*Float64Array.BYTES_PER_ELEMENT,s=new Uint8Array(t.subarray(n,a)).buffer,o=new Float64Array(s);return e.set(a),i?$e(o,i,0):o}function sv(t,e,r){let i=e.get(),n=r*Uint32Array.BYTES_PER_ELEMENT,a=new DataView(t.buffer,t.byteOffset,t.byteLength),s=new Uint32Array(r);for(let o=0;o<r;o++)s[o]=a.getUint32(i+o*Uint32Array.BYTES_PER_ELEMENT,!0);return e.add(n),s}function ov(t,e,r){let i=e.get(),n=r*BigUint64Array.BYTES_PER_ELEMENT,a=new DataView(t.buffer,t.byteOffset,t.byteLength),s=new BigUint64Array(r);for(let o=0;o<r;o++)s[o]=a.getBigUint64(i+o*BigUint64Array.BYTES_PER_ELEMENT,!0);return e.add(n),s}var lv=new TextDecoder;function Po(t,e,r){return r-e>=12?lv.decode(t.subarray(e,r)):uv(t,e,r)}function uv(t,e,r){let i=\"\",n=e;for(;n<r;){let a=t[n],s=null,o=a>239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function pn(t,e,r,i,n){return dv(xr(t,e,r),r,i,n)}function xt(t,e,r,i,n){return yv(xr(t,e,r),r,i,n)}function pe(t,e,r){return gv(xr(t,e,r),r)}function xr(t,e,r){let i=r.physicalLevelTechnique;switch(i){case Rt.FAST_PFOR:return k2(t,r.numValues,r.byteLength,e);case Rt.VARINT:return wt(t,e,r.numValues);case Rt.NONE:return sv(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function gi(t,e,r){let i=r.physicalLevelTechnique;switch(i){case Rt.VARINT:return Do(t,e,r.numValues);case Rt.NONE:return ov(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function hv(t,e,r){let i=xr(t,e,r);return i.length===1?X(i[0]):j2(i)}function Co(t,e,r){let i=xr(t,e,r);return i.length===1?r.logicalLevelTechnique1===G.DELTA?X(i[0]):i[0]:G2(i)}function Op(t,e,r){return Y2(xr(t,e,r))}function Rp(t,e,r){return W2(Do(t,e,r.numValues))}function $p(t,e,r,i){return Up(gi(t,e,r),r,i)}function zo(t,e,r,i){return qp(gi(t,e,r),r,i)}function cv(t,e,r,i){let n=pv(t,e,r,!1);return i?$e(n,i,0):n}function pv(t,e,r,i){if(r.physicalLevelTechnique===Rt.VARINT)return mv(S2(t,e,r.numValues),r,i);let n=gi(t,e,r),a=i?Up(n,r):qp(n,r);return Float64Array.from(a,Number)}function fv(t,e,r){let i=gi(t,e,r);return i.length===1?vt(i[0]):Z2(i)}function Np(t,e,r){let i=gi(t,e,r);return i.length===1?r.logicalLevelTechnique1===G.DELTA?vt(i[0]):i[0]:X2(i)}function dv(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case G.DELTA:if(e.logicalLevelTechnique2===G.RLE){let a=e;if(!i)return $2(t,a.runs,a.numRleValues);t=Es(t,a.runs,a.numRleValues),n=gu(t)}else n=gu(t);break;case G.RLE:n=P2(t,e.runs,e.numRleValues);break;case G.MORTON:Fo(t),n=new Int32Array(t);break;case G.COMPONENTWISE_DELTA:if(r&&!i)return zp(t,r.scale,r.min,r.max);n=L2(t);break;case G.NONE:n=E2(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?$e(n,i,0):n}function yv(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case G.DELTA:if(e.logicalLevelTechnique2===G.RLE){let a=e;n=vu(Es(t,a.runs,a.numRleValues))}else n=vu(t);break;case G.RLE:n=Es(t,e.runs,e.numRleValues);break;case G.MORTON:Fo(t),n=t;break;case G.COMPONENTWISE_DELTA:n=r&&!i?q2(t,r.scale,r.min,r.max):U2(t);break;case G.NONE:n=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?$e(n,i,0):n}function Up(t,e,r){let i;switch(e.logicalLevelTechnique1){case G.DELTA:if(e.logicalLevelTechnique2===G.RLE){let n=e;if(!r)return N2(t,n.runs,n.numRleValues);t=Ms(t,n.runs,n.numRleValues),i=xu(t)}else i=xu(t);break;case G.RLE:i=C2(t,e.runs,e.numRleValues);break;case G.NONE:i=M2(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?$e(i,r,0n):i}function qp(t,e,r){let i;switch(e.logicalLevelTechnique1){case G.DELTA:if(e.logicalLevelTechnique2===G.RLE){let n=e;i=bu(Ms(t,n.runs,n.numRleValues))}else i=bu(t);break;case G.RLE:i=Ms(t,e.runs,e.numRleValues);break;case G.NONE:i=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?$e(i,r,0n):i}function mv(t,e,r){switch(e.logicalLevelTechnique1){case G.DELTA:if(e.logicalLevelTechnique2===G.RLE){let i=e;t=Cp(t,i.runs,i.numRleValues)}return F2(t),t;case G.RLE:return vv(t,e,r);case G.NONE:return r&&D2(t),t;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function gv(t,e){if(e.logicalLevelTechnique1===G.DELTA&&e.logicalLevelTechnique2===G.NONE)return V2(t);if(e.logicalLevelTechnique1===G.RLE&&e.logicalLevelTechnique2===G.NONE){let r=e;return R2(t,r.runs,r.numRleValues)}if(e.logicalLevelTechnique1===G.NONE&&e.logicalLevelTechnique2===G.NONE){B2(t);let r=new Uint32Array(e.numValues+1);return r[0]=0,r.set(t,1),r}if(e.logicalLevelTechnique1===G.DELTA&&e.logicalLevelTechnique2===G.RLE){let r=e,i=O2(t,r.runs,r.numRleValues);return Fo(i),new Uint32Array(i)}throw Error(\"Only delta encoding is supported for transforming length to offset streams yet.\")}function $n(t,e,r,i,n=\"int32\"){let a=t.logicalLevelTechnique1;if(a===G.RLE)return t.runs===1?J.CONST:J.FLAT;if(a!==G.DELTA||t.logicalLevelTechnique2!==G.RLE)return t.numValues===1?J.CONST:J.FLAT;let s=e instanceof qt?e.size():e,o=t;if(o.numRleValues!==s)return J.FLAT;if(o.runs===1)return J.SEQUENCE;if(o.runs!==2)return t.numValues===1?J.CONST:J.FLAT;let l=i.get();if(t.physicalLevelTechnique===Rt.VARINT)return xv(r,i,n)?J.SEQUENCE:t.numValues===1?J.CONST:J.FLAT;let u=i.get(),h=new Int32Array(r.buffer,r.byteOffset+u,4);return i.set(l),h[2]===2&&h[3]===2?J.SEQUENCE:t.numValues===1?J.CONST:J.FLAT}function xv(t,e,r){let i=new Dp(e.get());if(r===\"int64\"){let a=Do(t,i,4);return a[2]===2n&&a[3]===2n}let n=wt(t,i,4);return n[2]===2&&n[3]===2}function vv(t,e,r){return r?z2(t,e.runs,e.numRleValues):Cp(t,e.runs,e.numRleValues)}var Gp=class extends Rn{getValueFromBuffer(t){return this.dataBuffer[t]}},jp=class extends Ep{constructor(t,e,r,i,n){super(t,n?BigInt64Array.of(e):BigUint64Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}};function Bo(t,e,r){return{x:_u(t,e)-r,y:_u(t>>1,e)-r}}function _u(t,e){let r=0;for(let i=0;i<e;i++)r|=(t&1<<2*i)>>i;return r}var bt;(function(t){t[t.POINT=0]=\"POINT\",t[t.LINESTRING=1]=\"LINESTRING\",t[t.POLYGON=2]=\"POLYGON\",t[t.MULTIPOINT=3]=\"MULTIPOINT\",t[t.MULTILINESTRING=4]=\"MULTILINESTRING\",t[t.MULTIPOLYGON=5]=\"MULTIPOLYGON\"})(bt||={});var bv;(function(t){t[t.POINT=0]=\"POINT\",t[t.LINESTRING=1]=\"LINESTRING\",t[t.POLYGON=2]=\"POLYGON\"})(bv||={});var Ne;(function(t){t[t.MORTON=0]=\"MORTON\",t[t.VEC_2=1]=\"VEC_2\",t[t.VEC_3=2]=\"VEC_3\"})(Ne||={});function wv(t){let e=Array(t.numGeometries),r=1,i=1,n=1,a=0,s=0,o=0,l=t.mortonSettings,u=t.topologyVector,h=u.geometryOffsets,c=u.partOffsets,p=u.ringOffsets,f=t.vertexOffsets,d=!f||f.length===0,y=t.containsPolygonGeometry(),m=t.vertexBuffer;for(let g=0;g<t.numGeometries;g++){let x=t.geometryType(g);switch(x){case bt.POINT:{let b,v;if(d)b=m[s++],v=m[s++];else if(t.vertexBufferType===Ne.MORTON){let _=m[f[o++]],A=Bo(_,l.numBits,l.coordinateShift);b=A.x,v=A.y}else{let _=f[o++]*2;b=m[_],v=m[_+1]}e[a++]=[[new F(b,v)]],h&&n++,c&&r++,p&&i++}break;case bt.MULTIPOINT:{let b=h[n]-h[n-1];n++;let v;if(d){v=Array(b);for(let _=0;_<b;_++){let A=m[s++],S=m[s++];v[_]=new F(A,S)}}else v=Ae(t.vertexBufferType,m,f,o,b,!1,l),o+=b;e[a++]=v.map(_=>[_]),r+=b,i+=b}break;case bt.LINESTRING:{let b;y?(b=p[i]-p[i-1],i++):b=c[r]-c[r-1],r++;let v;d?(v=Ge(m,s,b,!1),s+=b*2):(v=Ae(t.vertexBufferType,m,f,o,b,!1,l),o+=b),e[a++]=[v],h&&n++}break;case bt.POLYGON:{let b=c[r]-c[r-1];r++;let v=Array(b-1),_,A=p[i]-p[i-1];if(i++,d){_=Ge(m,s,A,!0),s+=A*2;for(let S=0;S<v.length;S++)A=p[i]-p[i-1],i++,v[S]=Ge(m,s,A,!0),s+=A*2}else{_=Ae(t.vertexBufferType,m,f,o,A,!0,l),o+=A;for(let S=0;S<v.length;S++)A=p[i]-p[i-1],i++,v[S]=Ae(t.vertexBufferType,m,f,o,A,!0,l),o+=A}e[a++]=[_].concat(v),h&&n++}break;case bt.MULTILINESTRING:{let b=h[n]-h[n-1];n++;let v=Array(b);for(let _=0;_<b;_++){let A;if(y?(A=p[i]-p[i-1],i++):A=c[r]-c[r-1],r++,d)v[_]=Ge(m,s,A,!1),s+=A*2;else{let S=Ae(t.vertexBufferType,m,f,o,A,!1,l);v[_]=S,o+=A}}e[a++]=v}break;case bt.MULTIPOLYGON:{let b=h[n]-h[n-1];n++;let v=Array(b);for(let _=0;_<b;_++){let A=c[r]-c[r-1];r++;let S,k=Array(A-1),T=p[i]-p[i-1];i++,d?(S=Ge(m,s,T,!0),s+=T*2):(S=Ae(t.vertexBufferType,m,f,o,T,!0,l),o+=T);for(let L=0;L<k.length;L++){let V=p[i]-p[i-1];i++,d?(k[L]=Ge(m,s,V,!0),s+=V*2):(k[L]=Ae(t.vertexBufferType,m,f,o,V,!0,l),o+=V)}v[_]=[S].concat(k)}e[a++]=v.flat()}break;default:throw Error(`The specified geometry type (${x}) is currently not supported.`)}}return e}function Ae(t,e,r,i,n,a,s){return t===Ne.MORTON?Sv(e,r,i,n,a,s):_v(e,r,i,n,a)}function Ge(t,e,r,i){let n=Array(i?r+1:r);for(let a=0;a<r*2;a+=2){let s=t[e+a],o=t[e+a+1];n[a/2]=new F(s,o)}return i&&(n[n.length-1]=n[0]),n}function _v(t,e,r,i,n){let a=Array(n?i+1:i);for(let s=0;s<i*2;s+=2){let o=e[r+s/2]*2,l=t[o],u=t[o+1];a[s/2]=new F(l,u)}return n&&(a[a.length-1]=a[0]),a}function Sv(t,e,r,i,n,a){let s=Array(n?i+1:i);for(let o=0;o<i;o++){let l=t[e[r+o]],u=Bo(l,a.numBits,a.coordinateShift);s[o]=new F(u.x,u.y)}return n&&(s[s.length-1]=s[0]),s}var Yp=class{constructor(t,e,r,i,n){this._vertexBufferType=t,this._topologyVector=e,this._vertexOffsets=r,this._vertexBuffer=i,this._mortonSettings=n}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(t){let e=this.vertexOffsets?this.vertexOffsets[t]*2:t*2;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getVertex(t){if(this.vertexOffsets&&this.mortonSettings){let r=this.vertexOffsets[t],i=this.vertexBuffer[r],n=Bo(i,this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[n.x,n.y]}let e=this.vertexOffsets?this.vertexOffsets[t]*2:t*2;return[this.vertexBuffer[e],this.vertexBuffer[e+1]]}getGeometries(){return wv(this)}get mortonSettings(){return this._mortonSettings}};function Av(t,e,r,i,n){return new Xp(t,e,Ne.VEC_2,r,i,n)}function Tv(t,e,r,i,n,a){return new Xp(t,e,Ne.MORTON,r,i,n,a)}var Xp=class extends Yp{constructor(t,e,r,i,n,a,s){super(r,i,n,a,s),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===bt.POLYGON||this._geometryType===bt.MULTIPOLYGON}containsSingleGeometryType(){return!0}};function Zp(t,e,r,i){return new Wp(Ne.VEC_2,t,e,r,i)}function kv(t,e,r,i,n){return new Wp(Ne.MORTON,t,e,r,i,n)}var Wp=class extends Yp{constructor(t,e,r,i,n,a){super(t,r,i,n,a),this._geometryTypes=e}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsPolygonGeometry(){for(let t=0;t<this.numGeometries;t++)if(this.geometryType(t)===bt.POLYGON||this.geometryType(t)===bt.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}},Hp=class{constructor(t,e,r,i){this._triangleOffsets=t,this._indexBuffer=e,this._vertexBuffer=r,this._topologyVector=i}get triangleOffsets(){return this._triangleOffsets}get indexBuffer(){return this._indexBuffer}get vertexBuffer(){return this._vertexBuffer}get topologyVector(){return this._topologyVector}getGeometries(){if(!this._topologyVector)throw Error(\"Cannot convert GpuVector to coordinates without topology information\");let t=new Uint32Array(this.numGeometries);for(let e=0;e<this.numGeometries;e++)t[e]=this.geometryType(e);return Zp(t,this._topologyVector,void 0,this._vertexBuffer).getGeometries()}[Symbol.iterator](){return null}};function Su(t,e,r,i,n,a){return new Iv(t,e,r,i,n,a)}var Iv=class extends Hp{constructor(t,e,r,i,n,a){super(r,i,n,a),this._numGeometries=t,this._geometryType=e}geometryType(t){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}};function Au(t,e,r,i,n){return new Ev(t,e,r,i,n)}var Ev=class extends Hp{constructor(t,e,r,i,n){super(e,r,i,n),this._geometryTypes=t}geometryType(t){return this._geometryTypes[t]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}};function Mv(t,e,r,i,n){let a=tt(t,r),s=$n(a,i,t,r),o,l,u,h;if(s===J.CONST){let b=Co(t,r,a),v,_,A,S;for(let k=0;k<e-1;k++){let T=tt(t,r);switch(T.physicalStreamType){case ht.LENGTH:switch(T.logicalStreamType.lengthType){case dt.GEOMETRIES:v=pe(t,r,T);break;case dt.PARTS:_=pe(t,r,T);break;case dt.RINGS:A=pe(t,r,T);break;case dt.TRIANGLES:S=pe(t,r,T)}break;case ht.OFFSET:switch(T.logicalStreamType.offsetType){case ne.VERTEX:o=xt(t,r,T);break;case ne.INDEX:h=xt(t,r,T)}break;case ht.DATA:if(Tt.VERTEX===T.logicalStreamType.dictionaryType)l=pn(t,r,T,n);else{let L=T;u={numBits:L.numBits,coordinateShift:L.coordinateShift},l=xt(t,r,T,n)}}}return h?v!==void 0||_!==void 0?Su(i,b,S,h,l,{geometryOffsets:v,partOffsets:_,ringOffsets:A}):Su(i,b,S,h,l):u===void 0?Av(i,b,{geometryOffsets:v,partOffsets:_,ringOffsets:A},o,l):Tv(i,b,{geometryOffsets:v,partOffsets:_,ringOffsets:A},o,l,u)}let c=xt(t,r,a),p,f,d,y;for(let b=0;b<e-1;b++){let v=tt(t,r);switch(v.physicalStreamType){case ht.LENGTH:switch(v.logicalStreamType.lengthType){case dt.GEOMETRIES:p=xt(t,r,v);break;case dt.PARTS:f=xt(t,r,v);break;case dt.RINGS:d=xt(t,r,v);break;case dt.TRIANGLES:y=pe(t,r,v)}break;case ht.OFFSET:switch(v.logicalStreamType.offsetType){case ne.VERTEX:o=xt(t,r,v);break;case ne.INDEX:h=xt(t,r,v)}break;case ht.DATA:if(Tt.VERTEX===v.logicalStreamType.dictionaryType)l=pn(t,r,v,n);else{let _=v;u={numBits:_.numBits,coordinateShift:_.coordinateShift},l=xt(t,r,v,n)}}}let m,g,x;return p?(m=ya(c,p,2),f&&d?(g=Tu(c,m,f,!1),x=Fv(c,m,g,d)):f&&(g=Dv(c,m,f))):f&&d?(g=ya(c,f,1),x=Tu(c,g,d,!0)):f&&(g=ya(c,f,0)),h&&!g?Au(c,y,h,l):h?Au(c,y,h,l,{geometryOffsets:m,partOffsets:g,ringOffsets:x}):u===void 0?Zp(c,{geometryOffsets:m,partOffsets:g,ringOffsets:x},o,l):kv(c,{geometryOffsets:m,partOffsets:g,ringOffsets:x},o,l,u)}function ya(t,e,r){let i=new Uint32Array(t.length+1),n=0;i[0]=n;let a=0;for(let s=0;s<t.length;s++)n=i[s+1]=n+(t[s]>r?e[a++]:1);return i}function Tu(t,e,r,i){let n=new Uint32Array(e[e.length-1]+1),a=0;n[0]=a;let s=1,o=0;for(let l=0;l<t.length;l++){let u=t[l],h=e[l+1]-e[l];if(u===5||u===2||i&&(u===4||u===1))for(let c=0;c<h;c++)a=n[s++]=a+r[o++];else for(let c=0;c<h;c++)n[s++]=++a}return n}function Dv(t,e,r){let i=new Uint32Array(e[e.length-1]+1),n=0;i[0]=n;let a=1,s=0;for(let o=0;o<t.length;o++){let l=t[o],u=e[o+1]-e[o];if(l===4||l===1)for(let h=0;h<u;h++)n=i[a++]=n+r[s++];else for(let h=0;h<u;h++)i[a++]=++n}return i}function Fv(t,e,r,i){let n=new Uint32Array(r[r.length-1]+1),a=0;n[0]=a;let s=1,o=1,l=0;for(let u=0;u<t.length;u++){let h=t[u],c=e[u+1]-e[u];if(h!==0&&h!==3)for(let p=0;p<c;p++){let f=r[s]-r[s-1];s++;for(let d=0;d<f;d++)a=n[o++]=a+i[l++]}else for(let p=0;p<c;p++)n[o++]=++a,s++}return n}var Pv=class extends Re{constructor(t,e,r){super(t,e.getBuffer(),r),this.dataVector=e}getValueFromBuffer(t){return this.dataVector.get(t)}},Cv=class extends Rn{getValueFromBuffer(t){return this.dataBuffer[t]}},Kp=class extends Re{constructor(t,e,r,i){super(t,i?BigInt64Array.of(e):BigUint64Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}},Lo=class extends Re{constructor(t,e,r,i){super(t,r,i),this.offsetBuffer=e}},ku=class extends Lo{constructor(t,e,r,i){super(t,e,r,i??e.length-1)}getValueFromBuffer(t){let e=this.offsetBuffer[t],r=this.offsetBuffer[t+1];return Po(this.dataBuffer,e,r)}},ir=class extends Lo{constructor(t,e,r,i,n){super(t,r,i,n??e.length),this.indexBuffer=e,this.indexBuffer=e}getValueFromBuffer(t){let e=this.indexBuffer[t],r=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return Po(this.dataBuffer,r,i)}};function zv(t,e){let r=0;for(let i=0;i<e.length;i++){let n=e[i];n===255?(r++,i++):r+=t[n]}return r}function Bv(t,e,r){let i=new Uint32Array(e.length);for(let s=1;s<e.length;s++)i[s]=i[s-1]+e[s-1];let n=new Uint8Array(zv(e,r)),a=0;for(let s=0;s<r.length;s++){let o=r[s];if(o===255)s++,n[a++]=r[s];else{let l=e[o],u=i[o];for(;l-- >0;)n[a++]=t[u++]}}return n}var Jp=class extends Lo{constructor(t,e,r,i,n,a,s,o){super(t,r,i,s??e.length),this.indexBuffer=e,this.symbolOffsetBuffer=n,this.symbolTableBuffer=a,this.sharedDictionaryCache=o}getValueFromBuffer(t){this.decodedDictionary??(this.decodedDictionary=this.sharedDictionaryCache?.decodedDictionary,this.decodedDictionary??(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let e=this.indexBuffer[t],r=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return Po(this.decodedDictionary,r,i)}decodeDictionary(){return this.symbolLengthBuffer??=this.offsetToLengthBuffer(this.symbolOffsetBuffer),Bv(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(t){let e=new Uint32Array(t.length-1),r=t[0];for(let i=1;i<t.length;i++){let n=t[i];e[i-1]=n-r,r=n}return e}};function Qp(t,e,r,i,n){let a,s,o,l,u,h=n,c,p;for(let f=0;f<i;f++){let d=tt(e,r);switch(d.physicalStreamType){case ht.PRESENT:{let y=new qt(gr(e,d.numValues,d.byteLength,r),d.numValues);h=n??y;break}case ht.OFFSET:s=xt(e,r,d,void 0,h);break;case ht.LENGTH:{let y=pe(e,r,d);dt.DICTIONARY===d.logicalStreamType.lengthType?a=y:dt.SYMBOL===d.logicalStreamType.lengthType?l=y:c=y;break}case ht.DATA:{let y=e.subarray(r.get(),r.get()+d.byteLength);r.add(d.byteLength);let m=d.logicalStreamType.dictionaryType;Tt.FSST===m?u=y:Tt.SINGLE===m||Tt.SHARED===m?o=y:Tt.NONE===m&&(p=y);break}}}return Lv(t,u,s,a,o,l,h)??Vv(t,o,s,a,h)??Ov(t,c,p,s,h)}function Lv(t,e,r,i,n,a,s){if(e){if(!r||!i||!n||!a)throw Error(`Incomplete FSST dictionary string column \"${t}\"`);return new Jp(t,r,i,n,a,e,s)}}function Vv(t,e,r,i,n){if(e){if(!r||!i)throw Error(`Incomplete dictionary string column \"${t}\"`);return n?new ir(t,r,i,e,n):new ir(t,r,i,e)}}function Ov(t,e,r,i,n){if(!(!e||!r)){if(i)return n?new ir(t,i,e,r,n):new ir(t,i,e,r);if(n&&n.size()!==e.length-1){let a=new Uint32Array(n.size()),s=0;for(let o=0;o<n.size();o++)n.get(o)?a[o]=s++:a[o]=0;return new ir(t,a,e,r,n)}return n?new ku(t,e,r,n):new ku(t,e,r)}}function Rv(t,e,r,i){let n,a,s,o,l=!1;for(;!l;){let f=tt(t,e);switch(f.physicalStreamType){case ht.LENGTH:dt.DICTIONARY===f.logicalStreamType.lengthType?n=pe(t,e,f):s=pe(t,e,f);break;case ht.DATA:Tt.SINGLE===f.logicalStreamType.dictionaryType||Tt.SHARED===f.logicalStreamType.dictionaryType?(a=t.subarray(e.get(),e.get()+f.byteLength),l=!0):o=t.subarray(e.get(),e.get()+f.byteLength),e.add(f.byteLength)}}if(r.type!==\"complexType\")throw Error(`Shared dictionary column ${r.name} must be a complex (struct) column.`);if(!n||!a)throw Error(`Incomplete shared dictionary for column \"${r.name}\"`);let u=r.complexType.children,h=[],c=o?{}:void 0,p=0;for(let f of u){let d=wt(t,e,1)[0];if(d===0)continue;let y=f.name?`${r.name}${f.name}`:r.name;if(i&&!i.has(y)){Bp(d,t,e);continue}if(f.type!==\"scalarField\"||f.scalarField.physicalType!==Z.STRING)throw Error(\"Currently only scalar string fields are implemented for a struct.\");if(d>1&&!f.nullable||d===1&&f.nullable)throw Error(`The number of streams for the child field ${f.name} does not match its nullability. nullibilty: ${f.nullable}, numStreams: ${d}`);let m;if(f.nullable){let x=tt(t,e);m=new qt(gr(t,x.numValues,x.byteLength,e),x.numValues)}let g=xt(t,e,tt(t,e),void 0,m);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column \"${y}\"`);h[p++]=new Jp(y,g,n,a,s,o,m,c)}else h[p++]=new ir(y,g,n,a,m)}return h}var Iu=class extends Re{constructor(t,e,r){super(t,new Uint8Array,r??e.length),this.values=e}getValueFromBuffer(t){return this.values[t]}},ae;(function(t){t[t.STRING=1]=\"STRING\",t[t.INT32=2]=\"INT32\",t[t.UINT32=4]=\"UINT32\",t[t.INT64=8]=\"INT64\",t[t.UINT64=16]=\"UINT64\",t[t.FLOAT=32]=\"FLOAT\",t[t.DOUBLE=64]=\"DOUBLE\",t[t.PRESENCE=128]=\"PRESENCE\"})(ae||={});var Ee;(function(t){t[t.FALSE=0]=\"FALSE\",t[t.TRUE=1]=\"TRUE\",t[t.START_MAP=2]=\"START_MAP\",t[t.START_LIST=3]=\"START_LIST\",t[t.COUNT=4]=\"COUNT\"})(Ee||={});function $v(t,e,r,i){let n=Nv(r);if(i===0)return n.map(h=>new Iu(h,[]));let a=Uv(t,e,i),s=(a.presentStream?a.presentCount:a.lengthStream.length)/n.length,o=[],l=0,u=0;for(let h=0;h<n.length;h++){let c=Xv(a,h,s,l,u);o.push(new Iu(n[h],c.value,c.nullabilityBuffer)),l=c.countsEnd,u=c.valuesEnd}return o}function Nv(t){let e=t.type===\"complexType\"?t.complexType.children:void 0;return!e||e.length===0?[t.name]:e.map(r=>t.name+(r.name??\"\"))}function Uv(t,e,r){let i=t[e.get()];e.add(1);let n=xt(t,e,tt(t,e)),a=r-1,s=[];i&ae.STRING&&(a-=qv(t,e,s)),a-=Gv(t,e,i,s),a-=jv(t,e,i,s);let o,l=0;if(i&ae.PRESENCE){let h=Yv(t,e);o=h.value,l=h.count,a--}let u=new Uint32Array;if(a>0&&(u=xt(t,e,tt(t,e)),a--),a!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${a}`);return{lengthStream:n,dictionary:s,presentStream:o,presentCount:l,flattenedValues:u}}function qv(t,e,r){let i=t[e.get()];e.add(1);let n=Qp(\"\",t,e,i);if(n)for(let a=0;a<n.size;a++)r.push(n.getValue(a));return i}function Gv(t,e,r,i){let n=0;return r&ae.INT32?(Ke(i,pn(t,e,tt(t,e))),n++):r&ae.INT64&&(Ke(i,$p(t,e,tt(t,e))),n++),r&ae.UINT32?(Ke(i,xt(t,e,tt(t,e))),n++):r&ae.UINT64&&(Ke(i,zo(t,e,tt(t,e))),n++),n}function jv(t,e,r,i){let n=0;return r&ae.FLOAT&&(Ke(i,Lp(t,e,tt(t,e).numValues)),n++),r&ae.DOUBLE&&(Ke(i,Vp(t,e,tt(t,e).numValues)),n++),n}function Yv(t,e){let r=tt(t,e);if(r.physicalStreamType!==ht.PRESENT)throw Error(`Expected PRESENT stream for map column but found: ${r.physicalStreamType}`);let i=r.numValues,n=e.get(),a=new qt(gr(t,i,r.byteLength,e),i);return e.set(n+r.byteLength),{value:a,count:i}}function Xv(t,e,r,i,n){let{lengthStream:a,flattenedValues:s,presentStream:o,dictionary:l}=t,u=e*r,h=r,c;if(o){c=new qt(new Uint8Array(Math.ceil(r/8)),r),h=0;for(let x=0;x<r;x++)o.get(u+x)&&(c.set(x,!0),h++)}let p=i+h;if(p>a.length)throw Error(\"Merged map counts underflow while decoding child streams\");let f=Array(r),d=i,y=n;for(let x=0;x<r;x++){if(o&&!o.get(u+x)){f[x]=null;continue}let b=y+a[d++];if(b>s.length)throw Error(\"Map value stream underflow while decoding feature payload\");let v=Zv(s,y,b,l);f[x]=v.value,y=v.nextIndex}let m=0;for(let x=i;x<p;x++)m+=a[x];let g=n+m;if(y!==g)throw Error(\"Unused flattened map values remain after decode\");return{value:f,nullabilityBuffer:c,countsEnd:p,valuesEnd:g}}function Zv(t,e,r,i){return r-e===1||t[e]===Ee.START_LIST?Vo(t,e,r,i):tf(t,e,r,i)}function tf(t,e,r,i){let n=Object.create(null),a=e;for(;a<r;){let s=ef(t[a++],i);if(typeof s!=\"string\")throw Error(`Map key dictionary index does not resolve to a string: ${s}`);let o=Vo(t,a,r,i);n[s]=o.value,a=o.nextIndex}return{value:n,nextIndex:a}}function Vo(t,e,r,i){if(e>=r)throw Error(\"Unexpected end of map value stream\");let n=t[e];if(n===Ee.FALSE)return{value:!1,nextIndex:e+1};if(n===Ee.TRUE)return{value:!0,nextIndex:e+1};if(n===Ee.START_MAP){let a=Eu(t,e,r);return{value:tf(t,e+2,a,i).value,nextIndex:a}}if(n===Ee.START_LIST){let a=Eu(t,e,r),s=[],o=e+2;for(;o<a;){let l=Vo(t,o,a,i);s.push(l.value),o=l.nextIndex}return{value:s,nextIndex:a}}return{value:ef(n,i),nextIndex:e+1}}function Eu(t,e,r){if(e+1>=r)throw Error(\"Missing length for nested map/list payload\");let i=t[e+1];if(i<2)throw Error(`Invalid nested payload length: ${i}`);let n=e+i;if(n>r)throw Error(\"Nested payload exceeds containing payload bounds\");return n}function ef(t,e){let r=t-Ee.COUNT;if(r<0||r>=e.length)throw Error(`Scalar dictionary index out of range: ${t}`);return e[r]}function Ke(t,e){for(let r of e)t.push(r)}function Wv(t,e,r,i,n,a){return r.type===\"scalarType\"?a&&!a.has(r.name)?(Bp(i,t,e),null):Hv(i,t,e,n,r.scalarType,r):r.complexType?.physicalType===ge.MAP?$v(t,e,r,i):i===0?null:Rv(t,e,r,a)}function Hv(t,e,r,i,n,a){let s;if(t===0)return null;if(a.nullable){let l=tt(e,r),u=l.numValues,h=r.get(),c=gr(e,u,l.byteLength,r);r.set(h+l.byteLength),s=new qt(c,l.numValues)}let o=s??i;switch(n.physicalType){case Z.UINT_32:case Z.INT_32:return eb(e,r,a,n,o);case Z.STRING:{let l=a.nullable?t-1:t;return Qp(a.name,e,r,l,s)??null}case Z.BOOLEAN:return Kv(e,r,a,i,o);case Z.UINT_64:case Z.INT_64:return tb(e,r,a,o,n);case Z.FLOAT:return Jv(e,r,a,o);case Z.DOUBLE:return Qv(e,r,a,o);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}function Kv(t,e,r,i,n){let a=tt(t,e),s=a.numValues,o=e.get(),l=xi(n)?n:void 0,u=gr(t,s,a.byteLength,e,l);e.set(o+a.byteLength);let h=new qt(u,s);return new Pv(r.name,h,n)}function Jv(t,e,r,i){let n=tt(t,e),a=xi(i)?i:void 0,s=Lp(t,e,n.numValues,a);return new Cv(r.name,s,i)}function Qv(t,e,r,i){let n=tt(t,e),a=xi(i)?i:void 0,s=Vp(t,e,n.numValues,a);return new To(r.name,s,i)}function tb(t,e,r,i,n){let a=tt(t,e),s=$n(a,i,t,e,\"int64\"),o=n.physicalType===Z.INT_64;if(s===J.FLAT){let u=xi(i)?i:void 0,h=o?$p(t,e,a,u):zo(t,e,a,u);return new Gp(r.name,h,i)}if(s===J.SEQUENCE){let u=Rp(t,e,a);return new jp(r.name,u[0],u[1],a.numRleValues,o)}let l=o?fv(t,e,a):Np(t,e,a);return new Kp(r.name,l,i,o)}function eb(t,e,r,i,n){let a=tt(t,e),s=$n(a,n,t,e),o=i.physicalType===Z.INT_32;if(s===J.FLAT){let u=xi(n)?n:void 0,h=o?pn(t,e,a,void 0,u):xt(t,e,a,void 0,u);return new Ao(r.name,h,n)}if(s===J.SEQUENCE){let u=Op(t,e,a);return new ko(r.name,u[0],u[1],a.numRleValues,o)}let l=o?hv(t,e,a):Co(t,e,a);return new Io(r.name,l,n,o)}function xi(t){return t instanceof qt}var ft={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function rf(t){switch(t){case ft.ID:case ft.ID|ft.ID_NULLABLE:case ft.ID|ft.ID_LONG:case ft.ID|ft.ID_LONG|ft.ID_NULLABLE:return{nullable:(t&ft.ID_NULLABLE)!==0,columnScope:Or.FEATURE,type:\"scalarType\",scalarType:{longID:(t&ft.ID_LONG)!==0,type:\"logicalType\",logicalType:Mp.ID}};case ft.GEOMETRY:return{nullable:!1,columnScope:Or.FEATURE,type:\"complexType\",complexType:{type:\"physicalType\",physicalType:ge.GEOMETRY,children:[]}};case ft.STRUCT:return{nullable:!1,columnScope:Or.FEATURE,type:\"complexType\",complexType:{type:\"physicalType\",physicalType:ge.STRUCT,children:[]}};case ft.MAP:return{nullable:!0,columnScope:Or.FEATURE,type:\"complexType\",complexType:{type:\"physicalType\",physicalType:ge.MAP,children:[]}};default:return sb(t)}}function rb(t){return t>=ft.SCALAR_BASE}function nf(t){return t===ft.STRUCT||t===ft.MAP}function ib(t){if(t.type===\"scalarType\"){let e=t.scalarType;if(e.type===\"physicalType\")switch(e.physicalType){case Z.BOOLEAN:case Z.INT_8:case Z.UINT_8:case Z.INT_32:case Z.UINT_32:case Z.INT_64:case Z.UINT_64:case Z.FLOAT:case Z.DOUBLE:return!1;case Z.STRING:return!0;default:return!1}if(e.type===\"logicalType\")return!1}else if(t.type===\"complexType\"){let e=t.complexType;if(e.type===\"physicalType\")switch(e.physicalType){case ge.GEOMETRY:case ge.STRUCT:case ge.MAP:return!0;default:return!1}}return console.warn(\"Unexpected column type in hasStreamCount\",t),!1}function nb(t){return t.type===\"scalarType\"&&t.scalarType?.type===\"logicalType\"&&t.scalarType.logicalType===Mp.ID}function ab(t){return t.type===\"complexType\"&&t.complexType?.type===\"physicalType\"&&t.complexType.physicalType===ge.GEOMETRY}function sb(t){let e;switch(t){case 10:case 11:e=Z.BOOLEAN;break;case 12:case 13:e=Z.INT_8;break;case 14:case 15:e=Z.UINT_8;break;case 16:case 17:e=Z.INT_32;break;case 18:case 19:e=Z.UINT_32;break;case 20:case 21:e=Z.INT_64;break;case 22:case 23:e=Z.UINT_64;break;case 24:case 25:e=Z.FLOAT;break;case 26:case 27:e=Z.DOUBLE;break;case 28:case 29:e=Z.STRING;break;default:return null}return{nullable:!!(t&1),columnScope:Or.FEATURE,type:\"scalarType\",scalarType:{longID:!1,type:\"physicalType\",physicalType:e}}}var ob=new TextDecoder,Mu=\"0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)\";function Oo(t,e){let r=wt(t,e,1)[0];if(r===0)return\"\";let i=e.get(),n=i+r,a=t.subarray(i,n);return e.add(r),ob.decode(a)}function lb(t){let e=t.name,r=t.nullable;return t.type===\"scalarType\"?{type:\"scalarField\",scalarField:t.scalarType,name:e,nullable:r}:{type:\"complexField\",complexField:t.complexType,name:e,nullable:r}}function af(t,e){let r=wt(t,e,1)[0]>>>0,i=r>=ft.SCALAR_BASE?rf(r):null;if(!i)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let n={...i,name:Oo(t,e)};if(n.type===\"complexType\"&&nf(r)){let a=n.complexType,s=wt(t,e,1)[0]>>>0;a.children=Array(s);for(let o=0;o<s;o++)a.children[o]=af(t,e)}return lb(n)}function ub(t,e){let r=wt(t,e,1)[0]>>>0,i=rf(r);if(!i)throw Error(`Unsupported column type code ${r}. Supported: ${Mu}`);let n;if(rb(r))n=Oo(t,e);else if(r<ft.GEOMETRY)n=\"id\";else if(r===ft.GEOMETRY)n=\"geometry\";else throw Error(`Unsupported column type code ${r}. Supported: ${Mu}`);let a={...i,name:n};if(a.type===\"complexType\"&&nf(r)){let s=wt(t,e,1)[0]>>>0,o=a.complexType;o.children=Array(s);for(let l=0;l<s;l++)o.children[l]=af(t,e)}return a}function hb(t,e){let r={};r.featureTables=[];let i={};if(i.name=Oo(t,e),i.name.length===0)throw Error(\"Missing layer name\");let n=wt(t,e,1)[0]>>>0,a=wt(t,e,1)[0]>>>0;i.columns=Array(a);for(let s=0;s<a;s++)i.columns[s]=ub(t,e);return r.featureTables.push(i),[r,n]}function cb(t,e,r=!0){let i=new Dp(0),n=[];for(;i.get()<t.length;){let a=wt(t,i,1)[0]>>>0,s=i.get()+a;if(s>t.length)throw Error(`Block overruns tile: ${s} > ${t.length}`);let o=wt(t,i,1)[0]>>>0;if(o!==1&&o!==2){i.set(s);continue}let[l,u]=hb(t,i),h=l.featureTables[0],c=null,p=null,f=[],d=0;for(let m of h.columns){let g=m.name;if(nb(m)){let x=null;if(m.nullable){let v=tt(t,i),_=i.get(),A=gr(t,v.numValues,v.byteLength,i);i.set(_+v.byteLength),x=new qt(A,v.numValues)}let b=tt(t,i);d=x?x.size():b.decompressedCount,c=pb(t,m,i,g,b,x??d,r)}else if(ab(m)){let x=wt(t,i,1)[0];if(d===0){let b=i.get();d=tt(t,i).decompressedCount,i.set(b)}e&&(e.scale=e.extent/u),p=Mv(t,x,i,d,e)}else{let x=ib(m)?wt(t,i,1)[0]:1;if(x===0)continue;let b=Wv(t,i,m,x,d,void 0);if(b)if(Array.isArray(b))for(let v of b)f.push(v);else f.push(b)}}let y=new zx(h.name,p,c,f,u);n.push(y),i.set(s)}return n}function pb(t,e,r,i,n,a,s=!1){let o=e.scalarType?.longID?Z.UINT_64:Z.UINT_32,l=typeof a==\"number\"?void 0:a,u=$n(n,a,t,r,o===Z.UINT_64?\"int64\":\"int32\");if(o===Z.UINT_32)switch(u){case J.FLAT:return new Ao(i,xt(t,r,n,void 0,l),a);case J.SEQUENCE:{let h=Op(t,r,n);return new ko(i,h[0],h[1],n.numRleValues,!1)}case J.CONST:return new Io(i,Co(t,r,n),a,!1)}switch(u){case J.FLAT:return s?new To(i,cv(t,r,n,l),a):new Gp(i,zo(t,r,n,l),a);case J.SEQUENCE:{let h=Rp(t,r,n);return new jp(i,h[0],h[1],n.numRleValues,!1)}case J.CONST:return new Kp(i,Np(t,r,n),a,!1)}throw Error(\"Vector type not supported for id column.\")}var fb=class{constructor(t,e){switch(this._featureData=t,this.properties=this._featureData.properties||{},this._featureData.geometry?.type){case bt.POINT:case bt.MULTIPOINT:this.type=1;break;case bt.LINESTRING:case bt.MULTILINESTRING:this.type=2;break;case bt.POLYGON:case bt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let e of this._featureData.geometry.coordinates){let r=[];for(let i of e)r.push(new F(i.x,i.y));t.push(r)}return t}},db=class{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new fb(this.features[t],this.extent)}},Ro=class{constructor(t){this.layers={};let e=cb(new Uint8Array(t));this.layers=e.reduce((r,i)=>({...r,[i.name]:new db(i)}),{})}},$o=class{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Ma(nt,16,0),this.grid3D=new Ma(nt,16,0),this.featureIndexArray=new Vc,this.promoteId=e}insert(t,e,r,i,n,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);let o=a?this.grid3D:this.grid;for(let l of e){let u=[1/0,1/0,-1/0,-1/0];for(let h of l)u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&o.insert(s,u[0],u[1],u[2],u[3])}}loadVTLayers(){if(!this.vtLayers){switch(this.encoding){case\"mlt\":this.vtLayers=new Ro(this.rawTileData).layers;break;default:this.vtLayers=new lo(new vo(this.rawTileData)).layers}this.sourceLayerCoder=new So(this.vtLayers?Object.keys(this.vtLayers).sort():[Ts])}return this.vtLayers}query(t,e,r,i){this.loadVTLayers();let n=t.params,a=nt/t.tileSize/t.scale,s=hr(n.filter,\"queryRenderedFeatures filter\",n.globalState),o=t.queryGeometry,l=t.queryPadding*a,u=hn.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=hn.fromPoints(t.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,m,g,x)=>Jm(t.cameraQueryGeometry,y-l,m-l,g+l,x+l));for(let y of p)h.push(y);h.sort(yb);let f={},d;for(let y of h){if(y===d)continue;d=y;let m=this.featureIndexArray.get(y),g=null;this.loadMatchingFeature(f,m.bucketIndex,m.sourceLayerIndex,m.featureIndex,s,n.layers,n.availableImages,e,r,i,(x,b,v)=>(g||=Oe(x),b.queryIntersectsFeature({queryGeometry:o,feature:x,featureState:v,geometry:g,zoom:this.z,transform:t.transform,pixelsToTileUnits:a,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return f}loadMatchingFeature(t,e,r,i,n,a,s,o,l,u,h){let c=this.bucketLayerIDs[e];if(a&&!c.some(m=>a.has(m))||r>=this.sourceLayerCoder.size)return;let p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p];if(!f||i>=f.length)return;let d=f.feature(i);if(n.needGeometry){let m=mr(d,!0);if(!n.filter(new H(this.tileID.overscaledZ),m,this.tileID.canonical))return}else if(!n.filter(new H(this.tileID.overscaledZ),d))return;let y=this.getId(d,p);for(let m of c){if(a&&!a.has(m))continue;let g=o[m];if(!g)continue;let x={};y&&u&&(x=u.getState(g.sourceLayer||\"_geojsonTileLayer\",y));let b=Mt({},l[m]);b.paint=Du(b.paint,g.paint,d,x,s),b.layout=Du(b.layout,g.layout,d,x,s);let v=!h||h(d,g,x);if(!v)continue;let _=new Cx(d,this.z,this.x,this.y,y);_.layer=b;let A=t[m];A===void 0&&(A=t[m]=[]),A.push({featureIndex:i,feature:_,intersectionZ:v})}}lookupSymbolFeatures(t,e,r,i,n,a,s,o){let l={};this.loadVTLayers();let u=hr(n.filterSpec,\"queryRenderedFeatures symbol filter\",n.globalState);for(let h of t)this.loadMatchingFeature(l,r,i,h,u,a,s,o,e);return l}hasLayer(t){for(let e of this.bucketLayerIDs)for(let r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;if(this.promoteId){let i=typeof this.promoteId==\"string\"?this.promoteId:this.promoteId[e];r=t.properties[i],typeof r==\"boolean\"&&(r=Number(r)),r===void 0&&t.properties?.cluster&&this.promoteId&&(r=Number(t.properties.cluster_id))}return r}};D(\"FeatureIndex\",$o,{omit:[\"rawTileData\",\"sourceLayerCoder\"]});function Du(t,e,r,i,n){return fn(t,(a,s)=>{let o=e instanceof Fn?e.get(s):null;return o?.evaluate?o.evaluate(r,i,n):o})}function yb(t,e){return e-t}function mb(t,e,r){return!(t<0||t>25||r<0||r>=2**t||e<0||e>=2**t)}var sf=class{constructor(t,e,r){if(!mb(t,e,r))throw Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${2**t}, 0<=y<${2**t} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=jr(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){let i=xb(this.x,this.y,this.z),n=vb(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(r===\"tms\"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,e>1?\"@2x\":\"\").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=2**this.z;return new F((t.x*e-this.x)*nt,(t.y*e-this.y)*nt)}toString(){return`${this.z}/${this.x}/${this.y}`}},gb=class{constructor(t,e){this.wrap=t,this.canonical=e,this.key=jr(t,e.z,e.z,e.x,e.y)}},No=class Bt{constructor(e,r,i,n,a){if(this.terrainRttPosMatrix32f=null,e<i)throw Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=r,this.canonical=new sf(i,+n,+a),this.key=jr(r,e,i,n,a)}clone(){return new Bt(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new Bt(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Bt(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,r){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-e;return e>this.canonical.z?jr(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):jr(this.wrap*+r,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let r=this.canonical.z-e.canonical.z;return r<0?!1:e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new Bt(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=this.canonical.x*2,n=this.canonical.y*2;return[new Bt(r,this.wrap,r,i,n),new Bt(r,this.wrap,r,i+1,n),new Bt(r,this.wrap,r,i,n+1),new Bt(r,this.wrap,r,i+1,n+1)]}isLessThan(e){return this.wrap<e.wrap?!0:this.wrap>e.wrap?!1:this.overscaledZ<e.overscaledZ?!0:this.overscaledZ>e.overscaledZ?!1:this.canonical.x<e.canonical.x?!0:this.canonical.x>e.canonical.x?!1:this.canonical.y<e.canonical.y}wrapped(){return new Bt(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Bt(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return 2**(this.overscaledZ-this.canonical.z)}toUnwrapped(){return new gb(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new uo(e.x-this.wrap,e.y))}normalizeCoordinates(e,r,i=nt){if(e>=0&&e<i&&r>=0&&r<i)return{tileID:this,x:e,y:r};let n=Math.floor(e/i),a=Math.floor(r/i),s=e-n*i,o=r-a*i,l=this.canonical.z,u=1<<l,h=this.canonical.y+a;if(h<0||h>=u)return null;let c=this.canonical.x+n,p=this.wrap;return c<0?(p-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(p+=Math.floor(c/u),c%=u),{tileID:new Bt(this.overscaledZ,p,l,c,h),x:s,y:o}}};function jr(t,e,r,i,n){t*=2,t<0&&(t=t*-1-1);let a=1<<r;return(a*a*t+a*n+i).toString(36)+r.toString(36)+e.toString(36)}var ma=Math.PI*6378137;function xb(t,e,r){e=2**r-e-1;let i=Fu(t*256,e*256,r),n=Fu((t+1)*256,(e+1)*256,r);return`${i[0]},${i[1]},${n[0]},${n[1]}`}function Fu(t,e,r){let i=2*ma/256/2**r;return[t*i-ma,e*i-ma]}function vb(t,e,r){let i=\"\";for(let n=t;n>0;n--){let a=1<<n-1;i+=(e&a?1:0)+(r&a?2:0)}return i}D(\"CanonicalTileID\",sf),D(\"OverscaledTileID\",No,{omit:[\"terrainRttPosMatrix32f\"]});var of=class{constructor(t){this.maxEntries=t,this.map=new Map}get(t){let e=this.map.get(t);return e!==void 0&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){let r=this.map.keys().next().value;this.map.delete(r)}this.map.set(t,e)}clear(){this.map.clear()}};function bb(t,e,r,i,n){let a=[];for(let s of t){let o;for(let l=0;l<s.length-1;l++){let u=s[l],h=s[l+1];u.x<e&&h.x<e||(u.x<e?u=new F(e,u.y+(h.y-u.y)*((e-u.x)/(h.x-u.x)))._round():h.x<e&&(h=new F(e,u.y+(h.y-u.y)*((e-u.x)/(h.x-u.x)))._round()),!(u.y<r&&h.y<r)&&(u.y<r?u=new F(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round():h.y<r&&(h=new F(u.x+(h.x-u.x)*((r-u.y)/(h.y-u.y)),r)._round()),!(u.x>=i&&h.x>=i)&&(u.x>=i?u=new F(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round():h.x>=i&&(h=new F(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round()),!(u.y>=n&&h.y>=n)&&(u.y>=n?u=new F(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round():h.y>=n&&(h=new F(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],a.push(o)),o.push(h)))))}}return a}function lf(t,e,r,i,n,a){let s=Pu(t,e,r,n,0);return s=Pu(s,e,i,a,1),s}function Pu(t,e,r,i,n){switch(e){case 1:return wb(t,r,i,n);case 2:return Cu(t,r,i,n,!1);case 3:return Cu(t,r,i,n,!0)}return[]}function wb(t,e,r,i){let n=[];for(let a of t)for(let s of a){let o=i===0?s.x:s.y;o>=e&&o<=r&&n.push([s])}return n}function _b(t,e,r,i,n){let a=i===0?Sb:Ab,s=[],o=[];for(let h=0;h<t.length-1;h++){let c=t[h],p=t[h+1],f=i===0?c.x:c.y,d=i===0?p.x:p.y,y=!1;f<e?d>e&&s.push(a(c,p,e)):f>r?d<r&&s.push(a(c,p,r)):s.push(c),d<e&&f>=e&&(s.push(a(c,p,e)),y=!0),d>r&&f<=r&&(s.push(a(c,p,r)),y=!0),!n&&y&&(o.push(s),s=[])}let l=t.length-1,u=i===0?t[l].x:t[l].y;return u>=e&&u<=r&&s.push(t[l]),n&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new F(s[0].x,s[0].y)),s.length>0&&o.push(s),o}function Cu(t,e,r,i,n){let a=[];for(let s of t){let o=_b(s,e,r,i,n);o.length>0&&a.push(...o)}return a}function Sb(t,e,r){let i=(r-t.x)/(e.x-t.x);return new F(r,t.y+(e.y-t.y)*i)}function Ab(t,e,r){let i=(r-t.y)/(e.y-t.y);return new F(t.x+(e.x-t.x)*i,r)}var nr=class uf extends F{constructor(e,r,i,n){super(e,r),this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new uf(this.x,this.y,this.angle,this.segment)}};D(\"Anchor\",nr);function hf(t,e,r,i,n){if(e.segment===void 0||r===0)return!0;let a=e,s=e.segment+1,o=0;for(;o>-r/2;){if(s--,s<0)return!1;o-=t[s].dist(a),a=t[s]}o+=t[s].dist(t[s+1]),s++;let l=[],u=0;for(;o<r/2;){let h=t[s-1],c=t[s],p=t[s+1];if(!p)return!1;let f=h.angleTo(c)-c.angleTo(p);for(f=Math.abs((f+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:o,angleDelta:f}),u+=f;o-l[0].distance>i;)u-=l.shift().angleDelta;if(u>n)return!1;s++,o+=c.dist(p)}return!0}function cf(t){let e=0;for(let r=0;r<t.length-1;r++)e+=t[r].dist(t[r+1]);return e}function pf(t,e,r){return t?3/5*e*r:0}function ff(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function Tb(t,e,r,i,n,a){let s=pf(r,n,a),o=ff(r,i)*a,l=0,u=cf(t)/2;for(let h=0;h<t.length-1;h++){let c=t[h],p=t[h+1],f=c.dist(p);if(l+f>u){let d=(u-l)/f,y=new nr(Pe.number(c.x,p.x,d),Pe.number(c.y,p.y,d),p.angleTo(c),h);return y._round(),!s||hf(t,y,o,s,e)?y:void 0}l+=f}}function kb(t,e,r,i,n,a,s,o,l){let u=pf(i,a,s),h=ff(i,n),c=h*s,p=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-c<e/4&&(e=c+e/4);let f=a*2;return df(t,p?e/2*o%e:(h/2+f)*s*o%e,e,u,r,c,p,!1,l)}function df(t,e,r,i,n,a,s,o,l){let u=a/2,h=cf(t),c=0,p=e-r,f=[];for(let d=0;d<t.length-1;d++){let y=t[d],m=t[d+1],g=y.dist(m),x=m.angleTo(y);for(;p+r<c+g;){p+=r;let b=(p-c)/g,v=Pe.number(y.x,m.x,b),_=Pe.number(y.y,m.y,b);if(v>=0&&v<l&&_>=0&&_<l&&p-u>=0&&p+u<=h){let A=new nr(v,_,x,d);A._round(),(!i||hf(t,A,a,i,n))&&f.push(A)}}c+=g}return!o&&!f.length&&!s&&(f=df(t,c/2,r,i,n,a,s,!0,l)),f}function zu(t,e,r,i){let n=[],a=t.image,s=a.pixelRatio,o=a.paddedRect.w-2,l=a.paddedRect.h-2,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},h=a.stretchX||[[0,o]],c=a.stretchY||[[0,l]],p=(E,O)=>E+O[1]-O[0],f=h.reduce(p,0),d=c.reduce(p,0),y=o-f,m=l-d,g=0,x=f,b=0,v=d,_=0,A=y,S=0,k=m;if(a.content&&i){let E=a.content,O=E[2]-E[0],$=E[3]-E[1];(a.textFitWidth||a.textFitHeight)&&(u=_p(t)),g=$i(h,0,E[0]),b=$i(c,0,E[1]),x=$i(h,E[0],E[2]),v=$i(c,E[1],E[3]),_=E[0]-g,S=E[1]-b,A=O-x,k=$-v}let T=u.x1,L=u.y1,V=u.x2-T,z=u.y2-L,C=(E,O,$,B)=>{let N=Ni(E.stretch-g,x,V,T),W=Ui(E.fixed-_,A,E.stretch,f),pt=Ni(O.stretch-b,v,z,L),et=Ui(O.fixed-S,k,O.stretch,d),It=Ni($.stretch-g,x,V,T),Ue=Ui($.fixed-_,A,$.stretch,f),vi=Ni(B.stretch-b,v,z,L),Nn=Ui(B.fixed-S,k,B.stretch,d),bi=new F(N,pt),wi=new F(It,pt),_i=new F(It,vi),Si=new F(N,vi),Un=new F(W/s,et/s),qn=new F(Ue/s,Nn/s),St=e*Math.PI/180;if(St){let ki=Math.sin(St),At=Math.cos(St),gt=[At,-ki,ki,At];bi._matMult(gt),wi._matMult(gt),Si._matMult(gt),_i._matMult(gt)}let be=E.stretch+E.fixed,Ai=$.stretch+$.fixed,Ti=O.stretch+O.fixed,Gn=B.stretch+B.fixed;return{tl:bi,tr:wi,bl:Si,br:_i,tex:{x:a.paddedRect.x+1+be,y:a.paddedRect.y+1+Ti,w:Ai-be,h:Gn-Ti},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Un,pixelOffsetBR:qn,minFontScaleX:A/s/V,minFontScaleY:k/s/z,isSDF:r}};if(!i||!a.stretchX&&!a.stretchY)n.push(C({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));else{let E=Bu(h,y,f),O=Bu(c,m,d);for(let $=0;$<E.length-1;$++){let B=E[$],N=E[$+1];for(let W=0;W<O.length-1;W++){let pt=O[W],et=O[W+1];n.push(C(B,pt,N,et))}}}return n}function $i(t,e,r){let i=0;for(let n of t)i+=Math.max(e,Math.min(r,n[1]))-Math.max(e,Math.min(r,n[0]));return i}function Bu(t,e,r){let i=[{fixed:-1,stretch:0}];for(let[n,a]of t){let s=i[i.length-1];i.push({fixed:n-s.stretch,stretch:s.stretch}),i.push({fixed:n-s.stretch,stretch:s.stretch+(a-n)})}return i.push({fixed:e+1,stretch:r}),i}function Ni(t,e,r,i){return t/e*r+i}function Ui(t,e,r,i){return t-e*r/i}function Ib(t,e,r,i,n,a,s,o){let l=i.layout.get(\"text-rotate\").evaluate(a,{})*Math.PI/180,u=[];for(let h of e.positionedLines)for(let c of h.positionedGlyphs){if(!c.rect)continue;let p=c.rect||{},f=4,d=!0,y=1,m=0,g=(n||o)&&c.vertical,x=c.metrics.advance*c.scale/2;if(o&&e.verticalizable){let B=(c.scale-1)*24,N=(24-c.metrics.width*c.scale)/2;m=h.lineOffset/2-(c.imageName?-N:B)}if(c.imageName){let B=s[c.imageName];d=B.sdf,y=B.pixelRatio,f=1/y}let b=n?[c.x+x,c.y]:[0,0],v=n?[0,0]:[c.x+x+r[0],c.y+r[1]-m],_=[0,0];g&&(_=v,v=[0,0]);let A=c.metrics.isDoubleResolution?2:1,S=(c.metrics.left-f)*c.scale-x+v[0],k=(-c.metrics.top-f)*c.scale+v[1],T=S+p.w/A*c.scale/y,L=k+p.h/A*c.scale/y,V=new F(S,k),z=new F(T,k),C=new F(S,L),E=new F(T,L);if(g){let B=new F(-x,x- -17),N=-Math.PI/2,W=12-x,pt=c.imageName?W:0,et=new F(22-W,-pt),It=new F(..._);V._rotateAround(N,B)._add(et)._add(It),z._rotateAround(N,B)._add(et)._add(It),C._rotateAround(N,B)._add(et)._add(It),E._rotateAround(N,B)._add(et)._add(It)}if(l){let B=Math.sin(l),N=Math.cos(l),W=[N,-B,B,N];V._matMult(W),z._matMult(W),C._matMult(W),E._matMult(W)}let O=new F(0,0),$=new F(0,0);u.push({tl:V,tr:z,bl:C,br:E,tex:p,writingMode:e.writingMode,glyphOffset:b,sectionIndex:c.sectionIndex,isSDF:d,pixelOffsetTL:O,pixelOffsetBR:$,minFontScaleX:0,minFontScaleY:0})}return u}var qi=class{constructor(t,e,r,i,n,a,s,o,l,u){if(this.boxStartIndex=t.length,l){let h=a.top,c=a.bottom,p=a.collisionPadding;p&&(h-=p[1],c+=p[3]);let f=c-h;f>0&&(f=Math.max(10,f),this.circleDiameter=f)}else{let h=a.image?.content&&(a.image.textFitWidth||a.image.textFitHeight)?_p(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};h.y1=h.y1*s-o[0],h.y2=h.y2*s+o[2],h.x1=h.x1*s-o[3],h.x2=h.x2*s+o[1];let c=a.collisionPadding;if(c&&(h.x1-=c[0]*s,h.y1-=c[1]*s,h.x2+=c[2]*s,h.y2+=c[3]*s),u){let p=new F(h.x1,h.y1),f=new F(h.x2,h.y1),d=new F(h.x1,h.y2),y=new F(h.x2,h.y2),m=u*Math.PI/180;p._rotate(m),f._rotate(m),d._rotate(m),y._rotate(m),h.x1=Math.min(p.x,f.x,d.x,y.x),h.x2=Math.max(p.x,f.x,d.x,y.x),h.y1=Math.min(p.y,f.y,d.y,y.y),h.y2=Math.max(p.y,f.y,d.y,y.y)}t.emplaceBack(e.x,e.y,h.x1,h.y1,h.x2,h.y2,r,i,n)}this.boxEndIndex=t.length}},Eb=class{constructor(t=[],e=(r,i)=>r<i?-1:+(r>i)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t<i;){let a=(t<<1)+1,s=a+1;if(s<this.length&&r(e[s],e[a])<0&&(a=s),r(e[a],n)>=0)break;e[t]=e[a],t=a}e[t]=n}};function Mb(t,e=1){let r=hn.fromPoints(t[0]),i=Math.min(r.width(),r.height()),n=i/2,a=new Eb([],Db),{minX:s,minY:o,maxX:l,maxY:u}=r;if(i===0)return new F(s,o);for(let p=s;p<l;p+=i)for(let f=o;f<u;f+=i)a.push(new We(p+n,f+n,n,t));let h=Pb(t),c=h;for(;a.length;){let p=a.pop();(p.d>c.d||!c.d)&&(c=p),!(p.max-c.d<=e)&&(n=p.h/2,a.push(new We(p.p.x-n,p.p.y-n,n,t)),a.push(new We(p.p.x+n,p.p.y-n,n,t)),a.push(new We(p.p.x-n,p.p.y+n,n,t)),a.push(new We(p.p.x+n,p.p.y+n,n,t)))}return h.d>0&&c.d-h.d<=e?h.p:c.p}function Db(t,e){return e.max-t.max}var We=class{constructor(t,e,r,i){this.p=new F(t,e),this.h=r,this.d=Fb(this.p,i),this.max=this.d+this.h*Math.SQRT2}};function Fb(t,e){let r=!1,i=1/0;for(let n of e)for(let a=0,s=n.length,o=s-1;a<s;o=a++){let l=n[a],u=n[o];l.y>t.y!=u.y>t.y&&t.x<(u.x-l.x)*(t.y-l.y)/(u.y-l.y)+l.x&&(r=!r),i=Math.min(i,Gc(t,l,u))}return(r?1:-1)*Math.sqrt(i)}function Pb(t){let e=0,r=0,i=0,n=t[0];for(let a=0,s=n.length,o=s-1;a<s;o=a++){let l=n[a],u=n[o],h=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*h,i+=(l.y+u.y)*h,e+=h*3}return new We(r/e,i/e,0,t)}var Cb=(function(t){return t[t.center=1]=\"center\",t[t.left=2]=\"left\",t[t.right=3]=\"right\",t[t.top=4]=\"top\",t[t.bottom=5]=\"bottom\",t[t[\"top-left\"]=6]=\"top-left\",t[t[\"top-right\"]=7]=\"top-right\",t[t[\"bottom-left\"]=8]=\"bottom-left\",t[t[\"bottom-right\"]=9]=\"bottom-right\",t})({}),Uo=1/0;function yf(t,e){function r(n,a){let s=0,o=0;a<0&&(a=0);let l=a/Math.SQRT2;switch(n){case\"top-right\":case\"top-left\":o=l-7;break;case\"bottom-right\":case\"bottom-left\":o=-l+7;break;case\"bottom\":o=-a+7;break;case\"top\":o=a-7}switch(n){case\"top-right\":case\"bottom-right\":s=-l;break;case\"top-left\":case\"bottom-left\":s=l;break;case\"left\":s=a;break;case\"right\":s=-a}return[s,o]}function i(n,a,s){let o=0,l=0;switch(a=Math.abs(a),s=Math.abs(s),n){case\"top-right\":case\"top-left\":case\"top\":l=s-7;break;case\"bottom-right\":case\"bottom-left\":case\"bottom\":l=-s+7}switch(n){case\"top-right\":case\"bottom-right\":case\"right\":o=-a;break;case\"top-left\":case\"bottom-left\":case\"left\":o=a}return[o,l]}return e[1]===Uo?r(t,e[0]):i(t,e[0],e[1])}function mf(t,e,r){let i=t.layout,n=i.get(\"text-variable-anchor-offset\")?.evaluate(e,{},r);if(n){let s=n.values,o=[];for(let l=0;l<s.length;l+=2){let u=o[l]=s[l],h=s[l+1].map(c=>c*24);u.startsWith(\"top\")?h[1]-=7:u.startsWith(\"bottom\")&&(h[1]+=7),o[l+1]=h}return new Wt(o)}let a=i.get(\"text-variable-anchor\");if(a){let s;s=t._unevaluatedLayout.getValue(\"text-radial-offset\")===void 0?i.get(\"text-offset\").evaluate(e,{},r).map(l=>l*24):[i.get(\"text-radial-offset\").evaluate(e,{},r)*24,Uo];let o=[];for(let l of a)o.push(l,yf(l,s));return new Wt(o)}return null}function gf(t){t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=nt/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,a={layoutIconSize:n[\"icon-size\"].possiblyEvaluate(new H(t.bucket.zoom+1),t.canonical),layoutTextSize:n[\"text-size\"].possiblyEvaluate(new H(t.bucket.zoom+1),t.canonical),textMaxSize:n[\"text-size\"].possiblyEvaluate(new H(18))};if(t.bucket.textSizeData.kind===\"composite\"){let{minZoom:h,maxZoom:c}=t.bucket.textSizeData;a.compositeTextSizes=[n[\"text-size\"].possiblyEvaluate(new H(h),t.canonical),n[\"text-size\"].possiblyEvaluate(new H(c),t.canonical)]}if(t.bucket.iconSizeData.kind===\"composite\"){let{minZoom:h,maxZoom:c}=t.bucket.iconSizeData;a.compositeIconSizes=[n[\"icon-size\"].possiblyEvaluate(new H(h),t.canonical),n[\"icon-size\"].possiblyEvaluate(new H(c),t.canonical)]}let s=i.get(\"text-line-height\")*24,o=i.get(\"text-rotation-alignment\")!==\"viewport\"&&i.get(\"symbol-placement\")!==\"point\",l=i.get(\"text-keep-upright\"),u=i.get(\"text-size\");for(let h of t.bucket.features){let c=i.get(\"text-font\").evaluate(h,{},t.canonical).join(\",\"),p=u.evaluate(h,{},t.canonical),f=a.layoutTextSize.evaluate(h,{},t.canonical),d=a.layoutIconSize.evaluate(h,{},t.canonical),y={horizontal:{},vertical:void 0},m=h.text,g=[0,0];if(m){let _=m.toString(),A=i.get(\"text-letter-spacing\").evaluate(h,{},t.canonical)*24,S=hm(_)?A:0,k=i.get(\"text-anchor\").evaluate(h,{},t.canonical),T=mf(r,h,t.canonical);if(!T){let C=i.get(\"text-radial-offset\").evaluate(h,{},t.canonical);g=C?yf(k,[C*24,Uo]):i.get(\"text-offset\").evaluate(h,{},t.canonical).map(E=>E*24)}let L=o?\"center\":i.get(\"text-justify\").evaluate(h,{},t.canonical),V=i.get(\"symbol-placement\")===\"point\"?i.get(\"text-max-width\").evaluate(h,{},t.canonical)*24:1/0,z=()=>{t.bucket.allowVerticalPlacement&&Da(_)&&(y.vertical=Oi(m,t.glyphMap,t.glyphPositions,t.imagePositions,c,V,s,k,\"left\",S,g,2,!0,f,p))};if(!o&&T){let C=new Set;if(L===\"auto\")for(let O=0;O<T.values.length;O+=2)C.add(Lu(T.values[O]));else C.add(L);let E=!1;for(let O of C)if(!y.horizontal[O])if(E)y.horizontal[O]=y.horizontal[0];else{let $=Oi(m,t.glyphMap,t.glyphPositions,t.imagePositions,c,V,s,\"center\",O,S,g,1,!1,f,p);$&&(y.horizontal[O]=$,E=$.positionedLines.length===1)}z()}else{L===\"auto\"&&(L=Lu(k));let C=Oi(m,t.glyphMap,t.glyphPositions,t.imagePositions,c,V,s,k,L,S,g,1,!1,f,p);C&&(y.horizontal[L]=C),z(),Da(_)&&o&&l&&(y.vertical=Oi(m,t.glyphMap,t.glyphPositions,t.imagePositions,c,V,s,k,L,S,g,2,!1,f,p))}}let x,b=!1;if(h.icon?.name){let _=t.imageMap[h.icon.name];_&&(x=ox(t.imagePositions[h.icon.name],i.get(\"icon-offset\").evaluate(h,{},t.canonical),i.get(\"icon-anchor\").evaluate(h,{},t.canonical)),b=!!_.sdf,t.bucket.sdfIcons===void 0?t.bucket.sdfIcons=b:t.bucket.sdfIcons!==b&&mt(\"Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer\"),_.pixelRatio===t.bucket.pixelRatio?i.get(\"icon-rotate\").constantOr(1)!==0&&(t.bucket.iconsNeedLinear=!0):t.bucket.iconsNeedLinear=!0)}let v=xf(y.horizontal)||y.vertical;t.bucket.iconsInText||=v?v.iconsInText:!1,(v||x)&&zb(t.bucket,h,y,x,t.imageMap,a,f,d,g,b,t.canonical,t.subdivisionGranularity)}t.showCollisionBoxes&&t.bucket.generateCollisionDebugBuffers()}function Lu(t){switch(t){case\"right\":case\"top-right\":case\"bottom-right\":return\"right\";case\"left\":case\"top-left\":case\"bottom-left\":return\"left\"}return\"center\"}function zb(t,e,r,i,n,a,s,o,l,u,h,c){let p=a.textMaxSize.evaluate(e,{});p===void 0&&(p=s);let f=t.layers[0].layout,d=f.get(\"icon-offset\").evaluate(e,{},h),y=xf(r.horizontal),m=s/24,g=t.tilePixelRatio*m,x=t.tilePixelRatio*p/24,b=t.tilePixelRatio*o,v=t.tilePixelRatio*f.get(\"symbol-spacing\"),_=f.get(\"text-padding\")*t.tilePixelRatio,A=xx(f,e,h,t.tilePixelRatio),S=f.get(\"text-max-angle\")/180*Math.PI,k=f.get(\"text-rotation-alignment\")!==\"viewport\"&&f.get(\"symbol-placement\")!==\"point\",T=f.get(\"icon-rotation-alignment\").constantOr(\"viewport\")===\"map\"&&f.get(\"symbol-placement\")!==\"point\",L=f.get(\"symbol-placement\"),V=v/2,z=f.get(\"icon-text-fit\"),C;i&&z!==\"none\"&&(t.allowVerticalPlacement&&r.vertical&&(C=pu(i,r.vertical,z,f.get(\"icon-text-fit-padding\"),d,m)),y&&(i=pu(i,y,z,f.get(\"icon-text-fit-padding\"),d,m)));let E=h?c.line.getGranularityForZoomLevel(h.z):1,O=($,B)=>{B.x<0||B.x>=8192||B.y<0||B.y>=8192||Lb(t,B,$,r,i,n,C,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[_,_,_,_],k,l,b,A,T,d,e,a,u,h,s)};if(L===\"line\")for(let $ of bb(e.geometry,0,0,nt,nt)){let B=Ie($,E),N=kb(B,v,S,r.vertical||y,i,24,x,t.overscaling,nt);for(let W of N){let pt=y;(!pt||!Vb(t,pt.text,V,W))&&O(B,W)}}else if(L===\"line-center\"){for(let $ of e.geometry)if($.length>1){let B=Ie($,E),N=Tb(B,S,r.vertical||y,i,24,x);N&&O(B,N)}}else if(e.type===\"Polygon\")for(let $ of Sn(e.geometry,0)){let B=Mb($,16);O(Ie($[0],E,!0),new nr(B.x,B.y,0))}else if(e.type===\"LineString\")for(let $ of e.geometry){let B=Ie($,E);O(B,new nr(B[0].x,B[0].y,0))}else if(e.type===\"Point\")for(let $ of e.geometry)for(let B of $)O([B],new nr(B.x,B.y,0))}function Bb(t,e){let r=t.length,i=e?.values;if(i?.length>0)for(let n=0;n<i.length;n+=2){let a=Cb[i[n]],s=i[n+1];t.emplaceBack(a,s[0],s[1])}return[r,t.length]}function Vu(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y){let m=Ib(e,r,o,n,a,s,i,t.allowVerticalPlacement),g=t.textSizeData,x=null;g.kind===\"source\"?(x=[128*n.layout.get(\"text-size\").evaluate(s,{})],x[0]>32640&&mt(`${t.layerIds[0]}: Value for \"text-size\" is >= 255. Reduce your \"text-size\".`)):g.kind===\"composite\"&&(x=[128*d.compositeTextSizes[0].evaluate(s,{},y),128*d.compositeTextSizes[1].evaluate(s,{},y)],(x[0]>32640||x[1]>32640)&&mt(`${t.layerIds[0]}: Value for \"text-size\" is >= 255. Reduce your \"text-size\".`)),t.addSymbols(t.text,m,x,o,a,s,h,e,u.lineStartIndex,u.lineLength,f,y,l);for(let b of c)p[b]=t.text.placedSymbolArray.length-1;return m.length*4}function xf(t){for(let e in t)return t[e];return null}function Lb(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,b,v,_,A,S,k){let T=t.addToLineVertexArray(e,r),L=o.layout.get(\"symbol-height-offset\").evaluate(v,{},S),V,z,C,E,O=0,$=0,B=0,N=0,W=-1,pt=-1,et={},It=(0,Ja.default)(\"\");if(t.allowVerticalPlacement&&i.vertical){let At=o.layout.get(\"text-rotate\").evaluate(v,{},S)+90,gt=i.vertical;C=new qi(l,e,u,h,c,gt,p,f,d,At),s&&(E=new qi(l,e,u,h,c,s,m,g,d,At))}if(n){let At=o.layout.get(\"icon-rotate\").evaluate(v,{}),gt=o.layout.get(\"icon-text-fit\")!==\"none\",vr=zu(n,At,A,gt),jn=s?zu(s,At,A,gt):void 0;z=new qi(l,e,u,h,c,n,m,g,!1,At),O=vr.length*4;let jo=t.iconSizeData,we=null;jo.kind===\"source\"?(we=[128*o.layout.get(\"icon-size\").evaluate(v,{})],we[0]>32640&&mt(`${t.layerIds[0]}: Value for \"icon-size\" is >= 255. Reduce your \"icon-size\".`)):jo.kind===\"composite\"&&(we=[128*_.compositeIconSizes[0].evaluate(v,{},S),128*_.compositeIconSizes[1].evaluate(v,{},S)],(we[0]>32640||we[1]>32640)&&mt(`${t.layerIds[0]}: Value for \"icon-size\" is >= 255. Reduce your \"icon-size\".`)),t.addSymbols(t.icon,vr,we,b,x,v,0,e,T.lineStartIndex,T.lineLength,-1,S,L),W=t.icon.placedSymbolArray.length-1,jn&&($=jn.length*4,t.addSymbols(t.icon,jn,we,b,x,v,2,e,T.lineStartIndex,T.lineLength,-1,S,L),pt=t.icon.placedSymbolArray.length-1)}let Ue=Object.keys(i.horizontal);for(let At of Ue){let gt=i.horizontal[At];V||=(It=(0,Ja.default)(gt.text),new qi(l,e,u,h,c,gt,p,f,d,o.layout.get(\"text-rotate\").evaluate(v,{},S)));let vr=gt.positionedLines.length===1;if(B+=Vu(t,e,gt,a,o,d,v,y,L,T,i.vertical?1:3,vr?Ue:[At],et,W,_,S),vr)break}i.vertical&&(N+=Vu(t,e,i.vertical,a,o,d,v,y,L,T,2,[\"vertical\"],et,pt,_,S));let vi=V?V.boxStartIndex:t.collisionBoxArray.length,Nn=V?V.boxEndIndex:t.collisionBoxArray.length,bi=C?C.boxStartIndex:t.collisionBoxArray.length,wi=C?C.boxEndIndex:t.collisionBoxArray.length,_i=z?z.boxStartIndex:t.collisionBoxArray.length,Si=z?z.boxEndIndex:t.collisionBoxArray.length,Un=E?E.boxStartIndex:t.collisionBoxArray.length,qn=E?E.boxEndIndex:t.collisionBoxArray.length,St=-1,be=(At,gt)=>At?.circleDiameter?Math.max(At.circleDiameter,gt):gt;St=be(V,St),St=be(C,St),St=be(z,St),St=be(E,St);let Ai=+(St>-1);Ai&&(St*=k/24),t.glyphOffsetArray.length>=De.MAX_GLYPHS&&mt(\"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\"),v.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,v.sortKey);let Ti=mf(o,v,S),[Gn,ki]=Bb(t.textAnchorOffsets,Ti);t.symbolInstances.emplaceBack(e.x,e.y,et.right>=0?et.right:-1,et.center>=0?et.center:-1,et.left>=0?et.left:-1,et.vertical||-1,W,pt,It,vi,Nn,bi,wi,_i,Si,Un,qn,u,B,N,O,$,Ai,0,p,St,Gn,ki,L)}function Vb(t,e,r,i){let n=t.compareText;if(!(e in n))n[e]=[];else{let a=n[e];for(let s=a.length-1;s>=0;s--)if(i.dist(a[s])<r)return!0}return n[e].push(i),!1}/**\\n* MapLibre GL JS\\n* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.6.0/LICENSE.txt\\n*/function Go(t){let e=typeof t;if(e===\"number\"||e===\"boolean\"||e===\"string\"||t==null)return JSON.stringify(t);if(Array.isArray(t)){let n=\"[\";for(let a of t)n+=`${Go(a)},`;return`${n}]`}let r=Object.keys(t).sort(),i=\"{\";for(let n=0;n<r.length;n++)i+=`${JSON.stringify(r[n])}:${Go(t[r[n]])},`;return`${i}}`}function Ob(t){let e=\"\";for(let r of Hu)e+=`/${Go(t[r])}`;return e}function Rb(t,e){let r={};for(let n=0;n<t.length;n++){let a=e&&e[t[n].id]||Ob(t[n]);e&&(e[t[n].id]=a);let s=r[a];s||=r[a]=[],s.push(t[n])}let i=[];for(let n in r)i.push(r[n]);return i}var $b=class{constructor(t,e){this.keyCache={},t&&this.replace(t,e)}replace(t,e){this._layerConfigs={},this._layers={},this.update(t,[],e)}update(t,e,r){for(let n of t){this._layerConfigs[n.id]=n;let a=this._layers[n.id]=Tp(n,r);a._featureFilter=hr(a.filter,`layers[${n.id}].filter`,r),this.keyCache[n.id]&&delete this.keyCache[n.id]}for(let n of e)delete this.keyCache[n],delete this._layerConfigs[n],delete this._layers[n];this.familiesBySource={};let i=Rb(Object.values(this._layerConfigs),this.keyCache);for(let n of i){let a=n.map(c=>this._layers[c.id]),s=a[0];if(s.isHidden())continue;let o=s.source||\"\",l=this.familiesBySource[o];l||=this.familiesBySource[o]={};let u=s.sourceLayer||\"_geojsonTileLayer\",h=l[u];h||=l[u]=[],h.push(a)}}},bf=class{constructor(t){let e={},r=[];for(let s in t){let o=t[s],l=e[s]={};for(let u in o){let h=o[+u];if(!h||h.bitmap.width===0||h.bitmap.height===0)continue;let c={x:0,y:0,w:h.bitmap.width+2,h:h.bitmap.height+2};r.push(c),l[u]={rect:c,metrics:h.metrics}}}let{w:i,h:n}=bo(r),a=new Pn({width:i||1,height:n||1});for(let s in t){let o=t[s];for(let l in o){let u=o[+l];if(!u||u.bitmap.width===0||u.bitmap.height===0)continue;let h=e[s][l].rect;Pn.copy(u.bitmap,a,{x:0,y:0},{x:h.x+1,y:h.y+1},u.bitmap)}}this.image=a,this.positions=e}};D(\"GlyphAtlas\",bf);var wf=class{constructor(t){this.tileID=new No(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}async parse(t,e,r,i,n){this.data=t,this.collisionBoxArray=new to;let a=new So(Object.keys(t.layers).sort()),s=new $o(this.tileID,this.promoteId);s.bucketLayerIDs=[];let o={},l={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:r,subdivisionGranularity:n},u=e.familiesBySource[this.source];for(let k in u){let T=t.layers[k];if(!T)continue;T.version===1&&mt(`Vector tile source \"${this.source}\" layer \"${k}\" does not use vector tile spec v2 and therefore may have some rendering errors.`);let L=a.encode(k),V=[];for(let z=0;z<T.length;z++){let C=T.feature(z),E=s.getId(C,k);V.push({feature:C,id:E,index:z,sourceLayerIndex:L})}for(let z of u[k]){let C=z[0];C.source!==this.source&&mt(`layer.source = ${C.source} does not equal this.source = ${this.source}`),!C.isHidden(this.zoom,!0)&&(qo(z,this.zoom,r),(o[C.id]=C.createBucket({index:s.bucketLayerIDs.length,layers:z,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:L,sourceID:this.source})).populate(V,l,this.tileID.canonical),s.bucketLayerIDs.push(z.map(E=>E.id)))}}let h=fn(l.glyphDependencies,k=>Object.keys(k).map(Number));for(let k of this.inFlightDependencies)k?.abort();this.inFlightDependencies=[];let c=Promise.resolve({});if(Object.keys(h).length){let k=new AbortController;this.inFlightDependencies.push(k),c=i.sendAsync({type:\"GG\",data:{stacks:h,source:this.source,tileID:this.tileID,type:\"glyphs\"}},k)}let p=Object.keys(l.iconDependencies),f=Promise.resolve({});if(p.length){let k=new AbortController;this.inFlightDependencies.push(k),f=i.sendAsync({type:\"GI\",data:{icons:p,source:this.source,tileID:this.tileID,type:\"icons\"}},k)}let d=Object.keys(l.patternDependencies),y=Promise.resolve({});if(d.length){let k=new AbortController;this.inFlightDependencies.push(k),y=i.sendAsync({type:\"GI\",data:{icons:d,source:this.source,tileID:this.tileID,type:\"patterns\"}},k)}let m=l.dashDependencies,g=Promise.resolve({});if(Object.keys(m).length){let k=new AbortController;this.inFlightDependencies.push(k),g=i.sendAsync({type:\"GDA\",data:{dashes:m}},k)}let[x,b,v,_]=await Promise.all([c,f,y,g]),A=new bf(x),S=new wo(b,v);for(let k in o){let T=o[k];T instanceof De?(qo(T.layers,this.zoom,r),gf({bucket:T,glyphMap:x,glyphPositions:A.positions,imageMap:b,imagePositions:S.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:l.subdivisionGranularity})):T.hasDependencies&&(T instanceof Ln||T instanceof Vn||T instanceof On)&&(qo(T.layers,this.zoom,r),T.addFeatures(l,this.tileID.canonical,S.patternPositions,_))}return{buckets:Object.values(o).filter(k=>!k.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:A.image,imageAtlas:S,dashPositions:_,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?b:null,glyphPositions:this.returnDependencies?A.positions:null}}};function qo(t,e,r){let i=new H(e);for(let n of t)n.recalculate(i,r)}var _f=class{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(t,e){this.loading[t]=e}finishLoading(t){delete this.loading[t]}abort(t){let e=this.loading[t];e?.abort&&(e.abort.abort(),delete this.loading[t])}getParsing(t){return this.parsing[t]}setParsing(t,e){this.parsing[t]=e}removeParsing(t){delete this.parsing[t]}markLoaded(t,e){this.loaded[t]=e}getLoaded(t){let e=this.loaded[t];if(e)return e}removeLoaded(t){delete this.loaded[t]}clearLoaded(){this.loaded={}}},Sf=class{constructor(t){this.start=`${t}#start`,this.end=`${t}#end`,this.measure=t,performance.mark(this.start)}finish(){performance.mark(this.end);let t=performance.getEntriesByName(this.measure);return t.length===0&&(performance.measure(this.measure,this.start,this.end),t=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),t}},Nb=class{constructor(t,e,r,i,n){this.type=t,this.properties=r||{},this.extent=n,this.pointsArray=e,this.id=i}loadGeometry(){return this.pointsArray.map(t=>t.map(e=>new F(e.x,e.y)))}},Ub=class{constructor(t,e,r){this.version=2,this._myFeatures=t,this.name=e,this.length=t.length,this.extent=r}feature(t){return this._myFeatures[t]}},qb=class{constructor(){this.layers={}}addLayer(t){this.layers[t.name]=t}};function Gb(t,e,r){let{extent:i}=t,n=2**(r.z-e.z),a=(r.x-e.x*n)*i,s=(r.y-e.y*n)*i,o=[];for(let l=0;l<t.length;l++){let u=t.feature(l),h=u.loadGeometry();for(let c of h)for(let p of c)p.x=p.x*n-a,p.y=p.y*n-s;h=lf(h,u.type,-128,-128,i+128,i+128),h.length!==0&&o.push(new Nb(u.type,h,u.properties,u.id,i))}return new Ub(o,t.name,i)}var jb=class{constructor(t,e,r){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new _f,this.overzoomedTileResultCache=new of(1e3)}loadVectorTile(t,e){try{return{vectorTile:t.encoding===\"mlt\"?new Ro(e):new lo(new vo(e)),rawData:e}}catch(r){let i=new Uint8Array(e),n=i[0]===31&&i[1]===139,a=`Unable to parse the tile at ${t.request.url}, `;throw a+=n?\"please make sure the data is not gzipped and that you have configured the relevant header in the server\":`got error: ${Yr(r).message}`,Error(a)}}async loadTile(t){let{uid:e,overzoomParameters:r}=t;r&&(t.request=r.overzoomRequest);let i=this._startRequestTiming(t),n=new wf(t);this.tileState.startLoading(e,n);let a=new AbortController;n.abort=a;try{let s=await Xu(t.request,a);if(t.etag&&t.etag===s.etag)return this.tileState.finishLoading(e),this._getEtagUnmodifiedResult(s,i);let o=this.loadVectorTile(t,s.data);if(this.tileState.finishLoading(e),!o)return null;let{vectorTile:l,rawData:u}=o;r&&({vectorTile:l,rawData:u}=this._getOverzoomTile(t,l));let h=this._getExpiryData(s),c=this._finishRequestTiming(i);n.vectorTile=l,this.tileState.markLoaded(e,n);let p={rawData:u,cacheControl:h,resourceTiming:c};return this.tileState.setParsing(e,p),await this._parseWorkerTile(n,t)}catch(s){throw this.tileState.finishLoading(e),this.tileState.markLoaded(e,n),s}}_getEtagUnmodifiedResult(t,e){let r=this._getExpiryData(t),i=this._finishRequestTiming(e);return Mt({etagUnmodified:!0},r,i)}async _parseWorkerTile(t,e){let r=this.tileState.getParsing(t.uid),i=await t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);if(r){let{rawData:n,cacheControl:a,resourceTiming:s}=r,o=e.overzoomParameters?\"mvt\":e.encoding;i=Mt({rawTileData:n.slice(0),encoding:o},i,a,s),this.tileState.removeParsing(t.uid)}return i}_getExpiryData({expires:t,cacheControl:e,etag:r}){let i={};return t&&(i.expires=t),e&&(i.cacheControl=e),r&&(i.etag=r),i}_startRequestTiming(t){if(t.request?.collectResourceTiming)return new Sf(t.request.url)}_finishRequestTiming(t){let e=t?.finish();return e?{resourceTiming:JSON.parse(JSON.stringify(e))}:{}}_getOverzoomTile(t,e){let{tileID:r,source:i,overzoomParameters:n}=t,{maxZoomTileID:a}=n,s=`${a.key}_${r.key}_${t.request?.url}`,o=this.overzoomedTileResultCache.get(s);if(o)return o;let l=new qb,u=this.layerIndex.familiesBySource[i];for(let c in u){let p=e.layers[c];if(!p)continue;let f=Gb(p,a,r.canonical);f.length>0&&l.addLayer(f)}let h={vectorTile:l,rawData:_o(l).buffer};return this.overzoomedTileResultCache.set(s,h),h}async reloadTile(t){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)throw Error(\"Should not be trying to reload a tile that was never loaded or has been removed\");if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,await this._parseWorkerTile(r,t)}async abortTile(t){this.tileState.abort(t.uid)}async removeTile(t){this.tileState.removeLoaded(t.uid)}},Yb=class{constructor(){this.loaded={}}async loadTile(t){let{uid:e,encoding:r,rawImageData:i,redFactor:n,greenFactor:a,blueFactor:s,baseShift:o}=t,l=i.width+2,u=i.height+2,h=dn(i)?new Et({width:l,height:u},await Uu(i,-1,-1,l,u)):i,c=new so(e,h,r,n,a,s,o);return this.loaded||={},this.loaded[e]=c,c}removeTile(t){let e=this.loaded,r=t.uid;e?.[r]&&delete e[r]}},Xb=class{constructor(t,e,r,i=Zb){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new _f,this._createGeoJSONIndex=i}loadVectorTile(t){if(!this._geoJSONIndex)throw Error(\"Unable to parse the data into a cluster or geojson\");let{z:e,x:r,y:i}=t.tileID.canonical,n=this._geoJSONIndex.getTile(e,r,i);if(!n)return null;let a=new Ip(n.features,{version:2,extent:nt});return{vectorTile:a,rawData:_o(a,Nu).buffer}}async loadTile(t){let{uid:e}=t,r=new wf(t);r.abort=new AbortController;try{let i=this.loadVectorTile(t);if(!i)return null;let{vectorTile:n,rawData:a}=i;r.vectorTile=n,this.tileState.markLoaded(e,r);let s={rawData:a};return this.tileState.setParsing(e,s),await this._parseWorkerTile(r,t)}catch(i){throw this.tileState.markLoaded(e,r),i}}async _parseWorkerTile(t,e){let r=this.tileState.getParsing(t.uid),i=await t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);if(r){let{rawData:n}=r;i=Mt({rawTileData:n.slice(0),encoding:\"mvt\"},i),this.tileState.removeParsing(t.uid)}return i}async abortTile(t){this.tileState.abort(t.uid)}async removeTile(t){this.tileState.removeLoaded(t.uid)}async loadData(t){this._pendingRequest?.abort();let e=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{await this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let r={};return t.request&&(r.data=t.data),this._finishRequestTiming(e,t,r),r}catch(r){if(delete this._pendingRequest,!Ps(r))throw r;return{abandoned:!0}}}_startRequestTiming(t){if(t.request?.collectResourceTiming)return new Sf(t.request.url)}_finishRequestTiming(t,e,r){let i=t?.finish();i&&(r.resourceTiming={[e.source]:JSON.parse(JSON.stringify(i))})}async reloadTile(t){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)return await this.loadTile(t);if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,await this._parseWorkerTile(r,t)}async loadAndProcessGeoJSON(t,e){if(t.request&&(t.data=(await Yu(t.request,e)).data),t.data){t.data=this._filterGeoJSON(t.data,t.filter,t.source),this._geoJSONIndex=this._createGeoJSONIndex(t.data,t);return}if(t.dataDiff){this._geoJSONIndex??=this._createGeoJSONIndex({type:\"FeatureCollection\",features:[]},t),this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter,t.source));return}if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,Af(t)),this._geoJSONIndex==null)throw Error(`Input data given to \\'${t.source}\\' is not a valid GeoJSON object.`)}_filterGeoJSON(t,e,r){if(t.type!==\"FeatureCollection\")return t;let i=this._getFilterPredicate(e,r);return i?{type:\"FeatureCollection\",features:t.features.filter(n=>i(n))}:t}_getFilterPredicate(t,e){if(typeof t!=\"boolean\"&&!t?.length)return;let r=ve(t,`sources.${e}.filter`,{type:\"boolean\",\"property-type\":\"data-driven\",overridable:!1,transition:!1});if(r.result===\"error\")throw Error(r.value.map(i=>`${i.key}: ${i.message}`).join(\", \"));return i=>r.value.evaluate({zoom:0},i)}async removeSource(t){this._pendingRequest?.abort()}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getClusterChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getClusterLeaves(t.clusterId,t.limit,t.offset)}};function Zb(t,e){let r=Mt(e.geojsonVtOptions||{},{updateable:!0,clusterOptions:Af(e)});return new yp(t,r)}function Af({geojsonVtOptions:t,clusterProperties:e,source:r}){if(!e||!t.clusterOptions)return t.clusterOptions;let i={},n={},a={accumulated:null,zoom:0},s={properties:null},o=Object.keys(e);for(let l of o){let[u,h]=e[l],c=ve(h,`sources.${r}.clusterProperties.${l}[1]`),p=ve(typeof u==\"string\"?[u,[\"accumulated\"],[\"get\",l]]:u,`sources.${r}.clusterProperties.${l}[0]`);i[l]=c.value,n[l]=p.value}return t.clusterOptions.map=l=>{s.properties=l;let u={};for(let h of o)u[h]=i[h].evaluate(a,s);return u},t.clusterOptions.reduce=(l,u)=>{s.properties=u;for(let h of o)a.accumulated=l[h],l[h]=n[h].evaluate(a,s)},t.clusterOptions}async function vf(t){if(t.endsWith(\".mjs\")){await import(t);return}let e=await fetch(t,{credentials:\"same-origin\"});if(!e.ok)throw Error(`Failed to load ${t}: ${e.status}`);let r=await e.text();if(/^[ \\\\t]*(import|export)\\\\s/m.test(r)){let i=URL.createObjectURL(new Blob([r],{type:\"text/javascript\"}));try{await import(i)}finally{URL.revokeObjectURL(i)}return}globalThis.eval(r)}var Wb=class{constructor(t){this.self=t,this.actor=new kp(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,r)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name \"${e}\" already registered.`);this.externalWorkerSourceTypes[e]=r},this.self.addProtocol=qu,this.self.removeProtocol=Gu,this.self.registerRTLTextPlugin=e=>{Kt.setMethods(e)},this.self.makeRequest=yn,this.actor.registerMessageHandler(\"LDT\",(e,r)=>this._getDEMWorkerSource(e,r.source).loadTile(r)),this.actor.registerMessageHandler(\"RDT\",async(e,r)=>{this._getDEMWorkerSource(e,r.source).removeTile(r)}),this.actor.registerMessageHandler(\"GCEZ\",async(e,r)=>this._getWorkerSource(e,r.type,r.source).getClusterExpansionZoom(r)),this.actor.registerMessageHandler(\"GCC\",async(e,r)=>this._getWorkerSource(e,r.type,r.source).getClusterChildren(r)),this.actor.registerMessageHandler(\"GCL\",async(e,r)=>this._getWorkerSource(e,r.type,r.source).getClusterLeaves(r)),this.actor.registerMessageHandler(\"LD\",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadData(r)),this.actor.registerMessageHandler(\"LT\",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadTile(r)),this.actor.registerMessageHandler(\"RT\",(e,r)=>this._getWorkerSource(e,r.type,r.source).reloadTile(r)),this.actor.registerMessageHandler(\"AT\",(e,r)=>this._getWorkerSource(e,r.type,r.source).abortTile(r)),this.actor.registerMessageHandler(\"RMT\",(e,r)=>this._getWorkerSource(e,r.type,r.source).removeTile(r)),this.actor.registerMessageHandler(\"RS\",async(e,r)=>{if(!this.workerSources[e]?.[r.type]?.[r.source])return;let i=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],i.removeSource!==void 0&&i.removeSource(r)}),this.actor.registerMessageHandler(\"RM\",async e=>{delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],this.globalStates.delete(e)}),this.actor.registerMessageHandler(\"SR\",async(e,r)=>{this.referrer=r}),this.actor.registerMessageHandler(\"SRPS\",(e,r)=>this._syncRTLPluginState(e,r)),this.actor.registerMessageHandler(\"IS\",async(e,r)=>{await vf(r)}),this.actor.registerMessageHandler(\"SI\",(e,r)=>this._setImages(e,r)),this.actor.registerMessageHandler(\"UL\",async(e,r)=>{this._getLayerIndex(e).update(r.layers,r.removedIds,this._getGlobalState(e))}),this.actor.registerMessageHandler(\"UGS\",async(e,r)=>{let i=this._getGlobalState(e);for(let n in r)i[n]=r[n]}),this.actor.registerMessageHandler(\"SL\",async(e,r)=>{this._getLayerIndex(e).replace(r,this._getGlobalState(e))})}_getGlobalState(t){let e=this.globalStates.get(t);return e||(e={},this.globalStates.set(t,e)),e}async _setImages(t,e){this.availableImages[t]=e;for(let r in this.workerSources[t]){let i=this.workerSources[t][r];for(let n in i)i[n].availableImages=e}}async _syncRTLPluginState(t,e){return await Kt.syncState(e,vf)}_getAvailableImages(t){let e=this.availableImages[t];return e||=[],e}_getLayerIndex(t){let e=this.layerIndexes[t];return e||=this.layerIndexes[t]=new $b,e}_getWorkerSource(t,e,r){if(this.workerSources[t]||={},this.workerSources[t][e]||={},!this.workerSources[t][e][r]){let i={sendAsync:(n,a)=>(n.targetMapId=t,this.actor.sendAsync(n,a))};switch(e){case\"vector\":this.workerSources[t][e][r]=new jb(i,this._getLayerIndex(t),this._getAvailableImages(t));break;case\"geojson\":this.workerSources[t][e][r]=new Xb(i,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][r]=new this.externalWorkerSourceTypes[e](i,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][r]}_getDEMWorkerSource(t,e){return this.demWorkerSources[t]||={},this.demWorkerSources[t][e]||=new Yb,this.demWorkerSources[t][e]}};Fe(self)&&(self.worker=new Wb(self));})();\\n';var R5=\"#.cjs\",$1;function j1(){if(typeof Worker>\"u\"||V1())return;let e=O1();if(e!==pp.replace(/-.*$/,\"\"))throw new Error(`Bundled maplibre worker is ${pp} but the runtime is ${e}. Rebuild it with: pnpm --filter @atlas/bridge gen:maplibre-worker`);$1??($1=URL.createObjectURL(new Blob([U1],{type:\"text/javascript\"}))+R5),N1($1)}function G1(e){return j1(),new B1(e)}var L5={getTransformRequest:()=>{},onError:(e,t)=>console.error(\"[atlas]\",t,e)},W1=new WeakMap;function X1(e){let t=W1.get(e);return{...L5,...t}}function H1(e){return e._removed===!0}var q1=new WeakSet,Z1=new WeakMap,B5=new WeakMap,O5=/^(https?:|data:|blob:|\\/)/,gs=144;function V5(e,t){let r=B5.get(e)?.get(t);return r!==void 0?r:O5.test(t)?t:void 0}function N5(e){let t=Z1.get(e);return t||(t=new Map,Z1.set(e,t)),t}function U5(e,t){return e?.toLowerCase().includes(\"svg\")===!0?!0:(t.split(/[?#]/,1)[0]??t).toLowerCase().endsWith(\".svg\")}async function $5(e){let t=await createImageBitmap(e),r=Math.max(t.width,t.height);if(r<=gs)return t;let i=gs/r,a=await createImageBitmap(t,{resizeWidth:Math.round(t.width*i),resizeHeight:Math.round(t.height*i),resizeQuality:\"high\"});return t.close(),a}function j5(e,t){if(typeof OffscreenCanvas<\"u\")return new OffscreenCanvas(e,t);let r=document.createElement(\"canvas\");return r.width=e,r.height=t,r}async function G5(e,t,r){let i=j5(t,r),a=i.getContext(\"2d\");if(!a)throw new Error(\"icon-image canvas unavailable\");return a.imageSmoothingEnabled=!0,a.imageSmoothingQuality=\"high\",a.drawImage(e,0,0,t,r),createImageBitmap(i)}async function q5(e){let t=URL.createObjectURL(e);try{let r=new Image;r.decoding=\"async\",await new Promise((o,l)=>{r.addEventListener(\"load\",()=>{o()}),r.addEventListener(\"error\",()=>{l(new Error(\"icon-image could not be decoded\"))}),r.src=t});let i=Math.max(r.naturalWidth,r.naturalHeight),a=i>0?gs/i:1,n=Math.max(1,Math.round((r.naturalWidth||gs)*a)),s=Math.max(1,Math.round((r.naturalHeight||gs)*a));return await G5(r,n,s)}finally{URL.revokeObjectURL(t)}}async function Z5(e,t){let r=await X1(e).getTransformRequest()?.(t,\"Image\"),i=await fetch(r?.url??t,{credentials:\"same-origin\",cache:\"no-store\",...r?.headers&&{headers:r.headers}});if(!i.ok)throw new Error(`icon fetch failed (${String(i.status)}): ${t}`);let a=await i.blob();return U5(i.headers.get(\"content-type\"),t)?q5(a):$5(a)}async function W5(e,t,r){try{let i=await Z5(e,r);if(H1(e)||e.hasImage(t)){i.close();return}e.addImage(t,i)}catch(i){X1(e).onError(i,`icon-image load failed: ${r}`)}}function X5(e,t){if(!t||H1(e)||e.hasImage(t))return Promise.resolve();let r=V5(e,t);if(r===void 0)return Promise.resolve();let i=N5(e),a=i.get(t);if(a)return a;let n=W5(e,t,r).finally(()=>{i.delete(t)});return i.set(t,n),n}function Y1(e,t){q1.has(e)||(q1.add(e),t&&W1.set(e,t),e.setMissingStyleImageResolver(r=>X5(e,r)))}function K1(e,t){return\"bbox\"in t?{...e,bounds:t.bbox}:{...e,center:t.center,zoom:t.zoom,...t.pitch!==void 0&&{pitch:t.pitch},...t.bearing!==void 0&&{bearing:t.bearing}}}function H5(e){return/\\/interfaces\\/[^/]+\\/tiles\\//.test(e)}function Y5(e){try{return new URL(e).origin}catch{return null}}function J1(e){return async t=>{if(H5(t)){let{token:r,origin:i}=await e();if(Y5(t)===i)return{url:t,headers:{Authorization:`Bearer ${r}`}}}return{url:t}}}var dp=\"atlas-map-handle-v1\";function Q1(e){let t=globalThis,r=t[dp]??(t[dp]=new Set);r.add(e),e.on(\"remove\",()=>{r.delete(e)})}var K5=[\"center\",\"zoom\",\"bounds\"];function J5(e){return K5.some(t=>t in e)}function Q5(e,t){return t===void 0||typeof e==\"string\"?e:{...e,projection:{type:t}}}async function eD(e,t){let r=await e.call(\"atlas.project.resolveBasemapStyle\",{styleId:t.styleId,hideLabels:t.hideLabels,hideBoundaries:t.hideBoundaries,...t.color!==void 0&&{color:t.color}});return Q5(r,t.projection)}function tD(e){return e.call(\"atlas.tiles.getToken\",{})}function ex(e,t){let r=async(i={})=>{let a=await t.value(),n={style:await eD(e,a.basemap),attributionControl:!1,transformRequest:J1(()=>tD(e)),canvasContextAttributes:{preserveDrawingBuffer:!0},...a.maxBounds!==void 0&&{maxBounds:a.maxBounds}};return{...J5(i)?n:K1(n,a.initialCamera),...i,canvasContextAttributes:{...n.canvasContextAttributes,...i.canvasContextAttributes},style:n.style}};return{options:r,async create(i,a={}){let n=await r(a),s=G1({...n,container:i});return n.interactive!==!1&&(s.getContainer().style.pointerEvents=\"auto\"),Y1(s,{getTransformRequest:()=>n.transformRequest??void 0}),Q1(s),s}}}var rD=()=>{};function iD(){if(!(typeof window>\"u\"))return window[$p]}function tx(){return iD()?.hold()??rD}var mp=\"No Atlas host answered the bridge handshake. This bundle only runs inside an Atlas interface iframe.\",gp=3e4,aD=1e4,nD=250;function sD(e){if(typeof e!=\"object\"||e===null)return null;let t=e.protocolVersion;return typeof t==\"number\"?t:null}function fp(e){return new Pt(`Bridge request ${e} aborted`,e,\"ABORTED\")}var rx=0;function oD(){return rx+=1,`t${String(rx)}.${Math.random().toString(36).slice(2,8)}.`}var Sl=class{constructor(t,r=gp){Ye(this,\"host\");Ye(this,\"defaultTimeoutMs\");Ye(this,\"idPrefix\",oD());Ye(this,\"seq\",0);Ye(this,\"pending\",new Map);Ye(this,\"listeners\",new Map);Ye(this,\"queued\",[]);Ye(this,\"connected\",!1);Ye(this,\"handshakeIds\",new Set);Ye(this,\"settleHandshake\",null);Ye(this,\"hostProtocolVersion\",null);Ye(this,\"onMessage\");this.host=t,this.defaultTimeoutMs=r,this.onMessage=i=>this.receive(i),window.addEventListener(\"message\",this.onMessage)}connect(t=aD){return this.connected?Promise.resolve(this.hostProtocolVersion):new Promise((r,i)=>{let a=()=>{let l=`${this.idPrefix}handshake-${String(++this.seq)}`;this.handshakeIds.add(l),this.post({type:Up,id:l,payload:{}})},n=setInterval(a,nD),s=setTimeout(()=>{o(),this.destroy();let l=new Pt(mp,\"connect\",\"NO_HOST\");this.failQueue(l),i(l)},t),o=()=>{clearInterval(n),clearTimeout(s),this.handshakeIds.clear(),this.settleHandshake=null};this.settleHandshake=l=>{o(),this.connected=!0,this.hostProtocolVersion=sD(l),this.flushQueue(),r(this.hostProtocolVersion)},a()})}call(t,r,i={}){return new Promise((a,n)=>{if(i.signal?.aborted){n(fp(t));return}let s={method:t,args:r,options:i,resolve:a,reject:n};if(this.connected){this.dispatch(s);return}s.onAbort=()=>{let o=this.queued.indexOf(s);o!==-1&&(this.queued.splice(o,1),n(fp(t)))},i.signal?.addEventListener(\"abort\",s.onAbort,{once:!0}),this.queued.push(s)})}on(t,r){let i=this.listeners.get(t);return i||(i=new Set,this.listeners.set(t,i)),i.add(r),()=>{this.listeners.get(t)?.delete(r)}}destroy(){window.removeEventListener(\"message\",this.onMessage)}dispatch(t){let{method:r,options:i}=t,a=`${this.idPrefix}${String(++this.seq)}`,n=tx(),s=null,o=null,l=h=>{this.pending.delete(a)&&(s!==null&&clearTimeout(s),o&&i.signal?.removeEventListener(\"abort\",o),n(),h())};i.signal&&(o=()=>l(()=>t.reject(fp(r))),i.signal.addEventListener(\"abort\",o,{once:!0})),this.pending.set(a,{method:r,resolve:h=>l(()=>t.resolve(h)),reject:h=>l(()=>t.reject(h))}),this.post({type:r,id:a,payload:t.args});let u=i.timeoutMs??this.defaultTimeoutMs;s=setTimeout(()=>{l(()=>t.reject(new Pt(`Bridge request ${r} timed out after ${String(u)}ms`,r,\"TIMEOUT\")))},u)}flushQueue(){let t=this.queued;this.queued=[];for(let r of t)r.onAbort&&r.options.signal?.removeEventListener(\"abort\",r.onAbort),this.dispatch(r)}failQueue(t){let r=this.queued;this.queued=[];for(let i of r)i.onAbort&&i.options.signal?.removeEventListener(\"abort\",i.onAbort),i.reject(t)}receive(t){if(t.source!==this.host||!jp(t.data))return;let r=t.data.data;if(r.type===\"atlas.event\"){this.listeners.get(r.event)?.forEach(a=>{a(r.payload)});return}if(this.handshakeIds.has(r.id)){this.settleHandshake?.(r.type===\"atlas.response\"?r.result:void 0);return}let i=this.pending.get(r.id);i&&(r.type===\"atlas.response\"?i.resolve(r.result):i.reject(new Pt(r.error,i.method,r.code)))}post(t){this.host.postMessage({channel:zl,v:1,data:t},\"*\")}};function ix(e){let t=new Map,r=new Map,i=o=>{r.get(o)?.forEach(l=>l())},a=(o,l)=>{let u=r.get(o)??new Set;return u.add(l),r.set(o,u),()=>{u.delete(l),u.size===0&&r.delete(o)}},n=o=>{let l=t.get(o.datasetId);if(l)return l;let u=ir({load:async()=>await e.call(\"atlas.views.list\",o),invalidations:h=>{let c=e.on(\"specChange\",f=>{f.datasetId===o.datasetId&&h()}),p=e.on(\"datasetListChange\",h),d=a(o.datasetId,h);return()=>{c(),p(),d()}}});return t.set(o.datasetId,u),u},s=o=>(l,u)=>e.call(`atlas.views.${o}`,l,u).then(h=>(i(l.datasetId),h));return{live:n,create:s(\"create\"),createMarker:s(\"createMarker\"),update:s(\"update\"),delete:s(\"delete\")}}function ax(e){return typeof e==\"symbol\"||e===\"then\"}function lD(e,t,r){let i=new Map,a=n=>{let s=i.get(n);if(s)return s;let o=t[n],l=new Proxy(o??{},{get(u,h){if(!ax(h))return h in u?Reflect.get(u,h):(c,p)=>e.call(`atlas.${n}.${String(h)}`,c??{},p)},has:()=>!0});return i.set(n,l),l};return new Proxy(r,{get(n,s){if(!ax(s))return s in n?Reflect.get(n,s):a(String(s))}})}function uD(e){if(e==null)throw new Pt(\"The host returned no project chrome \\u2014 this interface is not mounted in a project\",\"atlas.project.getChrome\");return e}var yp=null;async function hD(e,t){let r=await e.connect(t);if(r!==null&&r!==1)throw new Pt(`This bundle speaks bridge protocol ${String(1)} but the host speaks ${String(r)}; redeploy the interface`,\"connect\",\"PROTOCOL_MISMATCH\")}function _p(e={}){let t=yp;if(t)return t.retain(),t.handle;if(typeof window>\"u\"||window.parent===window)return Promise.reject(new Pt(mp,\"connect\",\"NO_HOST\"));let r=new Sl(window.parent,e.callTimeoutMs??gp),i=1,a=!0,n=()=>{a&&(a=!1,yp=null,r.destroy())},s=hD(r,e.handshakeTimeoutMs).then(()=>cD(r,()=>{i-=1,i<=0&&n()}),o=>{throw n(),o});return yp={handle:s,retain:()=>{i+=1}},s}function cD(e,t=()=>e.destroy()){let r=ir({load:async()=>uD(await e.call(\"atlas.project.getChrome\",{}))}),i=ir({load:async()=>await e.call(\"atlas.datasets.list\",{}),invalidations:l=>e.on(\"datasetListChange\",l)}),a=ir({load:async()=>await e.call(\"atlas.auth.me\",{})}),n=ir({load:async()=>await e.call(\"atlas.url.getParams\",{}),invalidations:l=>e.on(\"urlChange\",l)}),s=rd(e,i),o=Wp(e);return lD(e,{project:{live:()=>r},datasets:{live:()=>i},auth:{live:()=>a},url:{live:()=>n},layers:{live:()=>s},views:ix(e),data:o.data,rows:o.rows,ai:qp(e),embed:Hp(e)},{map:ex(e,r),scalar:o.scalar,aggregate:o.aggregate,histogram:o.histogram,statistics:o.statistics,close:t})}import{useCallback as Ts,useEffect as Pr,useRef as wi,useState as ea}from\"react\";import{useState as dD}from\"react\";var pD={\"03\":\"Oslo\",11:\"Rogaland\",15:\"M\\xF8re og Romsdal\",18:\"Nordland\",31:\"\\xD8stfold\",32:\"Akershus\",33:\"Buskerud\",34:\"Innlandet\",39:\"Vestfold\",40:\"Telemark\",42:\"Agder\",46:\"Vestland\",50:\"Tr\\xF8ndelag\",55:\"Troms\",56:\"Finnmark\"},Jr=e=>typeof e==\"number\"&&Number.isFinite(e)?e:null,ys=[],xp=new Map,Il=[];function vp(e){return e.toLowerCase().replace(/æ/g,\"ae\").replace(/ø/g,\"o\").replace(/å/g,\"a\").normalize(\"NFD\").replace(/[̀-ͯ]/g,\"\").replace(/[^a-z0-9]+/g,\" \").trim()}function nx(e){ys=[];for(let t of e){let r=t.nr,i=t.kommune;typeof r!=\"string\"||typeof i!=\"string\"||ys.push({nr:r,navn:i,fylke:pD[r.slice(0,2)]??\"\",husholdninger:Jr(t.husholdninger)??0,med:Jr(t.med_norgespris),uten:Jr(t.uten_norgespris),andel:Jr(t.andel_med),nyttar:Jr(t.med_nyttar),boks:[Jr(t.v)??4.5,Jr(t.s)??57.95,Jr(t.o)??31.2,Jr(t.n)??71.2]})}return xp=new Map(ys.map(t=>[t.nr,t])),Il=ys.map(t=>({k:t,v:vp(t.navn)})),ys.length}function bp(e){return e?xp.get(e)??null:null}function wp(e){if(!e)return null;let t=vp(e);return/^\\d{3,4}$/.test(t)?xp.get(t.padStart(4,\"0\"))??null:Il.find(r=>r.v===t)?.k??null}function sx(e,t){let r=vp(e);if(!r)return[];let i=Il.filter(s=>s.v.startsWith(r)),a=Il.filter(s=>!s.v.startsWith(r)&&s.v.includes(r)),n=(s,o)=>s.k.navn.localeCompare(o.k.navn,\"nb\");return[...i.sort(n),...a.sort(n)].slice(0,t).map(s=>s.k)}var _s=\"#F6F7F4\",Qi=\"#1E2633\",ox=\"#5B6472\",mr=[50,60,70,75,80],Qr=[\"#EFE38A\",\"#B4CC5E\",\"#76B26A\",\"#3F9177\",\"#257075\",\"#154A56\"],Tp=\"#E6E4DC\",lx=\"#B5B1A4\",Sp=[\"case\",[\"==\",[\"get\",\"andel_med\"],null],Tp,[\"step\",[\"get\",\"andel_med\"],Qr[0],mr[0],Qr[1],mr[1],Qr[2],mr[2],Qr[3],mr[3],Qr[4],mr[4],Qr[5]]];function Wa(e){return String(Math.round(e)).replace(/\\B(?=(\\d{3})+(?!\\d))/g,\"\\xA0\")}function Al(e){return`${e.toFixed(1).replace(\".\",\",\")}\\xA0%`}import{Fragment as ux,jsx as De,jsxs as et}from\"react/jsx-runtime\";var Ep=\"focus:outline-none focus-visible:ring-2 focus-visible:ring-[#1F4FE0]/40\";function Ip({smal:e}){let t=et(\"div\",{className:\"flex h-[18px] items-center gap-2 text-[13px] leading-[18px] text-[#1E2633]\",children:[De(\"span\",{className:e?\"block h-0.5 w-5 shrink-0 bg-[#1E2633]\":\"block h-0.5 w-9 shrink-0 bg-[#1E2633]\",\"aria-hidden\":\"true\"}),\"Grense for prisomr\\xE5de\"]});return et(\"div\",{className:e?\"flex items-start gap-3\":\"\",children:[et(\"div\",{className:e?\"min-w-0 flex-1\":\"\",children:[De(\"div\",{className:\"flex\",\"aria-hidden\":\"true\",children:Qr.map(r=>De(\"span\",{className:\"h-3.5 flex-1\",style:{backgroundColor:r}},r))}),et(\"div\",{className:\"relative mt-1 h-[18px] text-[13px] leading-[18px] text-[#1E2633]\",children:[De(\"span\",{className:\"absolute left-0 whitespace-nowrap\",children:e?`<${mr[0]}`:`under ${mr[0]}`}),mr.slice(1).map((r,i)=>et(\"span\",{className:\"absolute -translate-x-1/2 whitespace-nowrap\",style:{left:`${(i+2)/Qr.length*100}%`},children:[r,r===mr[mr.length-1]?\" %\":\"\"]},r))]}),e&&t]}),et(\"div\",{className:e?\"shrink-0\":\"mt-2.5 flex items-start gap-2\",children:[De(\"span\",{className:e?\"kl-skravur block h-3.5 w-full\":\"kl-skravur mt-0.5 block h-3.5 w-9 shrink-0\",\"aria-hidden\":\"true\"}),et(\"span\",{className:e?\"mt-1 block text-[13px] leading-[18px] text-[#1E2633]\":\"text-[13px] leading-[18px] text-[#1E2633]\",children:[\"Under 100 med Norgespris\",De(\"span\",{className:\"block text-[#5B6472]\",children:\"Elhub oppgir ikke tallet\"})]})]}),!e&&De(\"div\",{className:\"mt-1.5\",children:t})]})}function Ap({onVelg:e,oppover:t}){let[r,i]=dD(\"\"),a=sx(r,5),n=o=>{i(\"\"),e(o)},s=r.trim()!==\"\"?et(\"ul\",{className:t?\"mb-1.5\":\"mt-1.5\",role:\"listbox\",\"aria-label\":\"Kommuner\",children:[a.map(o=>De(\"li\",{role:\"option\",\"aria-selected\":!1,children:et(\"button\",{type:\"button\",onClick:()=>n(o),className:`flex min-h-[44px] w-full items-baseline justify-between gap-3 rounded-md px-2 text-left text-[16px] hover:bg-[#EEF0EA] active:bg-[#E6E4DC] ${Ep}`,children:[De(\"span\",{children:o.navn}),De(\"span\",{className:\"text-[13px] text-[#5B6472]\",children:o.fylke})]})},o.nr)),a.length===0&&De(\"li\",{className:\"px-2 py-2.5 text-[16px] text-[#5B6472]\",children:\"Ingen kommune med det navnet\"})]}):null;return et(\"div\",{children:[t&&s,De(\"input\",{type:\"search\",value:r,onChange:o=>i(o.target.value),onKeyDown:o=>{o.key===\"Enter\"&&a[0]&&n(a[0]),o.key===\"Escape\"&&i(\"\")},placeholder:\"Finn kommunen din\",\"aria-label\":\"S\\xF8k etter kommune\",className:`h-11 w-full rounded-md border border-[#D5DAD6] bg-white px-3 text-[16px] text-[#1E2633] placeholder:text-[#5B6472] ${Ep}`}),!t&&s]})}function xs({navn:e,verdi:t}){return et(\"div\",{className:\"flex items-baseline justify-between gap-3 border-t border-[#E6E4DC] py-[3px]\",children:[De(\"dt\",{className:\"text-[#5B6472]\",children:e}),De(\"dd\",{className:\"font-semibold\",children:t})]})}function Mp({k:e,onLukk:t}){return et(\"div\",{className:\"text-[16px] leading-[24px] text-[#1E2633]\",children:[et(\"div\",{className:\"flex items-start justify-between gap-2\",children:[et(\"h2\",{className:\"pt-1 text-[20px] font-semibold leading-[26px]\",children:[e.navn,\" \",e.fylke!==e.navn&&De(\"span\",{className:\"text-[13px] font-normal text-[#5B6472]\",children:e.fylke})]}),De(\"button\",{type:\"button\",onClick:t,\"aria-label\":\"Lukk kommunen\",className:`-mr-2 -mt-1 flex h-11 w-11 shrink-0 items-center justify-center rounded-md text-[22px] leading-none text-[#5B6472] hover:bg-[#EEF0EA] active:bg-[#E6E4DC] ${Ep}`,children:\"\\xD7\"})]}),e.andel!==null&&e.med!==null&&e.uten!==null?et(ux,{children:[et(\"p\",{className:\"mb-1.5\",children:[De(\"span\",{className:\"font-semibold\",children:Al(e.andel)}),\" av husholdningene har Norgespris.\"]}),et(\"dl\",{children:[De(xs,{navn:\"Husholdninger\",verdi:Wa(e.husholdninger)}),De(xs,{navn:\"Med Norgespris\",verdi:Wa(e.med)}),De(xs,{navn:\"Uten Norgespris\",verdi:Wa(e.uten)}),De(xs,{navn:\"Med ved nytt\\xE5r 2025/26\",verdi:e.nyttar===null?\"F\\xE6rre enn 100\":Wa(e.nyttar)})]})]}):et(ux,{children:[et(\"p\",{className:\"mb-1.5\",children:[De(\"span\",{className:\"font-semibold\",children:\"F\\xE6rre enn 100\"}),\" har Norgespris. Elhub oppgir ikke tall under 100.\"]}),De(\"dl\",{children:De(xs,{navn:\"Husholdninger\",verdi:Wa(e.husholdninger)})})]})]})}import{useEffect as fD}from\"react\";import{jsx as gr,jsxs as vs}from\"react/jsx-runtime\";var mD=[{hva:\"Norgespris\",hvem:\"Elhub, antall m\\xE5lere per kommune og forbruksgruppe (norgespris_count_per_municipality_consumption_group), gruppen Husholdning. Tall for 31. oktober 2026 og 31. desember 2025. CC BY 4.0. Hentet 4. november 2026.\",url:\"https://data.elhub.no\"},{hva:\"Kommunegrenser\",hvem:\"Kartverket via robhop, forenklet utgave. CC BY 4.0.\",url:\"https://github.com/robhop/fylker-og-kommuner\"},{hva:\"Prisomr\\xE5der\",hvem:\"NVE, prisomr\\xE5der fra datasettet Nettomr\\xE5der. NLOD 2.0. Hentet 13. august 2026. P\\xE5 kartet st\\xE5r bare linjene mellom omr\\xE5dene.\",url:\"https://kartkatalog.geonorge.no/metadata/uuid/890fe9ea-5111-459b-aebd-450480c7713a\"},{hva:\"Bakgrunnskart\",hvem:\"\\xA9 OpenStreetMap-bidragsytere, ODbL, via OpenFreeMap.\",url:\"https://www.openstreetmap.org/copyright\"}],gD=[\"Antall husholdningsm\\xE5lere og antall med Norgespris per kommune er hentet fra Elhub.\",\"Andelen er m\\xE5lere med Norgespris delt p\\xE5 alle husholdningsm\\xE5lere i kommunen, med \\xE9n desimal.\",\"Uten Norgespris er alle husholdningsm\\xE5lere minus dem med Norgespris.\",\"Elhub viser 0 n\\xE5r tallet er under 100. Disse kommunene er skravert. De er ikke regnet som 0 %. Det samme gjelder tallet for nytt\\xE5r.\"],yD=[\"Tallene er str\\xF8mm\\xE5lere til husholdninger, ikke personer.\",\"Uten Norgespris betyr ikke uten st\\xF8tte. Str\\xF8mst\\xF8tten gjelder da, og noen kan ha fastpris eller lokale avtaler.\",\"Elhub skjuler tall under 100. De 81 skraverte kommunene har til sammen rundt 700 m\\xE5lere med Norgespris av 195 921 husholdninger. Det er regnet ut (per prisomr\\xE5de minus per kommune minus \\xABUkjent tilh\\xF8righet\\xBB), ikke oppgitt av Elhub.\",\"Tallene er fra 31. oktober 2026, ikke fra i dag.\",\"Prisomr\\xE5dene f\\xF8lger str\\xF8mnettet, ikke kommunegrensene.\"];function hx({onLukk:e,mobil:t}){return fD(()=>{let r=i=>{i.key===\"Escape\"&&e()};return window.addEventListener(\"keydown\",r),()=>window.removeEventListener(\"keydown\",r)},[e]),vs(\"div\",{className:\"pointer-events-auto absolute inset-0 z-30\",children:[gr(\"button\",{type:\"button\",\"aria-label\":\"Lukk\",onClick:e,className:\"absolute inset-0 h-full w-full cursor-default bg-[#1E2633]/30\"}),vs(\"div\",{role:\"dialog\",\"aria-label\":\"Kilder og metode\",className:t?\"absolute bottom-0 left-0 right-0 max-h-[88%] overflow-y-auto rounded-t-xl bg-[#F6F7F4] px-4 pb-5 pt-2\":\"absolute left-1/2 top-1/2 max-h-[86%] w-[560px] max-w-[92%] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-lg bg-[#F6F7F4] px-6 pb-6 pt-3 shadow-[0_8px_30px_rgba(30,38,51,0.2)]\",style:{scrollbarWidth:\"thin\",scrollbarColor:\"#D5DAD6 transparent\"},children:[vs(\"div\",{className:\"flex items-center justify-between\",children:[gr(\"h2\",{className:\"text-[20px] font-semibold text-[#1E2633]\",children:\"Kilder og metode\"}),gr(\"button\",{type:\"button\",\"aria-label\":\"Lukk\",onClick:e,className:\"-mr-2 flex h-11 w-11 items-center justify-center rounded-md text-[22px] leading-none text-[#5B6472] hover:bg-[#EEF0EA] focus:outline-none focus-visible:ring-2 focus-visible:ring-[#1F4FE0]/40\",children:\"\\xD7\"})]}),vs(\"div\",{className:\"text-[16px] leading-[24px] text-[#1E2633]\",children:[gr(\"h3\",{className:\"mt-2 font-semibold\",children:\"Hva kartet ikke viser\"}),gr(\"ul\",{className:\"mt-1 list-disc pl-5\",children:yD.map(r=>gr(\"li\",{className:\"mt-1\",children:r},r))}),gr(\"h3\",{className:\"mt-4 font-semibold\",children:\"Metode\"}),gr(\"ol\",{className:\"mt-1 list-decimal pl-5\",children:gD.map(r=>gr(\"li\",{className:\"mt-1\",children:r},r))}),gr(\"h3\",{className:\"mt-4 font-semibold\",children:\"Kilder\"}),mD.map(r=>vs(\"p\",{className:\"mt-2\",children:[gr(\"a\",{href:r.url,target:\"_blank\",rel:\"noopener noreferrer\",className:\"text-[#1F4FE0] underline underline-offset-2\",children:r.hva}),\". \",r.hvem]},r.hva))]})]})]})}var _D=\"https://cdn.jsdelivr.net/npm/@fontsource/schibsted-grotesk@5/files\",bs=null;function cx(){if(bs)return bs;if(typeof FontFace>\"u\"||!document.fonts)return bs=Promise.resolve();let e=[\"400\",\"600\"].map(r=>new FontFace(\"Schibsted Grotesk\",`url(${_D}/schibsted-grotesk-latin-${r}-normal.woff2) format('woff2')`,{weight:r,style:\"normal\",display:\"swap\"}).load().then(i=>{document.fonts.add(i)}).catch(()=>{})),t=new Promise(r=>setTimeout(r,4e3));return bs=Promise.race([Promise.all(e).then(()=>{}),t]),bs}var px=cx();function dx(){cx()}function fx(e,t,r,i,a,n,s){n[0]=0,s[0]=-1e20,s[1]=1e20,a[0]=e[t];for(let o=1,l=0,u=0;o<i;o++){a[o]=e[t+o*r];let h=o*o;do{let c=n[l];u=(a[o]-a[c]+h-c*c)/(o-c)/2}while(u<=s[l]&&--l>-1);l++,n[l]=o,s[l]=u,s[l+1]=1e20}for(let o=0,l=0;o<i;o++){for(;s[l+1]<o;)l++;let u=n[l],h=o-u;e[t+o*r]=a[u]+h*h}}function mx(e,t,r,i,a,n,s,o,l){for(let u=t;u<t+i;u++)fx(e,r*n+u,n,a,s,o,l);for(let u=r;u<r+a;u++)fx(e,u*n+t,1,i,s,o,l)}function xD(e,t,r){let i=String.fromCodePoint(t),a=e.measureText(i),n=Math.ceil(a.actualBoundingBoxAscent),s=Math.max(0,Math.min(r-3,Math.ceil(a.actualBoundingBoxRight+a.actualBoundingBoxLeft))),o=Math.max(0,Math.min(r-3,n+Math.ceil(a.actualBoundingBoxDescent))),l=Math.round(a.width),u=Math.round(-a.actualBoundingBoxLeft);if(s===0||o===0)return{id:t,bitmap:new Uint8Array(0),width:0,height:0,left:0,top:-8,advance:l};let h=s+6,c=o+6,p=h*c;e.clearRect(0,0,r,r),e.fillText(i,3+a.actualBoundingBoxLeft,3+n);let d=e.getImageData(3,3,s,o),f=new Float64Array(p).fill(1e20),m=new Float64Array(p);for(let w=0;w<o;w++)for(let b=0;b<s;b++){let T=d.data[4*(w*s+b)+3]/255;if(T===0)continue;let I=(w+3)*h+b+3;if(T===1)f[I]=0,m[I]=1e20;else{let S=.5-T;f[I]=S>0?S*S:0,m[I]=S<0?S*S:0}}let g=Math.max(h,c),y=new Float64Array(g),_=new Uint16Array(g),x=new Float64Array(g+1);mx(f,0,0,h,c,h,y,_,x),mx(m,3,3,s,o,h,y,_,x);let v=new Uint8Array(p);for(let w=0;w<p;w++){let b=Math.sqrt(f[w])-Math.sqrt(m[w]);v[w]=Math.max(0,Math.min(255,Math.round(255-255*(b/8+.25))))}return{id:t,bitmap:v,width:s,height:o,left:u,top:n-27,advance:l}}var ws=class{constructor(){Ye(this,\"b\",[])}varint(t){let r=t>>>0;for(;r>127;)this.b.push(r&127|128),r>>>=7;this.b.push(r)}tag(t,r){this.varint(t<<3|r)}uint(t,r){this.tag(t,0),this.varint(r)}sint(t,r){this.tag(t,0),this.varint(r<<1^r>>31)}bytes(t,r){this.tag(t,2),this.varint(r.length);for(let i=0;i<r.length;i++)this.b.push(r[i])}str(t,r){this.bytes(t,new TextEncoder().encode(r))}};function gx(e,t,r,i){let n=document.createElement(\"canvas\");n.width=n.height=36;let s=n.getContext(\"2d\",{willReadFrequently:!0});if(!s)throw new Error(\"canvas\");s.font=t,s.textBaseline=\"alphabetic\",s.textAlign=\"left\",s.fillStyle=\"black\";let o=new ws;o.str(1,e),o.str(2,`${r}-${i}`);for(let u=r;u<=i;u++){if(u<32)continue;let h=xD(s,u,36),c=new ws;c.uint(1,h.id),h.bitmap.length&&c.bytes(2,h.bitmap),c.uint(3,h.width),c.uint(4,h.height),c.sint(5,h.left),c.sint(6,h.top),c.uint(7,h.advance),o.bytes(3,c.b)}let l=new ws;return l.bytes(1,o.b),new Uint8Array(l.b).buffer}var yx=[[[[4.61,61.04],[4.74,61.17],[4.63,61.33],[4.97,61.46],[4.69,61.56],[4.79,61.88],[4.97,61.95],[4.96,62.07],[5.1,62.07],[5.08,62.23],[5.3,62.21],[5.57,62.45],[5.78,62.38],[6.16,62.72],[6.48,62.82],[6.48,62.65],[6.63,62.74],[6.56,62.86],[6.75,62.77],[6.74,62.87],[7.02,63],[8,63.25],[7.75,63.36],[7.86,63.48],[8.12,63.51],[8.32,63.3],[8.47,63.39],[8.2,63.47],[8.4,63.63],[8.24,63.7],[8.53,63.75],[8.65,63.91],[8.92,63.8],[8.9,63.68],[9.19,63.7],[9.24,63.56],[9.3,63.68],[9.51,63.69],[9.53,63.79],[9.37,63.75],[9.37,63.85],[9.87,63.94],[9.8,64.05],[10,64.12],[9.99,64.22],[10.14,64.2],[10.67,64.59],[11.16,64.71],[11.04,64.82],[10.64,64.82],[10.7,64.97],[11.05,65.07],[11.26,64.96],[11.57,64.99],[11.48,65.04],[11.53,65.13],[12.06,65.27],[11.96,65.4],[12.09,65.63],[11.88,65.55],[11.67,65.69],[12.14,65.73],[12.2,65.52],[12.37,65.79],[12.13,65.87],[12.1,66.03],[12.3,66.08],[12.31,66.2],[12.66,66.22],[12.81,66.34],[12.75,66.55],[12.94,66.63],[12.9,66.71],[13.29,66.81],[13.41,66.97],[13.69,66.99],[13.83,67.16],[14.18,67.17],[14.33,67.35],[14.18,67.36],[14.29,67.46],[14.43,67.47],[14.35,67.35],[14.43,67.35],[14.63,67.6],[14.97,67.62],[14.72,67.64],[14.64,67.84],[15.39,68.18],[16.01,68.31],[16.04,68.4],[15.67,68.27],[15.22,68.29],[14.67,68.11],[14.61,68.2],[14.21,68.13],[14.17,68.22],[12.76,67.82],[13.06,68.15],[13.44,68.19],[13.55,68.32],[14.28,68.34],[14.69,68.47],[14.28,68.62],[14.44,68.81],[15,69.04],[15.2,69.05],[15.38,68.9],[15.54,69.13],[16.13,69.36],[16.21,69.24],[15.91,69.02],[15.95,68.94],[16.07,68.86],[16.56,69.1],[16.8,68.97],[16.75,68.84],[16.63,68.85],[16.69,68.69],[17.1,68.96],[17.32,68.97],[17.37,69.1],[17.23,68.98],[16.76,69.02],[16.75,69.12],[16.88,69.16],[16.84,69.41],[17.48,69.64],[17.76,69.59],[18.03,69.67],[18.03,69.78],[18.5,69.89],[18.49,70.15],[18.63,69.9],[18.62,70.06],[18.81,70.23],[19.21,70.3],[19.26,70.12],[19.42,70.21],[19.69,70.03],[19.46,70.26],[19.77,70.3],[20.16,70.1],[19.81,69.89],[19.71,69.69],[20.29,70.02],[20.43,69.9],[20.33,69.72],[20.39,69.63],[20.58,69.98],[20.34,70.05],[20.39,70.21],[20.81,70.25],[21.15,69.92],[21.26,70.13],[21.15,70.24],[21.4,70.42],[21.64,70.3],[21.71,70.43],[21.84,70.32],[22.31,70.31],[22.78,70.43],[22.84,70.48],[22.07,70.44],[22.09,70.54],[21.89,70.65],[22.89,70.77],[23.04,70.9],[23.54,70.81],[23.15,70.59],[23.56,70.66],[23.67,70.79],[24.17,70.63],[24.3,70.73],[24.16,70.89],[23.8,70.99],[24.04,71.13],[24.52,70.85],[24.51,71.03],[24.71,71.16],[24.88,71.13],[24.85,70.97],[24.98,71.09],[25.23,70.92],[25.3,71.18],[25.67,71.22],[26.05,71.16],[26.03,71.06],[26.25,71.09],[26.18,70.97],[25.89,70.93],[25.9,70.65],[25.76,70.64],[25.77,70.75],[25.27,70.55],[25.25,70.31],[26.68,71.01],[26.77,70.82],[26.61,70.5],[26.69,70.45],[27.24,70.82],[27.07,70.91],[27.12,71.01],[27.65,71.17],[28.56,71.01],[28.54,70.88],[28.27,70.76],[28.34,70.68],[28.22,70.54],[28.71,70.88],[28.97,70.93],[29.44,70.74],[30.09,70.75],[31.18,70.41],[31.07,70.25],[30.52,70.2],[30.18,70.03],[29.19,70.08],[30.81,69.83],[30.99,69.57],[30.51,69.5],[30.2,69.62],[30.14,69.43],[29.34,69.27],[29.27,69.09],[29.05,68.97],[28.77,69.12],[28.81,69.26],[29.27,69.48],[29.11,69.66],[28.39,69.78],[27.94,70.05],[27.62,70.03],[27.04,69.87],[26.49,69.9],[25.99,69.67],[25.75,69.23],[25.81,68.99],[25.64,68.86],[25.18,68.76],[25.15,68.61],[24.91,68.52],[23.87,68.8],[23.68,68.67],[23.17,68.59],[22.37,68.68],[21.61,69.24],[21.28,69.27],[21.04,69.2],[21.15,69.11],[21.07,69],[20.72,69.08],[20.22,69.01],[20.37,68.79],[20.08,68.56],[20.26,68.48],[19.93,68.32],[18.4,68.54],[18.16,68.5],[18.19,68.18],[17.92,67.93],[17.29,68.08],[16.76,67.88],[16.52,67.56],[16.15,67.44],[16.44,67.23],[16.42,67.02],[15.43,66.47],[15.51,66.25],[14.57,66.09],[14.67,65.81],[14.54,65.29],[13.72,64.6],[14.15,64.48],[14.2,64.18],[14,63.98],[12.94,64.02],[12.21,63.58],[12.25,63.46],[12.03,63.26],[12.26,63.01],[12.12,62.89],[12.1,62.61],[12.34,62.27],[12.19,61.74],[12.59,61.6],[12.91,61.35],[12.7,61.03],[12.3,60.99],[12.64,60.39],[12.48,60.01],[11.96,59.85],[11.97,59.67],[11.74,59.59],[11.87,59.24],[11.67,58.87],[11.44,58.85],[11.34,59.08],[11.17,59.08],[11.06,58.95],[10.85,59.01],[10.58,59.38],[10.49,59.04],[9.73,58.95],[8.26,58.09],[7.52,57.93],[6.61,58.03],[6.52,58.11],[6.57,58.17],[5.86,58.39],[5.52,58.64],[5.45,58.75],[5.53,59.14],[5.73,59.16],[5.77,59.29],[5.46,59.12],[5.16,59.12],[5.16,59.31],[5.03,59.44],[5.19,59.42],[5.2,59.54],[5.02,59.81],[4.92,60.4],[4.76,60.54],[4.84,60.74],[4.65,60.77],[4.77,60.81],[4.75,60.96],[4.61,61.04]]],[[[20.22,70.18],[20.16,70.35],[20.33,70.27],[20.22,70.18]]],[[[13.9,67.22],[14.02,67.33],[14.06,67.27],[13.9,67.22]]],[[[13.81,67.4],[13.97,67.48],[14.03,67.44],[13.89,67.36],[13.81,67.4]]],[[[12.75,67.62],[12.52,67.66],[12.79,67.79],[12.75,67.62]]],[[[12.65,66.51],[12.63,66.64],[12.72,66.59],[12.65,66.51]]],[[[12.5,66.33],[12.53,66.43],[12.68,66.38],[12.61,66.3],[12.5,66.33]]],[[[12.3,66.4],[12.37,66.32],[12.27,66.33],[12.3,66.4]]],[[[12.14,67.57],[12.15,67.48],[12.03,67.49],[12.04,67.54],[12.14,67.57]]],[[[12.12,66.46],[11.99,66.54],[12.14,66.52],[12.12,66.46]]],[[[11.99,66],[12.04,66.11],[12.08,66.07],[11.99,66]]],[[[9.04,63.94],[9.17,64.05],[9.22,63.99],[9.04,63.94]]],[[[4.93,59.26],[4.85,59.35],[4.95,59.31],[4.93,59.26]]]];var Ue={utfyll:\"np-utfyll\",fyll:\"np-fyll\",skravur:\"np-skravur\",kant:\"np-kant\",pris:\"np-prisgrense\",hover:\"np-hover\",valgtUnder:\"np-valgt-under\",valgt:\"np-valgt\",navn:\"np-navn\",byPrikk:\"np-by-prikk\",by:\"np-by\"},Cp=\"np-skravur-bilde\",_x=\"np-navn-kilde\",Pp=\"np-by-kilde\",kp=6.5,Fp=\"NP Schibsted Regular\",bx=\"NP Schibsted SemiBold\",vD={[Fp]:'400 24px \"Schibsted Grotesk\", system-ui, sans-serif',[bx]:'600 24px \"Schibsted Grotesk\", system-ui, sans-serif'},bD=\"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf\",xx=!1;function wD(e){let t=e.getStyle().glyphs??bD;xx||(xx=!0,vh(\"npglyf\",async r=>{let[i=\"\",a=\"\"]=r.url.replace(\"npglyf://\",\"\").split(\"/\"),n=decodeURIComponent(i),s=a.replace(\".pbf\",\"\"),o=vD[n];if(o){await px;let[u=0,h=255]=s.split(\"-\").map(Number);return{data:gx(n,o,u,h)}}return{data:await(await fetch(t.replace(\"{fontstack}\",i).replace(\"{range}\",s))).arrayBuffer()}})),e.setGlyphs(\"npglyf://{fontstack}/{range}\")}var Dp=[];function wx(e){wD(e);let t;Dp=[];for(let r of e.getStyle().layers??[]){let i=r.id.toLowerCase();try{if(r.type===\"background\")e.setPaintProperty(r.id,\"background-color\",_s);else if(r.type===\"fill\"&&/water|ocean|sea|lake/.test(i)&&!/way|intermittent/.test(i))e.setPaintProperty(r.id,\"fill-color\",_s),e.setPaintProperty(r.id,\"fill-opacity\",1),Dp.push(r.id);else if(r.type===\"symbol\")if(t===void 0&&(t=r.id),/place|label|city|town/.test(i)&&/city|town|capital/.test(i)&&!/country|state/.test(i)){e.setLayoutProperty(r.id,\"text-field\",[\"coalesce\",[\"get\",\"name:nb\"],[\"get\",\"name:no\"],[\"get\",\"name:latin\"],[\"get\",\"name\"]]),e.setLayoutProperty(r.id,\"text-font\",[\"literal\",[Fp]]),e.setPaintProperty(r.id,\"text-color\",Qi),e.setPaintProperty(r.id,\"text-halo-color\",\"rgba(246,247,244,0.85)\"),e.setPaintProperty(r.id,\"text-halo-width\",1),e.setLayerZoomRange(r.id,kp,24);let a=e.getFilter(r.id),n=[\"within\",{type:\"MultiPolygon\",coordinates:yx}];e.setFilter(r.id,a?[\"all\",a,n]:n)}else e.setLayoutProperty(r.id,\"visibility\",\"none\");else e.setLayoutProperty(r.id,\"visibility\",\"none\")}catch{}}return t}function TD(e){if(e.hasImage(Cp))return;let t=s=>[1,3,5].map(o=>Number.parseInt(s.slice(o,o+2),16)),[r,i]=[t(Tp),t(lx)],a=8,n=new Uint8Array(a*a*4);for(let s=0;s<a;s+=1)for(let o=0;o<a;o+=1){let l=(o+s)%a===0?i:r;n.set([l[0]??0,l[1]??0,l[2]??0,255],(s*a+o)*4)}e.addImage(Cp,{width:a,height:a,data:n})}function SD(){return{type:\"FeatureCollection\",features:[[\"Nord-Norge\",[11.6,68],\"right\"],[\"Midt-Norge\",[9,64.4],\"right\"],[\"Vest-Norge\",[4.4,61],\"right\"],[\"S\\xF8rvest-Norge\",[5.9,58.2],\"right\"],[\"\\xD8st-Norge\",[12.9,60.5],\"left\"]].map(([t,r,i])=>({type:\"Feature\",geometry:{type:\"Point\",coordinates:r},properties:{navn:t,anker:i}}))}}function ED(e){return{type:\"FeatureCollection\",features:[[\"Oslo\",[10.75,59.91],\"bottom\"],[\"Bergen\",[5.33,60.39],\"right\"],[\"Trondheim\",[10.4,63.43],\"bottom\"],[\"Bod\\xF8\",[14.4,67.28],\"right\"],[\"Troms\\xF8\",[18.96,69.65],\"bottom\"],...e?[]:[[\"Stavanger\",[5.73,58.97],\"right\"]]].map(([r,i,a])=>({type:\"Feature\",geometry:{type:\"Point\",coordinates:i},properties:{navn:r,anker:a}}))}}function vx(e){let t=e?.maplibre,r=e?.spec;return!t||t.kind!==\"ready\"||!r||r.source.kind!==\"mvt\"?null:{sourceId:t.sourceId,sourceLayer:r.source.sourceLayer,kompilert:t}}var Xa=e=>[\"==\",[\"get\",\"nr\"],e??\"\\0\"],ID=[\"interpolate\",[\"linear\"],[\"zoom\"],4,1,6,2,8,4,10,8];function zp(e,t,r,i,a){let n=i&&e.getLayer(i)?i:void 0;TD(e);let s=vx(t.find(l=>l.name===\"Norgespris_kommuner\"));if(s&&!r.kommuner){r.kommuner=!0,e.getSource(s.sourceId)||e.addSource(s.sourceId,s.kompilert.source);let l={source:s.sourceId,\"source-layer\":s.sourceLayer};e.addLayer({id:Ue.utfyll,type:\"line\",...l,layout:{\"line-join\":\"round\"},paint:{\"line-color\":Sp,\"line-width\":ID}},n),e.addLayer({id:Ue.fyll,type:\"fill\",...l,paint:{\"fill-color\":Sp}},n),e.addLayer({id:Ue.skravur,type:\"fill\",...l,filter:[\"==\",[\"get\",\"andel_med\"],null],paint:{\"fill-pattern\":Cp}},n),e.addLayer({id:Ue.kant,type:\"line\",...l,paint:{\"line-color\":\"#FFFFFF\",\"line-width\":[\"interpolate\",[\"linear\"],[\"zoom\"],3,.2,6,.5,9,1]}},n),e.addLayer({id:Ue.hover,type:\"line\",...l,filter:Xa(null),paint:{\"line-color\":Qi,\"line-width\":1.2}},n),e.addLayer({id:Ue.valgtUnder,type:\"line\",...l,filter:Xa(null),layout:{\"line-join\":\"round\"},paint:{\"line-color\":\"#FFFFFF\",\"line-width\":4.5}},n),e.addLayer({id:Ue.valgt,type:\"line\",...l,filter:Xa(null),layout:{\"line-join\":\"round\"},paint:{\"line-color\":Qi,\"line-width\":2}},n)}let o=vx(t.find(l=>l.name===\"Prisomrade_grenser\"));o&&!r.pris&&(r.pris=!0,e.getSource(o.sourceId)||e.addSource(o.sourceId,o.kompilert.source),e.addLayer({id:Ue.pris,type:\"line\",source:o.sourceId,\"source-layer\":o.sourceLayer,layout:{\"line-join\":\"round\",\"line-cap\":\"round\"},paint:{\"line-color\":Qi,\"line-width\":[\"interpolate\",[\"linear\"],[\"zoom\"],3,1,8,1.8],\"line-opacity\":.9}},e.getLayer(Ue.hover)?Ue.hover:n),e.addSource(_x,{type:\"geojson\",data:SD()}),e.addLayer({id:Ue.navn,type:\"symbol\",source:_x,maxzoom:7,layout:{\"text-field\":[\"get\",\"navn\"],\"text-font\":[\"literal\",[bx]],\"text-size\":13,\"text-anchor\":[\"get\",\"anker\"],\"text-allow-overlap\":!0,\"text-ignore-placement\":!0},paint:{\"text-color\":ox,\"text-halo-color\":_s,\"text-halo-width\":1.2}}),e.addSource(Pp,{type:\"geojson\",data:ED(a)}),e.addLayer({id:Ue.byPrikk,type:\"circle\",source:Pp,maxzoom:kp,paint:{\"circle-radius\":2,\"circle-color\":Qi,\"circle-stroke-color\":_s,\"circle-stroke-width\":1}}),e.addLayer({id:Ue.by,type:\"symbol\",source:Pp,maxzoom:kp,layout:{\"text-field\":[\"get\",\"navn\"],\"text-font\":[\"literal\",[Fp]],\"text-size\":13,\"text-anchor\":[\"get\",\"anker\"],\"text-offset\":[\"case\",[\"==\",[\"get\",\"anker\"],\"bottom\"],[\"literal\",[0,-.35]],[\"literal\",[-.5,0]]],\"text-allow-overlap\":!0,\"text-ignore-placement\":!0},paint:{\"text-color\":Qi,\"text-halo-color\":\"rgba(246,247,244,0.92)\",\"text-halo-width\":1.3}}));for(let l of Dp)e.getLayer(l)&&e.moveLayer(l,n)}function Tx(e,t){e.getLayer(Ue.valgt)&&e.setFilter(Ue.valgt,Xa(t)),e.getLayer(Ue.valgtUnder)&&e.setFilter(Ue.valgtUnder,Xa(t))}function Rp(e,t){e.getLayer(Ue.hover)&&e.setFilter(Ue.hover,Xa(t))}import{Fragment as CD,jsx as Xe,jsxs as Ha}from\"react/jsx-runtime\";var Lp=[4.5,57.95,31.2,71.2],Sx=364,Ex=68,AD=128,MD=286,ta=()=>window.matchMedia(\"(max-width: 767px)\").matches;function Ix(e,t){return e?t?{top:Ex+24,bottom:MD+24,left:32,right:32}:{top:Ex+8,bottom:AD+8,left:84,right:8}:t?{top:60,bottom:60,left:Sx+60,right:60}:{top:20,bottom:20,left:Sx+40,right:24}}function PD(){let e=wi(null),t=wi(null),r=wi(null),i=wi(!1),a=wi(!1),n=wi(!1),s=wi(null),o=wi(null),[l,u]=ea(null),[h,c]=ea(null),[p,d]=ea(null),[f,m]=ea(!1),[g,y]=ea(!1),[_,x]=ea(!1),[v,w]=ea(ta);Pr(()=>{dx();let F=window.matchMedia(\"(max-width: 767px)\"),E=()=>w(F.matches);return F.addEventListener(\"change\",E),()=>F.removeEventListener(\"change\",E)},[]),Pr(()=>{let F,E,M=!1;return(async()=>{let A=await _p();if(M||!e.current)return;u(A),A.attribution.set({corner:\"bottom-right\",theme:\"light\"}).catch(()=>{});let k=await A.map.create(e.current,{bounds:Lp,fitBoundsOptions:{padding:Ix(ta(),!1)}});F=k,o.current=k,k.dragRotate.disable(),k.touchZoomRotate.disableRotation();let H={kommuner:!1,pris:!1},$=!1,U,Y=[];k.on(\"load\",()=>{$=!0,U=wx(k),zp(k,Y,H,U,ta()),c(k)}),k.on(\"dragstart\",()=>{i.current=!0}),k.on(\"zoomstart\",ue=>{ue.originalEvent&&(i.current=!0)}),E=A.layers.live().subscribe(ue=>{Y=ue,$&&zp(k,ue,H,U,ta())},()=>{})})(),()=>{M=!0,E?.(),o.current=null,c(null),F?.remove()}},[]);let b=Ts((F,E,M)=>{let A=o.current;A&&A.fitBounds(F,{padding:Ix(ta(),E),maxZoom:E?8.5:12,duration:M})},[]),T=Ts(()=>{a.current=!1,i.current=!1,b(Lp,!1,350)},[b]),I=Ts((F,E)=>{d(F),F&&(a.current=!0,b(F.boks,!0,E))},[b]);Pr(()=>{if(!l)return;let F,E=!1;return l.datasets.live().value().then(M=>{let A=M.find(k=>k.name===\"Kommune_oppslag\");E||!A||(F=l.rows.live({datasetId:A.id,hostFilters:\"ignore\",opts:{limit:400}}).subscribe(k=>{nx(k.rows.map(H=>H.properties))>0&&m(!0)},()=>{}))}).catch(()=>{}),()=>{E=!0,F?.()}},[l]),Pr(()=>{if(!(!l||!h||!f))return l.url.live().subscribe(F=>{n.current||(n.current=!0,I(wp(F.kommune),0),y(!0))},()=>{n.current=!0,y(!0)})},[l,h,f,I]),Pr(()=>{if(!(!l||!h||!f))return l.embed.on(F=>{if(F.type!==\"scene\")return;let E=F.payload?.params;if(!E||typeof E!=\"object\")return;n.current=!0;let M=E.kommune??E[\"i.kommune\"],A=wp(typeof M==\"string\"||typeof M==\"number\"?String(M):void 0);A?I(A,350):(d(null),T()),F.reply({kommune:A?.nr??null})})},[l,h,f,I,T]),Pr(()=>{!l||!g||l.url.setParams(p?{set:{kommune:p.nr}}:{remove:[\"kommune\"]}).catch(()=>{})},[l,g,p]),Pr(()=>{h&&Tx(h,p?.nr??null)},[h,p]),Pr(()=>{let F=s.current;if(s.current=null,!h||!p||F===null||!r.current)return;let E=r.current.getBoundingClientRect().top-40;F>E&&(a.current=!0,h.panBy([0,F-E],{duration:200}))},[h,p]),Pr(()=>{if(!h)return;let F=$=>{if(!h.getLayer(Ue.fyll))return null;let Y=h.queryRenderedFeatures($,{layers:[Ue.fyll]})[0]?.properties?.nr;return typeof Y==\"string\"?Y:null},E=$=>{let U=bp(F($.point));d(U),!U&&a.current&&T(),s.current=U&&ta()?$.point.y:null},M=null,A=$=>{if(ta())return;let U=F($.point);h.getCanvas().style.cursor=U?\"pointer\":\"\",U!==M&&(M=U,Rp(h,U));let Y=t.current,ue=bp(U);if(Y){if(!ue){Y.style.display=\"none\";return}Y.style.display=\"block\",Y.style.transform=`translate(${$.point.x+14}px, ${$.point.y+14}px)`,Y.textContent=`${ue.navn}: ${ue.andel===null?\"f\\xE6rre enn 100\":Al(ue.andel)}`}},k=()=>{M=null,Rp(h,null),t.current&&(t.current.style.display=\"none\")};h.on(\"click\",E),h.on(\"mousemove\",A),h.getCanvas().addEventListener(\"mouseleave\",k);let H=h.getCanvas();return()=>{h.off(\"click\",E),h.off(\"mousemove\",A),H.removeEventListener(\"mouseleave\",k)}},[h,T]),Pr(()=>{if(!h)return;let F=()=>{!i.current&&!a.current&&b(Lp,!1,0)};return h.on(\"resize\",F),()=>{h.off(\"resize\",F)}},[h,b]);let S=Ts(()=>{d(null),a.current&&T()},[T]),D=Ts(F=>I(F,350),[I]),R=Xe(\"button\",{type:\"button\",onClick:()=>x(!0),className:\"min-h-[44px] shrink-0 rounded-md px-2 text-[14px] text-[#5B6472] underline underline-offset-2 hover:text-[#1E2633] focus:outline-none focus-visible:ring-2 focus-visible:ring-[#1F4FE0]/40\",children:v?\"Kilder\":\"Kilder og metode\"});return Ha(\"div\",{className:\"kl-font pointer-events-none fixed inset-0 overflow-hidden text-[#1E2633]\",children:[Xe(\"div\",{ref:e,className:\"pointer-events-auto absolute inset-0\"}),Xe(\"div\",{ref:t,className:\"pointer-events-none absolute left-0 top-0 z-10 hidden whitespace-nowrap rounded bg-[#1E2633] px-2 py-1 text-[13px] text-white\"}),v?Ha(CD,{children:[Ha(\"header\",{className:\"pointer-events-auto absolute left-0 right-0 top-0 flex items-start justify-between gap-2 border-b border-[#E6E4DC] bg-[#F6F7F4] px-4 pb-1.5 pt-2\",children:[Ha(\"div\",{className:\"min-w-0\",children:[Xe(\"h1\",{className:\"text-[17px] font-semibold leading-[22px]\",children:\"Andel husholdninger med Norgespris\"}),Xe(\"p\",{className:\"text-[13px] leading-[18px] text-[#5B6472]\",children:\"Per kommune, 31. oktober 2026\"})]}),Xe(\"div\",{className:\"-mr-2 -mt-1\",children:R})]}),Ha(\"div\",{ref:r,className:\"pointer-events-auto absolute bottom-0 left-0 right-0 max-h-[68%] overflow-y-auto rounded-t-xl border-t border-[#D5DAD6] bg-[#F6F7F4] px-4 pb-2 pt-2.5\",children:[p?Xe(Mp,{k:p,onLukk:S}):Xe(Ap,{onVelg:D,oppover:!0}),Xe(\"div\",{className:\"mt-2\",children:Xe(Ip,{smal:!0})})]})]}):Ha(\"aside\",{className:\"pointer-events-auto absolute left-0 top-0 max-h-full w-[344px] overflow-y-auto bg-[#F6F7F4] pb-3 pl-6 pr-3 pt-5\",style:{scrollbarWidth:\"thin\",scrollbarColor:\"#D5DAD6 transparent\"},children:[Xe(\"h1\",{className:\"text-[26px] font-semibold leading-[31px]\",children:\"Andel husholdninger med Norgespris\"}),Xe(\"p\",{className:\"mt-1.5 text-[15px] leading-[21px] text-[#5B6472]\",children:\"Per kommune, 31. oktober 2026. Elhub, str\\xF8mm\\xE5lere til husholdninger.\"}),Xe(\"div\",{className:\"mt-4\",children:Xe(Ip,{smal:!1})}),Xe(\"div\",{className:\"mt-4\",children:Xe(Ap,{onVelg:D,oppover:!1})}),Xe(\"div\",{className:\"-ml-2 mt-2\",children:R}),p&&Xe(\"div\",{className:\"mt-3\",children:Xe(Mp,{k:p,onLukk:S})})]}),_&&Xe(hx,{onLukk:()=>x(!1),mobil:v})]})}export{PD as default};\n/*! Bundled license information:\n\nmaplibre-gl/dist/maplibre-gl-shared.mjs:\nmaplibre-gl/dist/maplibre-gl.mjs:\n  (**\n  * MapLibre GL JS\n  * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.6.0/LICENSE.txt\n  *)\n*/\n","styles":".kl-font,.kl-font button,.kl-font input{font-family:Schibsted Grotesk,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif}.kl-skravur{background-color:#e6e4dc;background-image:repeating-linear-gradient(135deg,#b5b1a4 0,#b5b1a4 1px,transparent 1px,transparent 5.66px)}\n\n*, ::before, ::after {\n  --tw-border-spacing-x: 0;\n  --tw-border-spacing-y: 0;\n  --tw-translate-x: 0;\n  --tw-translate-y: 0;\n  --tw-rotate: 0;\n  --tw-skew-x: 0;\n  --tw-skew-y: 0;\n  --tw-scale-x: 1;\n  --tw-scale-y: 1;\n  --tw-pan-x:  ;\n  --tw-pan-y:  ;\n  --tw-pinch-zoom:  ;\n  --tw-scroll-snap-strictness: proximity;\n  --tw-gradient-from-position:  ;\n  --tw-gradient-via-position:  ;\n  --tw-gradient-to-position:  ;\n  --tw-ordinal:  ;\n  --tw-slashed-zero:  ;\n  --tw-numeric-figure:  ;\n  --tw-numeric-spacing:  ;\n  --tw-numeric-fraction:  ;\n  --tw-ring-inset:  ;\n  --tw-ring-offset-width: 0px;\n  --tw-ring-offset-color: #fff;\n  --tw-ring-color: rgb(59 130 246 / 0.5);\n  --tw-ring-offset-shadow: 0 0 #0000;\n  --tw-ring-shadow: 0 0 #0000;\n  --tw-shadow: 0 0 #0000;\n  --tw-shadow-colored: 0 0 #0000;\n  --tw-blur:  ;\n  --tw-brightness:  ;\n  --tw-contrast:  ;\n  --tw-grayscale:  ;\n  --tw-hue-rotate:  ;\n  --tw-invert:  ;\n  --tw-saturate:  ;\n  --tw-sepia:  ;\n  --tw-drop-shadow:  ;\n  --tw-backdrop-blur:  ;\n  --tw-backdrop-brightness:  ;\n  --tw-backdrop-contrast:  ;\n  --tw-backdrop-grayscale:  ;\n  --tw-backdrop-hue-rotate:  ;\n  --tw-backdrop-invert:  ;\n  --tw-backdrop-opacity:  ;\n  --tw-backdrop-saturate:  ;\n  --tw-backdrop-sepia:  ;\n  --tw-contain-size:  ;\n  --tw-contain-layout:  ;\n  --tw-contain-paint:  ;\n  --tw-contain-style:  ;\n}\n\n::backdrop {\n  --tw-border-spacing-x: 0;\n  --tw-border-spacing-y: 0;\n  --tw-translate-x: 0;\n  --tw-translate-y: 0;\n  --tw-rotate: 0;\n  --tw-skew-x: 0;\n  --tw-skew-y: 0;\n  --tw-scale-x: 1;\n  --tw-scale-y: 1;\n  --tw-pan-x:  ;\n  --tw-pan-y:  ;\n  --tw-pinch-zoom:  ;\n  --tw-scroll-snap-strictness: proximity;\n  --tw-gradient-from-position:  ;\n  --tw-gradient-via-position:  ;\n  --tw-gradient-to-position:  ;\n  --tw-ordinal:  ;\n  --tw-slashed-zero:  ;\n  --tw-numeric-figure:  ;\n  --tw-numeric-spacing:  ;\n  --tw-numeric-fraction:  ;\n  --tw-ring-inset:  ;\n  --tw-ring-offset-width: 0px;\n  --tw-ring-offset-color: #fff;\n  --tw-ring-color: rgb(59 130 246 / 0.5);\n  --tw-ring-offset-shadow: 0 0 #0000;\n  --tw-ring-shadow: 0 0 #0000;\n  --tw-shadow: 0 0 #0000;\n  --tw-shadow-colored: 0 0 #0000;\n  --tw-blur:  ;\n  --tw-brightness:  ;\n  --tw-contrast:  ;\n  --tw-grayscale:  ;\n  --tw-hue-rotate:  ;\n  --tw-invert:  ;\n  --tw-saturate:  ;\n  --tw-sepia:  ;\n  --tw-drop-shadow:  ;\n  --tw-backdrop-blur:  ;\n  --tw-backdrop-brightness:  ;\n  --tw-backdrop-contrast:  ;\n  --tw-backdrop-grayscale:  ;\n  --tw-backdrop-hue-rotate:  ;\n  --tw-backdrop-invert:  ;\n  --tw-backdrop-opacity:  ;\n  --tw-backdrop-saturate:  ;\n  --tw-backdrop-sepia:  ;\n  --tw-contain-size:  ;\n  --tw-contain-layout:  ;\n  --tw-contain-paint:  ;\n  --tw-contain-style:  ;\n}/*\n! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n  box-sizing: border-box; /* 1 */\n  border-width: 0; /* 2 */\n  border-style: solid; /* 2 */\n  border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n  --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n  line-height: 1.5; /* 1 */\n  -webkit-text-size-adjust: 100%; /* 2 */\n  -moz-tab-size: 4; /* 3 */\n  tab-size: 4; /* 3 */\n  font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n  font-feature-settings: normal; /* 5 */\n  font-variation-settings: normal; /* 6 */\n  -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n  margin: 0; /* 1 */\n  line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n  height: 0; /* 1 */\n  color: inherit; /* 2 */\n  border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n  text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n  font-size: inherit;\n  font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n  color: inherit;\n  text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n  font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n  font-feature-settings: normal; /* 2 */\n  font-variation-settings: normal; /* 3 */\n  font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n  font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n  font-size: 75%;\n  line-height: 0;\n  position: relative;\n  vertical-align: baseline;\n}\n\nsub {\n  bottom: -0.25em;\n}\n\nsup {\n  top: -0.5em;\n}\n\n/*\n1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)\n2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n  text-indent: 0; /* 1 */\n  border-color: inherit; /* 2 */\n  border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n  font-family: inherit; /* 1 */\n  font-feature-settings: inherit; /* 1 */\n  font-variation-settings: inherit; /* 1 */\n  font-size: 100%; /* 1 */\n  font-weight: inherit; /* 1 */\n  line-height: inherit; /* 1 */\n  letter-spacing: inherit; /* 1 */\n  color: inherit; /* 1 */\n  margin: 0; /* 2 */\n  padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n  text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n  -webkit-appearance: button; /* 1 */\n  background-color: transparent; /* 2 */\n  background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n  outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n  box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n  vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n  height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n  -webkit-appearance: textfield; /* 1 */\n  outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n  -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n  -webkit-appearance: button; /* 1 */\n  font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n  display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n  margin: 0;\n}\n\nfieldset {\n  margin: 0;\n  padding: 0;\n}\n\nlegend {\n  padding: 0;\n}\n\nol,\nul,\nmenu {\n  list-style: none;\n  margin: 0;\n  padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n  padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n  resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::placeholder,\ntextarea::placeholder {\n  opacity: 1; /* 1 */\n  color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n  cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n  cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n   This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n  display: block; /* 1 */\n  vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n  max-width: 100%;\n  height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden]:where(:not([hidden=\"until-found\"])) {\n  display: none;\n}\n.container {\n  width: 100%;\n}\n@media (min-width: 640px) {\n\n  .container {\n    max-width: 640px;\n  }\n}\n@media (min-width: 768px) {\n\n  .container {\n    max-width: 768px;\n  }\n}\n@media (min-width: 1024px) {\n\n  .container {\n    max-width: 1024px;\n  }\n}\n@media (min-width: 1280px) {\n\n  .container {\n    max-width: 1280px;\n  }\n}\n@media (min-width: 1536px) {\n\n  .container {\n    max-width: 1536px;\n  }\n}\n.pointer-events-none {\n  pointer-events: none;\n}\n.pointer-events-auto {\n  pointer-events: auto;\n}\n.visible {\n  visibility: visible;\n}\n.static {\n  position: static;\n}\n.fixed {\n  position: fixed;\n}\n.absolute {\n  position: absolute;\n}\n.relative {\n  position: relative;\n}\n.inset-0 {\n  inset: 0px;\n}\n.bottom-0 {\n  bottom: 0px;\n}\n.left-0 {\n  left: 0px;\n}\n.left-1\\/2 {\n  left: 50%;\n}\n.right-0 {\n  right: 0px;\n}\n.top-0 {\n  top: 0px;\n}\n.top-1\\/2 {\n  top: 50%;\n}\n.z-10 {\n  z-index: 10;\n}\n.z-30 {\n  z-index: 30;\n}\n.m-1 {\n  margin: 0.25rem;\n}\n.-ml-2 {\n  margin-left: -0.5rem;\n}\n.-mr-2 {\n  margin-right: -0.5rem;\n}\n.-mt-1 {\n  margin-top: -0.25rem;\n}\n.mb-1\\.5 {\n  margin-bottom: 0.375rem;\n}\n.mt-0\\.5 {\n  margin-top: 0.125rem;\n}\n.mt-1 {\n  margin-top: 0.25rem;\n}\n.mt-1\\.5 {\n  margin-top: 0.375rem;\n}\n.mt-2 {\n  margin-top: 0.5rem;\n}\n.mt-2\\.5 {\n  margin-top: 0.625rem;\n}\n.mt-3 {\n  margin-top: 0.75rem;\n}\n.mt-4 {\n  margin-top: 1rem;\n}\n.block {\n  display: block;\n}\n.flex {\n  display: flex;\n}\n.grid {\n  display: grid;\n}\n.hidden {\n  display: none;\n}\n.h-0\\.5 {\n  height: 0.125rem;\n}\n.h-1 {\n  height: 0.25rem;\n}\n.h-11 {\n  height: 2.75rem;\n}\n.h-2 {\n  height: 0.5rem;\n}\n.h-3\\.5 {\n  height: 0.875rem;\n}\n.h-\\[18px\\] {\n  height: 18px;\n}\n.h-full {\n  height: 100%;\n}\n.max-h-\\[68\\%\\] {\n  max-height: 68%;\n}\n.max-h-\\[86\\%\\] {\n  max-height: 86%;\n}\n.max-h-\\[88\\%\\] {\n  max-height: 88%;\n}\n.max-h-full {\n  max-height: 100%;\n}\n.min-h-\\[44px\\] {\n  min-height: 44px;\n}\n.w-11 {\n  width: 2.75rem;\n}\n.w-2 {\n  width: 0.5rem;\n}\n.w-5 {\n  width: 1.25rem;\n}\n.w-9 {\n  width: 2.25rem;\n}\n.w-\\[344px\\] {\n  width: 344px;\n}\n.w-\\[560px\\] {\n  width: 560px;\n}\n.w-full {\n  width: 100%;\n}\n.min-w-0 {\n  min-width: 0px;\n}\n.max-w-\\[92\\%\\] {\n  max-width: 92%;\n}\n.flex-1 {\n  flex: 1 1 0%;\n}\n.shrink-0 {\n  flex-shrink: 0;\n}\n.-translate-x-1\\/2 {\n  --tw-translate-x: -50%;\n  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.-translate-y-1\\/2 {\n  --tw-translate-y: -50%;\n  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.transform {\n  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));\n}\n.cursor-default {\n  cursor: default;\n}\n.resize {\n  resize: both;\n}\n.list-decimal {\n  list-style-type: decimal;\n}\n.list-disc {\n  list-style-type: disc;\n}\n.items-start {\n  align-items: flex-start;\n}\n.items-center {\n  align-items: center;\n}\n.items-baseline {\n  align-items: baseline;\n}\n.justify-center {\n  justify-content: center;\n}\n.justify-between {\n  justify-content: space-between;\n}\n.gap-2 {\n  gap: 0.5rem;\n}\n.gap-3 {\n  gap: 0.75rem;\n}\n.overflow-hidden {\n  overflow: hidden;\n}\n.overflow-y-auto {\n  overflow-y: auto;\n}\n.whitespace-nowrap {\n  white-space: nowrap;\n}\n.rounded {\n  border-radius: 0.25rem;\n}\n.rounded-lg {\n  border-radius: 0.5rem;\n}\n.rounded-md {\n  border-radius: 0.375rem;\n}\n.rounded-t-xl {\n  border-top-left-radius: 0.75rem;\n  border-top-right-radius: 0.75rem;\n}\n.border {\n  border-width: 1px;\n}\n.border-b {\n  border-bottom-width: 1px;\n}\n.border-t {\n  border-top-width: 1px;\n}\n.border-\\[\\#D5DAD6\\] {\n  --tw-border-opacity: 1;\n  border-color: rgb(213 218 214 / var(--tw-border-opacity, 1));\n}\n.border-\\[\\#E6E4DC\\] {\n  --tw-border-opacity: 1;\n  border-color: rgb(230 228 220 / var(--tw-border-opacity, 1));\n}\n.bg-\\[\\#1E2633\\] {\n  --tw-bg-opacity: 1;\n  background-color: rgb(30 38 51 / var(--tw-bg-opacity, 1));\n}\n.bg-\\[\\#1E2633\\]\\/30 {\n  background-color: rgb(30 38 51 / 0.3);\n}\n.bg-\\[\\#F6F7F4\\] {\n  --tw-bg-opacity: 1;\n  background-color: rgb(246 247 244 / var(--tw-bg-opacity, 1));\n}\n.bg-white {\n  --tw-bg-opacity: 1;\n  background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));\n}\n.p-1 {\n  padding: 0.25rem;\n}\n.px-2 {\n  padding-left: 0.5rem;\n  padding-right: 0.5rem;\n}\n.px-3 {\n  padding-left: 0.75rem;\n  padding-right: 0.75rem;\n}\n.px-4 {\n  padding-left: 1rem;\n  padding-right: 1rem;\n}\n.px-6 {\n  padding-left: 1.5rem;\n  padding-right: 1.5rem;\n}\n.py-1 {\n  padding-top: 0.25rem;\n  padding-bottom: 0.25rem;\n}\n.py-2\\.5 {\n  padding-top: 0.625rem;\n  padding-bottom: 0.625rem;\n}\n.py-\\[3px\\] {\n  padding-top: 3px;\n  padding-bottom: 3px;\n}\n.pb-1\\.5 {\n  padding-bottom: 0.375rem;\n}\n.pb-2 {\n  padding-bottom: 0.5rem;\n}\n.pb-3 {\n  padding-bottom: 0.75rem;\n}\n.pb-5 {\n  padding-bottom: 1.25rem;\n}\n.pb-6 {\n  padding-bottom: 1.5rem;\n}\n.pl-5 {\n  padding-left: 1.25rem;\n}\n.pl-6 {\n  padding-left: 1.5rem;\n}\n.pr-3 {\n  padding-right: 0.75rem;\n}\n.pt-1 {\n  padding-top: 0.25rem;\n}\n.pt-2 {\n  padding-top: 0.5rem;\n}\n.pt-2\\.5 {\n  padding-top: 0.625rem;\n}\n.pt-3 {\n  padding-top: 0.75rem;\n}\n.pt-5 {\n  padding-top: 1.25rem;\n}\n.text-left {\n  text-align: left;\n}\n.text-justify {\n  text-align: justify;\n}\n.text-\\[13px\\] {\n  font-size: 13px;\n}\n.text-\\[14px\\] {\n  font-size: 14px;\n}\n.text-\\[15px\\] {\n  font-size: 15px;\n}\n.text-\\[16px\\] {\n  font-size: 16px;\n}\n.text-\\[17px\\] {\n  font-size: 17px;\n}\n.text-\\[20px\\] {\n  font-size: 20px;\n}\n.text-\\[22px\\] {\n  font-size: 22px;\n}\n.text-\\[26px\\] {\n  font-size: 26px;\n}\n.font-normal {\n  font-weight: 400;\n}\n.font-semibold {\n  font-weight: 600;\n}\n.uppercase {\n  text-transform: uppercase;\n}\n.lowercase {\n  text-transform: lowercase;\n}\n.italic {\n  font-style: italic;\n}\n.leading-\\[18px\\] {\n  line-height: 18px;\n}\n.leading-\\[21px\\] {\n  line-height: 21px;\n}\n.leading-\\[22px\\] {\n  line-height: 22px;\n}\n.leading-\\[24px\\] {\n  line-height: 24px;\n}\n.leading-\\[26px\\] {\n  line-height: 26px;\n}\n.leading-\\[31px\\] {\n  line-height: 31px;\n}\n.leading-none {\n  line-height: 1;\n}\n.text-\\[\\#1E2633\\] {\n  --tw-text-opacity: 1;\n  color: rgb(30 38 51 / var(--tw-text-opacity, 1));\n}\n.text-\\[\\#1F4FE0\\] {\n  --tw-text-opacity: 1;\n  color: rgb(31 79 224 / var(--tw-text-opacity, 1));\n}\n.text-\\[\\#5B6472\\] {\n  --tw-text-opacity: 1;\n  color: rgb(91 100 114 / var(--tw-text-opacity, 1));\n}\n.text-white {\n  --tw-text-opacity: 1;\n  color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\n.underline {\n  text-decoration-line: underline;\n}\n.underline-offset-2 {\n  text-underline-offset: 2px;\n}\n.shadow-\\[0_8px_30px_rgba\\(30\\2c 38\\2c 51\\2c 0\\.2\\)\\] {\n  --tw-shadow: 0 8px 30px rgba(30,38,51,0.2);\n  --tw-shadow-colored: 0 8px 30px var(--tw-shadow-color);\n  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\n.ring {\n  --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n}\n.blur {\n  --tw-blur: blur(8px);\n  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.invert {\n  --tw-invert: invert(100%);\n  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.filter {\n  filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);\n}\n.transition {\n  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n  transition-duration: 150ms;\n}\n.placeholder\\:text-\\[\\#5B6472\\]::placeholder {\n  --tw-text-opacity: 1;\n  color: rgb(91 100 114 / var(--tw-text-opacity, 1));\n}\n.hover\\:bg-\\[\\#EEF0EA\\]:hover {\n  --tw-bg-opacity: 1;\n  background-color: rgb(238 240 234 / var(--tw-bg-opacity, 1));\n}\n.hover\\:text-\\[\\#1E2633\\]:hover {\n  --tw-text-opacity: 1;\n  color: rgb(30 38 51 / var(--tw-text-opacity, 1));\n}\n.focus\\:outline-none:focus {\n  outline: 2px solid transparent;\n  outline-offset: 2px;\n}\n.focus-visible\\:ring-2:focus-visible {\n  --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);\n  --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);\n  box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);\n}\n.focus-visible\\:ring-\\[\\#1F4FE0\\]\\/40:focus-visible {\n  --tw-ring-color: rgb(31 79 224 / 0.4);\n}\n.active\\:bg-\\[\\#E6E4DC\\]:active {\n  --tw-bg-opacity: 1;\n  background-color: rgb(230 228 220 / var(--tw-bg-opacity, 1));\n}\n","bundle_hash":"3402286ae80da24f"}