1(function(ja,xo){typeof exports=="object"&&typeof module<"u"?module.exports=xo():typeof define=="function"&&define.amd?define([],xo):(ja=typeof globalThis<"u"?globalThis:ja||self,ja.CarteLoopi=xo())})(this,function(){var ja=Object.create,xo=Object.defineProperty,Fm=Object.getOwnPropertyDescriptor,Rm=Object.getOwnPropertyNames,Bm=Object.getPrototypeOf,Om=Object.prototype.hasOwnProperty,Bd=(R,z)=>()=>(z||R((z={exports:{}}).exports,z),z.exports),Vm=(R,z,L,j)=>{if(z&&typeof z=="object"||typeof z=="function")for(var Z=Rm(z),E=0,c=Z.length,H;E<c;E++)H=Z[E],!Om.call(R,H)&&H!==L&&xo(R,H,{get:(he=>z[he]).bind(null,H),enumerable:!(j=Fm(z,H))||j.enumerable});return R},Od=(R,z,L)=>(L=R!=null?ja(Bm(R)):{},Vm(z||!R||!R.__esModule?xo(L,"default",{value:R,enumerable:!0}):L,R)),jm=Bd(((R,z)=>{(function(L,j){typeof R=="object"&&typeof z<"u"?z.exports=j():typeof define=="function"&&define.amd?define(j):(L=typeof globalThis<"u"?globalThis:L||self,L.maplibregl=j())})(R,(function(){"use strict";var L={},j={};function Z(E,c,H){if(j[E]=H,E==="index"){var he="var sharedModule = {}; ("+j.shared+")(sharedModule); ("+j.worker+")(sharedModule);",xe={};return j.shared(xe),j.index(L,xe),typeof window<"u"&&L.setWorkerUrl(window.URL.createObjectURL(new Blob([he],{type:"text/javascript"}))),L}}return Z("shared",["exports"],(function(E){"use strict";function c(r,e,i,s){return new(i||(i=Promise))((function(o,l){function h(m){try{g(s.next(m))}catch(v){l(v)}}function d(m){try{g(s.throw(m))}catch(v){l(v)}}function g(m){var v;m.done?o(m.value):(v=m.value,v instanceof i?v:new i((function(_){_(v)}))).then(h,d)}g((s=s.apply(r,e||[])).next())}))}function H(r,e){this.x=r,this.y=e}function he(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var xe,Ae;H.prototype={clone(){return new H(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),s=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=s,this},_rotateAround(r,e){const i=Math.cos(r),s=Math.sin(r),o=e.y+s*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-s*(this.y-e.y),this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:H},H.convert=function(r){if(r instanceof H)return r;if(Array.isArray(r))return new H(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new H(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};var Le=he((function(){if(Ae)return xe;function r(e,i,s,o){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(o-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=o}return Ae=1,xe=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,o=0;o<8;o++){var l=this.sampleCurveX(s)-e;if(Math.abs(l)<i)return s;var h=this.sampleCurveDerivativeX(s);
vendor: 5,047 bytes, line 1
1if(Math.abs(h)<1e-6)break;s-=l/h}var d=0,g=1;for(s=e,o=0;o<20&&(l=this.sampleCurveX(s),!(Math.abs(l-e)<i));o++)e>l?d=s:g=s,s=.5*(g-d)+d;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},xe})());let Ee,ze;function be(){return Ee??=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function",Ee}function le(){if(ze==null&&(ze=!1,be())){const e=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(e){for(let s=0;s<25;s++){const o=4*s;e.fillStyle=`rgb(${o},${o+1},${o+2})`,e.fillRect(s%5,Math.floor(s/5),1,1)}const i=e.getImageData(0,0,5,5).data;for(let s=0;s<100;s++)if(s%4!=3&&i[s]!==s){ze=!0;break}}}return ze||!1}var Be=1e-6,Ne=typeof Float32Array<"u"?Float32Array:Array;function ht(){var r=new Ne(9);return Ne!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function dt(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Vt(){var r=new Ne(3);return Ne!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Ut(r){var e=r[0],i=r[1],s=r[2];return Math.sqrt(e*e+i*i+s*s)}function Tt(r,e,i){var s=new Ne(3);return s[0]=r,s[1]=e,s[2]=i,s}function nt(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function J(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function re(r,e,i){var s=e[0],o=e[1],l=e[2],h=i[0],d=i[1],g=i[2];return r[0]=o*g-l*d,r[1]=l*h-s*g,r[2]=s*d-o*h,r}var oe,Ce=Ut;function Ue(r,e,i){var s=e[0],o=e[1],l=e[2],h=e[3];return r[0]=i[0]*s+i[4]*o+i[8]*l+i[12]*h,r[1]=i[1]*s+i[5]*o+i[9]*l+i[13]*h,r[2]=i[2]*s+i[6]*o+i[10]*l+i[14]*h,r[3]=i[3]*s+i[7]*o+i[11]*l+i[15]*h,r}function ct(){var r=new Ne(4);return Ne!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function We(r,e,i,s){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:"zyx",l=Math.PI/360;e*=l,s*=l,i*=l;var h=Math.sin(e),d=Math.cos(e),g=Math.sin(i),m=Math.cos(i),v=Math.sin(s),_=Math.cos(s);switch(o){case"xyz":r[0]=h*m*_+d*g*v,r[1]=d*g*_-h*m*v,r[2]=d*m*v+h*g*_,r[3]=d*m*_-h*g*v;break;case"xzy":r[0]=h*m*_-d*g*v,r[1]=d*g*_-h*m*v,r[2]=d*m*v+h*g*_,r[3]=d*m*_+h*g*v;break;case"yxz":r[0]=h*m*_+d*g*v,r[1]=d*g*_-h*m*v,r[2]=d*m*v-h*g*_,r[3]=d*m*_+h*g*v;break;case"yzx":r[0]=h*m*_+d*g*v,r[1]=d*g*_+h*m*v,r[2]=d*m*v-h*g*_,r[3]=d*m*_-h*g*v;break;case"zxy":r[0]=h*m*_-d*g*v,r[1]=d*g*_+h*m*v,r[2]=d*m*v+h*g*_,r[3]=d*m*_-h*g*v;break;case"zyx":r[0]=h*m*_-d*g*v,r[1]=d*g*_+h*m*v,r[2]=d*m*v-h*g*_,r[3]=d*m*_+h*g*v;break;default:throw new Error("Unknown angle order "+o)}return r}function ot(){var r=new Ne(2);return Ne!=Float32Array&&(r[0]=0,r[1]=0),r}function Ye(r,e){var i=new Ne(2);return i[0]=r,i[1]=e,i}Vt(),oe=new Ne(4),Ne!=Float32Array&&(oe[0]=0,oe[1]=0,oe[2]=0,oe[3]=0),Vt(),Tt(1,0,0),Tt(0,1,0),ct(),ct(),ht(),ot();const Ge=8192;function it(r,e,i){return e*(Ge/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}function $t(r,e){return(r%e+e)%e}function Kt(r,e,i){return r*(1-i)+e*i}function or(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function rn(r,e,i,s){const o=new Le(r,e,i,s);return l=>o.solve(l)}const Is=rn(.25,.1,.25,1);function Ri(r,e,i){return Math.min(i,Math.max(e,r))}function Ms(r,e,i){const s=i-e,o=((r-e)%s+s)%s+e;return o===e?i:o}function Bi(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}let Un=1;function $n(r,e,i){const s={};for(const o in r)s[o]=e.call(this,r[o],o,r);return s}function Gn(r,e,i){const s={};for(const o in r)e.call(this,r[o],o,r)&&(s[o]=r[o]);return s}function mt(r){return Array.isArray(r)?r.map(mt):typeof r=="object"&&r?$n(r,mt):r}const nn={};function et(r){nn[r]||(typeof console<"u"&&console.warn(r),nn[r]=!0)}function Et(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function _r(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let Ur=null;function Oi(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const Xi="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function sn(r,e,i,s,o){return c(this,void 0,void 0,(function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const l=new VideoFrame(r,{timestamp:0});try{const h=l?.format;if(!h||!h.startsWith("BGR")&&!h.startsWith("RGB"))throw new Error(`Unrecognized format ${h}`);const d=h.startsWith("BGR"),g=new Uint8ClampedArray(s*o*4);if(yield l.copyTo(g,(function(m,v,_,T,x){const I=4*Math.max(-v,0),M=(Math.max(0,_)-_)*T*4+I,D=4*T,k=Math.max(0,v),O=Math.max(0,_);return{rect:{x:k,y:O,width:Math.min(m.width,v+T)-k,height:Math.min(m.height,_+x)-O},layout:[{offset:M,stride:D}]}})(r,e,i,s,o)),d)for(let m=0;m<g.length;m+=4){const v=g[m];g[m]=g[m+2],g[m+2]=v}return g}finally{l.close()}}))}let $r,qn;function So(r,e,i,s){return r.addEventListener(e,i,s),{unsubscribe:()=>{r.removeEventListener(e,i,s)}}}function Gr(r){return r*Math.PI/180}function on(r){return r/Math.PI*180}const Ga={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0}
1,qa={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},Po="AbortError";class Es extends Error{constructor(e=Po){super(e instanceof Error?e.message:e),this.name=Po,e instanceof Error&&e.stack&&(this.stack=e.stack)}}function pc(r){return r.name===Po}function Io(r){if(r.aborted)throw new Es(r.reason)}const qr={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Er(r){return qr.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const Yi="global-dispatcher";class Zn extends Error{constructor(e,i,s,o){super(`AJAXError: ${i} (${e}): ${s}`),this.status=e,this.statusText=i,this.url=s,this.body=o}}const Za=()=>_r(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,an=function(r,e){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const s=Er(r.url);if(s)return s(r,e);if(_r(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Yi},e)}if(!(/^file:/.test(i=r.url)||/^file:/.test(Za())&&!/^\w+:/.test(i))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return(function(s,o){return c(this,void 0,void 0,(function*(){const l=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:Za(),referrerPolicy:s.referrerPolicy,signal:o.signal});let h,d;s.type!=="json"||l.headers.has("Accept")||l.headers.set("Accept","application/json");try{h=yield fetch(l)}catch(m){throw pc(m)?m:new Zn(0,m.message,s.url,new Blob)}if(!h.ok){const m=yield h.blob();throw new Zn(h.status,h.statusText,s.url,m)}d=s.type==="arrayBuffer"||s.type==="image"?h.arrayBuffer():s.type==="json"?h.json():h.text();const g=yield d;return Io(o.signal),{data:g,cacheControl:h.headers.get("Cache-Control"),expires:h.headers.get("Expires"),etag:h.headers.get("ETag")}}))})(r,e);if(_r(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Yi},e)}var i;return(function(s,o){return new Promise(((l,h)=>{var d;const g=new XMLHttpRequest;g.open(s.method||"GET",s.url,!0),s.type!=="arrayBuffer"&&s.type!=="image"||(g.responseType="arraybuffer");for(const m in s.headers)g.setRequestHeader(m,s.headers[m]);s.type==="json"&&(g.responseType="text",!((d=s.headers)===null||d===void 0)&&d.Accept||g.setRequestHeader("Accept","application/json")),g.withCredentials=s.credentials==="include",g.onerror=()=>{h(new Error(g.statusText))},g.onload=()=>{if(!o.signal.aborted)if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let m=g.response;if(s.type==="json")try{m=JSON.parse(g.response)}catch(v){h(v);return}l({data:m,cacheControl:g.getResponseHeader("Cache-Control"),expires:g.getResponseHeader("Expires"),etag:g.getResponseHeader("ETag")})}else{const m=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});h(new Zn(g.status,g.statusText,s.url,m))}},o.signal.addEventListener("abort",(()=>{g.abort(),h(new Es(o.signal.reason))})),g.send(s.body)}))})(r,e)};function ar(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const e=new URL(r),i=window.location;return e.protocol===i.protocol&&e.host===i.host}function Wn(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function ln(r,e,i){if(i&&i[r]){const s=i[r].indexOf(e);s!==-1&&i[r].splice(s,1)}}class Cs{constructor(e,i={}){Bi(this,i),this.type=e}}class Hn extends Cs{constructor(e,i={}){super("error",Bi({error:e},i))}}class Mo{on(e,i){return this._listeners=this._listeners||{},Wn(e,i,this._listeners),{unsubscribe:()=>{this.off(e,i)}}}off(e,i){return ln(e,i,this._listeners),ln(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Wn(e,i,this._oneTimeListeners),this):new Promise((s=>this.once(e,s)))}fire(e,i){typeof e=="string"&&(e=new Cs(e,i||{}));const s=e.type;if(this.listens(s)){e.target=this;const o=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const d of o)d.call(this,e);const l=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const d of l)ln(s,d,this._oneTimeListeners),d.call(this,e);const h=this._eventedParent;h&&(Bi(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),h.fire(e))}else e instanceof Hn&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}var ve={$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"}
vendor: 21,023 bytes, line 1
1,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:{required:!0,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"}},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"]},"property-type":"data-constant"},"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"},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-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],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
vendor: 12,722 bytes, line 1
1"},"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"}},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"}]}}}}}
vendor: 58,402 bytes, line 1
1;const Wa=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Ha(r,e){const i={};for(const s in r)s!=="ref"&&(i[s]=r[s]);return Wa.forEach((s=>{s in e&&(i[s]=e[s])})),i}function gt(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!gt(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!gt(r[i],e[i]))return!1;return!0}return r===e}function Di(r,e){r.push(e)}function cn(r,e,i){Di(i,{command:"addSource",args:[r,e[r]]})}function fc(r,e,i){Di(e,{command:"removeSource",args:[r]}),i[r]=!0}function mc(r,e,i,s){fc(r,i,s),cn(r,e,i)}function Ku(r,e,i){let s;for(s in r[i])if(Object.prototype.hasOwnProperty.call(r[i],s)&&s!=="data"&&!gt(r[i][s],e[i][s]))return!1;for(s in e[i])if(Object.prototype.hasOwnProperty.call(e[i],s)&&s!=="data"&&!gt(r[i][s],e[i][s]))return!1;return!0}function Eo(r,e,i,s,o,l){r=r||{},e=e||{};for(const h in r)Object.prototype.hasOwnProperty.call(r,h)&&(gt(r[h],e[h])||i.push({command:l,args:[s,h,e[h],o]}));for(const h in e)Object.prototype.hasOwnProperty.call(e,h)&&!Object.prototype.hasOwnProperty.call(r,h)&&(gt(r[h],e[h])||i.push({command:l,args:[s,h,e[h],o]}))}function Xa(r){return r.id}function gc(r,e){return r[e.id]=e,r}class Me{constructor(e,i,s,o){this.message=(e?`${e}: `:"")+s,o&&(this.identifier=o),i!=null&&i.__line__&&(this.line=i.__line__)}}function un(r,...e){for(const i of e)for(const s in i)r[s]=i[s];return r}class pi extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Ya{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[s,o]of i)this.bindings[s]=o}concat(e){return new Ya(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Zr={kind:"null"},De={kind:"number"},He={kind:"string"},Je={kind:"boolean"},Vi={kind:"color"},Xn={kind:"projectionDefinition"},Wr={kind:"object"},Ke={kind:"value"},Co={kind:"collator"},Yn={kind:"formatted"},As={kind:"padding"},Kn={kind:"colorArray"},Ds={kind:"numberArray"},hn={kind:"resolvedImage"},yr={kind:"variableAnchorOffsetCollection"};function si(r,e){return{kind:"array",itemType:r,N:e}}function Ct(r){if(r.kind==="array"){const e=Ct(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Ka=[Zr,De,He,Je,Vi,Xn,Yn,Wr,si(Ke),As,Ds,Kn,hn,yr];function ks(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!ks(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of Ka)if(!ks(i,e))return null}}return`Expected ${Ct(r)} but found ${Ct(e)} instead.`}function Jn(r,e){return e.some((i=>i.kind===r.kind))}function dn(r,e){return e.some((i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r))}function ji(r,e){return r.kind==="array"&&e.kind==="array"?r.itemType.kind===e.itemType.kind&&typeof r.N=="number":r.kind===e.kind}const Ao=.96422,ti=.82521,_c=4/29,pn=6/29,Qn=3*pn*pn,yc=pn*pn*pn,Ju=Math.PI/180,Qu=180/Math.PI;function Ja(r){return(r%=360)<0&&(r+=360),r}function vc([r,e,i,s]){let o,l;const h=Qa((.2225045*(r=Do(r))+.7168786*(e=Do(e))+.0606169*(i=Do(i)))/1);r===e&&e===i?o=l=h:(o=Qa((.4360747*r+.3850649*e+.1430804*i)/Ao),l=Qa((.0139322*r+.0971045*e+.7141733*i)/ti));const d=116*h-16;return[d<0?0:d,500*(o-h),200*(h-l),s]}function Do(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Qa(r){return r>yc?Math.pow(r,1/3):r/Qn+_c}function xc([r,e,i,s]){let o=(r+16)/116,l=isNaN(e)?o:o+e/500,h=isNaN(i)?o:o-i/200;return o=1*tl(o),l=Ao*tl(l),h=ti*tl(h),[el(3.1338561*l-1.6168667*o-.4906146*h),el(-.9787684*l+1.9161415*o+.033454*h),el(.0719453*l-.2289914*o+1.4052427*h),s]}function el(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function tl(r){return r>pn?r*r*r:Qn*(r-_c)}const eh=Object.hasOwn||function(r,e){return Object.prototype.hasOwnProperty.call(r,e)};function zs(r,e){return eh(r,e)?r[e]:void 0}function ko(r){return parseInt(r.padEnd(2,r),16)/255}function il(r,e){return vr(e?r/100:r,0,1)}function vr(r,e,i){return Math.min(Math.max(e,r),i)}function bc(r){return!r.some(Number.isNaN)}const th={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 Ki(r,e,i){return r+i*(e-r)}function es(r,e,i){return r.map(((s,o)=>Ki(s,e[o],i)))}class rt{constructor(e,i,s,o=1,l=!0){this.r=e,this.g=i,this.b=s,this.a=o,l||(this.r*=o,this.g*=o,this.b*=o,o||this.overwriteGetter("rgb",[e,i,s,o]))}static parse(e){if(e instanceof rt)return e;if(typeof e!="string")return;const i=(function(s){if((s=s.toLowerCase().trim())==="transparent")return[0,0,0,0];const o=zs(th,s);if(o){const[h,d,g]=o;return[h/255,d/255,g/255,1]}if(s.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(s)){const h=s.length<6?1:2;let d=1;return[ko(s.slice(d,d+=h)),ko(s.slice(d,d+=h)),ko(s.slice(d,d+=h)),ko(s.slice(d,d+h)||"ff")]}if(s.startsWith("rgb")){const h=s.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(h){const[d,g,m,v,_,T,x,I,M,D,k,O]=h,B=[v||" ",x||" ",D].join("");if(B===" "||B===" /"||B===",,"||B===",,,"){const N=[m,T,M].join(""),$=N==="%%%"?100:N===""?255:0;if($){const W=[vr(+g/$,0,1),vr(+_/$,0,1),vr(+I/$,0,1),k?il(+k,O):1];if(bc(W))return W}}return}}const l=s.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(l){const[h,d,g,m,v,_,T,x,I]=l,M=[g||" ",v||" ",T].join("");if(M===" "||M===" /"||M===",,"||M===",,,"){const D=[+d,vr(+m,0,100),vr(+_,0,100),x?il(+x,I):1];if(bc(D))return(function([k,O,B,N]){function $(W){const ie=(W+k/30)%12,ne=O*Math.min(B,1-B);return B-ne*Math.max(-1,Math.min(ie-3,9-ie,1))}return k=Ja(k),O/=100,B/=100,[$(0),$(8),$(4),N]})(D)}}})(e);return i?new rt(...i,!1):void 0}get rgb(){const{r:e,g:i,b:s,a:o}=this,l=o||1/0;return this.overwriteGetter("rgb",[e/l,i/l,s/l,o])}get hcl(){return this.overwriteGetter("hcl",(function(e){const[i,s,o,l]=vc(e),h=Math.sqrt(s*s+o*o);return[Math.round(1e4*h)?Ja(Math.atan2(o,s)*Qu):NaN,h,i,l]})(this.rgb))}get lab(){return this.overwriteGetter("lab",vc(this.rgb))}overwriteGetter(e,i){return Object.defineProperty(this,e,{value:i}),i}toString(){const[e,i,s,o]=this.rgb;return`rgba(${[e,i,s].map((l=>Math.round(255*l))).join(",")},${o})`}static interpolate(e,i,s,o="rgb"){switch(o){case"rgb":{const[l,h,d,g]=es(e.rgb,i.rgb,s);return new rt(l,h,d,g,!1)}case"hcl":{const[l,h,d,g]=e.hcl,[m,v,_,T]=i.hcl;let x,I;if(isNaN(l)||isNaN(m))isNaN(l)?isNaN(m)?x=NaN:(x=m,d!==1&&d!==0||(I=v)):(x=l,_!==1&&_!==0||(I=h));else{let B=m-l;m>l&&B>180?B-=360:m<l&&l-m>180&&(B+=360),x=l+s*B}const[M,D,k,O]=(function([B,N,$,W]){return B=isNaN(B)?0:B*Ju,xc([$,Math.cos(B)*N,Math.sin(B)*N,W])})([x,I??Ki(h,v,s),Ki(d,_,s),Ki(g,T,s)]);return new rt(M,D,k,O,!1)}case"lab":{const[l,h,d,g]=xc(es(e.lab,i.lab,s));return new rt(l,h,d,g,!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);class rl{constructor(e,i,s){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=s,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const wc=["bottom","center","top"];class zo{constructor(e,i,s,o,l,h){this.text=e,this.image=i,this.scale=s,this.fontStack=o,this.textColor=l,this.verticalAlign=h}}class Gt{constructor(e){this.sections=e}static fromString(e){return new Gt([new zo(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 Gt?e:Gt.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map((e=>e.text)).join("")}}class Ze{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Ze)return e;if(typeof e=="number")return new Ze([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const i of e)if(typeof i!="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 Ze(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new Ze(es(e.values,i.values,s))}}class Jt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Jt)return e;if(typeof e=="number")return new Jt([e]);if(Array.isArray(e)){for(const i of e)if(typeof i!="number")return;return new Jt(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){return new Jt(es(e.values,i.values,s))}}class Lt{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Lt)return e;if(typeof e=="string"){const s=rt.parse(e);return s?new Lt([s]):void 0}if(!Array.isArray(e))return;const i=[];for(const s of e){if(typeof s!="string")return;const o=rt.parse(s);if(!o)return;i.push(o)}return new Lt(i)}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s,o="rgb"){const l=[];if(e.values.length!=i.values.length)throw new Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${i.values.length}), cannot interpolate.`);for(let h=0;h<e.values.length;h++)l.push(rt.interpolate(e.values[h],i.values[h],s,o));return new Lt(l)}}class Ft extends Error{constructor(e){super(e),this.name="RuntimeError"}toJSON(){return this.message}}const Tc=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class _i{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof _i)return e;if(Array.isArray(e)&&!(e.length<1)&&e.length%2==0){for(let i=0;i<e.length;i+=2){const s=e[i],o=e[i+1];if(typeof s!="string"||!Tc.has(s)||!Array.isArray(o)||o.length!==2||typeof o[0]!="number"||typeof o[1]!="number")return}return new _i(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,i,s){const o=e.values,l=i.values;if(o.length!==l.length)throw new Ft(`Cannot interpolate values of different length. from: ${e.toString()}, to: ${i.toString()}`);const h=[];for(let d=0;d<o.length;d+=2){if(o[d]!==l[d])throw new Ft(`Cannot interpolate values containing mismatched anchors. from[${d}]: ${o[d]}, to[${d}]: ${l[d]}`);h.push(o[d]);const[g,m]=o[d+1],[v,_]=l[d+1];h.push([Ki(g,v,s),Ki(m,_,s)])}return new _i(h)}}class yi{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new yi({name:e,available:!1}):null}}class vi{constructor(e,i,s){this.from=e,this.to=i,this.transition=s}static interpolate(e,i,s){return new vi(e,i,s)}static parse(e){return e instanceof vi?e:Array.isArray(e)&&e.length===3&&typeof e[0]=="string"&&typeof e[1]=="string"&&typeof e[2]=="number"?new vi(e[0],e[1],e[2]):typeof e=="object"&&typeof e.from=="string"&&typeof e.to=="string"&&typeof e.transition=="number"?new vi(e.from,e.to,e.transition):typeof e=="string"?new vi(e,e,1):void 0}}function nl(r,e,i,s){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?s===void 0||typeof s=="number"&&s>=0&&s<=1?null:`Invalid rgba value [${[r,e,i,s].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof s=="number"?[r,e,i,s]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function fn(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof vi||r instanceof rt||r instanceof rl||r instanceof Gt||r instanceof Ze||r instanceof Jt||r instanceof Lt||r instanceof _i||r instanceof yi)return!0;if(Array.isArray(r)){for(const e of r)if(!fn(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!fn(r[e]))return!1;return!0}return!1}function Rt(r){if(r===null)return Zr;if(typeof r=="string")return He;if(typeof r=="boolean")return Je;if(typeof r=="number")return De;if(r instanceof rt)return Vi;if(r instanceof vi)return Xn;if(r instanceof rl)return Co;if(r instanceof Gt)return Yn;if(r instanceof Ze)return As;if(r instanceof Jt)return Ds;if(r instanceof Lt)return Kn;if(r instanceof _i)return yr;if(r instanceof yi)return hn;if(Array.isArray(r)){const e=r.length;let i;for(const s of r){const o=Rt(s);if(i){if(i===o)continue;i=Ke;break}i=o}return si(i||Ke,e)}return Wr}function Ls(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof rt||r instanceof vi||r instanceof Gt||r instanceof Ze||r instanceof Jt||r instanceof Lt||r instanceof _i||r instanceof yi?r.toString():JSON.stringify(r)}class xr{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!fn(e[1]))return i.error("invalid value");const s=e[1];let o=Rt(s);const l=i.expectedType;return o.kind!=="array"||o.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(o=l),new xr(o,s)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Cr={string:He,number:De,boolean:Je,object:Wr};class Ji{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s,o=1;const l=e[0];if(l==="array"){let d,g;if(e.length>2){const m=e[1];if(typeof m!="string"||!(m in Cr)||m==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);d=Cr[m],o++}else d=Ke;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);g=e[2],o++}s=si(d,g)}else{if(!Cr[l])throw new Error(`Types doesn't contain name = ${l}`);s=Cr[l]}const h=[];for(;o<e.length;o++){const d=i.parse(e[o],o,Ke);if(!d)return null;h.push(d)}return new Ji(s,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const s=this.args[i].evaluate(e);if(!ks(this.type,Rt(s)))return s;if(i===this.args.length-1)throw new Ft(`Expected value to be of type ${Ct(this.type)}, but found ${Ct(Rt(s))} instead.`)}throw new Error}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const sl={"to-boolean":Je,"to-color":Vi,"to-number":De,"to-string":He};class Ar{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[0];if(!sl[s])throw new Error(`Can't parse ${s} as it is not part of the known types`);if((s==="to-boolean"||s==="to-string")&&e.length!==2)return i.error("Expected one argument.");const o=sl[s],l=[];for(let h=1;h<e.length;h++){const d=i.parse(e[h],h,Ke);if(!d)return null;l.push(d)}return new Ar(o,l)}evaluate(e){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(e);case"color":{let i,s;for(const o of this.args){if(i=o.evaluate(e),s=null,i instanceof rt)return i;if(typeof i=="string"){const l=e.parseColor(i);if(l)return l}else if(Array.isArray(i)&&(s=i.length<3||i.length>4?`Invalid rgba value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:nl(i[0],i[1],i[2],i[3]),!s))return new rt(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new Ft(s||`Could not parse color from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"padding":{let i;for(const s of this.args){i=s.evaluate(e);const o=Ze.parse(i);if(o)return o}throw new Ft(`Could not parse padding from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"numberArray":{let i;for(const s of this.args){i=s.evaluate(e);const o=Jt.parse(i);if(o)return o}throw new Ft(`Could not parse numberArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"colorArray":{let i;for(const s of this.args){i=s.evaluate(e);const o=Lt.parse(i);if(o)return o}throw new Ft(`Could not parse colorArray from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"variableAnchorOffsetCollection":{let i;for(const s of this.args){i=s.evaluate(e);const o=_i.parse(i);if(o)return o}throw new Ft(`Could not parse variableAnchorOffsetCollection from value '${typeof i=="string"?i:JSON.stringify(i)}'`)}case"number":{let i=null;for(const s of this.args){if(i=s.evaluate(e),i===null)return 0;const o=Number(i);if(!isNaN(o))return o}throw new Ft(`Could not convert ${JSON.stringify(i)} to number.`)}case"formatted":return Gt.fromString(Ls(this.args[0].evaluate(e)));case"resolvedImage":return yi.fromString(Ls(this.args[0].evaluate(e)));case"projectionDefinition":return this.args[0].evaluate(e);default:return Ls(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}const Lo=["Unknown","Point","LineString","Polygon"];class It{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"?Lo[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 i=this._parseColorCache.get(e);return i||(i=rt.parse(e),this._parseColorCache.set(e,i)),i}}class ts{constructor(e,i,s=[],o,l=new Ya,h=[]){this.registry=e,this.path=s,this.key=s.map((d=>`[${d}]`)).join(""),this.scope=l,this.errors=h,this.expectedType=o,this._isConstant=i}parse(e,i,s,o,l={}){return i?this.concat(i,s,o)._parse(e,l):this._parse(e,l)}_parse(e,i){function s(o,l,h){return h==="assert"?new Ji(l,[o]):h==="coerce"?new Ar(l,[o]):o}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const o=e[0];if(typeof o!="string")return this.error(`Expression name must be a string, but found ${typeof o} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const l=this.registry[o];if(l){let h=l.parse(e,this);if(!h)return null;if(this.expectedType){const d=this.expectedType,g=h.type;if(d.kind!=="string"&&d.kind!=="number"&&d.kind!=="boolean"&&d.kind!=="object"&&d.kind!=="array"||g.kind!=="value"){if(d.kind==="projectionDefinition"&&["string","array"].includes(g.kind)||["color","formatted","resolvedImage"].includes(d.kind)&&["value","string"].includes(g.kind)||["padding","numberArray"].includes(d.kind)&&["value","number","array"].includes(g.kind)||d.kind==="colorArray"&&["value","string","array"].includes(g.kind)||d.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(g.kind))h=s(h,d,i.typeAnnotation||"coerce");else if(this.checkSubtype(d,g))return null}else h=s(h,d,i.typeAnnotation||"assert")}if(!(h instanceof xr)&&h.type.kind!=="resolvedImage"&&this._isConstant(h)){const d=new It;try{h=new xr(h.type,h.evaluate(d))}catch(g){return this.error(g.message),null}}return h}return this.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,s){const o=typeof e=="number"?this.path.concat(e):this.path,l=s?this.scope.concat(s):this.scope;return new ts(this.registry,this._isConstant,o,i||null,l,this.errors)}error(e,...i){const s=`${this.key}${i.map((o=>`[${o}]`)).join("")}`;this.errors.push(new pi(s,e))}checkSubtype(e,i){const s=ks(e,i);return s&&this.error(s),s}}class st{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const s=[];for(let l=1;l<e.length-1;l+=2){const h=e[l];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,l);if(/[^a-zA-Z0-9_]/.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",l);const d=i.parse(e[l+1],l+1);if(!d)return null;s.push([h,d])}const o=i.parse(e[e.length-1],e.length-1,i.expectedType,s);return o?new st(s,o):null}outputDefined(){return this.result.outputDefined()}}class Xe{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const s=e[1];return i.scope.has(s)?new Xe(s,i.scope.get(s)):i.error(`Unknown variable "${s}". Make sure "${s}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Fs{constructor(e,i,s){this.type=e,this.index=i,this.input=s}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,De),o=i.parse(e[2],2,si(i.expectedType||Ke));return s&&o?new Fs(o.type.itemType,s,o):null}evaluate(e){const i=this.index.evaluate(e),s=this.input.evaluate(e);if(i<0)throw new Ft(`Array index out of bounds: ${i} < 0.`);if(i>=s.length)throw new Ft(`Array index out of bounds: ${i} > ${s.length-1}.`);if(i!==Math.floor(i))throw new Ft(`Array index must be an integer, but found ${i} instead.`);return s[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class at{constructor(e,i){this.type=Je,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Ke),o=i.parse(e[2],2,Ke);return s&&o?Jn(s.type,[Je,He,De,Zr,Ke])?new at(s,o):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ct(s.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!s)return!1;if(!dn(i,["boolean","string","number","null"]))throw new Ft(`Expected first argument to be of type boolean, string, number or null, but found ${Ct(Rt(i))} instead.`);if(!dn(s,["string","array"]))throw new Ft(`Expected second argument to be of type array or string, but found ${Ct(Rt(s))} instead.`);return s.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class is{constructor(e,i,s){this.type=De,this.needle=e,this.haystack=i,this.fromIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Ke),o=i.parse(e[2],2,Ke);if(!s||!o)return null;if(!Jn(s.type,[Je,He,De,Zr,Ke]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ct(s.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,De);return l?new is(s,o,l):null}return new is(s,o)}evaluate(e){const i=this.needle.evaluate(e),s=this.haystack.evaluate(e);if(!dn(i,["boolean","string","number","null"]))throw new Ft(`Expected first argument to be of type boolean, string, number or null, but found ${Ct(Rt(i))} instead.`);let o;if(this.fromIndex&&(o=this.fromIndex.evaluate(e)),dn(s,["string"])){const l=s.indexOf(i,o);return l===-1?-1:[...s.slice(0,l)].length}if(dn(s,["array"]))return s.indexOf(i,o);throw new Ft(`Expected second argument to be of type array or string, but found ${Ct(Rt(s))} instead.`)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class lr{constructor(e,i,s,o,l,h){this.inputType=e,this.type=i,this.input=s,this.cases=o,this.outputs=l,this.otherwise=h}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let s,o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const l={},h=[];for(let m=2;m<e.length-1;m+=2){let v=e[m];const _=e[m+1];Array.isArray(v)||(v=[v]);const T=i.concat(m);if(v.length===0)return T.error("Expected at least one branch label.");for(const I of v){if(typeof I!="number"&&typeof I!="string")return T.error("Branch labels must be numbers or strings.");if(typeof I=="number"&&Math.abs(I)>Number.MAX_SAFE_INTEGER)return T.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof I=="number"&&Math.floor(I)!==I)return T.error("Numeric branch labels must be integer values.");if(s){if(T.checkSubtype(s,Rt(I)))return null}else s=Rt(I);if(l[String(I)]!==void 0)return T.error("Branch labels must be unique.");l[String(I)]=h.length}const x=i.parse(_,m,o);if(!x)return null;o=o||x.type,h.push(x)}const d=i.parse(e[1],1,Ke);if(!d)return null;const g=i.parse(e[e.length-1],e.length-1,o);return g?d.type.kind!=="value"&&i.concat(1).checkSubtype(s,d.type)?null:new lr(s,o,d,l,h,g):null}evaluate(e){const i=this.input.evaluate(e);return(Rt(i)===this.inputType&&this.outputs[this.cases[i]]||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()}}class Rs{constructor(e,i,s){this.type=e,this.branches=i,this.otherwise=s}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const o=[];for(let h=1;h<e.length-1;h+=2){const d=i.parse(e[h],h,Je);if(!d)return null;const g=i.parse(e[h+1],h+1,s);if(!g)return null;o.push([d,g]),s=s||g.type}const l=i.parse(e[e.length-1],e.length-1,s);if(!l)return null;if(!s)throw new Error("Can't infer output type");return new Rs(s,o,l)}evaluate(e){for(const[i,s]of this.branches)if(i.evaluate(e))return s.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,s]of this.branches)e(i),e(s);e(this.otherwise)}outputDefined(){return this.branches.every((([e,i])=>i.outputDefined()))&&this.otherwise.outputDefined()}}class mn{constructor(e,i,s,o){this.type=e,this.input=i,this.beginIndex=s,this.endIndex=o}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);const s=i.parse(e[1],1,Ke),o=i.parse(e[2],2,De);if(!s||!o)return null;if(!Jn(s.type,[si(Ke),He,Ke]))return i.error(`Expected first argument to be of type array or string, but found ${Ct(s.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,De);return l?new mn(s.type,s,o,l):null}return new mn(s.type,s,o)}evaluate(e){const i=this.input.evaluate(e),s=this.beginIndex.evaluate(e);let o;if(this.endIndex&&(o=this.endIndex.evaluate(e)),dn(i,["string"]))return[...i].slice(s,o).join("");if(dn(i,["array"]))return i.slice(s,o);throw new Ft(`Expected first argument to be of type array or string, but found ${Ct(Rt(i))} instead.`)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function Bs(r,e){const i=r.length-1;let s,o,l=0,h=i,d=0;for(;l<=h;)if(d=Math.floor((l+h)/2),s=r[d],o=r[d+1],s<=e){if(d===i||e<o)return d;l=d+1}else{if(!(s>e))throw new Ft("Input is not a number.");h=d-1}return 0}class gn{constructor(e,i,s){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[o,l]of s)this.labels.push(o),this.outputs.push(l)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const s=i.parse(e[1],1,De);if(!s)return null;const o=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let h=1;h<e.length;h+=2){const d=h===1?-1/0:e[h],g=e[h+1],m=h,v=h+1;if(typeof d!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',m);if(o.length&&o[o.length-1][0]>=d)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',m);const _=i.parse(g,v,l);if(!_)return null;l=l||_.type,o.push([d,_])}return new gn(l,s,o)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return s[0].evaluate(e);const l=i.length;return o>=i[l-1]?s[l-1].evaluate(e):s[Bs(i,o)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function Sc(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ol,al,Pc=Sc((function(){if(al)return ol;function r(e,i,s,o){this.cx=3*e,this.bx=3*(s-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(o-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=s,this.p2y=o}return al=1,ol=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var s=e,o=0;o<8;o++){var l=this.sampleCurveX(s)-e;if(Math.abs(l)<i)return s;var h=this.sampleCurveDerivativeX(s);if(Math.abs(h)<1e-6)break;s-=l/h}var d=0,g=1;for(s=e,o=0;o<20&&(l=this.sampleCurveX(s),!(Math.abs(l-e)<i));o++)e>l?d=s:g=s,s=.5*(g-d)+d;return s},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},ol})());class Xt{constructor(e,i,s,o,l){this.type=e,this.operator=i,this.interpolation=s,this.input=o,this.labels=[],this.outputs=[];for(const[h,d]of l)this.labels.push(h),this.outputs.push(d)}static interpolationFactor(e,i,s,o){let l=0;if(e.name==="exponential")l=oi(i,e.base,s,o);else if(e.name==="linear")l=oi(i,1,s,o);else if(e.name==="cubic-bezier"){const h=e.controlPoints;l=new Pc(h[0],h[1],h[2],h[3]).solve(oi(i,1,s,o))}return l}static parse(e,i){let[s,o,l,...h]=e;if(!Array.isArray(o)||o.length===0)return i.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const m=o[1];if(typeof m!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:m}}else{if(o[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const m=o.slice(1);if(m.length!==4||m.some((v=>typeof v!="number"||v<0||v>1)))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:m}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(l=i.parse(l,2,De),!l)return null;const d=[];let g=null;s!=="interpolate-hcl"&&s!=="interpolate-lab"||i.expectedType==Kn?i.expectedType&&i.expectedType.kind!=="value"&&(g=i.expectedType):g=Vi;for(let m=0;m<h.length;m+=2){const v=h[m],_=h[m+1],T=m+3,x=m+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',T);if(d.length&&d[d.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',T);const I=i.parse(_,x,g);if(!I)return null;g=g||I.type,d.push([v,I])}return ji(g,De)||ji(g,Xn)||ji(g,Vi)||ji(g,As)||ji(g,Ds)||ji(g,Kn)||ji(g,yr)||ji(g,si(De))?new Xt(g,s,o,l,d):i.error(`Type ${Ct(g)} is not interpolatable.`)}evaluate(e){const i=this.labels,s=this.outputs;if(i.length===1)return s[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return s[0].evaluate(e);const l=i.length;if(o>=i[l-1])return s[l-1].evaluate(e);const h=Bs(i,o),d=Xt.interpolationFactor(this.interpolation,o,i[h],i[h+1]),g=s[h].evaluate(e),m=s[h+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Ki(g,m,d);case"color":return rt.interpolate(g,m,d);case"padding":return Ze.interpolate(g,m,d);case"colorArray":return Lt.interpolate(g,m,d);case"numberArray":return Jt.interpolate(g,m,d);case"variableAnchorOffsetCollection":return _i.interpolate(g,m,d);case"array":return es(g,m,d);case"projectionDefinition":return vi.interpolate(g,m,d)}case"interpolate-hcl":switch(this.type.kind){case"color":return rt.interpolate(g,m,d,"hcl");case"colorArray":return Lt.interpolate(g,m,d,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return rt.interpolate(g,m,d,"lab");case"colorArray":return Lt.interpolate(g,m,d,"lab")}}}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every((e=>e.outputDefined()))}}function oi(r,e,i,s){const o=s-i,l=r-i;return o===0?0:e===1?l/o:(Math.pow(e,l)-1)/(Math.pow(e,o)-1)}const Ni={color:rt.interpolate,number:Ki,padding:Ze.interpolate,numberArray:Jt.interpolate,colorArray:Lt.interpolate,variableAnchorOffsetCollection:_i.interpolate,array:es};class Os{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let s=null;const o=i.expectedType;o&&o.kind!=="value"&&(s=o);const l=[];for(const h of e.slice(1)){const d=i.parse(h,1+l.length,s,void 0,{typeAnnotation:"omit"});if(!d)return null;s=s||d.type,l.push(d)}if(!s)throw new Error("No output type");return new Os(o&&l.some((h=>ks(o,h.type)))?Ke:s,l)}evaluate(e){let i,s=null,o=0;for(const l of this.args)if(o++,s=l.evaluate(e),s&&s instanceof yi&&!s.available&&(i||(i=s.name),s=null,o===this.args.length&&(s=i)),s!==null)break;return s}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every((e=>e.outputDefined()))}}function Vs(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function ii(r,e,i,s){return s.compare(e,i)===0}function _n(r,e,i){const s=r!=="=="&&r!=="!=";return class km{constructor(l,h,d){this.type=Je,this.lhs=l,this.rhs=h,this.collator=d,this.hasUntypedArgument=l.type.kind==="value"||h.type.kind==="value"}static parse(l,h){if(l.length!==3&&l.length!==4)return h.error("Expected two or three arguments.");const d=l[0];let g=h.parse(l[1],1,Ke);if(!g)return null;if(!Vs(d,g.type))return h.concat(1).error(`"${d}" comparisons are not supported for type '${Ct(g.type)}'.`);let m=h.parse(l[2],2,Ke);if(!m)return null;if(!Vs(d,m.type))return h.concat(2).error(`"${d}" comparisons are not supported for type '${Ct(m.type)}'.`);if(g.type.kind!==m.type.kind&&g.type.kind!=="value"&&m.type.kind!=="value")return h.error(`Cannot compare types '${Ct(g.type)}' and '${Ct(m.type)}'.`);s&&(g.type.kind==="value"&&m.type.kind!=="value"?g=new Ji(m.type,[g]):g.type.kind!=="value"&&m.type.kind==="value"&&(m=new Ji(g.type,[m])));let v=null;if(l.length===4){if(g.type.kind!=="string"&&m.type.kind!=="string"&&g.type.kind!=="value"&&m.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(v=h.parse(l[3],3,Co),!v)return null}return new km(g,m,v)}evaluate(l){const h=this.lhs.evaluate(l),d=this.rhs.evaluate(l);if(s&&this.hasUntypedArgument){const g=Rt(h),m=Rt(d);if(g.kind!==m.kind||g.kind!=="string"&&g.kind!=="number")throw new Ft(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${g.kind}, ${m.kind}) instead.`)}if(this.collator&&!s&&this.hasUntypedArgument){const g=Rt(h),m=Rt(d);if(g.kind!=="string"||m.kind!=="string")return e(l,h,d)}return this.collator?i(l,h,d,this.collator.evaluate(l)):e(l,h,d)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}}}const ll=_n("==",(function(r,e,i){return e===i}),ii),Ic=_n("!=",(function(r,e,i){return e!==i}),(function(r,e,i,s){return!ii(0,e,i,s)})),ih=_n("<",(function(r,e,i){return e<i}),(function(r,e,i,s){return s.compare(e,i)<0})),rs=_n(">",(function(r,e,i){return e>i}),(function(r,e,i,s){return s.compare(e,i)>0})),Fo=_n("<=",(function(r,e,i){return e<=i}),(function(r,e,i,s){return s.compare(e,i)<=0})),cl=_n(">=",(function(r,e,i){return e>=i}),(function(r,e,i,s){return s.compare(e,i)>=0}));class Ro{constructor(e,i,s){this.type=Co,this.locale=s,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const s=e[1];if(typeof s!="object"||Array.isArray(s))return i.error("Collator options argument must be an object.");const o=i.parse(s["case-sensitive"]!==void 0&&s["case-sensitive"],1,Je);if(!o)return null;const l=i.parse(s["diacritic-sensitive"]!==void 0&&s["diacritic-sensitive"],1,Je);if(!l)return null;let h=null;return s.locale&&(h=i.parse(s.locale,1,He),!h)?null:new Ro(o,l,h)}evaluate(e){return new rl(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}}class Bo{constructor(e,i,s,o,l,h){this.type=He,this.number=e,this.locale=i,this.currency=s,this.unit=o,this.minFractionDigits=l,this.maxFractionDigits=h}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const s=i.parse(e[1],1,De);if(!s)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return i.error("NumberFormat options argument must be an object.");let l=null;if(o.locale&&(l=i.parse(o.locale,1,He),!l))return null;let h=null;if(o.currency&&(h=i.parse(o.currency,1,He),!h))return null;let d=null;if(o.unit&&(d=i.parse(o.unit,1,He),!d))return null;if(h&&d)return i.error("NumberFormat options `currency` and `unit` are mutually exclusive");let g=null;if(o["min-fraction-digits"]&&(g=i.parse(o["min-fraction-digits"],1,De),!g))return null;let m=null;return o["max-fraction-digits"]&&(m=i.parse(o["max-fraction-digits"],1,De),!m)?null:new Bo(s,l,h,d,g,m)}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}}class yn{constructor(e){this.type=Yn,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const s=e[1];if(!Array.isArray(s)&&typeof s=="object")return i.error("First argument must be an image or text section.");const o=[];let l=!1;for(let h=1;h<=e.length-1;++h){const d=e[h];if(l&&typeof d=="object"&&!Array.isArray(d)){l=!1;let g=null;if(d["font-scale"]&&(g=i.parse(d["font-scale"],1,De),!g))return null;let m=null;if(d["text-font"]&&(m=i.parse(d["text-font"],1,si(He)),!m))return null;let v=null;if(d["text-color"]&&(v=i.parse(d["text-color"],1,Vi),!v))return null;let _=null;if(d["vertical-align"]){if(typeof d["vertical-align"]=="string"&&!wc.includes(d["vertical-align"]))return i.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${d["vertical-align"]}' instead.`);if(_=i.parse(d["vertical-align"],1,He),!_)return null}const T=o[o.length-1];T.scale=g,T.font=m,T.textColor=v,T.verticalAlign=_}else{const g=i.parse(e[h],1,Ke);if(!g)return null;const m=g.type.kind;if(m!=="string"&&m!=="value"&&m!=="null"&&m!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,o.push({content:g,scale:null,font:null,textColor:null,verticalAlign:null})}}return new yn(o)}evaluate(e){return new Gt(this.sections.map((i=>{const s=i.content.evaluate(e);return Rt(s)===hn?new zo("",s,null,null,null,i.verticalAlign?i.verticalAlign.evaluate(e):null):new zo(Ls(s),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null,i.verticalAlign?i.verticalAlign.evaluate(e):null)})))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor),i.verticalAlign&&e(i.verticalAlign)}outputDefined(){return!1}}class ns{constructor(e){this.type=hn,this.input=e}static parse(e,i){if(e.length!==2)return i.error("Expected two arguments.");const s=i.parse(e[1],1,He);return s?new ns(s):i.error("No image name provided.")}evaluate(e){const i=this.input.evaluate(e),s=yi.fromString(i);return s&&e.availableImages&&(s.available=e.availableImages.indexOf(i)>-1),s}eachChild(e){e(this.input)}outputDefined(){return!1}}class Ui{constructor(e){this.type=De,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=i.parse(e[1],1);return s?s.type.kind!=="array"&&s.type.kind!=="string"&&s.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${Ct(s.type)} instead.`):new Ui(s):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string")return[...i].length;if(Array.isArray(i))return i.length;throw new Ft(`Expected value to be of type string or array, but found ${Ct(Rt(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const cr=8192;function Oo(r,e){const i=(180+r[0])/360,s=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(i*o*cr),Math.round(s*o*cr)]}function ul(r,e){const i=Math.pow(2,e.z);return[(o=(r[0]/cr+e.x)/i,360*o-180),(s=(r[1]/cr+e.y)/i,360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90)];var s,o}function vn(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function js(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function rh(r,e,i){const s=r[0]-e[0],o=r[1]-e[1],l=r[0]-i[0],h=r[1]-i[1];return s*h-l*o==0&&s*l<=0&&o*h<=0}function Vo(r,e,i,s){return(o=[s[0]-i[0],s[1]-i[1]])[0]*(l=[e[0]-r[0],e[1]-r[1]])[1]-o[1]*l[0]!=0&&!(!Ec(r,e,i,s)||!Ec(i,s,r,e));var o,l}function nh(r,e,i){for(const s of i)for(let o=0;o<s.length-1;++o)if(Vo(r,e,s[o],s[o+1]))return!0;return!1}function Dr(r,e,i=!1){let s=!1;for(const d of e)for(let g=0;g<d.length-1;g++){if(rh(r,d[g],d[g+1]))return i;(l=d[g])[1]>(o=r)[1]!=(h=d[g+1])[1]>o[1]&&o[0]<(h[0]-l[0])*(o[1]-l[1])/(h[1]-l[1])+l[0]&&(s=!s)}var o,l,h;return s}function sh(r,e){for(const i of e)if(Dr(r,i))return!0;return!1}function hl(r,e){for(const i of r)if(!Dr(i,e))return!1;for(let i=0;i<r.length-1;++i)if(nh(r[i],r[i+1],e))return!1;return!0}function Mc(r,e){for(const i of e)if(hl(r,i))return!0;return!1}function Ec(r,e,i,s){const o=s[0]-i[0],l=s[1]-i[1],h=(r[0]-i[0])*l-o*(r[1]-i[1]),d=(e[0]-i[0])*l-o*(e[1]-i[1]);return h>0&&d<0||h<0&&d>0}function jo(r,e,i){const s=[];for(let o=0;o<r.length;o++){const l=[];for(let h=0;h<r[o].length;h++){const d=Oo(r[o][h],i);vn(e,d),l.push(d)}s.push(l)}return s}function Cc(r,e,i){const s=[];for(let o=0;o<r.length;o++){const l=jo(r[o],e,i);s.push(l)}return s}function Ac(r,e,i,s){if(r[0]<i[0]||r[0]>i[2]){const o=.5*s;let l=r[0]-i[0]>o?-s:i[0]-r[0]>o?s:0;l===0&&(l=r[0]-i[2]>o?-s:i[2]-r[0]>o?s:0),r[0]+=l}vn(e,r)}function Dc(r,e,i,s){const o=Math.pow(2,s.z)*cr,l=[s.x*cr,s.y*cr],h=[];for(const d of r)for(const g of d){const m=[g.x+l[0],g.y+l[1]];Ac(m,e,i,o),h.push(m)}return h}function kc(r,e,i,s){const o=Math.pow(2,s.z)*cr,l=[s.x*cr,s.y*cr],h=[];for(const g of r){const m=[];for(const v of g){const _=[v.x+l[0],v.y+l[1]];vn(e,_),m.push(_)}h.push(m)}if(e[2]-e[0]<=o/2){(d=e)[0]=d[1]=1/0,d[2]=d[3]=-1/0;for(const g of h)for(const m of g)Ac(m,e,i,o)}var d;return h}class xn{constructor(e,i){this.type=Je,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(fn(e[1])){const s=e[1];if(s.type==="FeatureCollection"){const o=[];for(const l of s.features){const{type:h,coordinates:d}=l.geometry;h==="Polygon"&&o.push(d),h==="MultiPolygon"&&o.push(...d)}if(o.length)return new xn(s,{type:"MultiPolygon",coordinates:o})}else if(s.type==="Feature"){const o=s.geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new xn(s,s.geometry)}else if(s.type==="Polygon"||s.type==="MultiPolygon")return new xn(s,s)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,s){const o=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(s.type==="Polygon"){const d=jo(s.coordinates,l,h),g=Dc(i.geometry(),o,l,h);if(!js(o,l))return!1;for(const m of g)if(!Dr(m,d))return!1}if(s.type==="MultiPolygon"){const d=Cc(s.coordinates,l,h),g=Dc(i.geometry(),o,l,h);if(!js(o,l))return!1;for(const m of g)if(!sh(m,d))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const o=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(s.type==="Polygon"){const d=jo(s.coordinates,l,h),g=kc(i.geometry(),o,l,h);if(!js(o,l))return!1;for(const m of g)if(!hl(m,d))return!1}if(s.type==="MultiPolygon"){const d=Cc(s.coordinates,l,h),g=kc(i.geometry(),o,l,h);if(!js(o,l))return!1;for(const m of g)if(!Mc(m,d))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let dl=class{constructor(r=[],e=(i,s)=>i<s?-1:i>s?1:0){if(this.data=r,this.length=this.data.length,this.compare=e,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:e,compare:i}=this,s=e[r];for(;r>0;){const o=r-1>>1,l=e[o];if(i(s,l)>=0)break;e[r]=l,r=o}e[r]=s}_down(r){const{data:e,compare:i}=this,s=this.length>>1,o=e[r];for(;r<s;){let l=1+(r<<1);const h=l+1;if(h<this.length&&i(e[h],e[l])<0&&(l=h),i(e[l],o)>=0)break;e[r]=e[l],r=l}e[r]=o}};function pl(r,e,i=0,s=r.length-1,o=oh){for(;s>i;){if(s-i>600){const g=s-i+1,m=e-i+1,v=Math.log(g),_=.5*Math.exp(2*v/3),T=.5*Math.sqrt(v*_*(g-_)/g)*(m-g/2<0?-1:1);pl(r,e,Math.max(i,Math.floor(e-m*_/g+T)),Math.min(s,Math.floor(e+(g-m)*_/g+T)),o)}const l=r[e];let h=i,d=s;for(ss(r,i,e),o(r[s],l)>0&&ss(r,i,s);h<d;){for(ss(r,h,d),h++,d--;o(r[h],l)<0;)h++;for(;o(r[d],l)>0;)d--}o(r[i],l)===0?ss(r,i,d):(d++,ss(r,d,s)),d<=e&&(i=d+1),e<=d&&(s=d-1)}}function ss(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function oh(r,e){return r<e?-1:r>e?1:0}function No(r,e){if(r.length<=1)return[r];const i=[];let s,o;for(const l of r){const h=lh(l);h!==0&&(l.area=Math.abs(h),o===void 0&&(o=h<0),o===h<0?(s&&i.push(s),s=[l]):s.push(l))}if(s&&i.push(s),e>1)for(let l=0;l<i.length;l++)i[l].length<=e||(pl(i[l],e,1,i[l].length-1,ah),i[l]=i[l].slice(0,e));return i}function ah(r,e){return e.area-r.area}function lh(r){let e=0;for(let i,s,o=0,l=r.length,h=l-1;o<l;h=o++)i=r[o],s=r[h],e+=(s.x-i.x)*(i.y+s.y);return e}const Ns=1/298.257223563,zc=Ns*(2-Ns),Lc=Math.PI/180;class fl{constructor(e){const i=6378.137*Lc*1e3,s=Math.cos(e*Lc),o=1/(1-zc*(1-s*s)),l=Math.sqrt(o);this.kx=i*l*s,this.ky=i*l*o*(1-zc)}distance(e,i){const s=this.wrap(e[0]-i[0])*this.kx,o=(e[1]-i[1])*this.ky;return Math.sqrt(s*s+o*o)}pointOnLine(e,i){let s,o,l,h,d=1/0;for(let g=0;g<e.length-1;g++){let m=e[g][0],v=e[g][1],_=this.wrap(e[g+1][0]-m)*this.kx,T=(e[g+1][1]-v)*this.ky,x=0;_===0&&T===0||(x=(this.wrap(i[0]-m)*this.kx*_+(i[1]-v)*this.ky*T)/(_*_+T*T),x>1?(m=e[g+1][0],v=e[g+1][1]):x>0&&(m+=_/this.kx*x,v+=T/this.ky*x)),_=this.wrap(i[0]-m)*this.kx,T=(i[1]-v)*this.ky;const I=_*_+T*T;I<d&&(d=I,s=m,o=v,l=g,h=x)}return{point:[s,o],index:l,t:Math.max(0,Math.min(1,h))}}wrap(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}}function Fc(r,e){return e[0]-r[0]}function os(r){return r[1]-r[0]+1}function br(r,e){return r[1]>=r[0]&&r[1]<e}function ml(r,e){if(r[0]>r[1])return[null,null];const i=os(r);if(e){if(i===2)return[r,null];const o=Math.floor(i/2);return[[r[0],r[0]+o],[r[0]+o,r[1]]]}if(i===1)return[r,null];const s=Math.floor(i/2)-1;return[[r[0],r[0]+s],[r[0]+s+1,r[1]]]}function gl(r,e){if(!br(e,r.length))return[1/0,1/0,-1/0,-1/0];const i=[1/0,1/0,-1/0,-1/0];for(let s=e[0];s<=e[1];++s)vn(i,r[s]);return i}function Uo(r){const e=[1/0,1/0,-1/0,-1/0];for(const i of r)for(const s of i)vn(e,s);return e}function _l(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function yl(r,e,i){if(!_l(r)||!_l(e))return NaN;let s=0,o=0;return r[2]<e[0]&&(s=e[0]-r[2]),r[0]>e[2]&&(s=r[0]-e[2]),r[1]>e[3]&&(o=r[1]-e[3]),r[3]<e[1]&&(o=e[1]-r[3]),i.distance([0,0],[s,o])}function bn(r,e,i){const s=i.pointOnLine(e,r);return i.distance(r,s.point)}function vl(r,e,i,s,o){const l=Math.min(bn(r,[i,s],o),bn(e,[i,s],o)),h=Math.min(bn(i,[r,e],o),bn(s,[r,e],o));return Math.min(l,h)}function Rc(r,e,i,s,o){if(!br(e,r.length)||!br(s,i.length))return 1/0;let l=1/0;for(let h=e[0];h<e[1];++h){const d=r[h],g=r[h+1];for(let m=s[0];m<s[1];++m){const v=i[m],_=i[m+1];if(Vo(d,g,v,_))return 0;l=Math.min(l,vl(d,g,v,_,o))}}return l}function ch(r,e,i,s,o){if(!br(e,r.length)||!br(s,i.length))return NaN;let l=1/0;for(let h=e[0];h<=e[1];++h)for(let d=s[0];d<=s[1];++d)if(l=Math.min(l,o.distance(r[h],i[d])),l===0)return l;return l}function uh(r,e,i){if(Dr(r,e,!0))return 0;let s=1/0;for(const o of e){const l=o[0],h=o[o.length-1];if(l!==h&&(s=Math.min(s,bn(r,[h,l],i)),s===0))return s;const d=i.pointOnLine(o,r);if(s=Math.min(s,i.distance(r,d.point)),s===0)return s}return s}function hh(r,e,i,s){if(!br(e,r.length))return NaN;for(let l=e[0];l<=e[1];++l)if(Dr(r[l],i,!0))return 0;let o=1/0;for(let l=e[0];l<e[1];++l){const h=r[l],d=r[l+1];for(const g of i)for(let m=0,v=g.length,_=v-1;m<v;_=m++){const T=g[_],x=g[m];if(Vo(h,d,T,x))return 0;o=Math.min(o,vl(h,d,T,x,s))}}return o}function Bc(r,e){for(const i of r)for(const s of i)if(Dr(s,e,!0))return!0;return!1}function pt(r,e,i,s=1/0){const o=Uo(r),l=Uo(e);if(s!==1/0&&yl(o,l,i)>=s)return s;if(js(o,l)){if(Bc(r,e))return 0}else if(Bc(e,r))return 0;let h=1/0;for(const d of r)for(let g=0,m=d.length,v=m-1;g<m;v=g++){const _=d[v],T=d[g];for(const x of e)for(let I=0,M=x.length,D=M-1;I<M;D=I++){const k=x[D],O=x[I];if(Vo(_,T,k,O))return 0;h=Math.min(h,vl(_,T,k,O,i))}}return h}function Oc(r,e,i,s,o,l){if(!l)return;const h=yl(gl(s,l),o,i);h<e&&r.push([h,l,[0,0]])}function $o(r,e,i,s,o,l,h){if(!l||!h)return;const d=yl(gl(s,l),gl(o,h),i);d<e&&r.push([d,l,h])}function Go(r,e,i,s,o=1/0){let l=Math.min(s.distance(r[0],i[0][0]),o);if(l===0)return l;const h=new dl([[0,[0,r.length-1],[0,0]]],Fc),d=Uo(i);for(;h.length>0;){const g=h.pop();if(g[0]>=l)continue;const m=g[1],v=e?50:100;if(os(m)<=v){if(!br(m,r.length))return NaN;if(e){const _=hh(r,m,i,s);if(isNaN(_)||_===0)return _;l=Math.min(l,_)}else for(let _=m[0];_<=m[1];++_){const T=uh(r[_],i,s);if(l=Math.min(l,T),l===0)return 0}}else{const _=ml(m,e);Oc(h,l,s,r,d,_[0]),Oc(h,l,s,r,d,_[1])}}return l}function qo(r,e,i,s,o,l=1/0){let h=Math.min(l,o.distance(r[0],i[0]));if(h===0)return h;const d=new dl([[0,[0,r.length-1],[0,i.length-1]]],Fc);for(;d.length>0;){const g=d.pop();if(g[0]>=h)continue;const m=g[1],v=g[2],_=e?50:100,T=s?50:100;if(os(m)<=_&&os(v)<=T){if(!br(m,r.length)&&br(v,i.length))return NaN;let x;if(e&&s)x=Rc(r,m,i,v,o),h=Math.min(h,x);else if(e&&!s){const I=r.slice(m[0],m[1]+1);for(let M=v[0];M<=v[1];++M)if(x=bn(i[M],I,o),h=Math.min(h,x),h===0)return h}else if(!e&&s){const I=i.slice(v[0],v[1]+1);for(let M=m[0];M<=m[1];++M)if(x=bn(r[M],I,o),h=Math.min(h,x),h===0)return h}else x=ch(r,m,i,v,o),h=Math.min(h,x)}else{const x=ml(m,e),I=ml(v,s);$o(d,h,o,r,i,x[0],I[0]),$o(d,h,o,r,i,x[0],I[1]),$o(d,h,o,r,i,x[1],I[0]),$o(d,h,o,r,i,x[1],I[1])}}return h}function xl(r){return r.type==="MultiPolygon"?r.coordinates.map((e=>({type:"Polygon",coordinates:e}))):r.type==="MultiLineString"?r.coordinates.map((e=>({type:"LineString",coordinates:e}))):r.type==="MultiPoint"?r.coordinates.map((e=>({type:"Point",coordinates:e}))):[r]}class wn{constructor(e,i){this.type=De,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires exactly one argument, but found ${e.length-1} instead.`);if(fn(e[1])){const s=e[1];if(s.type==="FeatureCollection")return new wn(s,s.features.map((o=>xl(o.geometry))).flat());if(s.type==="Feature")return new wn(s,xl(s.geometry));if("type"in s&&"coordinates"in s)return new wn(s,xl(s))}return i.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(function(i,s){const o=i.geometry(),l=o.flat().map((g=>ul([g.x,g.y],i.canonical)));if(o.length===0)return NaN;const h=new fl(l[0][1]);let d=1/0;for(const g of s){switch(g.type){case"Point":d=Math.min(d,qo(l,!1,[g.coordinates],!1,h,d));break;case"LineString":d=Math.min(d,qo(l,!1,g.coordinates,!0,h,d));break;case"Polygon":d=Math.min(d,Go(l,!1,g.coordinates,h,d))}if(d===0)return d}return d})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,s){const o=i.geometry(),l=o.flat().map((g=>ul([g.x,g.y],i.canonical)));if(o.length===0)return NaN;const h=new fl(l[0][1]);let d=1/0;for(const g of s){switch(g.type){case"Point":d=Math.min(d,qo(l,!0,[g.coordinates],!1,h,d));break;case"LineString":d=Math.min(d,qo(l,!0,g.coordinates,!0,h,d));break;case"Polygon":d=Math.min(d,Go(l,!0,g.coordinates,h,d))}if(d===0)return d}return d})(e,this.geometries);if(e.geometryType()==="Polygon")return(function(i,s){const o=i.geometry();if(o.length===0||o[0].length===0)return NaN;const l=No(o,0).map((g=>g.map((m=>m.map((v=>ul([v.x,v.y],i.canonical))))))),h=new fl(l[0][0][0][1]);let d=1/0;for(const g of s)for(const m of l){switch(g.type){case"Point":d=Math.min(d,Go([g.coordinates],!1,m,h,d));break;case"LineString":d=Math.min(d,Go(g.coordinates,!0,m,h,d));break;case"Polygon":d=Math.min(d,pt(m,g.coordinates,h,d))}if(d===0)return d}return d})(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Us{constructor(e){this.type=Ke,this.key=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const s=e[1];return s==null?i.error("Global state property must be defined."):typeof s!="str
1ing"?i.error(`Global state property must be string, but found ${typeof e[1]} instead.`):new Us(s)}evaluate(e){var i;const s=(i=e.globals)===null||i===void 0?void 0:i.globalState;return s&&Object.keys(s).length!==0?zs(s,this.key):null}eachChild(){}outputDefined(){return!1}}const as={"==":ll,"!=":Ic,">":rs,"<":ih,">=":cl,"<=":Fo,array:Ji,at:Fs,boolean:Ji,case:Rs,coalesce:Os,collator:Ro,format:yn,image:ns,in:at,"index-of":is,interpolate:Xt,"interpolate-hcl":Xt,"interpolate-lab":Xt,length:Ui,let:st,literal:xr,match:lr,number:Ji,"number-format":Bo,object:Ji,slice:mn,step:gn,string:Ji,"to-boolean":Ar,"to-color":Ar,"to-number":Ar,"to-string":Ar,var:Xe,within:xn,distance:wn,"global-state":Us};class Qi{constructor(e,i,s,o){this.name=e,this.type=i,this._evaluate=s,this.args=o}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,i){const s=e[0],o=Qi.definitions[s];if(!o)return i.error(`Unknown expression "${s}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(o)?o[0]:o.type,h=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,d=h.filter((([m])=>!Array.isArray(m)||m.length===e.length-1));let g=null;for(const[m,v]of d){g=new ts(i.registry,Zo,i.path,null,i.scope);const _=[];let T=!1;for(let x=1;x<e.length;x++){const I=e[x],M=Array.isArray(m)?m[x-1]:m.type,D=g.parse(I,1+_.length,M);if(!D){T=!0;break}_.push(D)}if(!T)if(Array.isArray(m)&&m.length!==_.length)g.error(`Expected ${m.length} arguments, but found ${_.length} instead.`);else{for(let x=0;x<_.length;x++){const I=Array.isArray(m)?m[x]:m.type,M=_[x];g.concat(x+1).checkSubtype(I,M.type)}if(g.errors.length===0)return new Qi(s,l,v,_)}}if(d.length===1)i.errors.push(...g.errors);else{const m=(d.length?d:h).map((([_])=>{return T=_,Array.isArray(T)?`(${T.map(Ct).join(", ")})`:`(${Ct(T.type)}...)`;var T})).join(" | "),v=[];for(let _=1;_<e.length;_++){const T=i.parse(e[_],1+v.length);if(!T)return null;v.push(Ct(T.type))}i.error(`Expected arguments of type ${m}, but found (${v.join(", ")}) instead.`)}return null}static register(e,i){Qi.definitions=i;for(const s in i)e[s]=Qi}}function Vc(r,[e,i,s,o]){e=e.evaluate(r),i=i.evaluate(r),s=s.evaluate(r);const l=o?o.evaluate(r):1,h=nl(e,i,s,l);if(h)throw new Ft(h);return new rt(e/255,i/255,s/255,l,!1)}function jc(r,e){return r in e}function bl(r,e){const i=e[r];return i===void 0?null:i}function Tn(r){return{type:r}}function Zo(r){if(r instanceof Xe)return Zo(r.boundExpression);if(r instanceof Qi&&r.name==="error"||r instanceof Ro||r instanceof xn||r instanceof wn||r instanceof Us)return!1;const e=r instanceof Ar||r instanceof Ji;let i=!0;return r.eachChild((s=>{i=e?i&&Zo(s):i&&s instanceof xr})),!!i&&Wo(r)&&Ho(r,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function Wo(r){if(r instanceof Qi&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof xn||r instanceof wn)return!1;let e=!0;return r.eachChild((i=>{e&&!Wo(i)&&(e=!1)})),e}function $s(r){if(r instanceof Qi&&r.name==="feature-state")return!1;let e=!0;return r.eachChild((i=>{e&&!$s(i)&&(e=!1)})),e}function Ho(r,e){if(r instanceof Qi&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild((s=>{i&&!Ho(s,e)&&(i=!1)})),i}function Nc(r){return{result:"success",value:r}}function ls(r){return{result:"error",value:r}}function cs(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Uc(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function wl(r){return!!r.expression&&r.expression.interpolated}function Qe(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function Xo(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)&&Rt(r)===Wr}function dh(r){return r}function $c(r,e){const i=r.stops&&typeof r.stops[0][0]=="object",s=i||!(i||r.property!==void 0),o=r.type||(wl(e)?"exponential":"interval"),l=(function(v){switch(v.type){case"color":return rt.parse;case"padding":return Ze.parse;case"numberArray":return Jt.parse;case"colorArray":return Lt.parse;default:return null}})(e);if(l&&((r=un({},r)).stops&&(r.stops=r.stops.map((v=>[v[0],l(v[1])]))),r.default=l(r.default?r.default:e.default)),r.colorSpace&&(h=r.colorSpace)!=="rgb"&&h!=="hcl"&&h!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var h;const d=(function(v){switch(v){case"exponential":return Gc;case"interval":return fh;case"categorical":return ph;case"identity":return mh;default:throw new Error(`Unknown function type "${v}"`)}})(o);let g,m;if(o==="categorical"){g=Object.create(null);for(const v of r.stops)g[v[0]]=v[1];m=typeof r.stops[0][0]}if(i){const v={},_=[];for(let I=0;I<r.stops.length;I++){const M=r.stops[I],D=M[0].zoom;v[D]===void 0&&(v[D]={zoom:D,type:r.type,property:r.property,default:r.default,stops:[]},_.push(D)),v[D].stops.push([M[0].value,M[1]])}const T=[];for(const I of _)T.push([v[I].zoom,$c(v[I],e)]);const x={name:"linear"};return{kind:"composite",interpolationType:x,interpolationFactor:Xt.interpolationFactor.bind(void 0,x),zoomStops:T.map((I=>I[0])),evaluate:({zoom:I},M)=>Gc({stops:T,base:r.base},e,I).evaluate(I,M)}}if(s){const v=o==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:v,interpolationFactor:Xt.interpolationFactor.bind(void 0,v),zoomStops:r.stops.map((_=>_[0])),evaluate:({zoom:_})=>d(r,e,_,g,m)}}return{kind:"source",evaluate(v,_){const T=_&&_.properties?_.properties[r.property]:void 0;return T===void 0?Gs(r.default,e.default):d(r,e,T,g,m)}}}function Gs(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function ph(r,e,i,s,o){return Gs(typeof i===o?s[i]:void 0,r.default,e.default)}function fh(r,e,i){if(Qe(i)!=="number")return Gs(r.default,e.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const o=Bs(r.stops.map((l=>l[0])),i);return r.stops[o][1]}function Gc(r,e,i){const s=r.base!==void 0?r.base:1;if(Qe(i)!=="number")return Gs(r.default,e.default);const o=r.stops.length;if(o===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[o-1][0])return r.stops[o-1][1];const l=Bs(r.stops.map((v=>v[0])),i),h=(function(v,_,T,x){const I=x-T,M=v-T;return I===0?0:_===1?M/I:(Math.pow(_,M)-1)/(Math.pow(_,I)-1)}
vendor: 31,909 bytes, lines 1-2
1)(i,s,r.stops[l][0],r.stops[l+1][0]),d=r.stops[l][1],g=r.stops[l+1][1],m=Ni[e.type]||dh;return typeof d.evaluate=="function"?{evaluate(...v){const _=d.evaluate.apply(void 0,v),T=g.evaluate.apply(void 0,v);if(_!==void 0&&T!==void 0)return m(_,T,h,r.colorSpace)}}:m(d,g,h,r.colorSpace)}function mh(r,e,i){switch(e.type){case"color":i=rt.parse(i);break;case"formatted":i=Gt.fromString(i.toString());break;case"resolvedImage":i=yi.fromString(i.toString());break;case"padding":i=Ze.parse(i);break;case"colorArray":i=Lt.parse(i);break;case"numberArray":i=Jt.parse(i);break;default:Qe(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0)}return Gs(i,r.default,e.default)}Qi.register(as,{error:[{kind:"error"},[He],(r,[e])=>{throw new Ft(e.evaluate(r))}],typeof:[He,[Ke],(r,[e])=>Ct(Rt(e.evaluate(r)))],"to-rgba":[si(De,4),[Vi],(r,[e])=>{const[i,s,o,l]=e.evaluate(r).rgb;return[255*i,255*s,255*o,l]}],rgb:[Vi,[De,De,De],Vc],rgba:[Vi,[De,De,De,De],Vc],has:{type:Je,overloads:[[[He],(r,[e])=>jc(e.evaluate(r),r.properties())],[[He,Wr],(r,[e,i])=>jc(e.evaluate(r),i.evaluate(r))]]},get:{type:Ke,overloads:[[[He],(r,[e])=>bl(e.evaluate(r),r.properties())],[[He,Wr],(r,[e,i])=>bl(e.evaluate(r),i.evaluate(r))]]},"feature-state":[Ke,[He],(r,[e])=>bl(e.evaluate(r),r.featureState||{})],properties:[Wr,[],r=>r.properties()],"geometry-type":[He,[],r=>r.geometryType()],id:[Ke,[],r=>r.id()],zoom:[De,[],r=>r.globals.zoom],"heatmap-density":[De,[],r=>r.globals.heatmapDensity||0],elevation:[De,[],r=>r.globals.elevation||0],"line-progress":[De,[],r=>r.globals.lineProgress||0],accumulated:[Ke,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[De,Tn(De),(r,e)=>{let i=0;for(const s of e)i+=s.evaluate(r);return i}],"*":[De,Tn(De),(r,e)=>{let i=1;for(const s of e)i*=s.evaluate(r);return i}],"-":{type:De,overloads:[[[De,De],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[De],(r,[e])=>-e.evaluate(r)]]},"/":[De,[De,De],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[De,[De,De],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[De,[],()=>Math.LN2],pi:[De,[],()=>Math.PI],e:[De,[],()=>Math.E],"^":[De,[De,De],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[De,[De],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[De,[De],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[De,[De],(r,[e])=>Math.log(e.evaluate(r))],log2:[De,[De],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[De,[De],(r,[e])=>Math.sin(e.evaluate(r))],cos:[De,[De],(r,[e])=>Math.cos(e.evaluate(r))],tan:[De,[De],(r,[e])=>Math.tan(e.evaluate(r))],asin:[De,[De],(r,[e])=>Math.asin(e.evaluate(r))],acos:[De,[De],(r,[e])=>Math.acos(e.evaluate(r))],atan:[De,[De],(r,[e])=>Math.atan(e.evaluate(r))],min:[De,Tn(De),(r,e)=>Math.min(...e.map((i=>i.evaluate(r))))],max:[De,Tn(De),(r,e)=>Math.max(...e.map((i=>i.evaluate(r))))],abs:[De,[De],(r,[e])=>Math.abs(e.evaluate(r))],round:[De,[De],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[De,[De],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[De,[De],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[Je,[He,Ke],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[Je,[Ke],(r,[e])=>r.id()===e.value],"filter-type-==":[Je,[He],(r,[e])=>r.geometryType()===e.value],"filter-<":[Je,[He,Ke],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s<o}],"filter-id-<":[Je,[Ke],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<s}],"filter->":[Je,[He,Ke],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s>o}],"filter-id->":[Je,[Ke],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>s}],"filter-<=":[Je,[He,Ke],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s<=o}],"filter-id-<=":[Je,[Ke],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i<=s}],"filter->=":[Je,[He,Ke],(r,[e,i])=>{const s=r.properties()[e.value],o=i.value;return typeof s==typeof o&&s>=o}],"filter-id->=":[Je,[Ke],(r,[e])=>{const i=r.id(),s=e.value;return typeof i==typeof s&&i>=s}],"filter-has":[Je,[Ke],(r,[e])=>e.value in r.properties()],"filter-has-id":[Je,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[Je,[si(He)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[Je,[si(Ke)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[Je,[He,si(Ke)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[Je,[He,si(Ke)],(r,[e,i])=>(function(s,o,l,h){for(;l<=h;){const d=l+h>>1;if(o[d]===s)return!0;o[d]>s?h=d-1:l=d+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Je,overloads:[[[Je,Je],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[Tn(Je),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:Je,overloads:[[[Je,Je],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[Tn(Je),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[Je,[Je],(r,[e])=>!e.evaluate(r)],"is-supported-script":[Je,[He],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[He,[He],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[He,[He],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[He,Tn(Ke),(r,e)=>e.map((i=>Ls(i.evaluate(r)))).join("")],split:[si(He),[He,He],(r,[e,i])=>e.evaluate(r).split(i.evaluate(r))],join:[He,[si(He),He],(r,[e,i])=>e.evaluate(r).join(i.evaluate(r))],"resolved-locale":[He,[Co],(r,[e])=>e.evaluate(r).resolvedLocale()]});class qs{constructor(e,i,s){this.expression=e,this._warningHistory={},this._evaluator=new It,this._defaultValue=i?(function(o){if(o.type==="color"&&Xo(o.default))return new rt(0,0,0,0);switch(o.type){case"color":return rt.parse(o.default)||null;case"padding":return Ze.parse(o.default)||null;case"numberArray":return Jt.parse(o.default)||null;case"colorArray":return Lt.parse(o.default)||null;case"variableAnchorOffsetCollection":return _i.parse(o.default)||null;case"projectionDefinition":return vi.parse(o.default)||null;default:return o.default===void 0?null:o.default}})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this._globalState=s}evaluateWithoutErrorHandling(e,i,s,o,l,h){return this._globalState&&(e=hs(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=s,this._evaluator.canonical=o,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=h,this.expression.evaluate(this._evaluator)}evaluate(e,i,s,o,l,h){this._globalState&&(e=hs(e,this._globalState)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=s||null,this._evaluator.canonical=o,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=h||null;try{const d=this.expression.evaluate(this._evaluator);if(d==null||typeof d=="number"&&d!=d)return this._defaultValue;if(this._enumValues&&!(d in this._enumValues))throw new Ft(`Expected value to be one of ${Object.keys(this._enumValues).map((g=>JSON.stringify(g))).join(", ")}, but found ${JSON.stringify(d)} instead.`);return d}catch(d){return this._warningHistory[d.message]||(this._warningHistory[d.message]=!0,typeof console<"u"&&console.warn(d.message)),this._defaultValue}}}function Yo(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in as}function Zs(r,e,i){const s=new ts(as,Zo,[],e?(function(l){const h={color:Vi,string:He,number:De,enum:He,boolean:Je,formatted:Yn,padding:As,numberArray:Ds,colorArray:Kn,projectionDefinition:Xn,resolvedImage:hn,variableAnchorOffsetCollection:yr};return l.type==="array"?si(h[l.value]||Ke,l.length):h[l.type]})(e):void 0),o=s.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return o?Nc(new qs(o,e,i)):ls(s.errors)}class Ko{constructor(e,i,s){this.kind=e,this._styleExpression=i,this.isStateDependent=e!=="constant"&&!$s(i.expression),this.globalStateRefs=us(i.expression),this._globalState=s}evaluateWithoutErrorHandling(e,i,s,o,l,h){return this._globalState&&(e=hs(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,o,l,h)}evaluate(e,i,s,o,l,h){return this._globalState&&(e=hs(e,this._globalState)),this._styleExpression.evaluate(e,i,s,o,l,h)}}class Jo{constructor(e,i,s,o,l){this.kind=e,this.zoomStops=s,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!$s(i.expression),this.globalStateRefs=us(i.expression),this.interpolationType=o,this._globalState=l}evaluateWithoutErrorHandling(e,i,s,o,l,h){return this._globalState&&(e=hs(e,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(e,i,s,o,l,h)}evaluate(e,i,s,o,l,h){return this._globalState&&(e=hs(e,this._globalState)),this._styleExpression.evaluate(e,i,s,o,l,h)}interpolationFactor(e,i,s){return this.interpolationType?Xt.interpolationFactor(this.interpolationType,e,i,s):0}}function qc(r,e,i){const s=Zs(r,e,i);if(s.result==="error")return s;const o=s.value.expression,l=Wo(o);if(!l&&!cs(e))return ls([new pi("","data expressions not supported")]);const h=Ho(o,["zoom"]);if(!h&&!Uc(e))return ls([new pi("","zoom expressions not supported")]);const d=Sn(o);return d||h?d instanceof pi?ls([d]):d instanceof Xt&&!wl(e)?ls([new pi("",'"interpolate" expressions cannot be used with this property')]):Nc(d?new Jo(l?"camera":"composite",s.value,d.labels,d instanceof Xt?d.interpolation:void 0,i):new Ko(l?"constant":"source",s.value,i)):ls([new pi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Qo{constructor(e,i){this._parameters=e,this._specification=i,un(this,$c(this._parameters,this._specification))}static deserialize(e){return new Qo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Sn(r){let e=null;if(r instanceof st)e=Sn(r.result);else if(r instanceof Os){for(const i of r.args)if(e=Sn(i),e)break}else(r instanceof gn||r instanceof Xt)&&r.input instanceof Qi&&r.input.name==="zoom"&&(e=r);return e instanceof pi||r.eachChild((i=>{const s=Sn(i);s instanceof pi?e=s:!e&&s?e=new pi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&s&&e!==s&&(e=new pi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))})),e}function us(r,e=new Set){return r instanceof Us&&e.add(r.key),r.eachChild((i=>{us(i,e)})),e}function hs(r,e){const{zoom:i,heatmapDensity:s,elevation:o,lineProgress:l,isSupportedScript:h,accumulated:d}=r??{};return{zoom:i,heatmapDensity:s,elevation:o,lineProgress:l,isSupportedScript:h,accumulated:d,globalState:e}}function Tl(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!Tl(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const gh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Ws(r,e){if(r==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Tl(r)||(r=Hs(r));const i=Zs(r,gh,e);if(i.result==="error")throw new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));return{filter:(s,o,l)=>i.value.evaluate(s,o,{},l),needGeometry:Sl(r),getGlobalStateRefs:()=>us(i.value.expression)}}function _h(r,e){return r<e?-1:r>e?1:0}function Sl(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(Sl(r[e]))return!0;return!1}function Hs(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?Pl(r[1],r[2],"=="):e==="!="?Xs(Pl(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Pl(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(Hs))):e==="all"?["all"].concat(r.slice(1).map(Hs)):e==="none"?["all"].concat(r.slice(1).map(Hs).map(Xs)):e==="in"?Zc(r[1],r.slice(2)):e==="!in"?Xs(Zc(r[1],r.slice(2))):e==="has"?Il(r[1]):e!=="!has"||Xs(Il(r[1]));var i}function Pl(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function Zc(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some((i=>typeof i!=typeof e[0]))?["filter-in-large",r,["literal",e.sort(_h)]]:["filter-in-small",r,["literal",e]]}}function Il(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Xs(r){return["!",r]}function ea(r){const e=typeof r;if(e==="number"||e==="boolean"||e==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let o="[";for(const l of r)o+=`${ea(l)},`;return`${o}]`}const i=Object.keys(r).sort();let s="{";for(let o=0;o<i.length;o++)s+=`${JSON.stringify(i[o])}:${ea(r[i[o]])},`;return`${s}}`}function yh(r){let e="";for(const i of Wa)e+=`/${ea(r[i])}`;return e}function Wc(r){const e=r.value;return e?[new Me(r.key,e,"constants have been deprecated as of v8")]:[]}function qt(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Pn(r){if(Array.isArray(r))return r.map(Pn);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=Pn(r[i]);return e}return qt(r)}function ki(r){const e=r.key,i=r.value,s=r.valueSpec||{},o=r.objectElementValidators||{},l=r.style,h=r.styleSpec,d=r.validateSpec;let g=[];const m=Qe(i);if(m!=="object")return[new Me(e,i,`object expected, ${m} found`)];for(const v in i){const _=v.split(".")[0],T=zs(s,_)||s["*"];let x;if(zs(o,_))x=o[_];else if(zs(s,_)){if(i[v]===void 0)continue;x=d}else if(o["*"])x=o["*"];else{if(!s["*"]){g.push(new Me(e,i[v],`unknown property "${v}"`));continue}x=d}g=g.concat(x({key:(e&&`${e}.`)+v,value:i[v],valueSpec:T,style:l,styleSpec:h,object:i,objectKey:v,validateSpec:d},i))}for(const v in s)o[v]||s[v].required&&s[v].default===void 0&&i[v]===void 0&&g.push(new Me(e,i,`missing required property "${v}"`));return g}function ta(r){const e=r.value,i=r.valueSpec,s=r.style,o=r.styleSpec,l=r.key,h=r.arrayElementValidator||r.validateSpec;if(Qe(e)!=="array")return[new Me(l,e,`array expected, ${Qe(e)} found`)];if(i.length&&e.length!==i.length)return[new Me(l,e,`array length ${i.length} expected, length ${e.length} found`)];let d={type:i.value,values:i.values};o.$version<7&&(d.function=i.function),Qe(i.value)==="object"&&(d=i.value);let g=[];for(let m=0;m<e.length;m++)g=g.concat(h({array:e,arrayIndex:m,value:e[m],valueSpec:d,validateSpec:r.validateSpec,style:s,styleSpec:o,key:`${l}[${m}]`}));return g}function ds(r){const e=r.key,i=r.value,s=r.valueSpec;let o=Qe(i);return o==="number"&&i!=i&&(o="NaN"),o!=="number"?[new Me(e,i,`number expected, ${o} found`)]:"minimum"in s&&i<s.minimum?[new Me(e,i,`${i} is less than the minimum value ${s.minimum}`)]:"maximum"in s&&i>s.maximum?[new Me(e,i,`${i} is greater than the maximum value ${s.maximum}`)]:[]}function ia(r){const e=r.valueSpec,i=qt(r.value.type);let s,o,l,h={};const d=i!=="categorical"&&r.value.property===void 0,g=!d,m=Qe(r.value.stops)==="array"&&Qe(r.value.stops[0])==="array"&&Qe(r.value.stops[0][0])==="object",v=ki({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(x){if(i==="identity")return[new Me(x.key,x.value,'identity function may not have a "stops" property')];let I=[];const M=x.value;return I=I.concat(ta({key:x.key,value:M,valueSpec:x.valueSpec,validateSpec:x.validateSpec,style:x.style,styleSpec:x.styleSpec,arrayElementValidator:_})),Qe(M)==="array"&&M.length===0&&I.push(new Me(x.key,M,"array must have at least one stop")),I},default:function(x){return x.validateSpec({key:x.key,value:x.value,valueSpec:e,validateSpec:x.validateSpec,style:x.style,styleSpec:x.styleSpec})}}});return i==="identity"&&d&&v.push(new Me(r.key,r.value,'missing required property "property"')),i==="identity"||r.value.stops||v.push(new Me(r.key,r.value,'missing required property "stops"')),i==="exponential"&&r.valueSpec.expression&&!wl(r.valueSpec)&&v.push(new Me(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(g&&!cs(r.valueSpec)?v.push(new Me(r.key,r.value,"property functions not supported")):d&&!Uc(r.valueSpec)&&v.push(new Me(r.key,r.value,"zoom functions not supported"))),i!=="categorical"&&!m||r.value.property!==void 0||v.push(new Me(r.key,r.value,'"property" property is required')),v;function _(x){let I=[];const M=x.value,D=x.key;if(Qe(M)!=="array")return[new Me(D,M,`array expected, ${Qe(M)} found`)];if(M.length!==2)return[new Me(D,M,`array length 2 expected, length ${M.length} found`)];if(m){if(Qe(M[0])!=="object")return[new Me(D,M,`object expected, ${Qe(M[0])} found`)];if(M[0].zoom===void 0)return[new Me(D,M,"object stop key must have zoom")];if(M[0].value===void 0)return[new Me(D,M,"object stop key must have value")];if(l&&l>qt(M[0].zoom))return[new Me(D,M[0].zoom,"stop zoom values must appear in ascending order")];qt(M[0].zoom)!==l&&(l=qt(M[0].zoom),o=void 0,h={}),I=I.concat(ki({key:`${D}[0]`,value:M[0],valueSpec:{zoom:{}},validateSpec:x.validateSpec,style:x.style,styleSpec:x.styleSpec,objectElementValidators:{zoom:ds,value:T}}))}else I=I.concat(T({key:`${D}[0]`,value:M[0],validateSpec:x.validateSpec,style:x.style,styleSpec:x.styleSpec},M));return Yo(Pn(M[1]))?I.concat([new Me(`${D}[1]`,M[1],"expressions are not allowed in function stops.")]):I.concat(x.validateSpec({key:`${D}[1]`,value:M[1],valueSpec:e,validateSpec:x.validateSpec,style:x.style,styleSpec:x.styleSpec}))}function T(x,I){const M=Qe(x.value),D=qt(x.value),k=x.value!==null?x.value:I;if(s){if(M!==s)return[new Me(x.key,k,`${M} stop domain type must match previous stop domain type ${s}`)]}else s=M;if(M!=="number"&&M!=="string"&&M!=="boolean")return[new Me(x.key,k,"stop domain value must be a number, string, or boolean")];if(M!=="number"&&i!=="categorical"){let O=`number expected, ${M} found`;return cs(e)&&i===void 0&&(O+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Me(x.key,k,O)]}return i!=="categorical"||M!=="number"||isFinite(D)&&Math.floor(D)===D?i!=="categorical"&&M==="number"&&o!==void 0&&D<o?[new Me(x.key,k,"stop domain values must appear in ascending order")]:(o=D,i==="categorical"&&D in h?[new Me(x.key,k,"stop domain values must be unique")]:(h[D]=!0,[])):[new Me(x.key,k,`integer expected, found ${D}`)]}}function Hr(r){const e=(r.expressionContext==="property"?qc:Zs)(Pn(r.value),r.valueSpec);if(e.result==="error")return e.value.map((s=>new Me(`${r.key}${s.key}`,r.value,s.message)));const i=e.value.expression||e.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!i.outputDefined())return[new Me(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!$s(i))return[new Me(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!$s(i))return[new Me(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Ho(i,["zoom","feature-state"]))return[new Me(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!Wo(i))return[new Me(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ys(r){const e=r.key,i=r.value,s=Qe(i);return s!=="string"?[new Me(e,i,`color expected, ${s} found`)]:rt.parse(String(i))?[]:[new Me(e,i,`color expected, "${i}" found`)]}function Xr(r){const e=r.key,i=r.value,s=r.valueSpec,o=[];return Array.isArray(s.values)?s.values.indexOf(qt(i))===-1&&o.push(new Me(e,i,`expected one of [${s.values.join(", ")}], ${JSON.stringify(i)} found`)):Object.keys(s.values).indexOf(qt(i))===-1&&o.push(new Me(e,i,`expected one of [${Object.keys(s.values).join(", ")}], ${JSON.stringify(i)} found`)),o}function Ml(r){return Tl(Pn(r.value))?Hr(un({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Hc(r)}function Hc(r){const e=r.value,i=r.key;if(Qe(e)!=="array")return[new Me(i,e,`array expected, ${Qe(e)} found`)];const s=r.styleSpec;let o,l=[];if(e.length<1)return[new Me(i,e,"filter array must have at least 1 element")];switch(l=l.concat(Xr({key:`${i}[0]`,value:e[0],valueSpec:s.filter_operator,style:r.style,styleSpec:r.styleSpec})),qt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&qt(e[1])==="$type"&&l.push(new Me(i,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&l.push(new Me(i,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(o=Qe(e[1]),o!=="string"&&l.push(new Me(`${i}[1]`,e[1],`string expected, ${o} found`)));for(let h=2;h<e.length;h++)o=Qe(e[h]),qt(e[1])==="$type"?l=l.concat(Xr({key:`${i}[${h}]`,value:e[h],valueSpec:s.geometry_type,style:r.style,styleSpec:r.styleSpec})):o!=="string"&&o!=="number"&&o!=="boolean"&&l.push(new Me(`${i}[${h}]`,e[h],`string, number, or boolean expected, ${o} found`));break;case"any":case"all":case"none":for(let h=1;h<e.length;h++)l=l.concat(Hc({key:`${i}[${h}]`,value:e[h],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":o=Qe(e[1]),e.length!==2?l.push(new Me(i,e,`filter array for "${e[0]}" operator must have 2 elements`)):o!=="string"&&l.push(new Me(`${i}[1]`,e[1],`string expected, ${o} found`))}return l}function Xc(r,e){const i=r.key,s=r.validateSpec,o=r.style,l=r.styleSpec,h=r.value,d=r.objectKey,g=l[`${e}_${r.layerType}`];if(!g)return[];const m=d.match(/^(.*)-transition$/);if(e==="paint"&&m&&g[m[1]]&&g[m[1]].transition)return s({key:i,value:h,valueSpec:l.transition,style:o,styleSpec:l});const v=r.valueSpec||g[d];if(!v)return[new Me(i,h,`unknown property "${d}"`)];let _;if(Qe(h)==="string"&&cs(v)&&!v.tokens&&(_=/^{([^}]+)}$/.exec(h)))return[new Me(i,h,`"${d}" does not support interpolation syntax 2Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(_[1])} }\`.`)];const T=[];return r.layerType==="symbol"&&d==="text-font"&&Xo(Pn(h))&&qt(h.type)==="identity"&&T.push(new Me(i,h,'"text-font" does not support identity functions')),T.concat(s({key:r.key,value:h,valueSpec:v,style:o,styleSpec:l,expressionContext:"property",propertyType:e,propertyKey:d}))}function Yc(r){return Xc(r,"paint")}function Kc(r){return Xc(r,"layout")}function Jc(r){var e,i;let s=[];const o=r.value,l=r.key,h=r.style,d=r.styleSpec;if(Qe(o)!=="object")return[new Me(l,o,`object expected, ${Qe(o)} found`)];o.type||o.ref||s.push(new Me(l,o,'either "type" or "ref" is required'));let g=qt(o.type);const m=qt(o.ref);if(o.id){const v=qt(o.id);for(let _=0;_<r.arrayIndex;_++){const T=h.layers[_];qt(T.id)===v&&s.push(new Me(l,o.id,`duplicate layer id "${o.id}", previously used at line ${T.id.__line__}`))}}if("ref"in o){let v;["type","source","source-layer","filter","layout"].forEach((_=>{_ in o&&s.push(new Me(l,o[_],`"${_}" is prohibited for ref layers`))})),h.layers.forEach((_=>{qt(_.id)===m&&(v=_)})),v?v.ref?s.push(new Me(l,o.ref,"ref cannot reference another ref layer")):g=qt(v.type):s.push(new Me(l,o.ref,`ref layer "${m}" not found`))}else if(g!=="background")if(o.source){const v=h.sources&&h.sources[o.source],_=v&&qt(v.type);v?_==="vector"&&g==="raster"?s.push(new Me(l,o.source,`layer "${o.id}" requires a raster source`)):_!=="raster-dem"&&g==="hillshade"||_!=="raster-dem"&&g==="color-relief"?s.push(new Me(l,o.source,`layer "${o.id}" requires a raster-dem source`)):_==="raster"&&g!=="raster"?s.push(new Me(l,o.source,`layer "${o.id}" requires a vector source`)):_!=="vector"||o["source-layer"]?_==="raster-dem"&&g!=="hillshade"&&g!=="color-relief"?s.push(new Me(l,o.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):g!=="line"||!o.paint||!o.paint["line-gradient"]||_==="geojson"&&v.lineMetrics||s.push(new Me(l,o,`layer "${o.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):s.push(new Me(l,o,`layer "${o.id}" must specify a "source-layer"`)):s.push(new Me(l,o.source,`source "${o.source}" not found`))}else s.push(new Me(l,o,'missing required property "source"'));return g==="raster"&&!((e=o.paint)===null||e===void 0)&&e.resampling&&!((i=o.paint)===null||i===void 0)&&i["raster-resampling"]&&s.push(new Me(l,o.paint,`layer "${o.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),s=s.concat(ki({key:l,value:o,valueSpec:d.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${l}.type`,value:o.type,valueSpec:d.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:o,objectKey:"type"}),filter:Ml,layout:v=>ki({layer:o,key:v.key,value:v.value,style:v.style,styleSpec:v.styleSpec,validateSpec:v.validateSpec,objectElementValidators:{"*":_=>Kc(un({layerType:g},_))}}),paint:v=>ki({layer:o,key:v.key,value:v.value,style:v.style,styleSpec:v.styleSpec,validateSpec:v.validateSpec,objectElementValidators:{"*":_=>Yc(un({layerType:g},_))}})}})),s}function kr(r){const e=r.value,i=r.key,s=Qe(e);return s!=="string"?[new Me(i,e,`string expected, ${s} found`)]:[]}const El={promoteId:function({key:r,value:e}){if(Qe(e)==="string")return kr({key:r,value:e});{const i=[];for(const s in e)i.push(...kr({key:`${r}.${s}`,value:e[s]}));return i}}};function Ks(r){const e=r.value,i=r.key,s=r.styleSpec,o=r.style,l=r.validateSpec;if(!e.type)return[new Me(i,e,'"type" is required')];const h=qt(e.type);let d;switch(h){case"vector":case"raster":return d=ki({key:i,value:e,valueSpec:s[`source_${h.replace("-","_")}`],style:r.style,styleSpec:s,objectElementValidators:El,validateSpec:l}),d;case"raster-dem":return d=(function(g){var m;const v=(m=g.sourceName)!==null&&m!==void 0?m:"",_=g.value,T=g.styleSpec,x=T.source_raster_dem,I=g.style;let M=[];const D=Qe(_);if(_===void 0)return M;if(D!=="object")return M.push(new Me("source_raster_dem",_,`object expected, ${D} found`)),M;const k=qt(_.encoding)==="custom",O=["redFactor","greenFactor","blueFactor","baseShift"],B=g.value.encoding?`"${g.value.encoding}"`:"Default";for(const N in _)!k&&O.includes(N)?M.push(new Me(N,_[N],`In "${v}": "${N}" is only valid when "encoding" is set to "custom". ${B} encoding found`)):x[N]?M=M.concat(g.validateSpec({key:N,value:_[N],valueSpec:x[N],validateSpec:g.validateSpec,style:I,styleSpec:T})):M.push(new Me(N,_[N],`unknown property "${N}"`));return M})({sourceName:i,value:e,style:r.style,styleSpec:s,validateSpec:l}),d;case"geojson":if(d=ki({key:i,value:e,valueSpec:s.source_geojson,style:o,styleSpec:s,validateSpec:l,objectElementValidators:El}),e.cluster)for(const g in e.clusterProperties){const[m,v]=e.clusterProperties[g],_=typeof m=="string"?[m,["accumulated"],["get",g]]:m;d.push(...Hr({key:`${i}.${g}.map`,value:v,expressionContext:"cluster-map"})),d.push(...Hr({key:`${i}.${g}.reduce`,value:_,expressionContext:"cluster-reduce"}))}return d;case"video":return ki({key:i,value:e,valueSpec:s.source_video,style:o,validateSpec:l,styleSpec:s});case"image":return ki({key:i,value:e,valueSpec:s.source_image,style:o,validateSpec:l,styleSpec:s});case"canvas":return[new Me(i,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Xr({key:`${i}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Qc(r){const e=r.value,i=r.styleSpec,s=i.light,o=r.style;let l=[];const h=Qe(e);if(e===void 0)return l;if(h!=="object")return l=l.concat([new Me("light",e,`object expected, ${h} found`)]),l;for(const d in e){const g=d.match(/^(.*)-transition$/);l=l.concat(g&&s[g[1]]&&s[g[1]].transition?r.validateSpec({key:d,value:e[d],valueSpec:i.transition,validateSpec:r.validateSpec,style:o,styleSpec:i}):s[d]?r.validateSpec({key:d,value:e[d],valueSpec:s[d],validateSpec:r.validateSpec,style:o,styleSpec:i}):[new Me(d,e[d],`unknown property "${d}"`)])}return l}function Cl(r){const e=r.value,i=r.styleSpec,s=i.sky,o=r.style,l=Qe(e);if(e===void 0)return[];if(l!=="object")return[new Me("sky",e,`object expected, ${l} found`)];let h=[];for(const d in e)h=h.concat(s[d]?r.validateSpec({key:d,value:e[d],valueSpec:s[d],style:o,styleSpec:i}):[new Me(d,e[d],`unknown property "${d}"`)]);return h}function Al(r){const e=r.value,i=r.styleSpec,s=i.terrain,o=r.style;let l=[];const h=Qe(e);if(e===void 0)return l;if(h!=="object")return l=l.concat([new Me("terrain",e,`object expected, ${h} found`)]),l;for(const d in e)l=l.concat(s[d]?r.validateSpec({key:d,value:e[d],valueSpec:s[d],validateSpec:r.validateSpec,style:o,styleSpec:i}):[new Me(d,e[d],`unknown property "${d}"`)]);return l}function Js(r){let e=[];const i=r.value,s=r.key;if(Array.isArray(i)){const o=[],l=[];for(const h in i)i[h].id&&o.includes(i[h].id)&&e.push(new Me(s,i,`all the sprites' ids must be unique, but ${i[h].id} is duplicated`)),o.push(i[h].id),i[h].url&&l.includes(i[h].url)&&e.push(new Me(s,i,`all the sprites' URLs must be unique, but ${i[h].url} is duplicated`)),l.push(i[h].url),e=e.concat(ki({key:`${s}[${h}]`,value:i[h],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return e}return kr({key:s,value:i})}function Dl(r){return!!r&&r.constructor===Object}function kl(r){return Dl(r.value)?[]:[new Me(r.key,r.value,`object expected, ${Qe(r.value)} found`)]}const ps={"*":()=>[],array:ta,boolean:function(r){const e=r.value,i=r.key,s=Qe(e);return s!=="boolean"?[new Me(i,e,`boolean expected, ${s} found`)]:[]},number:ds,color:Ys,constants:Wc,enum:Xr,filter:Ml,function:ia,layer:Jc,object:ki,source:Ks,light:Qc,sky:Cl,terrain:Al,projection:function(r){const e=r.value,i=r.styleSpec,s=i.projection,o=r.style,l=Qe(e);if(e===void 0)return[];if(l!=="object")return[new Me("projection",e,`object expected, ${l} found`)];let h=[];for(const d in e)h=h.concat(s[d]?r.validateSpec({key:d,value:e[d],valueSpec:s[d],style:o,styleSpec:i}):[new Me(d,e[d],`unknown property "${d}"`)]);return h},projectionDefinition:function(r){const e=r.key;let i=r.value;i=i instanceof String?i.valueOf():i;const s=Qe(i);return s!=="array"||(function(o){return Array.isArray(o)&&o.length===3&&typeof o[0]=="string"&&typeof o[1]=="string"&&typeof o[2]=="number"})(i)||(function(o){return!!["interpolate","step","literal"].includes(o[0])})(i)?["array","string"].includes(s)?[]:[new Me(e,i,`projection expected, invalid type "${s}" found`)]:[new Me(e,i,`projection expected, invalid array ${JSON.stringify(i)} found`)]},string:kr,formatted:function(r){return kr(r).length===0?[]:Hr(r)},resolvedImage:function(r){return kr(r).length===0?[]:Hr(r)},padding:function(r){const e=r.key,i=r.value;if(Qe(i)==="array"){if(i.length<1||i.length>4)return[new Me(e,i,`padding requires 1 to 4 values; ${i.length} values found`)];const s={type:"number"};let o=[];for(let l=0;l<i.length;l++)o=o.concat(r.validateSpec({key:`${e}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:s}));return o}return ds({key:e,value:i,valueSpec:{}})},numberArray:function(r){const e=r.key,i=r.value;if(Qe(i)==="array"){const s={type:"number"};if(i.length<1)return[new Me(e,i,"array length at least 1 expected, length 0 found")];let o=[];for(let l=0;l<i.length;l++)o=o.concat(r.validateSpec({key:`${e}[${l}]`,value:i[l],validateSpec:r.validateSpec,valueSpec:s}
2));return o}return ds({key:e,value:i,valueSpec:{}})},colorArray:function(r){const e=r.key,i=r.value;if(Qe(i)==="array"){if(i.length<1)return[new Me(e,i,"array length at least 1 expected, length 0 found")];let s=[];for(let o=0;o<i.length;o++)s=s.concat(Ys({key:`${e}[${o}]`,value:i[o]}));return s}return Ys({key:e,value:i})},variableAnchorOffsetCollection:function(r){const e=r.key,i=r.value,s=Qe(i),o=r.styleSpec;if(s!=="array"||i.length<1||i.length%2!=0)return[new Me(e,i,"variableAnchorOffsetCollection requires a non-empty array of even length")];let l=[];for(let h=0;h<i.length;h+=2)l=l.concat(Xr({key:`${e}[${h}]`,value:i[h],valueSpec:o.layout_symbol["text-anchor"]})),l=l.concat(ta({key:`${e}[${h+1}]`,value:i[h+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:o}));return l},sprite:Js,state:kl,fontFaces:function(r){const e=r.key,i=r.value,s=r.validateSpec,o=r.styleSpec,l=r.style;if(!Dl(i))return[new Me(e,i,`object expected, ${Qe(i)} found`)];const h=[];for(const d in i){const g=i[d],m=Qe(g);if(m==="string")h.push(...kr({key:`${e}.${d}`,value:g}));else if(m==="array"){const v={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(const[_,T]of g.entries())h.push(...ki({key:`${e}.${d}[${_}]`,value:T,valueSpec:v,styleSpec:o,style:l,validateSpec:s}))}else h.push(new Me(`${e}.${d}`,g,`string or array expected, ${m} found`))}return h}};function ra(r){const e=r.value,i=r.valueSpec,s=r.styleSpec;return r.validateSpec=ra,i.expression&&Xo(qt(e))?ia(r):i.expression&&Yo(Pn(e))?Hr(r):i.type&&ps[i.type]?ps[i.type](r):ki(un({},r,{valueSpec:i.type?s[i.type]:i}))}function eu(r){const e=r.value,i=r.key,s=kr(r);return s.length||(e.indexOf("{fontstack}")===-1&&s.push(new Me(i,e,'"glyphs" url must include a "{fontstack}" token')),e.indexOf("{range}")===-1&&s.push(new Me(i,e,'"glyphs" url must include a "{range}" token'))),s}function er(r,e=ve){let i=[];return i=i.concat(ra({key:"",value:r,valueSpec:e.$root,styleSpec:e,style:r,validateSpec:ra,objectElementValidators:{glyphs:eu,"*":()=>[]}})),r.constants&&(i=i.concat(Wc({key:"constants",value:r.constants}))),tu(i)}function ur(r){return function(e){return r(Object.assign({},e,{validateSpec:ra}))}}function tu(r){return[].concat(r).sort(((e,i)=>e.line-i.line))}function hr(r){return function(...e){return tu(r.apply(this,e))}}er.source=hr(ur(Ks)),er.sprite=hr(ur(Js)),er.glyphs=hr(ur(eu)),er.light=hr(ur(Qc)),er.sky=hr(ur(Cl)),er.terrain=hr(ur(Al)),er.state=hr(ur(kl)),er.layer=hr(ur(Jc)),er.filter=hr(ur(Ml)),er.paintProperty=hr(ur(Yc)),er.layoutProperty=hr(ur(Kc));const Qs={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"};class eo{constructor(e,i){this._globalState=i,this.setValue(e)}evaluate(){var e;return(e=this._literalValue)!==null&&e!==void 0?e:this._compiledValue.evaluate({})}setValue(e){if(e==null||e==="visible"||e==="none")return this._literalValue=e==="none"?"none":"visible",this._compiledValue=void 0,void(this._globalStateRefs=new Set);const i=Zs(e,Qs,this._globalState);if(i.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,new Error(i.value.map((s=>`${s.key}: ${s.message}`)).join(", "));this._literalValue=void 0,this._compiledValue=i.value,this._globalStateRefs=us(i.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}}const $i=ve,wr=er,iu=wr.light,vh=wr.sky,xh=wr.paintProperty,to=wr.layoutProperty;function zl(r,e){let i=!1;if(e&&e.length)for(const s of e)r.fire(new Hn(new Error(s.message))),i=!0;return i}class In{constructor(e,i,s){const o=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const h=new Int32Array(this.arrayBuffer);e=h[0],this.d=(i=h[1])+2*(s=h[2]);for(let g=0;g<this.d*this.d;g++){const m=h[3+g],v=h[3+g+1];o.push(m===v?null:h.subarray(m,v))}const d=h[3+o.length+1];this.keys=h.subarray(h[3+o.length],d),this.bboxes=h.subarray(d),this.insert=this._insertReadonly}else{this.d=i+2*s;for(let h=0;h<this.d*this.d;h++)o.push([]);this.keys=[],this.bboxes=[]}this.n=i,this.extent=e,this.padding=s,this.scale=i/e,this.uid=0;const l=s/i*e;this.min=-l,this.max=e+l}
vendor: 15,266 bytes, line 2
2insert(e,i,s,o,l){this._forEachCell(i,s,o,l,this._insertCell,this.uid++,void 0,void 0),this.keys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(o),this.bboxes.push(l)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(e,i,s,o,l,h){this.cells[l].push(h)}query(e,i,s,o,l){const h=this.min,d=this.max;if(e<=h&&i<=h&&d<=s&&d<=o&&!l)return[...this.keys];{const g=[];return this._forEachCell(e,i,s,o,this._queryCell,g,{},l),g}}_queryCell(e,i,s,o,l,h,d,g){const m=this.cells[l];if(m!==null){const v=this.keys,_=this.bboxes;for(let T=0;T<m.length;T++){const x=m[T];if(d[x]===void 0){const I=4*x;(g?g(_[I+0],_[I+1],_[I+2],_[I+3]):e<=_[I+2]&&i<=_[I+3]&&s>=_[I+0]&&o>=_[I+1])?(d[x]=!0,h.push(v[x])):d[x]=!1}}}}_forEachCell(e,i,s,o,l,h,d,g){const m=this._convertToCellCoord(e),v=this._convertToCellCoord(i),_=this._convertToCellCoord(s),T=this._convertToCellCoord(o);for(let x=m;x<=_;x++)for(let I=v;I<=T;I++){const M=this.d*I+x;if((!g||g(this._convertFromCellCoord(x),this._convertFromCellCoord(I),this._convertFromCellCoord(x+1),this._convertFromCellCoord(I+1)))&&l.call(this,e,i,s,o,M,h,d,g))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;const e=this.cells,i=3+this.cells.length+1+1;let s=0;for(let h=0;h<this.cells.length;h++)s+=this.cells[h].length;const o=new Int32Array(i+s+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;let l=i;for(let h=0;h<e.length;h++){const d=e[h];o[3+h]=l,o.set(d,l),l+=d.length}return o[3+e.length]=l,o.set(this.keys,l),l+=this.keys.length,o[3+e.length+1]=l,o.set(this.bboxes,l),l+=this.bboxes.length,o.buffer}static serialize(e,i){const s=e.toArrayBuffer();return i&&i.push(s),{buffer:s}}static deserialize(e){return new In(e.buffer)}}const zr={};function Re(r,e,i={}){if(zr[r])throw new Error(`${r} is already registered.`);Object.defineProperty(e,"_classRegistryKey",{value:r,writeable:!1}),zr[r]={klass:e,omit:i.omit||[],shallow:i.shallow||[]}}Re("Object",Object),Re("Set",Set),Re("TransferableGridIndex",In),Re("Color",rt),Re("Error",Error),Re("AJAXError",Zn),Re("ResolvedImage",yi),Re("StylePropertyFunction",Qo),Re("StyleExpression",qs,{omit:["_evaluator"]}),Re("ZoomDependentExpression",Jo),Re("ZoomConstantExpression",Ko),Re("CompoundExpression",Qi,{omit:["_evaluate"]});for(const r in as)as[r]._classRegistryKey||Re(`Expression_${r}`,as[r]);function ru(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Mn(r){return r.$name||r.constructor._classRegistryKey}function nu(r){return!(function(e){if(e===null||typeof e!="object")return!1;const i=Mn(e);return!(!i||i==="Object")})(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||ru(r)||Oi(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function io(r,e){if(nu(r))return(ru(r)||Oi(r))&&e&&e.push(r),ArrayBuffer.isView(r)&&e&&e.push(r.buffer),r instanceof ImageData&&e&&e.push(r.data.buffer),r;if(Array.isArray(r)){const l=[];for(const h of r)l.push(io(h,e));return l}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const i=Mn(r);if(!i)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!zr[i])throw new Error(`${i} is not registered.`);const{klass:s}=zr[i],o=s.serialize?s.serialize(r,e):{};if(s.serialize){if(e&&o===e[e.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const l in r){if(!r.hasOwnProperty(l)||zr[i].omit.indexOf(l)>=0)continue;const h=r[l];o[l]=zr[i].shallow.indexOf(l)>=0?h:io(h,e)}r instanceof Error&&(o.message=r.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return i!=="Object"&&(o.$name=i),o}function ro(r){if(nu(r))return r;if(Array.isArray(r))return r.map(ro);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const e=Mn(r)||"Object";if(!zr[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:i}=zr[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(r);const s=Object.create(i.prototype);for(const o of Object.keys(r)){if(o==="$name")continue;const l=r[o];s[o]=zr[e].shallow.indexOf(o)>=0?l:ro(l)}return s}class En{constructor(){this.first=!0}update(e,i){const s=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=s,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=s,!0):(this.lastFloorZoom>s?(this.lastIntegerZoom=s+1,this.lastIntegerZoomTime=i):this.lastFloorZoom<s&&(this.lastIntegerZoom=s,this.lastIntegerZoomTime=i),e!==this.lastZoom&&(this.lastZoom=e,this.lastFloorZoom=s,!0))}}function bh(r){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(r))}function Ll(r){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(r))}function no(r){return/\s/u.test(String.fromCodePoint(r))}function Fl(r){for(const e of r)if(Ll(e.codePointAt(0)))return!0;return!1}function Rl(r){for(const e of r)if(!ou(e.codePointAt(0)))return!1;return!0}function so(r){const e=r.map((i=>{try{return new RegExp(`\\p{sc=${i}}`,"u").source}catch{return null}})).filter((i=>i));return new RegExp(e.join("|"),"u")}const su=so(["Arab","Dupl","Mong","Ougr","Syrc"]);function ou(r){return!su.test(String.fromCodePoint(r))}function Bl(r){return!(Ll(r)||(e=r,/[\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(e))));var e}const au=so(["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"]);function na(r){return au.test(String.fromCodePoint(r))}function lu(r,e){return!(!e&&na(r)||/[\u0900-\u0DFF\u0F00-\u109F\u1780-\u17FF]/gim.test(String.fromCodePoint(r)))}function wh(r){for(const e of r)if(na(e.codePointAt(0)))return!0;return!1}const Lr=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(Lr.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,e){return c(this,void 0,void 0,(function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const i=r.pluginURL,s=new Promise((l=>{this.loadScriptResolve=l}));e(i);const o=new Promise((l=>setTimeout((()=>l()),this.TIMEOUT)));if(yield Promise.race([s,o]),this.isParsed()){const l={pluginStatus:"loaded",pluginURL:i};return this.setState(l),l}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${i}`)}))}};class vt{constructor(e,i){this.isSupportedScript=cu,this.zoom=e,i?(this.now=i.now||0,this.fadeDuration=i.fadeDuration||0,this.zoomHistory=i.zoomHistory||new En,this.transition=i.transition||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new En,this.transition={})}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,i=e-Math.floor(e),s=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:i+(1-i)*s}:{fromScale:.5,toScale:1,t:1-(1-s)*i}}}function cu(r){return(function(e,i){for(const s of e)if(!lu(s.codePointAt(0),i))return!1;return!0})(r,Lr.getRTLTextPluginStatus()==="loaded")}const sa="-transition";class oo{constructor(e,i,s){this.property=e,this.value=i,this.expression=(function(o,l,h){if(Xo(o))return new Qo(o,l);if(Yo(o)){const d=qc(o,l,h);if(d.result==="error")throw new Error(d.value.map((g=>`${g.key}: ${g.message}`)).join(", "));return d.value}{let d=o;return l.type==="color"&&typeof o=="string"?d=rt.parse(o):l.type!=="padding"||typeof o!="number"&&!Array.isArray(o)?l.type!=="numberArray"||typeof o!="number"&&!Array.isArray(o)?l.type!=="colorArray"||typeof o!="string"&&!Array.isArray(o)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(o)?d=_i.parse(o):l.type==="projectionDefinition"&&typeof o=="string"&&(d=vi.parse(o)):d=Lt.parse(o):d=Jt.parse(o):d=Ze.parse(o),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>d}}})(i===void 0?e.specification.default:i,e.specification,s)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(e,i,s){return this.property.possiblyEvaluate(this,e,i,s)}}class oa{constructor(e,i){this.property=e,this.value=new oo(e,void 0,i)}transitioned(e,i){return new hu(this.property,this.value,i,Bi({},e.transition,this.transition),e.now)}untransitioned(){return new hu(this.property,this.value,null,{},0)}}class uu{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._globalState=i}hasProperty(e){return e in this._properties.defaultTransitionablePropertyValues}getValue(e){return mt(this._values[e].value.value)}setValue(e,i){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new oa(this._values[e].property,this._globalState)),this._values[e].value=new oo(this._values[e].property,i===null?void 0:mt(i),this._globalState)}getTransition(e){return mt(this._values[e].transition)}setTransition(e,i){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new oa(this._values[e].property,this._globalState)),this._values[e].transition=mt(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s);const o=this.getTransition(i);o!==void 0&&(e[`${i}${sa}`]=o)}return e}transitioned(e,i){const s=new Ol(this._properties);for(const o of Object.keys(this._values))s._values[o]=this._values[o].transitioned(e,i._values[o]);return s}untransitioned(){const e=new Ol(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class hu{constructor(e,i,s,o,l){this.property=e,this.value=i,this.begin=l+o.delay||0,this.end=this.begin+o.duration||0,e.specification.transition&&(o.delay||o.duration)&&(this.prior=s)}possiblyEvaluate(e,i,s){const o=e.now||0,l=this.value.possiblyEvaluate(e,i,s),h=this.prior;if(h){if(o>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(o<this.begin)return h.possiblyEvaluate(e,i,s);{const d=(o-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,s),l,or(d))}}return l}}class Ol{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,s){const o=new ao(this._properties);for(const l of Object.keys(this._values))o._values[l]=this._values[l].possiblyEvaluate(e,i,s);return o}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class du{constructor(e,i){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._globalState=i}hasValue(e){return this._values[e].value!==void 0}hasProperty(e){return e in this._properties.defaultPropertyValues}getValue(e){return mt(this._values[e].value)}setValue(e,i){this._values[e]=new oo(this._values[e].property,i===null?void 0:mt(i),this._globalState)}serialize(){const e={};for(const i of Object.keys(this._values)){const s=this.getValue(i);s!==void 0&&(e[i]=s)}return e}possiblyEvaluate(e,i,s){const o=new ao(this._properties);for(const l of Object.keys(this._values))o._values[l]=this._values[l].possiblyEvaluate(e,i,s);return o}}class dr{constructor(e,i,s){this.property=e,this.value=i,this.parameters=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,s,o){return this.property.evaluate(this.value,this.parameters,e,i,s,o)}}class ao{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ve{constructor(e){this.specification=e}
2possiblyEvaluate(e,i){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(i)}interpolate(e,i,s){const o=Ni[this.specification.type];return o?o(e,i,s):e}}class $e{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,s,o){return new dr(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},s,o)}:e.expression,i)}interpolate(e,i,s){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new dr(this,{kind:"constant",value:void 0},e.parameters);const o=Ni[this.specification.type];if(o){const l=o(e.value.value,i.value.value,s);return new dr(this,{kind:"constant",value:l},e.parameters)}return e}evaluate(e,i,s,o,l,h){return e.kind==="constant"?e.value:e.evaluate(i,s,o,l,h)}}class Cn extends $e{possiblyEvaluate(e,i,s,o){if(e.value===void 0)return new dr(this,{kind:"constant",value:void 0},i);if(e.expression.kind==="constant"){const l=e.expression.evaluate(i,null,{},s,o),h=e.property.specification.type==="resolvedImage"&&typeof l!="string"?l.name:l,d=this._calculate(h,h,h,i);return new dr(this,{kind:"constant",value:d},i)}if(e.expression.kind==="camera"){const l=this._calculate(e.expression.evaluate({zoom:i.zoom-1}),e.expression.evaluate({zoom:i.zoom}),e.expression.evaluate({zoom:i.zoom+1}),i);return new dr(this,{kind:"constant",value:l},i)}return new dr(this,e.expression,i)}evaluate(e,i,s,o,l,h){if(e.kind==="source"){const d=e.evaluate(i,s,o,l,h);return this._calculate(d,d,d,i)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(i.zoom)-1},s,o),e.evaluate({zoom:Math.floor(i.zoom)},s,o),e.evaluate({zoom:Math.floor(i.zoom)+1},s,o),i):e.value}_calculate(e,i,s,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:s,to:i}}interpolate(e){return e}}class pu{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,o){if(e.value!==void 0){if(e.expression.kind==="constant"){const l=e.expression.evaluate(i,null,{},s,o);return this._calculate(l,l,l,i)}return this._calculate(e.expression.evaluate(new vt(Math.floor(i.zoom-1),i)),e.expression.evaluate(new vt(Math.floor(i.zoom),i)),e.expression.evaluate(new vt(Math.floor(i.zoom+1),i)),i)}}_calculate(e,i,s,o){return o.zoom>o.zoomHistory.lastIntegerZoom?{from:e,to:i}:{from:s,to:i}}interpolate(e){return e}}class aa{constructor(e){this.specification=e}possiblyEvaluate(e,i,s,o){return!!e.expression.evaluate(i,null,{},s,o)}interpolate(){return!1}}class xi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const i in e){const s=e[i];s.specification.overridable&&this.overridableProperties.push(i);const o=this.defaultPropertyValues[i]=new oo(s,void 0,void 0),l=this.defaultTransitionablePropertyValues[i]=new oa(s,void 0);this.defaultTransitioningPropertyValues[i]=l.untransitioned(),this.defaultPossiblyEvaluatedValues[i]=o.possiblyEvaluate({})}}}Re("DataDrivenProperty",$e),Re("DataConstantProperty",Ve),Re("CrossFadedDataDrivenProperty",Cn),Re("CrossFadedProperty",pu),Re("ColorRampProperty",aa);const Vl=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",la=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?";class pr extends Mo{constructor(e,i,s){if(super(),this.id=e.id,this.type=e.type,this._globalState=s,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=(function(o,l){return new eo(o,l)})(this.visibility,s),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=Ws(e.filter,s)),i.layout&&(this._unevaluatedLayout=new du(i.layout,s)),i.paint)){this._transitionablePaint=new uu(i.paint,s);for(const o in e.paint)this.setPaintProperty(o,e.paint[o],{validate:!1});for(const o in e.layout)this.setLayoutProperty(o,e.layout[o],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ao(i.paint)}}setFilter(e){this.filter=e,this._featureFilter=Ws(e,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){var i;if(e==="visibility")return this.visibility;if(!((i=this._transitionablePaint)===null||i===void 0)&&i.hasProperty(e))throw new Error(e+Vl);if(!this._unevaluatedLayout)throw new Error(`Cannot get layout property "${e}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(e)}getLayoutAffectingGlobalStateRefs(){const e=new Set;for(const i of this._visibilityExpression.getGlobalStateRefs())e.add(i);if(this._unevaluatedLayout)for(const i in this._unevaluatedLayout._values){const s=this._unevaluatedLayout._values[i];for(const o of s.getGlobalStateRefs())e.add(o)}for(const i of this._featureFilter.getGlobalStateRefs())e.add(i);return e}getPaintAffectingGlobalStateRefs(){var e;const i=new globalThis.Map;if(this._transitionablePaint)for(const s in this._transitionablePaint._values){const o=this._transitionablePaint._values[s].value;for(const l of o.getGlobalStateRefs()){const h=(e=i.get(l))!==null&&e!==void 0?e:[];h.push({name:s,value:o.value}),i.set(l,h)}}return i}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(e,i,s={}){var o;if(e==="visibility")return this.visibility=i,this._visibilityExpression.setValue(i),void this.recalculateVisibility();!((o=this._transitionablePaint)===null||o===void 0)&&o.hasProperty(e)?this.fire(new Hn(new Error(e+Vl))):i!=null&&this._val
2idate(to,`layers.${this.id}.layout.${e}`,e,i,s)||this._unevaluatedLayout.setValue(e,i)}getPaintProperty(e){var i,s;if(e.endsWith(sa)){const o=e.slice(0,-11);if(o==="visibility"||!((i=this._unevaluatedLayout)===null||i===void 0)&&i.hasProperty(o))throw new Error(e+la);return this._transitionablePaint.getTransition(o)}if(e==="visibility"||!((s=this._unevaluatedLayout)===null||s===void 0)&&s.hasProperty(e))throw new Error(e+la);return this._transitionablePaint.getValue(e)}setPaintProperty(e,i,s={}){var o;if(e==="visibility"||!((o=this._unevaluatedLayout)===null||o===void 0)&&o.hasProperty(e))return this.fire(new Hn(new Error(e+la))),!1;if(i!=null&&this._validate(xh,`layers.${this.id}.paint.${e}`,e,i,s))return!1;if(e.endsWith(sa))return this._transitionablePaint.setTransition(e.slice(0,-11),i||void 0),!1;{const l=this._transitionablePaint._values[e],h=l.property.specification["property-type"]==="cross-faded-data-driven",d=l.value.isDataDriven(),g=l.value;this._transitionablePaint.setValue(e,i),this._handleSpecialPaintPropertyUpdate(e);const m=this._transitionablePaint._values[e].value;return m.isDataDriven()||d||h||this._handleOverridablePaintPropertyUpdate(e,g,m)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,i,s){return!1}isHidden(e=this.minzoom,i=!1){return!!(this.minzoom&&e<(i?Math.floor(this.minzoom):this.minzoom))||!!(this.maxzoom&&e>=this.maxzoom)||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,i){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){var e,i;
vendor: 47,720 bytes, line 2
2const s={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:(e=this._unevaluatedLayout)===null||e===void 0?void 0:e.serialize(),paint:(i=this._transitionablePaint)===null||i===void 0?void 0:i.serialize()};return this.visibility&&(s.layout=s.layout||{},s.layout.visibility=this.visibility),Gn(s,((o,l)=>!(o===void 0||l==="layout"&&!Object.keys(o).length||l==="paint"&&!Object.keys(o).length)))}_validate(e,i,s,o,l={}){return l?.validate!==!1&&zl(this,e.call(wr,{key:i,layerType:this.type,objectKey:s,value:o,styleSpec:ve,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof dr&&cs(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}}let fu;var Th={get paint(){return fu=fu||new xi({"raster-opacity":new Ve(ve.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ve(ve.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ve(ve.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ve(ve.paint_raster["raster-brightness-max"]),"raster-saturation":new Ve(ve.paint_raster["raster-saturation"]),"raster-contrast":new Ve(ve.paint_raster["raster-contrast"]),resampling:new Ve(ve.paint_raster.resampling),"raster-resampling":new Ve(ve.paint_raster["raster-resampling"]),"raster-fade-duration":new Ve(ve.paint_raster["raster-fade-duration"])})}};class Sh extends pr{constructor(e,i){super(e,Th,i)}}const Ph={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Tr{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Bt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}}function Zt(r,e=1){let i=0,s=0;return{members:r.map((o=>{const l=Ph[o.type].BYTES_PER_ELEMENT,h=i=mu(i,Math.max(e,l)),d=o.components||1;return s=Math.max(s,l),i+=l*d,{name:o.name,type:o.type,components:d,offset:h}})),size:mu(i,Math.max(s,e)),alignment:e}}function mu(r,e){return Math.ceil(r/e)*e}class fs extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const o=2*e;return this.int16[o+0]=i,this.int16[o+1]=s,e}}fs.prototype.bytesPerElement=4,Re("StructArrayLayout2i4",fs);class lo extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=3*e;return this.int16[l+0]=i,this.int16[l+1]=s,this.int16[l+2]=o,e}}lo.prototype.bytesPerElement=6,Re("StructArrayLayout3i6",lo);class jl extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s,o)}emplace(e,i,s,o,l){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=s,this.int16[h+2]=o,this.int16[h+3]=l,e}}jl.prototype.bytesPerElement=8,Re("StructArrayLayout4i8",jl);class Nl extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,s,o,l,h)}emplace(e,i,s,o,l,h,d){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=o,this.int16[g+3]=l,this.int16[g+4]=h,this.int16[g+5]=d,e}}Nl.prototype.bytesPerElement=12,Re("StructArrayLayout2i4i12",Nl);class Fr extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,s,o,l,h)}emplace(e,i,s,o,l,h,d){const g=4*e,m=8*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.uint8[m+4]=o,this.uint8[m+5]=l,this.uint8[m+6]=h,this.uint8[m+7]=d,e}}Fr.prototype.bytesPerElement=8,Re("StructArrayLayout2i4ub8",Fr);class ms extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const o=2*e;return this.float32[o+0]=i,this.float32[o+1]=s,e}}ms.prototype.bytesPerElement=8,Re("StructArrayLayout2f8",ms);class co extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,h,d,g,m,v){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,s,o,l,h,d,g,m,v)}emplace(e,i,s,o,l,h,d,g,m,v,_){const T=10*e;return this.uint16[T+0]=i,this.uint16[T+1]=s,this.uint16[T+2]=o,this.uint16[T+3]=l,this.uint16[T+4]=h,this.uint16[T+5]=d,this.uint16[T+6]=g,this.uint16[T+7]=m,this.uint16[T+8]=v,this.uint16[T+9]=_,e}}co.prototype.bytesPerElement=20,Re("StructArrayLayout10ui20",co);class ca extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,h,d,g){const m=this.length;return this.resize(m+1),this.emplace(m,e,i,s,o,l,h,d,g)}emplace(e,i,s,o,l,h,d,g,m){const v=8*e;return this.uint16[v+0]=i,this.uint16[v+1]=s,this.uint16[v+2]=o,this.uint16[v+3]=l,this.uint16[v+4]=h,this.uint16[v+5]=d,this.uint16[v+6]=g,this.uint16[v+7]=m,e}}ca.prototype.bytesPerElement=16,Re("StructArrayLayout8ui16",ca);class uo extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,h,d,g,m,v,_,T){const x=this.length;return this.resize(x+1),this.emplace(x,e,i,s,o,l,h,d,g,m,v,_,T)}emplace(e,i,s,o,l,h,d,g,m,v,_,T,x){const I=12*e;return this.int16[I+0]=i,this.int16[I+1]=s,this.int16[I+2]=o,this.int16[I+3]=l,this.uint16[I+4]=h,this.uint16[I+5]=d,this.uint16[I+6]=g,this.uint16[I+7]=m,this.int16[I+8]=v,this.int16[I+9]=_,this.int16[I+10]=T,this.int16[I+11]=x,e}}uo.prototype.bytesPerElement=24,Re("StructArrayLayout4i4ui4i24",uo);class Ul extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=3*e;return this.float32[l+0]=i,this.float32[l+1]=s,this.float32[l+2]=o,e}}Ul.prototype.bytesPerElement=12,Re("StructArrayLayout3f12",Ul);class gs extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}gs.prototype.bytesPerElement=4,Re("StructArrayLayout1ul4",gs);class An extends Bt{_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,i,s,o,l,h,d,g,m){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,s,o,l,h,d,g,m)}emplace(e,i,s,o,l,h,d,g,m,v){const _=10*e,T=5*e;return this.int16[_+0]=i,this.int16[_+1]=s,this.int16[_+2]=o,this.int16[_+3]=l,this.int16[_+4]=h,this.int16[_+5]=d,this.uint32[T+3]=g,this.uint16[_+8]=m,this.uint16[_+9]=v,e}}An.prototype.bytesPerElement=20,Re("StructArrayLayout6i1ul2ui20",An);class $l extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,s,o,l,h)}emplace(e,i,s,o,l,h,d){const g=6*e;return this.int16[g+0]=i,this.int16[g+1]=s,this.int16[g+2]=o,this.int16[g+3]=l,this.int16[g+4]=h,this.int16[g+5]=d,e}}$l.prototype.bytesPerElement=12,Re("StructArrayLayout2i2i2i12",$l);class ua extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,s,o,l)}emplace(e,i,s,o,l,h){const d=4*e,g=8*e;return this.float32[d+0]=i,this.float32[d+1]=s,this.float32[d+2]=o,this.int16[g+6]=l,this.int16[g+7]=h,e}}ua.prototype.bytesPerElement=16,Re("StructArrayLayout2f1f2i16",ua);class Dn extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,s,o,l,h){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,s,o,l,h)}emplace(e,i,s,o,l,h,d){const g=16*e,m=4*e,v=8*e;return this.uint8[g+0]=i,this.uint8[g+1]=s,this.float32[m+1]=o,this.float32[m+2]=l,this.int16[v+6]=h,this.int16[v+7]=d,e}}Dn.prototype.bytesPerElement=16,Re("StructArrayLayout2ub2f2i16",Dn);class ha extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=3*e;return this.uint16[l+0]=i,this.uint16[l+1]=s,this.uint16[l+2]=o,e}}ha.prototype.bytesPerElement=6,Re("StructArrayLayout3ui6",ha);class Gl extends Bt{_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,i,s,o,l,h,d,g,m,v,_,T,x,I,M,D,k){const O=this.length;return this.resize(O+1),this.emplace(O,e,i,s,o,l,h,d,g,m,v,_,T,x,I,M,D,k)}emplace(e,i,s,o,l,h,d,g,m,v,_,T,x,I,M,D,k,O){const B=24*e,N=12*e,$=48*e;return this.int16[B+0]=i,this.int16[B+1]=s,this.uint16[B+2]=o,this.uint16[B+3]=l,this.uint32[N+2]=h,this.uint32[N+3]=d,this.uint32[N+4]=g,this.uint16[B+10]=m,this.uint16[B+11]=v,this.uint16[B+12]=_,this.float32[N+7]=T,this.float32[N+8]=x,this.uint8[$+36]=I,this.uint8[$+37]=M,this.uint8[$+38]=D,this.uint32[N+10]=k,this.int16[B+22]=O,e}}Gl.prototype.bytesPerElement=48,Re("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Gl);class da extends Bt{_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,i,s,o,l,h,d,g,m,v,_,T,x,I,M,D,k,O,B,N,$,W,ie,ne,ae,ue,ye,ge){const _e=this.length;return this.resize(_e+1),this.emplace(_e,e,i,s,o,l,h,d,g,m,v,_,T,x,I,M,D,k,O,B,N,$,W,ie,ne,ae,ue,ye,ge)}emplace(e,i,s,o,l,h,d,g,m,v,_,T,x,I,M,D,k,O,B,N,$,W,ie,ne,ae,ue,ye,ge,_e){const de=32*e,Ie=16*e;return this.int16[de+0]=i,this.int16[de+1]=s,this.int16[de+2]=o,this.int16[de+3]=l,this.int16[de+4]=h,this.int16[de+5]=d,this.int16[de+6]=g,this.int16[de+7]=m,this.uint16[de+8]=v,this.uint16[de+9]=_,this.uint16[de+10]=T,this.uint16[de+11]=x,this.uint16[de+12]=I,this.uint16[de+13]=M,this.uint16[de+14]=D,this.uint16[de+15]=k,this.uint16[de+16]=O,this.uint16[de+17]=B,this.uint16[de+18]=N,this.uint16[de+19]=$,this.uint16[de+20]=W,this.uint16[de+21]=ie,this.uint16[de+22]=ne,this.uint32[Ie+12]=ae,this.float32[Ie+13]=ue,this.float32[Ie+14]=ye,this.uint16[de+30]=ge,this.uint16[de+31]=_e,e}}da.prototype.bytesPerElement=64,Re("StructArrayLayout8i15ui1ul2f2ui64",da);class pa extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}pa.prototype.bytesPerElement=4,Re("StructArrayLayout1f4",pa);class p extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=3*e;return this.uint16[6*e+0]=i,this.float32[l+1]=s,this.float32[l+2]=o,e}}p.prototype.bytesPerElement=12,Re("StructArrayLayout1ui2f12",p);class t extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,s)}emplace(e,i,s,o){const l=4*e;return this.uint32[2*e+0]=i,this.uint16[l+2]=s,this.uint16[l+3]=o,e}}t.prototype.bytesPerElement=8,Re("StructArrayLayout1ul2ui8",t);class n extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,i)}emplace(e,i,s){const o=2*e;return this.uint16[o+0]=i,this.uint16[o+1]=s,e}}n.prototype.bytesPerElement=4,Re("StructArrayLayout2ui4",n);class a extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}a.prototype.bytesPerElement=2,Re("StructArrayLayout1ui2",a);class u extends Bt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,s,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,s,o)}emplace(e,i,s,o,l){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=s,this.float32[h+2]=o,this.float32[h+3]=l,e}}u.prototype.bytesPerElement=16,Re("StructArrayLayout4f16",u);class f extends Tr{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 H(this.anchorPointX,this.anchorPointY)}}f.prototype.size=20;class y extends An{get(e){return new f(this,e)}}Re("CollisionBoxArray",y);class b extends Tr{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]}}b.prototype.size=48;class w extends Gl{get(e){return new b(this,e)}}Re("PlacedSymbolArray",w);class S extends Tr{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]}}S.prototype.size=64;class P extends da{get(e){return new S(this,e)}}Re("SymbolInstanceArray",P);class C extends pa{getoffsetX(e){return this.float32[1*e+0]}}Re("GlyphOffsetArray",C);class A extends lo{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Re("SymbolLineVertexArray",A);class F extends Tr{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]}}F.prototype.size=12;class V extends p{get(e){return new F(this,e)}}Re("TextAnchorOffsetArray",V);class U extends Tr{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]}}U.prototype.size=8;class q extends t{get(e){return new U(this,e)}}Re("FeatureIndexArray",q);class G extends fs{}class Y extends fs{}class ee extends fs{}class X extends Nl{}class Q extends Fr{}class te extends ms{}class K extends co{}class se extends ca{}class me extends uo{}class pe extends Ul{}class ce extends gs{}class fe extends $l{}class Te extends Dn{}class Se extends ha{}class we extends n{}const{members:Oe}=Zt([{name:"a_pos",components:2,type:"Int16"}],4);class je{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,i,s,o){const l=this.segments[this.segments.length-1];return e>je.MAX_VERTEX_ARRAY_LENGTH&&et(`Max vertices per segment is ${je.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${je.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!l||l.vertexLength+e>je.MAX_VERTEX_ARRAY_LENGTH||l.sortKey!==o?this.createNewSegment(i,s,o):l}createNewSegment(e,i,s){const o={vertexOffset:e.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0,vaos:{}};return s!==void 0&&(o.sortKey=s),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(o),o}getOrCreateLatestSegment(e,i,s){return this.prepareSegment(0,e,i,s)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,s,o){return new je([{vertexOffset:e,primitiveOffset:i,vertexLength:s,primitiveLength:o,vaos:{},sortKey:0}])}}function ft(r,e){return 256*(r=Ri(Math.floor(r),0,255))+Ri(Math.floor(e),0,255)}je.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Re("SegmentVector",je);const Mt=Zt([{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"}]),St=Zt([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]);var At,xt,Qt,bt={exports:{}},ai={exports:{}},Wt={exports:{}},Ht=he((function(){if(Qt)return bt.exports;Qt=1;var r=(At||(At=1,ai.exports=function(i,s){var o,l,h,d,g,m,v,_;for(l=i.length-(o=3&i.length),h=s,g=3432918353,m=461845907,_=0;_<l;)v=255&i.charCodeAt(_)|(255&i.charCodeAt(++_))<<8|(255&i.charCodeAt(++_))<<16|(255&i.charCodeAt(++_))<<24,++_,h=27492+(65535&(d=5*(65535&(h=(h^=v=(65535&(v=(v=(65535&v)*g+(((v>>>16)*g&65535)<<16)&4294967295)<<15|v>>>17))*m+(((v>>>16)*m&65535)<<16)&4294967295)<<13|h>>>19))+((5*(h>>>16)&65535)<<16)&4294967295))+((58964+(d>>>16)&65535)<<16);switch(v=0,o){case 3:v^=(255&i.charCodeAt(_+2))<<16;case 2:v^=(255&i.charCodeAt(_+1))<<8;case 1:h^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(_)))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<15|v>>>17))*m+(((v>>>16)*m&65535)<<16)&4294967295}return h^=i.length,h=2246822507*(65535&(h^=h>>>16))+((2246822507*(h>>>16)&65535)<<16)&4294967295,h=3266489909*(65535&(h^=h>>>13))+((3266489909*(h>>>16)&65535)<<16)&4294967295,(h^=h>>>16)>>>0}),ai.exports),e=(xt||(xt=1,Wt.exports=function(i,s){for(var o,l=i.length,h=s^l,d=0;l>=4;)o=1540483477*(65535&(o=255&i.charCodeAt(d)|(255&i.charCodeAt(++d))<<8|(255&i.charCodeAt(++d))<<16|(255&i.charCodeAt(++d))<<24))+((1540483477*(o>>>16)&65535)<<16),h=1540483477*(65535&h)+((1540483477*(h>>>16)&65535)<<16)^(o=1540483477*(65535&(o^=o>>>24))+((1540483477*(o>>>16)&65535)<<16)),l-=4,++d;switch(l){case 3:h^=(255&i.charCodeAt(d+2))<<16;case 2:h^=(255&i.charCodeAt(d+1))<<8;case 1:h=1540483477*(65535&(h^=255&i.charCodeAt(d)))+((1540483477*(h>>>16)&65535)<<16)}return h=1540483477*(65535&(h^=h>>>13))+((1540483477*(h>>>16)&65535)<<16),(h^=h>>>15)>>>0}),Wt.exports);return bt.exports=r,bt.exports.murmur3=r,bt.exports.murmur2=e,bt.exports})());class fi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,i,s,o){this.ids.push(Yr(e)),this.positions.push(i,s,o)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const i=Yr(e);let s=0,o=this.ids.length-1;for(;s<o;){const h=s+o>>1;this.ids[h]>=i?o=h:s=h+1}const l=[];for(;this.ids[s]===i;)l.push({index:this.positions[3*s],start:this.positions[3*s+1],end:this.positions[3*s+2]}),s++;return l}static serialize(e,i){const s=new Float64Array(e.ids),o=new Uint32Array(e.positions);return Rr(s,o,0,s.length-1),i&&i.push(s.buffer,o.buffer),{ids:s,positions:o}}static deserialize(e){const i=new fi;return i.ids=e.ids,i.positions=e.positions,i.indexed=!0,i}}function Yr(r){const e=+r;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Ht(String(r))}function Rr(r,e,i,s){for(;i<s;){const o=r[i+s>>1];let l=i-1,h=s+1;for(;;){do l++;while(r[l]<o);do h--;while(r[h]>o);if(l>=h)break;Sr(r,l,h),Sr(e,3*l,3*h),Sr(e,3*l+1,3*h+1),Sr(e,3*l+2,3*h+2)}h-i<s-h?(Rr(r,e,i,h),i=h+1):(Rr(r,e,h+1,s),s=h)}}function Sr(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}Re("FeaturePositionMap",fi);class zi{constructor(e,i){this.gl=e.gl,this.location=i}}class kn extends zi{constructor(e,i){super(e,i),this.current=0}set(e){this.current!==e&&(this.current=e,this.gl.uniform1f(this.location,e))}}class ho extends zi{constructor(e,i){super(e,i),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]))}}class zn extends zi{constructor(e,i){super(e,i),this.current=rt.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))}}const tr=new Float32Array(16);function Pr(r){return[ft(255*r.r,255*r.g),ft(255*r.b,255*r.a)]}class fr{constructor(e,i,s){this.value=e,this.uniformNames=i.map((o=>`u_${o}`)),this.type=s}setUniform(e,i,s){e.set(s.constantOr(this.value))}getBinding(e,i,s){return this.type==="color"?new zn(e,i):new kn(e,i)}}class mr{constructor(e,i){this.uniformNames=i.map((s=>`u_${s}`)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,i){this.pixelRatioFrom=i.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=i.tlbr,this.patternTo=e.tlbr}setConstantDashPositions(e,i){this.dashTo=[0,e.y,e.height,e.width],this.dashFrom=[0,i.y,i.height,i.width]}setUniform(e,i,s,o){let l=null;o==="u_pattern_to"?l=this.patternTo:o==="u_pattern_from"?l=this.patternFrom:o==="u_dasharray_to"?l=this.dashTo:o==="u_dasharray_from"?l=this.dashFrom:o==="u_pixel_ratio_to"?l=this.pixelRatioTo:o==="u_pixel_ratio_from"&&(l=this.pixelRatioFrom),l!==null&&e.set(l)}getBinding(e,i,s){return s.startsWith("u_pattern")||s.startsWith("u_dasharray_")?new ho(e,i):new kn(e,i)}}class Pt{constructor(e,i,s,o){this.expression=e,this.type=s,this.maxValue=0,this.paintVertexAttributes=i.map((l=>({name:`a_${l}`,type:"Float32",components:s==="color"?2:1,offset:0}))),this.paintVertexArray=new o}populatePaintArray(e,i,s){const o=this.paintVertexArray.length,l=this.expression.evaluate(new vt(0,s),i,{},s.canonical,[],s.formattedSection);this.paintVertexArray.resize(e),this._setPaintValue(o,e,l)}updatePaintArray(e,i,s,o,l){const h=this.expression.evaluate(new vt(0,l),s,o);this._setPaintValue(e,i,h)}_setPaintValue(e,i,s){if(this.type==="color"){const o=Pr(s);for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,o[0],o[1])}else{for(let o=e;o<i;o++)this.paintVertexArray.emplace(o,s);this.maxValue=Math.max(this.maxValue,Math.abs(s))}}upload(e){var i;!((i=this.paintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(this.paintVertexBuffer&&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()}}class wt{constructor(e,i,s,o,l,h){this.expression=e,this.uniformNames=i.map((d=>`u_${d}_t`)),this.type=s,this.useIntegerZoom=o,this.zoom=l,this.maxValue=0,this.paintVertexAttributes=i.map((d=>({name:`a_${d}`,type:"Float32",components:s==="color"?4:2,offset:0}))),this.paintVertexArray=new h}populatePaintArray(e,i,s){const o=this.expression.evaluate(new vt(this.zoom,s),i,{},s.canonical,[],s.formattedSection),l=this.expression.evaluate(new vt(this.zoom+1,s),i,{},s.canonical,[],s.formattedSection),h=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(h,e,o,l)}updatePaintArray(e,i,s,o,l){const h=this.expression.evaluate(new vt(this.zoom,l),s,o),d=this.expression.evaluate(new vt(this.zoom+1,l),s,o);this._setPaintValue(e,i,h,d)}_setPaintValue(e,i,s,o){if(this.type==="color"){const l=Pr(s),h=Pr(o);for(let d=e;d<i;d++)this.paintVertexArray.emplace(d,l[0],l[1],h[0],h[1])}else{for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,s,o);this.maxValue=Math.max(this.maxValue,Math.abs(s),Math.abs(o))}}upload(e){var i;!((i=this.paintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(this.paintVertexBuffer&&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,i){const s=this.useIntegerZoom?Math.floor(i.zoom):i.zoom,o=Ri(this.expression.interpolationFactor(s,this.zoom,this.zoom+1),0,1);e.set(o)}getBinding(e,i,s){return new kn(e,i)}}class ri{constructor(e,i,s,o,l,h){this.expression=e,this.type=i,this.useIntegerZoom=s,this.zoom=o,this.layerId=h,this.zoomInPaintVertexArray=new l,this.zoomOutPaintVertexArray=new l}populatePaintArray(e,i,s){const o=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(e),this.zoomOutPaintVertexArray.resize(e),this._setPaintValues(o,e,this.getPositionIds(i),s)}updatePaintArray(e,i,s,o,l){this._setPaintValues(e,i,this.getPositionIds(s),l)}_setPaintValues(e,i,s,o){const l=this.getPositions(o);if(!l||!s)return;const h=l[s.min],d=l[s.mid],g=l[s.max];if(h&&d&&g)for(let m=e;m<i;m++)this.emplace(this.zoomInPaintVertexArray,m,d,h),this.emplace(this.zoomOutPaintVertexArray,m,d,g)}upload(e){var i,s;if(!((i=this.zoomInPaintVertexArray)===null||i===void 0)&&i.arrayBuffer.byteLength&&(!((s=this.zoomOutPaintVertexArray)===null||s===void 0)&&s.arrayBuffer.byteLength)){const o=this.getVertexAttributes();this.zoomInPaintVertexBuffer=e.createVertexBuffer(this.zoomInPaintVertexArray,o,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=e.createVertexBuffer(this.zoomOutPaintVertexArray,o,this.expression.isStateDependent)}}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class mi extends ri{getPositions(e){return e.imagePositions}getPositionIds(e){return e.patterns&&e.patterns[this.layerId]}getVertexAttributes(){return Mt.members}emplace(e,i,s,o){e.emplace(i,s.tlbr[0],s.tlbr[1],s.tlbr[2],s.tlbr[3],o.tlbr[0],o.tlbr[1],o.tlbr[2],o.tlbr[3],s.pixelRatio,o.pixelRatio)}}class gu extends ri{getPositions(e){return e.dashPositions}getPositionIds(e){return e.dashes&&e.dashes[this.layerId]}getVertexAttributes(){return St.members}emplace(e,i,s,o){e.emplace(i,0,s.y,s.height,s.width,0,o.y,o.height,o.width)}}class _u{constructor(e,i,s){this.binders={},this._buffers=[];const o=[];for(const l in e.paint._values){if(!s(l))continue;const h=e.paint.get(l);if(!(h instanceof dr&&cs(h.property.specification)))continue;const d=Ih(l,e.type),g=h.value,m=h.property.specification.type,v=h.property.useIntegerZoom,_=h.property.specification["property-type"],T=_==="cross-faded"||_==="cross-faded-data-driven";if(g.kind==="constant")this.binders[l]=T?new mr(g.value,d):new fr(g.value,d,m),o.push(`/u_${l}`);else if(g.kind==="source"||T){const x=yu(l,m,"source");this.binders[l]=T?l==="line-dasharray"?new gu(g,m,v,i,x,e.id):new mi(g,m,v,i,x,e.id):new Pt(g,d,m,x),o.push(`/a_${l}`)}else{const x=yu(l,m,"composite");this.binders[l]=new wt(g,d,m,v,i,x),o.push(`/z_${l}`)}}this.cacheKey=o.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof Pt||i instanceof wt?i.maxValue:0}populatePaintArrays(e,i,s){for(const o in this.binders){const l=this.binders[o];(l instanceof Pt||l instanceof wt||l instanceof ri)&&l.populatePaintArray(e,i,s)}}setConstantPatternPositions(e,i){for(const s in this.binders){const o=this.binders[s];o instanceof mr&&o.setConstantPatternPositions(e,i)}}setConstantDashPositions(e,i){for(const s in this.binders){const o=this.binders[s];o instanceof mr&&o.setConstantDashPositions(e,i)}}updatePaintArrays(e,i,s,o,l){let h=!1;for(const d in e){const g=i.getPositions(d);for(const m of g){const v=s.feature(m.index);for(const _ in this.binders){const T=this.binders[_];(T instanceof Pt||T instanceof wt||T instanceof ri)&&T.expression.isStateDependent===!0&&(T.expression=o.paint.get(_).value,T.updatePaintArray(m.start,m.end,v,e[d],l),h=!0)}}}return h}defines(){const e=[];for(const i in this.binders){const s=this.binders[i];(s instanceof fr||s instanceof mr)&&e.push(...s.uniformNames.map((o=>`#define HAS_UNIFORM_${o}`)))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof Pt||s instanceof wt)for(let o=0;o<s.paintVertexAttributes.length;o++)e.push(s.paintVertexAttributes[o].name);else if(s instanceof ri){const o=s.getVertexAttributes();for(const l of o)e.push(l.name)}}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const s=this.binders[i];if(s instanceof fr||s instanceof mr||s instanceof wt)for(const o of s.uniformNames)e.push(o)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e,i){const s=[];for(const o in this.binders){const l=this.binders[o];if(l instanceof fr||l instanceof mr||l instanceof wt){for(const h of l.uniformNames)if(i[h]){const d=l.getBinding(e,i[h],h);s.push({name:h,property:o,binding:d})}}}return s}setUniforms(e,i,s,o){for(const{name:l,property:h,binding:d}of i)this.binders[h].setUniform(d,o,s.get(h),l)}updatePaintBuffers(e){this._buffers=[];for(const i in this.binders){const s=this.binders[i];if(e&&s instanceof ri){const o=e.fromScale===2?s.zoomInPaintVertexBuffer:s.zoomOutPaintVertexBuffer;o&&this._buffers.push(o)}else(s instanceof Pt||s instanceof wt)&&s.paintVertexBuffer&&this._buffers.push(s.paintVertexBuffer)}}upload(e){for(const i in this.binders){const s=this.binders[i];(s instanceof Pt||s instanceof wt||s instanceof ri)&&s.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof Pt||i instanceof wt||i instanceof ri)&&i.destroy()}}}class Ln{constructor(e,i,s=()=>!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new _u(o,i,s);this.needsUpload=!1,this._featureMap=new fi,this._bufferOffset=0}populatePaintArrays(e,i,s,o){for(const l in this.programConfigurations)this.programConfigurations[l].populatePaintArrays(e,i,o);i.id!==void 0&&this._featureMap.add(i.id,s,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,s,o){for(const l of s)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,i,l,o)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function Ih(r,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"]}[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}function yu(r,e,i){const s={color:{source:ms,composite:u},number:{source:pa,composite:ms}},o=(function(l){return{"line-pattern":{source:K,composite:K},"fill-pattern":{source:K,composite:K},"fill-extrusion-pattern":{source:K,composite:K},"line-dasharray":{source:se,composite:se}}[l]})(r);return o&&o[i]||s[e][i]}Re("ConstantBinder",fr),Re("CrossFadedConstantBinder",mr),Re("SourceExpressionBinder",Pt),Re("CrossFadedPatternBinder",mi),Re("CrossFadedDasharrayBinder",gu),Re("CompositeExpressionBinder",wt),Re("ProgramConfiguration",_u,{omit:["_buffers"]}),Re("ProgramConfigurationSet",Ln);const ql=Math.pow(2,14)-1,Kr=-ql-1;function Jr(r){const e=Ge/r.extent,i=r.loadGeometry();for(let s=0;s<i.length;s++){const o=i[s];for(let l=0;l<o.length;l++){const h=o[l],d=Math.round(h.x*e),g=Math.round(h.y*e);h.x=Ri(d,Kr,ql),h.y=Ri(g,Kr,ql),(d<h.x||d>h.x+1||g<h.y||g>h.y+1)&&et("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return i}function Qr(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?Jr(r):[]}}const Zl=-32768;function Wl(r,e,i,s,o){r.emplaceBack(Zl+8*e+s,Zl+8*i+o)}class fa{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new Y,this.indexArray=new Se,this.segments=new je,this.programConfigurations=new Ln(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){const o=this.layers[0],l=[];let h=null,d=!1,g=o.type==="heatmap";if(o.type==="circle"){const v=o;h=v.layout.get("circle-sort-key"),d=!h.isConstant(),g=g||v.paint.get("circle-pitch-alignment")==="map"}const m=g?i.subdivisionGranularity.circle:1;for(const{feature:v,id:_,index:T,sourceLayerIndex:x}of e){const I=this.layers[0]._featureFilter.needGeometry,M=Qr(v,I);if(!this.layers[0]._featureFilter.filter(new vt(this.zoom),M,s))continue;const D=d?h.evaluate(M,{},s):void 0,k={id:_,properties:v.properties,type:v.type,sourceLayerIndex:x,index:T,geometry:I?M.geometry:Jr(v),patterns:{},sortKey:D};l.push(k)}d&&l.sort(((v,_)=>v.sortKey-_.sortKey));for(const v of l){const{geometry:_,index:T,sourceLayerIndex:x}=v,I=e[T].feature;this.addFeature(v,_,T,s,m),i.featureIndex.insert(I,_,T,x,this.index)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Oe),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,i,s,o,l=1){let h;switch(l){case 1:h=[0,7];break;case 3:h=[0,2,5,7];break;case 5:h=[0,1,3,4,6,7];break;case 7:h=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${l}; valid values are 1, 3, 5, 7.`)}const d=h.length;for(const g of i)for(const m of g){const v=m.x,_=m.y;if(v<0||v>=Ge||_<0||_>=Ge)continue;const T=this.segments.prepareSegment(d*d,this.layoutVertexArray,this.indexArray,e.sortKey),x=T.vertexLength;for(let I=0;I<d;I++)for(let M=0;M<d;M++)Wl(this.layoutVertexArray,v,_,h[M],h[I]);for(let I=0;I<d-1;I++)for(let M=0;M<d-1;M++){const D=x+I*d+M,k=x+(I+1)*d+M;this.indexArray.emplaceBack(D,k+1,D+1),this.indexArray.emplaceBack(D,k,k+1)}T.vertexLength+=d*d,T.primitiveLength+=(d-1)*(d-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:{},canonical:o})}}function ma(r,e){for(let i=0;i<r.length;i++)if(ga(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(ga(r,e[i]))return!0;return!!Mh(r,e)}function vu(r,e,i){return!!ga(r,e)||!!Eh(e,r,i)}function cp(r,e){if(r.length===1)return hp(e,r[0]);for(let i=0;i<e.length;i++){const s=e[i];for(let o=0;o<s.length;o++)if(ga(r,s[o]))return!0}for(let i=0;i<r.length;i++)if(hp(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Mh(r,e[i]))return!0;return!1}function Ug(r,e,i){if(r.length>1){if(Mh(r,e))return!0;for(let s=0;s<e.length;s++)if(Eh(e[s],r,i))return!0}for(let s=0;s<r.length;s++)if(Eh(r[s],e,i))return!0;return!1}function Mh(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const s=r[i],o=r[i+1];for(let l=0;l<e.length-1;l++)if($g(s,o,e[l],e[l+1]))return!0}return!1}function $g(r,e,i,s){return Et(r,i,s)!==Et(e,i,s)&&Et(r,e,i)!==Et(r,e,s)}function Eh(r,e,i){const s=i*i;if(e.length===1)return r.distSqr(e[0])<s;for(let o=1;o<e.length;o++)if(up(r,e[o-1],e[o])<s)return!0;return!1}function up(r,e,i){const s=e.distSqr(i);if(s===0)return r.distSqr(e);const o=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/s;return r.distSqr(o<0?e:o>1?i:i.sub(e)._mult(o)._add(e))}function hp(r,e){let i,s,o,l=!1;for(let h=0;h<r.length;h++){i=r[h];for(let d=0,g=i.length-1;d<i.length;g=d++)s=i[d],o=i[g],s.y>e.y!=o.y>e.y&&e.x<(o.x-s.x)*(e.y-s.y)/(o.y-s.y)+s.x&&(l=!l)}return l}function ga(r,e){let i=!1;for(let s=0,o=r.length-1;s<r.length;o=s++){const l=r[s],h=r[o];l.y>e.y!=h.y>e.y&&e.x<(h.x-l.x)*(e.y-l.y)/(h.y-l.y)+l.x&&(i=!i)}return i}function Gg(r,e,i){const s=i[0],o=i[2];if(r.x<s.x&&e.x<s.x||r.x>o.x&&e.x>o.x||r.y<s.y&&e.y<s.y||r.y>o.y&&e.y>o.y)return!1;const l=Et(r,e,i[0]);return l!==Et(r,e,i[1])||l!==Et(r,e,i[2])||l!==Et(r,e,i[3])}function _a(r,e,i){const s=e.paint.get(r).value;return s.kind==="constant"?s.value:i.programConfigurations.get(e.id).getMaxValue(r)}function xu(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function bu(r,e,i,s,o){if(!e[0]&&!e[1])return r;const l=H.convert(e)._mult(o);i==="viewport"&&l._rotate(-s);const h=[];for(let d=0;d<r.length;d++)h.push(r[d].sub(l));return h}function qg(r){const e=[];for(let i=0;i<r.length;i++){const s=r[i],o=e.at(-1);(i===0||o&&!s.equals(o))&&e.push(s)}return e}function Zg({queryGeometry:r,size:e},i){return vu(r,i,e)}function Wg({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o},l){return vu(r,l,e*(i.projectTileCoordinates(l.x,l.y,s,o).signedDistanceFromCamera/i.cameraToCenterDistance))}function Hg({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o},l){const h=i.projectTileCoordinates(l.x,l.y,s,o).signedDistanceFromCamera,d=e*(i.cameraToCenterDistance/h);return vu(r,Ch(l,i,s,o),d)}function Xg({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o},l){return vu(r,Ch(l,i,s,o),e)}function dp({queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o,pitchAlignment:l="map",pitchScale:h="map"},d){const g=l==="map"?h==="map"?Zg:Wg:h==="map"?Hg:Xg,m={queryGeometry:r,size:e,transform:i,unwrappedTileID:s,getElevation:o};for(const v of d)for(const _ of v)if(g(m,_))return!0;return!1}function Ch(r,e,i,s){const o=e.projectTileCoordinates(r.x,r.y,i,s).point;return new H((.5*o.x+.5)*e.width,(.5*-o.y+.5)*e.height)}let pp,fp;Re("CircleBucket",fa,{omit:["layers"]});var Yg={get paint(){return fp=fp||new xi({"circle-radius":new $e(ve.paint_circle["circle-radius"]),"circle-color":new $e(ve.paint_circle["circle-color"]),"circle-blur":new $e(ve.paint_circle["circle-blur"]),"circle-opacity":new $e(ve.paint_circle["circle-opacity"]),"circle-translate":new Ve(ve.paint_circle["circle-translate"]),"circle-translate-anchor":new Ve(ve.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ve(ve.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ve(ve.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new $e(ve.paint_circle["circle-stroke-width"]),"circle-stroke-color":new $e(ve.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new $e(ve.paint_circle["circle-stroke-opacity"])})},get layout(){return pp=pp||new xi({"circle-sort-key":new $e(ve.layout_circle["circle-sort-key"])})}};class Kg extends pr{constructor(e,i){super(e,Yg,i)}createBucket(e){return new fa(e)}queryRadius(e){const i=e;return _a("circle-radius",this,i)+_a("circle-stroke-width",this,i)+xu(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:l,pixelsToTileUnits:h,unwrappedTileID:d,getElevation:g}){const m=bu(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-l.bearingInRadians,h),v=this.paint.get("circle-radius").evaluate(i,s)+this.paint.get("circle-stroke-width").evaluate(i,s),_=this.paint.get("circle-pitch-scale"),T=this.paint.get("circle-pitch-alignment");let x,I;return T==="map"?(x=m,I=v*h):(x=(function(M,D,k,O){return M.map((B=>Ch(B,D,k,O)))})(m,l,d,g),I=v),dp({queryGeometry:x,size:I,transform:l,unwrappedTileID:d,getElevation:g,pitchAlignment:T,pitchScale:_},o)}}class mp extends fa{}let gp;Re("HeatmapBucket",mp,{omit:["layers"]});var Jg={get paint(){return gp=gp||new xi({"heatmap-radius":new $e(ve.paint_heatmap["heatmap-radius"]),"heatmap-weight":new $e(ve.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ve(ve.paint_heatmap["heatmap-intensity"]),"heatmap-color":new aa(ve.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ve(ve.paint_heatmap["heatmap-opacity"])})}};function Ah(r,{width:e,height:i},s,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*i*s)throw new RangeError(`mismatched image size. expected: ${o.length} but got: ${e*i*s}`)}else o=new Uint8Array(e*i*s);return r.width=e,r.height=i,r.data=o,r}function _p(r,{width:e,height:i},s){if(e===r.width&&i===r.height)return;const o=Ah({},{width:e,height:i},s);Dh(r,o,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,e),height:Math.min(r.height,i)},s),r.width=e,r.height=i,r.data=o.data}function Dh(r,e,i,s,o,l){if(o.width===0||o.height===0)return e;if(o.width>r.width||o.height>r.height||i.x>r.width-o.width||i.y>r.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||s.x>e.width-o.width||s.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const h=r.data,d=e.data;if(h===d)throw new Error("srcData equals dstData, so image is already copied");for(let g=0;g<o.height;g++){const m=((i.y+g)*r.width+i.x)*l,v=((s.y+g)*e.width+s.x)*l;for(let _=0;_<o.width*l;_++)d[v+_]=h[m+_]}return e}class Hl{constructor(e,i){Ah(this,e,1,i)}resize(e){_p(this,e,1)}clone(){return new Hl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,o,l){Dh(e,i,s,o,l,1)}}class Gi{constructor(e,i){Ah(this,e,4,i)}resize(e){_p(this,e,4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Gi({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,s,o,l){Dh(e,i,s,o,l,4)}setPixel(e,i,s){const o=4*(e*this.width+i);this.data[o+0]=Math.round(255*s.r/s.a),this.data[o+1]=Math.round(255*s.g/s.a),this.data[o+2]=Math.round(255*s.b/s.a),this.data[o+3]=Math.round(255*s.a)}}function yp(r){const e=new Uint8Array(r.length);for(let i=0;i<r.length;i+=4){const s=r[i+3];e[i+0]=Math.round(r[i+0]*s/255),e[i+1]=Math.round(r[i+1]*s/255),e[i+2]=Math.round(r[i+2]*s/255),e[i+3]=s}return e}function vp(r){const e={},i=r.resolution||256,s=r.clips?r.clips.length:1,o=r.image||new Gi({width:i,height:s});if(Math.log(i)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${i}`);const l=(h,d,g)=>{e[r.evaluationKey]=g;const m=r.expression.evaluate(e);o.setPixel(h/4/i,d/4,m)};if(r.clips)for(let h=0,d=0;h<s;++h,d+=4*i)for(let g=0,m=0;g<i;g++,m+=4){const v=g/(i-1),{start:_,end:T}=r.clips[h];
2l(d,m,_*(1-v)+T*v)}else for(let h=0,d=0;h<i;h++,d+=4)l(0,d,h/(i-1));return o}Re("AlphaImage",Hl),Re("RGBAImage",Gi);const kh="big-fb";class Qg extends pr{createBucket(e){return new mp(e)}constructor(e,i){super(e,Jg,i),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=vp({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(kh)&&this.heatmapFbos.delete(kh)}queryRadius(e){return _a("heatmap-radius",this,e)}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:l,pixelsToTileUnits:h,unwrappedTileID:d,getElevation:g}){return dp({queryGeometry:e,size:this.paint.get("heatmap-radius").evaluate(i,s)*h,transform:l,unwrappedTileID:d,getElevation:g},o)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&!this.isHidden()}}let xp;var e_={get paint(){return xp=xp||new xi({"hillshade-illumination-direction":new Ve(ve.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new Ve(ve.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new Ve(ve.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ve(ve.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ve(ve.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ve(ve.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ve(ve.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new Ve(ve.paint_hillshade["hillshade-method"]),resampling:new Ve(ve.paint_hillshade.resampling)})}};class t_ extends pr{constructor(e,i){super(e,e_,i),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let e=this.paint.get("hillshade-illumination-direction").values,i=this.paint.get("hillshade-illumination-altitude").values,s=this.paint.get("hillshade-highlight-color").values,o=this.paint.get("hillshade-shadow-color").values;const l=Math.max(e.length,i.length,s.length,o.length);e=e.concat(Array(l-e.length).fill(e.at(-1))),i=i.concat(Array(l-i.length).fill(i.at(-1))),s=s.concat(Array(l-s.length).fill(s.at(-1))),o=o.concat(Array(l-o.length).fill(o.at(-1)));const h=i.map(Gr);return{directionRadians:e.map(Gr),altitudeRadians:h,shadowColor:o,highlightColor:s}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}}let bp;var i_={get paint(){return bp=bp||new xi({"color-relief-opacity":new Ve(ve["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new aa(ve["paint_color-relief"]["color-relief-color"]),resampling:new Ve(ve["paint_color-relief"].resampling)})}};function wp(r){return"data"in r}class zh{constructor(e,i,s,o){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this._ownedHandle=this.texture,this.update(i,o)}update(e,i,s){const{width:o,height:l}=e,h=!(this.size&&this.size[0]===o&&this.size[1]===l||s),{context:d}=this,{gl:g}=d;this.useMipmap=!!(i&&i.useMipmap),g.bindTexture(g.TEXTURE_2D,this.texture),d.pixelStoreUnpackFlipY.set(!1),d.pixelStoreUnpack.set(1);const m=this.format===g.RGBA&&(!i||i.premultiply!==!1);if(h)this.size=[o,l],wp(e)?(d.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(e,m,o,l,g)):(d.pixelStoreUnpackPremultiplyAlpha.set(m),this._uploadDomImage(e,g));else{const{x:v,y:_}=s||{x:0,y:0};wp(e)?(d.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(e,m,v,_,o,l,g)):(d.pixelStoreUnpackPremultiplyAlpha.set(m),this._updateDomImage(e,v,_,g))}this.useMipmap&&this.isSizePowerOfTwo()&&g.generateMipmap(g.TEXTURE_2D),d.pixelStoreUnpackFlipY.setDefault(),d.pixelStoreUnpack.setDefault(),d.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(e,i){i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,i.UNSIGNED_BYTE,e)}_uploadRawData(e,i,s,o,l){let{data:h}=e;i&&h&&(h=yp(h)),l.texImage2D(l.TEXTURE_2D,0,this.format,s,o,0,this.format,l.UNSIGNED_BYTE,h)}_updateDomImage(e,i,s,o){o.texSubImage2D(o.TEXTURE_2D,0,i,s,o.RGBA,o.UNSIGNED_BYTE,e)}_updateRawData(e,i,s,o,l,h,d){let{data:g}=e;i&&g&&(g=yp(g)),d.texSubImage2D(d.TEXTURE_2D,0,s,o,l,h,d.RGBA,d.UNSIGNED_BYTE,g)}bind(e,i,s){const{context:o}=this,{gl:l}=o;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),l.bindTexture(l.TEXTURE_2D,this.texture),s!==l.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=l.LINEAR),e!==this.filter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,s||e),this.filter=e),i!==this.wrap&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}}class Tp{constructor(e,i,s,o=1,l=1,h=1,d=0){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(s&&!["mapbox","terrarium","custom"].includes(s))return void et(`"${s}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=i.height;const g=this.dim=i.height-2;switch(this.data=new Uint32Array(i.data.buffer),s){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;
vendor: 4,938 bytes, line 2
2case"custom":this.redFactor=o,this.greenFactor=l,this.blueFactor=h,this.baseShift=d;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let m=0;m<g;m++)this.data[this._idx(-1,m)]=this.data[this._idx(0,m)],this.data[this._idx(g,m)]=this.data[this._idx(g-1,m)],this.data[this._idx(m,-1)]=this.data[this._idx(m,0)],this.data[this._idx(m,g)]=this.data[this._idx(m,g-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(g,-1)]=this.data[this._idx(g-1,0)],this.data[this._idx(-1,g)]=this.data[this._idx(0,g-1)],this.data[this._idx(g,g)]=this.data[this._idx(g-1,g-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let m=0;m<g;m++)for(let v=0;v<g;v++){const _=this.get(m,v);_>this.max&&(this.max=_),_<this.min&&(this.min=_)}}get(e,i){const s=new Uint8Array(this.data.buffer),o=4*this._idx(e,i);return this.unpack(s[o],s[o+1],s[o+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${i}, dim: ${this.dim}`);return(i+1)*this.stride+(e+1)}unpack(e,i,s){return e*this.redFactor+i*this.greenFactor+s*this.blueFactor-this.baseShift}pack(e){return Sp(e,this.getUnpackVector())}getPixels(){return new Gi({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,i,s){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let o=i*this.dim,l=i*this.dim+this.dim,h=s*this.dim,d=s*this.dim+this.dim;switch(i){case-1:o=l-1;break;case 1:l=o+1}switch(s){case-1:h=d-1;break;case 1:d=h+1}const g=-i*this.dim,m=-s*this.dim;for(let v=h;v<d;v++)for(let _=o;_<l;_++)this.data[this._idx(_,v)]=e.data[this._idx(_+g,v+m)]}}function Sp(r,e){const i=e[0],s=e[1],o=e[2],l=e[3],h=Math.min(i,s,o),d=Math.round((r+l)/h);return{r:Math.floor(d*h/i)%256,g:Math.floor(d*h/s)%256,b:Math.floor(d*h/o)%256}}Re("DEMData",Tp);class r_ extends pr{constructor(e,i){super(e,i_,i)}_createColorRamp(e){const i={elevationStops:[],colorStops:[]},s=this._transitionablePaint._values["color-relief-color"].value.expression;if(s instanceof Ko&&s._styleExpression.expression instanceof Xt){this.colorRampExpression=s;const h=s._styleExpression.expression;i.elevationStops=h.labels,i.colorStops=[];for(const d of i.elevationStops)i.colorStops.push(h.evaluate({globals:{elevation:d}}))}if(i.elevationStops.length<1&&(i.elevationStops=[0],i.colorStops=[rt.transparent]),i.elevationStops.length<2&&(i.elevationStops.push(i.elevationStops[0]+1),i.colorStops.push(i.colorStops[0])),i.elevationStops.length<=e)return i;const o={elevationStops:[],colorStops:[]},l=(i.elevationStops.length-1)/(e-1);for(let h=0;h<i.elevationStops.length-.5;h+=l)o.elevationStops.push(i.elevationStops[Math.round(h)]),o.colorStops.push(i.colorStops[Math.round(h)]);return et(`Too many colors in specification of ${this.id} color-relief layer, may not render properly. Max possible colors: ${e}, provided: ${i.elevationStops.length}`),o}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(e,i,s){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const o=this._createColorRamp(i),l=new Gi({width:o.colorStops.length,height:1}),h=new Gi({width:o.colorStops.length,height:1});for(let d=0;d<o.elevationStops.length;d++){const g=Sp(o.elevationStops[d],s);h.setPixel(0,d,new rt(g.r/255,g.g/255,g.b/255,1)),l.setPixel(0,d,o.colorStops[d])}return this.colorRampTextures={elevationTexture:new zh(e,h,e.gl.RGBA),colorTexture:new zh(e,l,e.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return!this.isHidden()&&!!this.colorRampTextures}}const{members:n_}=Zt([{name:"a_pos",components:2,type:"Int16"}],4);function wu(r,e,i){const s=i.patternDependencies;let o=!1;for(const l of e){const h=l.paint.get(`${r}-pattern`);h.isConstant()||(o=!0);const d=h.constantOr(null);d&&(o=!0,s[d.to]=!0,s[d.from]=!0)}return o}function Lh(r,e,i,s,o){const{zoom:l}=s,h=o.patternDependencies;for(const d of e){const g=d.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let m=g.evaluate({zoom:l-1},i,{},o.availableImages),v=g.evaluate({zoom:l},i,{},o.availableImages),_=g.evaluate({zoom:l+1},i,{},o.availableImages);m=m&&m.name?m.name:m,v=v&&v.name?v.name:v,_=_&&_.name?_.name:_,h[m]=!0,h[v]=!0,h[_]=!0,i.patterns[d.id]={min:m,mid:v,max:_}}}return i}function Pp(r,e,i,s,o){let l;if(o===(function(h,d,g,m){let v=0;for(let _=d,T=g-m;_<g;_+=m)v+=(h[T]-h[_])*(h[_+1]+h[T+1]),T=_;return v})(r,e,i,s)>0)for(let h=e;h<i;h+=s)l=Cp(h/s|0,r[h],r[h+1],l);else for(let h=i-s;h>=e;h-=s)l=Cp(h/s|0,r[h],r[h+1],l);return l&&ya(l,l.next)&&(Jl(l),l=l.next),l}function po(r,e){if(!r)return r;e||(e=r);let i,s=r;do if(i=!1,s.steiner||!ya(s,s.next)&&Yt(s.prev,s,s.next)!==0)s=s.next;else{if(Jl(s),s=e=s.prev,s===s.next)break;
vendor: 2,267 bytes, line 2
2i=!0}while(i||s!==e);return e}function Xl(r,e,i,s,o,l,h){if(!r)return;!h&&l&&(function(g,m,v,_){let T=g;do T.z===0&&(T.z=Fh(T.x,T.y,m,v,_)),T.prevZ=T.prev,T.nextZ=T.next,T=T.next;while(T!==g);T.prevZ.nextZ=null,T.prevZ=null,(function(x){let I,M=1;do{let D,k=x;x=null;let O=null;for(I=0;k;){I++;let B=k,N=0;for(let W=0;W<M&&(N++,B=B.nextZ,B);W++);let $=M;for(;N>0||$>0&&B;)N!==0&&($===0||!B||k.z<=B.z)?(D=k,k=k.nextZ,N--):(D=B,B=B.nextZ,$--),O?O.nextZ=D:x=D,D.prevZ=O,O=D;k=B}O.nextZ=null,M*=2}while(I>1)})(T)})(r,s,o,l);let d=r;for(;r.prev!==r.next;){const g=r.prev,m=r.next;if(l?o_(r,s,o,l):s_(r))e.push(g.i,r.i,m.i),Jl(r),r=m.next,d=m.next;else if((r=m)===d){h?h===1?Xl(r=a_(po(r),e),e,i,s,o,l,2):h===2&&l_(r,e,i,s,o,l):Xl(po(r),e,i,s,o,l,1);break}}}function s_(r){const e=r.prev,i=r,s=r.next;if(Yt(e,i,s)>=0)return!1;const o=e.x,l=i.x,h=s.x,d=e.y,g=i.y,m=s.y,v=Math.min(o,l,h),_=Math.min(d,g,m),T=Math.max(o,l,h),x=Math.max(d,g,m);let I=s.next;for(;I!==e;){if(I.x>=v&&I.x<=T&&I.y>=_&&I.y<=x&&Yl(o,d,l,g,h,m,I.x,I.y)&&Yt(I.prev,I,I.next)>=0)return!1;I=I.next}return!0}function o_(r,e,i,s){const o=r.prev,l=r,h=r.next;if(Yt(o,l,h)>=0)return!1;const d=o.x,g=l.x,m=h.x,v=o.y,_=l.y,T=h.y,x=Math.min(d,g,m),I=Math.min(v,_,T),M=Math.max(d,g,m),D=Math.max(v,_,T),k=Fh(x,I,e,i,s),O=Fh(M,D,e,i,s);let B=r.prevZ,N=r.nextZ;for(;B&&B.z>=k&&N&&N.z<=O;){if(B.x>=x&&B.x<=M&&B.y>=I&&B.y<=D&&B!==o&&B!==h&&Yl(d,v,g,_,m,T,B.x,B.y)&&Yt(B.prev,B,B.next)>=0||(B=B.prevZ,N.x>=x&&N.x<=M&&N.y>=I&&N.y<=D&&N!==o&&N!==h&&Yl(d,v,g,_,m,T,N.x,N.y)&&Yt(N.prev,N,N.next)>=0))return!1;N=N.nextZ}for(;B&&B.z>=k;){if(B.x>=x&&B.x<=M&&B.y>=I&&B.y<=D&&B!==o&&B!==h&&Yl(d,v,g,_,m,T,B.x,B.y)&&Yt(B.prev,B,B.next)>=0)return!1;B=B.prevZ}for(;N&&N.z<=O;){if(N.x>=x&&N.x<=M&&N.y>=I&&N.y<=D&&N!==o&&N!==h&&Yl(d,v,g,_,m,T,N.x,N.y)&&Yt(N.prev,N,N.next)>=0)return!1;N=N.nextZ}return!0}function a_(r,e){let i=r;do{const s=i.prev,o=i.next.next;!ya(s,o)&&Mp(s,i,i.next,o)&&Kl(s,o)&&Kl(o,s)&&(e.push(s.i,i.i,o.i),Jl(i),Jl(i.next),i=r=o),i=i.next}while(i!==r);return po(i)}function l_(r,e,i,s,o,l){let h=r;do{let d=h.next.next;for(;d!==h.prev;){if(h.i!==d.i&&p_(h,d)){let g=Ep(h,d);h=po(h,h.next),g=po(g,g.next),Xl(h,e,i,s,o,l,0),Xl(g,e,i,s,o,l,0);return}d=d.next}h=h.next}while(h!==r)}function c_(r,e){let i=r.x-e.x;
vendor: 26,590 bytes, line 2
2return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function u_(r,e){const i=(function(o,l){let h=l;const d=o.x,g=o.y;let m,v=-1/0;if(ya(o,h))return h;do{if(ya(o,h.next))return h.next;if(g<=h.y&&g>=h.next.y&&h.next.y!==h.y){const M=h.x+(g-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(M<=d&&M>v&&(v=M,m=h.x<h.next.x?h:h.next,M===d))return m}h=h.next}while(h!==l);if(!m)return null;const _=m,T=m.x,x=m.y;let I=1/0;h=m;do{if(d>=h.x&&h.x>=T&&d!==h.x&&Ip(g<x?d:v,g,T,x,g<x?v:d,g,h.x,h.y)){const M=Math.abs(g-h.y)/(d-h.x);Kl(h,o)&&(M<I||M===I&&(h.x>m.x||h.x===m.x&&h_(m,h)))&&(m=h,I=M)}h=h.next}while(h!==_);return m})(r,e);if(!i)return e;const s=Ep(i,r);return po(s,s.next),po(i,i.next)}function h_(r,e){return Yt(r.prev,r,e.prev)<0&&Yt(e.next,r,r.next)<0}function Fh(r,e,i,s,o){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*o|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-s)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function d_(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function Ip(r,e,i,s,o,l,h,d){return(o-h)*(e-d)>=(r-h)*(l-d)&&(r-h)*(s-d)>=(i-h)*(e-d)&&(i-h)*(l-d)>=(o-h)*(s-d)}function Yl(r,e,i,s,o,l,h,d){return!(r===h&&e===d)&&Ip(r,e,i,s,o,l,h,d)}function p_(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,s){let o=i;do{if(o.i!==i.i&&o.next.i!==i.i&&o.i!==s.i&&o.next.i!==s.i&&Mp(o,o.next,i,s))return!0;o=o.next}while(o!==i);return!1})(r,e)&&(Kl(r,e)&&Kl(e,r)&&(function(i,s){let o=i,l=!1;const h=(i.x+s.x)/2,d=(i.y+s.y)/2;do o.y>d!=o.next.y>d&&o.next.y!==o.y&&h<(o.next.x-o.x)*(d-o.y)/(o.next.y-o.y)+o.x&&(l=!l),o=o.next;while(o!==i);return l})(r,e)&&(Yt(r.prev,r,e.prev)||Yt(r,e.prev,e))||ya(r,e)&&Yt(r.prev,r,r.next)>0&&Yt(e.prev,e,e.next)>0)}function Yt(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function ya(r,e){return r.x===e.x&&r.y===e.y}function Mp(r,e,i,s){const o=Su(Yt(r,e,i)),l=Su(Yt(r,e,s)),h=Su(Yt(i,s,r)),d=Su(Yt(i,s,e));return o!==l&&h!==d||!(o!==0||!Tu(r,i,e))||!(l!==0||!Tu(r,s,e))||!(h!==0||!Tu(i,r,s))||!(d!==0||!Tu(i,e,s))}function Tu(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function Su(r){return r>0?1:r<0?-1:0}function Kl(r,e){return Yt(r.prev,r,r.next)<0?Yt(r,e,r.next)>=0&&Yt(r,r.prev,e)>=0:Yt(r,e,r.prev)<0||Yt(r,r.next,e)<0}function Ep(r,e){const i=Rh(r.i,r.x,r.y),s=Rh(e.i,e.x,e.y),o=r.next,l=e.prev;return r.next=e,e.prev=r,i.next=o,o.prev=i,s.next=i,i.prev=s,l.next=s,s.prev=l,s}function Cp(r,e,i,s){const o=Rh(r,e,i);return s?(o.next=s.next,o.prev=s,s.next.prev=o,s.next=o):(o.prev=o,o.next=o),o}function Jl(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Rh(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class va{constructor(e,i){if(i>e)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=e,this._minGranularity=i}getGranularityForZoomLevel(e){return Math.max(Math.floor(this._baseZoomGranularity/(1<<e)),this._minGranularity,1)}}class Pu{constructor(e){this.fill=e.fill,this.line=e.line,this.tile=e.tile,this.stencil=e.stencil,this.circle=e.circle}}Pu.noSubdivision=new Pu({fill:new va(0,0),line:new va(0,0),tile:new va(0,0),stencil:new va(0,0),circle:1}),Re("SubdivisionGranularityExpression",va),Re("SubdivisionGranularitySetting",Pu);const xa=-32768,Ql=32767;class f_{constructor(e,i){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=e,this._granularityCellSize=Ge/e,this._canonical=i}_getKey(e,i){return(e+=32768)<<16|i+32768}_vertexToIndex(e,i){if(e<-32768||i<-32768||e>32767||i>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const s=0|Math.round(e),o=0|Math.round(i),l=this._getKey(s,o);if(this._vertexDictionary.has(l))return this._vertexDictionary.get(l);const h=this._vertexBuffer.length/2;return this._vertexDictionary.set(l,h),this._vertexBuffer.push(s,o),h}_subdivideTrianglesScanline(e){if(this._granularity<2)return(function(o,l){const h=[];for(let d=0;d<l.length;d+=3){const g=l[d],m=l[d+1],v=l[d+2],_=o[2*g],T=o[2*g+1];(o[2*m]-_)*(o[2*v+1]-T)-(o[2*m+1]-T)*(o[2*v]-_)>0?(h.push(g),h.push(v),h.push(m)):(h.push(g),h.push(m),h.push(v))}return h})(this._vertexBuffer,e);const i=[],s=e.length;for(let o=0;o<s;o+=3){const l=[e[o+0],e[o+1],e[o+2]],h=[this._vertexBuffer[2*e[o+0]+0],this._vertexBuffer[2*e[o+0]+1],this._vertexBuffer[2*e[o+1]+0],this._vertexBuffer[2*e[o+1]+1],this._vertexBuffer[2*e[o+2]+0],this._vertexBuffer[2*e[o+2]+1]];let d=1/0,g=1/0,m=-1/0,v=-1/0;for(let M=0;M<3;M++){const D=h[2*M],k=h[2*M+1];d=Math.min(d,D),m=Math.max(m,D),g=Math.min(g,k),v=Math.max(v,k)}if(d===m||g===v)continue;const _=Math.floor(d/this._granularityCellSize),T=Math.ceil(m/this._granularityCellSize),x=Math.floor(g/this._granularityCellSize),I=Math.ceil(v/this._granularityCellSize);if(_!==T||x!==I)for(let M=x;M<I;M++){const D=this._scanlineGenerateVertexRingForCellRow(M,h,l);m_(this._vertexBuffer,D,i)}else i.push(...l)}return i}_scanlineGenerateVertexRingForCellRow(e,i,s){const o=e*this._granularityCellSize,l=o+this._granularityCellSize,h=[];for(let d=0;d<3;d++){const g=i[2*d],m=i[2*d+1],v=i[2*(d+1)%6],_=i[(2*(d+1)+1)%6],T=i[2*(d+2)%6],x=i[(2*(d+2)+1)%6],I=v-g,M=_-m,D=I===0,k=M===0,O=(o-m)/M,B=(l-m)/M,N=Math.min(O,B),$=Math.max(O,B);if(!k&&(N>=1||$<=0)||k&&(m<o||m>l)){_>=o&&_<=l&&h.push(s[(d+1)%3]);continue}!k&&N>0&&h.push(this._vertexToIndex(g+I*N,m+M*N));const W=g+I*Math.max(N,0),ie=g+I*Math.min($,1);D||this._generateIntraEdgeVertices(h,g,m,v,_,W,ie),!k&&$<1&&h.push(this._vertexToIndex(g+I*$,m+M*$)),(k||_>=o&&_<=l)&&h.push(s[(d+1)%3]),!k&&(_<=o||_>=l)&&this._generateInterEdgeVertices(h,g,m,v,_,T,x,ie,o,l)}return h}_generateIntraEdgeVertices(e,i,s,o,l,h,d){const g=o-i,m=l-s,v=m===0,_=v?Math.min(i,o):Math.min(h,d),T=v?Math.max(i,o):Math.max(h,d),x=Math.floor(_/this._granularityCellSize)+1,I=Math.ceil(T/this._granularityCellSize)-1;if(v?i<o:h<d)for(let M=x;M<=I;M++){const D=M*this._granularityCellSize;e.push(this._vertexToIndex(D,s+m*(D-i)/g))}else for(let M=I;M>=x;M--){const D=M*this._granularityCellSize;e.push(this._vertexToIndex(D,s+m*(D-i)/g))}}_generateInterEdgeVertices(e,i,s,o,l,h,d,g,m,v){const _=l-s,T=h-o,x=d-l,I=(m-l)/x,M=(v-l)/x,D=Math.min(I,M),k=Math.max(I,M),O=o+T*D;let B=Math.floor(Math.min(O,g)/this._granularityCellSize)+1,N=Math.ceil(Math.max(O,g)/this._granularityCellSize)-1,$=g<O;const W=x===0;if(W&&(d===m||d===v))return;if(W||D>=1||k<=0){const ne=s-d,ae=h+(i-h)*Math.min((m-d)/ne,(v-d)/ne);B=Math.floor(Math.min(ae,g)/this._granularityCellSize)+1,N=Math.ceil(Math.max(ae,g)/this._granularityCellSize)-1,$=g<ae}const ie=_>0?v:m;if($)for(let ne=B;ne<=N;ne++)e.push(this._vertexToIndex(ne*this._granularityCellSize,ie));else for(let ne=N;ne>=B;ne--)e.push(this._vertexToIndex(ne*this._granularityCellSize,ie))}_generateOutline(e){const i=[];for(const s of e){const o=fo(s,this._granularity,!0),l=this._pointArrayToIndices(o),h=[];for(let d=1;d<l.length;d++)h.push(l[d-1]),h.push(l[d]);i.push(h)}return i}_handlePoles(e){let i=!1,s=!1;this._canonical&&(this._canonical.y===0&&(i=!0),this._canonical.y===(1<<this._canonical.z)-1&&(s=!0)),(i||s)&&this._fillPoles(e,i,s)}_ensureNoPoleVertices(){const e=this._vertexBuffer;for(let i=0;i<e.length;i+=2){const s=e[i+1];s===xa&&(e[i+1]=-32767),s===Ql&&(e[i+1]=32766)}}_generatePoleQuad(e,i,s,o,l,h){o>l!=(h===xa)?(e.push(i),e.push(s),e.push(this._vertexToIndex(o,h)),e.push(s),e.push(this._vertexToIndex(l,h)),e.push(this._vertexToIndex(o,h))):(e.push(s),e.push(i),e.push(this._vertexToIndex(o,h)),e.push(this._vertexToIndex(l,h)),e.push(s),e.push(this._vertexToIndex(o,h)))}_fillPoles(e,i,s){const o=this._vertexBuffer,l=Ge,h=e.length;for(let d=2;d<h;d+=3){const g=e[d-2],m=e[d-1],v=e[d],_=o[2*g],T=o[2*g+1],x=o[2*m],I=o[2*m+1],M=o[2*v],D=o[2*v+1];i&&(T===0&&I===0&&this._generatePoleQuad(e,g,m,_,x,xa),I===0&&D===0&&this._generatePoleQuad(e,m,v,x,M,xa),D===0&&T===0&&this._generatePoleQuad(e,v,g,M,_,xa)),s&&(T===l&&I===l&&this._generatePoleQuad(e,g,m,_,x,Ql),I===l&&D===l&&this._generatePoleQuad(e,m,v,x,M,Ql),D===l&&T===l&&this._generatePoleQuad(e,v,g,M,_,Ql))}}_initializeVertices(e){for(let i=0;i<e.length;i+=2)this._vertexToIndex(e[i],e[i+1])}subdividePolygonInternal(e,i){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:s,holeIndices:o}=(function(d){const g=[],m=[];for(const v of d)if(v.length!==0){v!==d[0]&&g.push(m.length/2);for(let _=0;_<v.length;_++)m.push(v[_].x),m.push(v[_].y)}return{flattened:m,holeIndices:g}})(e);let l;this._initializeVertices(s);try{const d=(function(m,v,_=2){const T=v&&v.length,x=T?v[0]*_:m.length;let I=Pp(m,0,x,_,!0);const M=[];if(!I||I.next===I.prev)return M;let D,k,O;if(T&&(I=(function(B,N,$,W){const ie=[];for(let ne=0,ae=N.length;ne<ae;ne++){const ue=Pp(B,N[ne]*W,ne<ae-1?N[ne+1]*W:B.length,W,!1);ue===ue.next&&(ue.steiner=!0),ie.push(d_(ue))}ie.sort(c_);for(let ne=0;ne<ie.length;ne++)$=u_(ie[ne],$);return $})(m,v,I,_)),m.length>80*_){D=m[0],k=m[1];let B=D,N=k;for(let $=_;$<x;$+=_){const W=m[$],ie=m[$+1];W<D&&(D=W),ie<k&&(k=ie),W>B&&(B=W),ie>N&&(N=ie)}O=Math.max(B-D,N-k),O=O!==0?32767/O:0}return Xl(I,M,_,D,k,O,0),M})(s,o),g=this._convertIndices(s,d);l=this._subdivideTrianglesScanline(g)}catch(d){console.error(d)}let h=[];return i&&(h=this._generateOutline(e)),this._ensureNoPoleVertices(),this._handlePoles(l),{verticesFlattened:this._vertexBuffer,indicesTriangles:l,indicesLineList:h}}_convertIndices(e,i){const s=[];for(let o=0;o<i.length;o++)s.push(this._vertexToIndex(e[2*i[o]],e[2*i[o]+1]));return s}_pointArrayToIndices(e){const i=[];for(let s=0;s<e.length;s++){const o=e[s];i.push(this._vertexToIndex(o.x,o.y))}return i}}function Ap(r,e,i,s=!0){return new f_(i,e).subdividePolygonInternal(r,s)}function fo(r,e,i=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const s=r[0],o=r[r.length-1],l=i&&(s.x!==o.x||s.y!==o.y);if(e<2)return l?[...r,r[0]]:[...r];const h=Math.floor(Ge/e),d=[];d.push(new H(r[0].x,r[0].y));const g=r.length,m=l?g:g-1;for(let v=0;v<m;v++){const _=r[v],T=v<g-1?r[v+1]:r[0],x=_.x,I=_.y,M=T.x,D=T.y,k=x!==M,O=I!==D;if(!k&&!O)continue;const B=M-x,N=D-I,$=Math.abs(B),W=Math.abs(N);let ie=x,ne=I;for(;;){const ue=B>0?(Math.floor(ie/h)+1)*h:(Math.ceil(ie/h)-1)*h,ye=N>0?(Math.floor(ne/h)+1)*h:(Math.ceil(ne/h)-1)*h,ge=Math.abs(ie-ue),_e=Math.abs(ne-ye),de=Math.abs(ie-M),Ie=Math.abs(ne-D),Fe=k?ge/$:Number.POSITIVE_INFINITY,ke=O?_e/W:Number.POSITIVE_INFINITY;if((de<=ge||!k)&&(Ie<=_e||!O))break;if(Fe<ke&&k||!O){ie=ue,ne+=N*Fe;const Pe=new H(ie,Math.round(ne));d[d.length-1].x===Pe.x&&d[d.length-1].y===Pe.y||d.push(Pe)}else{ie+=B*ke,ne=ye;const Pe=new H(Math.round(ie),ne);d[d.length-1].x===Pe.x&&d[d.length-1].y===Pe.y||d.push(Pe)}}const ae=new H(M,D);d[d.length-1].x===ae.x&&d[d.length-1].y===ae.y||d.push(ae)}return d}function m_(r,e,i){if(e.length===0)throw new Error("Subdivision vertex ring is empty.");let s=0,o=r[2*e[0]];for(let g=1;g<e.length;g++){const m=r[2*e[g]];m<o&&(o=m,s=g)}const l=e.length;let h=s,d=(h+1)%l;for(;;){const g=h-1>=0?h-1:l-1,m=(d+1)%l,v=r[2*e[g]],_=r[2*e[m]],T=r[2*e[h]],x=r[2*e[h]+1],I=r[2*e[d]+1];let M=!1;if(v<_)M=!0;else if(v>_)M=!1;else{const D=I-x,k=-(r[2*e[d]]-T),O=x<I?1:-1;((v-T)*D+(r[2*e[g]+1]-x)*k)*O>((_-T)*D+(r[2*e[m]+1]-x)*k)*O&&(M=!0)}if(M){const D=e[g],k=e[h],O=e[d];D!==k&&D!==O&&k!==O&&i.push(O,k,D),h--,h<0&&(h=l-1)}else{const D=e[m],k=e[h],O=e[d];D!==k&&D!==O&&k!==O&&i.push(O,k,D),d++,d>=l&&(d=0)}if(g===m)break}}function Dp(r,e,i,s,o,l,h,d,g){const m=o.length/2,v=h&&d&&g;if(m<je.MAX_VERTEX_ARRAY_LENGTH){const _=e.prepareSegment(m,i,s),T=_.vertexLength;for(let M=0;M<l.length;M+=3)s.emplaceBack(T+l[M],T+l[M+1],T+l[M+2]);let x,I;_.vertexLength+=m,_.primitiveLength+=l.length/3,v&&(I=h.prepareSegment(m,i,d),x=I.vertexLength,I.vertexLength+=m);for(let M=0;M<o.length;M+=2)r(o[M],o[M+1]);if(v)for(let M=0;M<g.length;M++){const D=g[M];for(let k=1;k<D.length;k+=2)d.emplaceBack(x+D[k-1],x+D[k]);I.primitiveLength+=D.length/2}}else(function(_,T,x,I,M,D){const k=[];for(let W=0;W<I.length/2;W++)k.push(-1);const O={count:0};let B=0,N=_.getOrCreateLatestSegment(T,x),$=N.vertexLength;for(let W=2;W<M.length;W+=3){const ie=M[W-2],ne=M[W-1],ae=M[W];let ue=k[ie]<B,ye=k[ne]<B,ge=k[ae]<B;N.vertexLength+((ue?1:0)+(ye?1:0)+(ge?1:0))>je.MAX_VERTEX_ARRAY_LENGTH&&(N=_.createNewSegment(T,x),B=O.count,ue=!0,ye=!0,ge=!0,$=0);const _e=ec(k,I,D,O,ie,ue,N),de=ec(k,I,D,O,ne,ye,N),Ie=ec(k,I,D,O,ae,ge,N);x.emplaceBack($+_e-B,$+de-B,$+Ie-B),N.primitiveLength++}})(e,i,s,o,l,r),v&&(function(_,T,x,I,M,D){const k=[];for(let W=0;W<I.length/2;W++)k.push(-1);const O={count:0};let B=0,N=_.getOrCreateLatestSegment(T,x),$=N.vertexLength;for(let W=0;W<M.length;W++){const ie=M[W];for(let ne=1;ne<M[W].length;ne+=2){const ae=ie[ne-1],ue=ie[ne];let ye=k[ae]<B,ge=k[ue]<B;N.vertexLength+((ye?1:0)+(ge?1:0))>je.MAX_VERTEX_ARRAY_LENGTH&&(N=_.createNewSegment(T,x),B=O.count,ye=!0,ge=!0,$=0);const _e=ec(k,I,D,O,ae,ye,N),de=ec(k,I,D,O,ue,ge,N);x.emplaceBack($+_e-B,$+de-B),N.primitiveLength++}}})(h,i,d,o,g,r),e.forceNewSegmentOnNextPrepare(),h?.forceNewSegmentOnNextPrepare()}function ec(r,e,i,s,o,l,h){if(l){const d=s.count;return i(e[2*o],e[2*o+1]),r[o]=s.count,s.count++,h.vertexLength++,d}return r[o]}class Bh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.layoutVertexArray=new ee,this.indexArray=new Se,this.indexArray2=new we,this.programConfigurations=new Ln(e.layers,e.zoom),this.segments=new je,this.segments2=new je,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.hasDependencies=wu("fill",this.layers,i);const o=this.layers[0].layout.get("fill-sort-key"),l=!o.isConstant(),h=[];for(const{feature:d,id:g,index:m,sourceLayerIndex:v}of e){const _=this.layers[0]._featureFilter.needGeometry,T=Qr(d,_);if(!this.layers[0]._featureFilter.filter(new vt(this.zoom),T,s))continue;const x=l?o.evaluate(T,{},s,i.availableImages):void 0,I={id:g,properties:d.properties,type:d.type,sourceLayerIndex:v,index:m,geometry:_?T.geometry:Jr(d),patterns:{},sortKey:x};h.push(I)}l&&h.sort(((d,g)=>d.sortKey-g.sortKey));for(const d of h){const{geometry:g,index:m,sourceLayerIndex:v}=d;if(this.hasDependencies){const _=Lh("fill",this.layers,d,{zoom:this.zoom},i);this.patternFeatures.push(_)}else this.addFeature(d,g,m,s,{},i.subdivisionGranularity);i.featureIndex.insert(e[m].feature,g,m,v,this.index)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}addFeatures(e,i,s){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,i,s,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,n_),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,i,s,o,l,h){for(const d of No(i,500)){const g=Ap(d,o,h.fill.getGranularityForZoomLevel(o.z)),m=this.layoutVertexArray;Dp(((v,_)=>{m.emplaceBack(v,_)}),this.segments,this.layoutVertexArray,this.indexArray,g.verticesFlattened,g.indicesTriangles,this.segments2,this.indexArray2,g.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:l,canonical:o})}}let kp,zp;Re("FillBucket",Bh,{omit:["layers","patternFeatures"]});var g_={get paint(){return zp=zp||new xi({"fill-antialias":new Ve(ve.paint_fill["fill-antialias"]),"fill-opacity":new $e(ve.paint_fill["fill-opacity"]),"fill-color":new $e(ve.paint_fill["fill-color"]),"fill-outline-color":new $e(ve.paint_fill["fill-outline-color"]),"fill-translate":new Ve(ve.paint_fill["fill-translate"]),"fill-translate-anchor":new Ve(ve.paint_fill["fill-translate-anchor"]),"fill-pattern":new Cn(ve.paint_fill["fill-pattern"])})},get layout(){return kp=kp||new xi({"fill-sort-key":new $e(ve.layout_fill["fill-sort-key"])})}};class __ extends pr{constructor(e,i){super(e,g_,i)}recalculate(e,i){super.recalculate(e,i);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(e){return new Bh(e)}queryRadius(){return xu(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:e,geometry:i,transform:s,pixelsToTileUnits:o}){return cp(bu(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-s.bearingInRadians,o),i)}isTileClipped(){return!0}}const y_=Zt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),v_=Zt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:x_}=y_;class tc{constructor(e,i,s,o,l){this.properties={},this.extent=s,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=o,this._values=l,e.readFields(b_,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,s=[];let o,l=1,h=0,d=0,g=0;for(;e.pos<i;){if(h<=0){const m=e.readVarint();l=7&m,h=m>>3}if(h--,l===1||l===2)d+=e.readSVarint(),g+=e.readSVarint(),l===1&&(o&&s.push(o),o=[]),o&&o.push(new H(d,g));else{if(l!==7)throw new Error(`unknown command ${l}`);o&&o.push(o[0].clone())}}return o&&s.push(o),s}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let s=1,o=0,l=0,h=0,d=1/0,g=-1/0,m=1/0,v=-1/0;for(;e.pos<i;){if(o<=0){const _=e.readVarint();s=7&_,o=_>>3}if(o--,s===1||s===2)l+=e.readSVarint(),h+=e.readSVarint(),l<d&&(d=l),l>g&&(g=l),h<m&&(m=h),h>v&&(v=h);else if(s!==7)throw new Error(`unknown command ${s}`)}return[d,m,g,v]}toGeoJSON(e,i,s){const o=this.extent*Math.pow(2,s),l=this.extent*e,h=this.extent*i,d=this.loadGeometry();function g(T){return[360*(T.x+l)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(T.y+h)/o)*Math.PI))-90]}function m(T){return T.map(g)}let v;if(this.type===1){const T=[];for(const I of d)T.push(I[0]);const x=m(T);v=T.length===1?{type:"Point",coordinates:x[0]}:{type:"MultiPoint",coordinates:x}}else if(this.type===2){const T=d.map(m);v=T.length===1?{type:"LineString",coordinates:T[0]}:{type:"MultiLineString",coordinates:T}}else{if(this.type!==3)throw new Error("unknown feature type");{const T=Lp(d),x=[];for(const I of T)x.push(I.map(m));v=x.length===1?{type:"Polygon",coordinates:x[0]}:{type:"MultiPolygon",coordinates:x}}}const _={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(_.id=this.id),_}}function b_(r,e,i){r===1?e.id=i.readVarint():r===2?(function(s,o){const l=s.readVarint()+s.pos;for(;s.pos<l;){const h=o._keys[s.readVarint()],d=o._values[s.readVarint()];o.properties[h]=d}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function Lp(r){const e=r.length;if(e<=1)return[r];const i=[];let s,o;for(let l=0;l<e;l++){const h=w_(r[l]);h!==0&&(o===void 0&&(o=h<0),o===h<0?(s&&i.push(s),s=[r[l]]):s&&s.push(r[l]))}return s&&i.push(s),i}function w_(r){let e=0;for(let i,s,o=0,l=r.length,h=l-1;o<l;h=o++)i=r[o],s=r[h],e+=(s.x-i.x)*(i.y+s.y);return e}tc.types=["Unknown","Point","LineString","Polygon"];class T_{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(S_,this,i),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const i=this._pbf.readVarint()+this._pbf.pos;return new tc(this._pbf,i,this.extent,this._keys,this._values)}}function S_(r,e,i){r===15?e.version=i.readVarint():r===1?e.name=i.readString():r===5?e.extent=i.readVarint():r===2?e._features.push(i.pos):r===3?e._keys.push(i.readString()):r===4&&e._values.push((function(s){let o=null;const l=s.readVarint()+s.pos;for(;s.pos<l;){const h=s.readVarint()>>3;o=h===1?s.readString():h===2?s.readFloat():h===3?s.readDouble():h===4?s.readVarint64():h===5?s.readVarint():h===6?s.readSVarint():h===7?s.readBoolean():null}if(o==null)throw new Error("unknown feature value");return o})(i))}class Fp{constructor(e,i){this.layers=e.readFields(P_,{},i)}}function P_(r,e,i){if(r===3){const s=new T_(i,i.readVarint()+i.pos);s.length&&(e[s.name]=s)}}const Oh=Math.pow(2,13);function ic(r,e,i,s,o,l,h,d){r.emplaceBack(e,i,2*Math.floor(s*Oh)+h,o*Oh*2,l*Oh*2,Math.round(d))}class Vh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.layoutVertexArray=new X,this.centroidVertexArray=new G,this.indexArray=new Se,this.programConfigurations=new Ln(e.layers,e.zoom),this.segments=new je,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.features=[],this.hasDependencies=wu("fill-extrusion",this.layers,i);for(const{feature:o,id:l,index:h,sourceLayerIndex:d}of e){const g=this.layers[0]._featureFilter.needGeometry,m=Qr(o,g);if(!this.layers[0]._featureFilter.filter(new vt(this.zoom),m,s))continue;const v={id:l,sourceLayerIndex:d,index:h,geometry:g?m.geometry:Jr(o),properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(Lh("fill-extrusion",this.layers,v,{zoom:this.zoom},i)):this.addFeature(v,v.geometry,h,s,{},i.subdivisionGranularity),i.featureIndex.insert(o,v.geometry,h,d,this.index,!0)}}addFeatures(e,i,s){for(const o of this.features){const{geometry:l}=o;this.addFeature(o,l,o.index,i,s,e.subdivisionGranularity)}}update(e,i,s){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s})}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,x_),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,v_.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,i,s,o,l,h){for(const d of No(i,500)){const g={x:0,y:0,sampleCount:0},m=this.layoutVertexArray.length;this.processPolygon(g,o,e,d,h);const v=this.layoutVertexArray.length-m,_=Math.floor(g.x/g.sampleCount),T=Math.floor(g.y/g.sampleCount);for(let x=0;x<v;x++)this.centroidVertexArray.emplaceBack(_,T)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:l,canonical:o})}processPolygon(e,i,s,o,l){if(o.length<1||Rp(o[0]))return;for(const _ of o)_.length!==0&&I_(e,_);const h={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},d=l.fill.getGranularityForZoomLevel(i.z),g=tc.types[s.type]==="Polygon";for(const _ of o){if(_.length===0||Rp(_))continue;const T=fo(_,d,g);this._generateSideFaces(T,h)}if(!g)return;const m=Ap(o,i,d,!1),v=this.layoutVertexArray;Dp(((_,T)=>{ic(v,_,T,0,0,1,1,0)}),this.segments,this.layoutVertexArray,this.indexArray,m.verticesFlattened,m.indicesTriangles)}_generateSideFaces(e,i){let s=0;for(let o=1;o<e.length;o++){const l=e[o],h=e[o-1];if(M_(l,h))continue;i.segment.vertexLength+4>je.MAX_VERTEX_ARRAY_LENGTH&&(i.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const d=l.sub(h)._perp()._unit(),g=h.dist(l);s+g>32768&&(s=0),ic(this.layoutVertexArray,l.x,l.y,d.x,d.y,0,0,s),ic(this.layoutVertexArray,l.x,l.y,d.x,d.y,0,1,s),s+=g,ic(this.layoutVertexArray,h.x,h.y,d.x,d.y,0,0,s),ic(this.layoutVertexArray,h.x,h.y,d.x,d.y,0,1,s);const m=i.segment.vertexLength;this.indexArray.emplaceBack(m,m+2,m+1),this.indexArray.emplaceBack(m+1,m+2,m+3),i.segment.vertexLength+=4,i.segment.primitiveLength+=2}}}function I_(r,e){for(let i=0;i<e.length;i++){const s=e[i];i===e.length-1&&e[0].x===s.x&&e[0].y===s.y||(r.x+=s.x,r.y+=s.y,r.sampleCount++)}}function M_(r,e){return r.x===e.x&&(r.x<0||r.x>Ge)||r.y===e.y&&(r.y<0||r.y>Ge)}function Rp(r){return r.every((e=>e.x<0))||r.every((e=>e.x>Ge))||r.every((e=>e.y<0))||r.every((e=>e.y>Ge))}let Bp;Re("FillExtrusionBucket",Vh,{omit:["layers","features"]});var E_={get paint(){return Bp=Bp||new xi({"fill-extrusion-opacity":new Ve(ve["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new $e(ve["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ve(ve["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ve(ve["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Cn(ve["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new $e(ve["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new $e(ve["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ve(ve["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class C_ extends pr{constructor(e,i){super(e,E_,i)}createBucket(e){return new Vh(e)}queryRadius(){return xu(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:l,pixelsToTileUnits:h,pixelPosMatrix:d}){const g=bu(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-l.bearingInRadians,h),m=this.paint.get("fill-extrusion-height").evaluate(i,s),v=this.paint.get("fill-extrusion-base").evaluate(i,s),_=(function(x,I){const M=[];for(const D of x){const k=[D.x,D.y,0,1];Ue(k,k,I),M.push(new H(k[0]/k[3],k[1]/k[3]))}return M})(g,d),T=(function(x,I,M,D){const k=[],O=[],B=D[8]*I,N=D[9]*I,$=D[10]*I,W=D[11]*I,ie=D[8]*M,ne=D[9]*M,ae=D[10]*M,ue=D[11]*M;for(const ye of x){const ge=[],_e=[];for(const de of ye){const Ie=de.x,Fe=de.y,ke=D[0]*Ie+D[4]*Fe+D[12],Pe=D[1]*Ie+D[5]*Fe+D[13],qe=D[2]*Ie+D[6]*Fe+D[14],lt=D[3]*Ie+D[7
2]*Fe+D[15],ut=qe+$,_t=lt+W,Si=ke+ie,jt=Pe+ne,ni=qe+ae,ui=lt+ue,kt=new H((ke+B)/_t,(Pe+N)/_t);kt.z=ut/_t,ge.push(kt);const gi=new H(Si/ui,jt/ui);gi.z=ni/ui,_e.push(gi)}k.push(ge),O.push(_e)}return[k,O]})(o,v,m,d);return(function(x,I,M){let D=1/0;cp(M,I)&&(D=Op(M,I[0]));for(let k=0;k<I.length;k++){const O=I[k],B=x[k];for(let N=0;N<O.length-1;N++){const $=O[N],W=[$,O[N+1],B[N+1],B[N],$];ma(M,W)&&(D=Math.min(D,Op(M,W)))}}return D!==1/0&&D})(T[0],T[1],_)}}function rc(r,e){return r.x*e.x+r.y*e.y}function Op(r,e){if(r.length===1){let i=0;const s=e[i++];let o;for(;!o||s.equals(o);)if(o=e[i++],!o)return 1/0;for(;i<e.length;i++){const l=e[i],h=r[0],d=o.sub(s),g=l.sub(s),m=h.sub(s),v=rc(d,d),_=rc(d,g),T=rc(g,g),x=rc(m,d),I=rc(m,g),M=v*T-_*_,D=(T*x-_*I)/M,k=(v*I-_*x)/M,O=s.z*(1-D-k)+o.z*D+l.z*k;if(isFinite(O))return O}return 1/0}{let i=1/0;for(const s of e)i=Math.min(i,s.z);return i}}const Vp=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Iu{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,s]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const o=s>>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const l=Vp[15&s];if(!l)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[d]=new Uint32Array(e,4,1);return new Iu(d,h,l,e)}constructor(e,i=64,s=Float64Array,o){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=s,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const l=Vp.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,d=e*this.IndexArrayType.BYTES_PER_ELEMENT,g=(8-d%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${s}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+g,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+d+g),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+g,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+l]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const s=this._pos>>1;return this.ids[s]=s,this.coords[this._pos++]=e,this.coords[this._pos++]=i,s}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return jh(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,s,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:h,nodeSize:d}=this,g=[0,l.length-1,0],m=[];for(;g.length;){const v=g.pop()||0,_=g.pop()||0,T=g.pop()||0;if(_-T<=d){for(let D=T;D<=_;D++){const k=h[2*D],O=h[2*D+1];k>=e&&k<=s&&O>=i&&O<=o&&m.push(l[D])}continue}const x=T+_>>1,I=h[2*x],M=h[2*x+1];I>=e&&I<=s&&M>=i&&M<=o&&m.push(l[x]),(v===0?e<=I:i<=M)&&(g.push(T),g.push(x-1),g.push(1-v)),(v===0?s>=I:o>=M)&&(g.push(x+1),g.push(_),g.push(1-v))}return m}within(e,i,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:l,nodeSize:h}=this,d=[0,o.length-1,0],g=[],m=s*s;for(;d.length;){const v=d.pop()||0,_=d.pop()||0,T=d.pop()||0;if(_-T<=h){for(let D=T;D<=_;D++)Np(l[2*D],l[2*D+1],e,i)<=m&&g.push(o[D]);continue}const x=T+_>>1,I=l[2*x],M=l[2*x+1];Np(I,M,e,i)<=m&&g.push(o[x]),(v===0?e-s<=I:i-s<=M)&&(d.push(T),d.push(x-1),d.push(1-v)),(v===0?e+s>=I:i+s>=M)&&(d.push(x+1),d.push(_),d.push(1-v))}return g}}function jh(r,e,i,s,o,l){if(o-s<=i)return;const h=s+o>>1;jp(r,e,h,s,o,l),jh(r,e,i,s,h-1,1-l),jh(r,e,i,h+1,o,1-l)}function jp(r,e,i,s,o,l){for(;o>s;){if(o-s>600){const m=o-s+1,v=i-s+1,_=Math.log(m),T=.5*Math.exp(2*_/3),x=.5*Math.sqrt(_*T*(m-T)/m)*(v-m/2<0?-1:1);jp(r,e,i,Math.max(s,Math.floor(i-v*T/m+x)),Math.min(o,Math.floor(i+(m-v)*T/m+x)),l)}const h=e[2*i+l];let d=s,g=o;for(nc(r,e,s,i),e[2*o+l]>h&&nc(r,e,s,o);d<g;){for(nc(r,e,d,g),d++,g--;e[2*d+l]<h;)d++;for(;e[2*g+l]>h;)g--}e[2*s+l]===h?nc(r,e,s,g):(g++,nc(r,e,g,o)),g<=i&&(s=g+1),i<=g&&(o=g-1)}}function nc(r,e,i,s){Nh(r,i,s),Nh(e,2*i,2*s),Nh(e,2*i+1,2*s+1)}function Nh(r,e,i){const s=r[e];r[e]=r[i],r[i]=s}function Np(r,e,i,s){const o=r-i,l=e-s;return o*o+l*l}function Uh(r,e,i,s){let o=s;const l=e+(i-e>>1);let h,d=i-e;const g=r[e],m=r[e+1],v=r[i],_=r[i+1];for(let T=e+3;T<i;T+=3){const x=A_(r[T],r[T+1],g,m,v,_);if(x>o)h=T,o=x;else if(x===o){const I=Math.abs(T-l);I<d&&(h=T,d=I)}}o>s&&(h-e>3&&Uh(r,e,h,s),r[h+2]=o,i-h>3&&Uh(r,h,i,s))}function A_(r,e,i,s,o,l){let h=o-i,d=l-s;if(h!==0||d!==0){const g=((r-i)*h+(e-s)*d)/(h*h+d*d);g>1?(i=o,s=l):g>0&&(i+=h*g,s+=d*g)}return h=r-i,d=e-s,h*h+d*d}function bi(r,e,i,s){const o={type:e,geom:i},l={id:r??null,type:o.type,geometry:o.geom,tags:s,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(o.type){case"Point":case"MultiPoint":case"LineString":Mu(l,o.geom);break;case"Polygon":Mu(l,o.geom[0]);break;case"MultiLineString":for(const h of o.geom)Mu(l,h);break;case"MultiPolygon":for(const h of o.geom)Mu(l,h[0])}return l}function Mu(r,e){for(let i=0;i<e.length;i+=3)r.minX=Math.min(r.minX,e[i]),r.minY=Math.min(r.minY,e[i+1]),r.maxX=Math.max(r.maxX,e[i]),r.maxY=Math.max(r.maxY,e[i+1])}function $h(r,e){const i=[];switch(r.type){case"FeatureCollection":for(let s=0;s<r.features.length;s++)Eu(i,r.features[s],e,s);break;case"Feature":Eu(i,r,e);break;default:Eu(i,{geometry:r,properties:void 0},e)}return i}function Eu(r,e,i,s){if(!e.geometry)return;if(e.geometry.type==="GeometryCollection")return void(function(h,d,g,m,v){for(const _ of g.geometries)Eu(h,{id:d.id,geometry:_,properties:d.properties},m,v)})(r,e,e.geometry,i,s);if(!e.geometry.coordinates?.length)return;const o=(function(h,d,g){return d.promoteId?h.properties?.[d.promoteId]:d.generateId?g||0:h.id})(e,i,s),l=Math.pow(i.tolerance/((1<<i.maxZoom)*i.extent),2);switch(e.geometry.type){case"Point":(function(h,d,g,m){const v=[];v.push(ba(g.coordinates[0]),wa(g.coordinates[1]),0),h.push(bi(d,"Point",v,m))})(r,o,e.geometry,e.properties);return;case"MultiPoint":(function(h,d,g,m){const v=[];for(const _ of g.coordinates)v.push(ba(_[0]),wa(_[1]),0);h.push(bi(d,"MultiPoint",v,m))})(r,o,e.geometry,e.properties);return;case"LineString":(function(h,d,g,m,v){const _=[];Gh(g.coordinates,_,m,!1),h.push(bi(d,"LineString",_,v))})(r,o,e.geometry,l,e.properties);return;case"MultiLineString":(function(h,d,g,m,v,_){if(v.lineMetrics)for(const T of g.coordinates){const x=[];Gh(T,x,m,!1),h.push(bi(d,"LineString",x,_))}else{const T=[];qh(g.coordinates,T,m,!1),h.push(bi(d,"MultiLineString",T,_))}})(r,o,e.geometry,l,i,e.properties);return;case"Polygon":(function(h,d,g,m,v){const _=[];qh(g.coordinates,_,m,!0),h.push(bi(d,"Polygon",_,v))})(r,o,e.geometry,l,e.properties);return;case"MultiPolygon":(function(h,d,g,m,v){const _=[];for(const T of g.coordinates){const x=[];qh(T,x,m,!0),_.push(x)}h.push(bi(d,"MultiPolygon",_,v))})(r,o,e.geometry,l,e.properties);return;default:throw new Error("Input data is not a valid GeoJSON object.")}}function Gh(r,e,i,s){let o,l,h=0;for(let g=0;g<r.length;g++){const m=ba(r[g][0]),v=wa(r[g][1]);e.push(m,v,0),g>0&&(h+=s?(o*v-m*l)/2:Math.sqrt(Math.pow(m-o,2)+Math.pow(v-l,2))),o=m,l=v}const d=e.length-3;e[2]=1,i>0&&Uh(e,0,d,i),e[d+2]=1,e.size=Math.abs(h),e.start=0,e.end=e.size}function qh(r,e,i,s){for(let o=0;o<r.length;o++){const l=[];Gh(r[o],l,i,s),e.push(l)}}function ba(r){return r/360+.5}function wa(r){const e=Math.sin(r*Math.PI/180),i=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return i<0?0:i>1?1:i}function Cu(r){const e={type:"Feature",geometry:D_(r),properties:r.tags};return r.id!=null&&(e.id=r.id),e}function D_(r){const{type:e,geometry:i}=r;switch(e){case"Point":return{type:e,coordinates:Up(i[0],i[1])};case"MultiPoint":case"LineString":return{type:e,coordinates:Zh(i)};case"MultiLineString":case"Polygon":return{type:e,coordinates:i.map((s=>Zh(s)))};case"MultiPolygon":return{type:e,coordinates:i.map((s=>s.map((o=>Zh(o)))))}}}function Zh(r){const e=[];for(let i=0;i<r.length;i+=3)e.push(Up(r[i],r[i+1]));return e}function Up(r,e){return[$p(r),Gp(e)]}function $p(r){return 360*(r-.5)}function Gp(r){const e=(180-360*r)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}var Ii;function Fn(r,e,i,s,o,l,h,d){if(s/=e,l>=(i/=e)&&h<s)return r;if(h<i||l>=s)return null;const g=[];for(const m of r){const v=o===Ii.X?m.minX:m.minY,_=o===Ii.X?m.maxX:m.maxY;if(v>=i&&_<s)g.push(m);else if(!(_<i||v>=s))switch(m.type){case"Point":case"MultiPoint":k_(m,g,i,s,o);continue;case"LineString":z_(m,g,i,s,o,d);continue;case"MultiLineString":L_(m,g,i,s,o);continue;case"Polygon":F_(m,g,i,s,o);continue;case"MultiPolygon":R_(m,g,i,s,o);continue}}return g.length?g:null}function k_(r,e,i,s,o){const l=[];(function(h,d,g,m,v){for(let _=0;_<h.length;_+=3){const T=h[_+v];T>=g&&T<=m&&Ta(d,h[_],h[_+1],h[_+2])}})(r.geometry,l,i,s,o),l.length&&e.push(bi(r.id,l.length===3?"Point":"MultiPoint",l,r.tags))}function z_(r,e,i,s,o,l){const h=[];if(qp(r.geometry,h,i,s,o,!1,l.lineMetrics),h.length)if(l.lineMetrics)for(const d of h)e.push(bi(r.id,"LineString",d,r.tags));else e.push(h.length>1?bi(r.id,"MultiLineString",h,r.tags):bi(r.id,"LineString",h[0],r.tags))}function L_(r,e,i,s,o){const l=[];Wh(r.geometry,l,i,s,o,!1),l.length&&e.push(l.length!==1?bi(r.id,"MultiLineString",l,r.tags):bi(r.id,"LineString",l[0],r.tags))}
2function F_(r,e,i,s,o){const l=[];Wh(r.geometry,l,i,s,o,!0),l.length&&e.push(bi(r.id,"Polygon",l,r.tags))}function R_(r,e,i,s,o){const l=[];for(const h of r.geometry){const d=[];Wh(h,d,i,s,o,!0),d.length&&l.push(d)}l.length&&e.push(bi(r.id,"MultiPolygon",l,r.tags))}function qp(r,e,i,s,o,l,h){let d=Zp(r);const g=o===Ii.X?B_:O_;let m,v,_=r.start;for(let D=0;D<r.length-3;D+=3){const k=r[D],O=r[D+1],B=r[D+2],N=r[D+3],$=r[D+4],W=o===Ii.X?k:O,ie=o===Ii.X?N:$;let ne=!1;h&&(m=Math.sqrt(Math.pow(k-N,2)+Math.pow(O-$,2))),W<i?ie>i&&(v=g(d,k,O,N,$,i),h&&(d.start=_+m*v)):W>s?ie<s&&(v=g(d,k,O,N,$,s),h&&(d.start=_+m*v)):Ta(d,k,O,B),ie<i&&W>=i&&(v=g(d,k,O,N,$,i),ne=!0),ie>s&&W<=s&&(v=g(d,k,O,N,$,s),ne=!0),!l&&ne&&(h&&(d.end=_+m*v),e.push(d),d=Zp(r)),h&&(_+=m)}let T=r.length-3;const x=r[T],I=r[T+1],M=o===Ii.X?x:I;M>=i&&M<=s&&Ta(d,x,I,r[T+2]),T=d.length-3,l&&T>=3&&(d[T]!==d[0]||d[T+1]!==d[1])&&Ta(d,d[0],d[1],d[2]),d.length&&e.push(d)}function Zp(r){const e=[];return e.size=r.size,e.start=r.start,e.end=r.end,e}function Wh(r,e,i,s,o,l){for(const h of r)qp(h,e,i,s,o,l,!1)}function Ta(r,e,i,s){r.push(e,i,s)}function B_(r,e,i,s,o,l){const h=(l-e)/(s-e);return Ta(r,l,i+(o-i)*h,1),h}function O_(r,e,i,s,o,l){const h=(l-i)/(o-i);return Ta(r,e+(s-e)*h,l,1),h}function Hh(r,e){const i=e.buffer/e.extent;let s=r;const o=Fn(r,1,-1-i,i,Ii.X,-1,2,e),l=Fn(r,1,1-i,2+i,Ii.X,-1,2,e);return(o||l)&&(s=Fn(r,1,-i,1+i,Ii.X,-1,2,e)||[],o&&(s=Wp(o,1).concat(s)),l&&(s=s.concat(Wp(l,-1)))),s}function Wp(r,e){const i=[];for(const s of r)switch(s.type){case"Point":case"MultiPoint":case"LineString":{const o=Xh(s.geometry,e);i.push(bi(s.id,s.type,o,s.tags));continue}case"MultiLineString":case"Polygon":{const o=[];for(const l of s.geometry)o.push(Xh(l,e));i.push(bi(s.id,s.type,o,s.tags));continue}case"MultiPolygon":{const o=[];for(const l of s.geometry){const h=[];for(const d of l)h.push(Xh(d,e));o.push(h)}i.push(bi(s.id,s.type,o,s.tags));continue}}return i}function Xh(r,e){const i=[];i.size=r.size,r.start!==void 0&&(i.start=r.start,i.end=r.end);for(let s=0;s<r.length;s+=3)i.push(r[s]+e,r[s+1],r[s+2]);return i}function V_(r,e,i){const s=!!e.newGeometry,o=e.removeAllProperties||e.removeProperties?.length>0||e.addOrUpdateProperties?.length>0;if(s){const l=r[0];let h=$h({type:"FeatureCollection",features:[{type:"Feature",id:l.id,geometry:e.newGeometry,properties:o?Hp(l.tags,e):l.tags}]},i);return h=Hh(h,i),h}if(o){const l=[];for(const h of r){const d={...h};d.tags=Hp(d.tags,e),l.push(d)}return l}return[]}function Hp(r,e){if(e.removeAllProperties)return{};const i={...r||{}};if(e.removeProperties)for(const s of e.removeProperties)delete i[s];if(e.addOrUpdateProperties)for(const{key:s,value:o}of e.addOrUpdateProperties)i[s]=o;return i}(function(r){r[r.X=0]="X",r[r.Y=1]="Y"})(Ii||(Ii={}));const Yh={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:r=>r};class j_{constructor(e){this.options=Object.assign(Object.create(Yh),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(e){const i=[];for(const s of e){if(!s.geometry)continue;const[o,l]=s.geometry.coordinates,[h,d]=[ba(o),wa(l)];i.push({id:s.id,type:"Point",geometry:[h,d],tags:s.properties})}this.createIndex(i)}initialize(e){const i=[];for(const s of e)s.type==="Point"&&i.push(s);this.createIndex(i)}updateIndex(e,i,s){this.options=Object.assign(Object.create(Yh),s.clusterOptions),this.initialize(e)}createIndex(e){const{log:i,minZoom:s,maxZoom:o}=this.options;i&&console.time("total time");const l=`prepare ${e.length} points`;i&&console.time(l),this.points=e;const h=[];for(let g=0;g<e.length;g++){const m=e[g];if(!m?.geometry)continue;let[v,_]=m.geometry;v=Math.fround(v),_=Math.fround(_),h.push(v,_,1/0,g,-1,1),this.options.reduce&&h.push(0)}let d=this.trees[o+1]=this.createTree(h);i&&console.timeEnd(l);for(let g=o;g>=s;g--){const m=Date.now();d=this.trees[g]=this.createTree(this.cluster(d,g)),i&&console.log("z%d: %d clusters in %dms",g,d.numItems,Date.now()-m)}i&&console.timeEnd("total time")}getClusters(e,i){return this.getClustersInternal(e,i).map((s=>Cu(s)))}getClustersInternal(e,i){let s=((e[0]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[1]));let l=e[2]===180?180:((e[2]+180)%360+360)%360-180;const h=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)s=-180,l=180;else if(s>l){const _=this.getClustersInternal([s,o,180,h],i),T=this.getClustersInternal([-180,o,l,h],i);return _.concat(T)}const d=this.trees[this.limitZoom(i)],g=d.range(ba(s),wa(h),ba(l),wa(o)),m=d.flatData,v=[];for(const _ of g){const T=this.stride*_;v.push(m[T+5]>1?N_(m,T,this.clusterProps):this.points[m[T+3]])}return v}getChildren(e){const i=this.getOriginId(e),s=this.getOriginZoom(e),o=new Error("No cluster with the specified id: "+e),l=this.trees[s];if(!l)throw o;const h=l.flatData;if(i*this.stride>=h.length)throw o;const d=this.options.radius/(this.options.extent*Math.pow(2,s-1)),g=l.within(h[i*this.stride],h[i*this.stride+1],d),m=[];for(const v of g){const _=v*this.stride;h[_+4]===e&&m.push(h[_+5]>1?U_(h,_,this.clusterProps):Cu(this.points[h[_+3]]))}if(m.length===0)throw o;return m}getLeaves(e,i,s){const o=[];return this.appendLeaves(o,e,i=i||10,s=s||0,0),o}getTile(e,i,s){const o=this.trees[this.limitZoom(e)];if(!o)return null;const l=Math.pow(2,e),{extent:h,radius:d}=this.options,g=d/h,m=(s-g)/l,v=(s+1+g)/l,_={transformed:!0,features:[],source:null,x:i,y:s,z:e};return this.addTileFeatures(o.range((i-g)/l,m,(i+1+g)/l,v),o.flatData,i,s,l,_),i===0&&this.addTileFeatures(o.range(1-g/l,m,1,v),o.flatData,l,s,l,_),i===l-1&&this.addTileFeatures(o.range(0,m,g/l,v),o.flatData,-1,s,l,_),_}getClusterExpansionZoom(e){return this.getOriginZoom(e)}appendLeaves(e,i,s,o,l){const h=this.getChildren(i);for(const d of h){const g=d.properties;if(g?.cluster?l+g.point_count<=o?l+=g.point_count:l=this.appendLeaves(e,g.cluster_id,s,o,l):l<o?l++:e.push(d),e.length===s)break}return l}createTree(e){const i=new Iu(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let s=0;s<e.length;s+=this.stride)i.add(e[s],e[s+1]);return i.finish(),i.flatData=e,i.data=null,i}addTileFeatures(e,i,s,o,l,h){for(const d of e){const g=d*this.stride,m=i[g+5]>1;let v,_,T;if(m)v=Kh(i,g,this.clusterProps),_=i[g],T=i[g+1];else{const M=this.points[i[g+3]];v=M.tags,[_,T]=M.geometry}const x={type:1,geometry:[[Math.round(this.options.extent*(_*l-s)),Math.round(this.options.extent*(T*l-o))]],tags:v};let I;I=m||this.options.generateId?i[g+3]:this.points[i[g+3]].id,I!==void 0&&(x.id=I),h.features.push(x)}}limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}cluster(e,i){const{radius:s,extent:o,reduce:l,minPoints:h}=this.options,d=s/(o*Math.pow(2,i)),g=e.flatData,m=[],v=this.stride;for(let _=0;_<g.length;_+=v){if(g[_+2]<=i)continue;g[_+2]=i;const T=g[_],x=g[_+1],I=e.within(g[_],g[_+1],d),M=g[_+5];let D=M;for(const k of I){const O=k*v;g[O+2]>i&&(D+=g[O+5])}if(D>M&&D>=h){let k,O=T*M,B=x*M,N=-1;const $=(_/v<<5)+(i+1)+this.points.length;for(const W of I){const ie=W*v;if(g[ie+2]<=i)continue;g[ie+2]=i;const ne=g[ie+5];O+=g[ie]*ne,B+=g[ie+1]*ne,g[ie+4]=$,l&&(k||(k=this.map(g,_,!0),N=this.clusterProps.length,this.clusterProps.push(k)),l(k,this.map(g,ie)))}g[_+4]=$,m.push(O/D,B/D,1/0,$,-1,D),l&&m.push(N)}else{for(let k=0;k<v;k++)m.push(g[_+k]);if(D>1)for(const k of I){const O=k*v;if(!(g[O+2]<=i)){g[O+2]=i;for(let B=0;B<v;B++)m.push(g[O+B])}}}}return m}getOriginId(e){return e-this.points.length>>5}getOriginZoom(e){return(e-this.points.length)%32}map(e,i,s){if(e[i+5]>1){const h=this.clusterProps[e[i+6]];return s?Object.assign({},h):h}const o=this.points[e[i+3]].tags,l=this.options.map(o);return s&&l===o?Object.assign({},l):l}}function N_(r,e,i){return{id:r[e+3],type:"Point",tags:Kh(r,e,i),geometry:[r[e],r[e+1]]}}function U_(r,e,i){return{type:"Feature",id:r[e+3],properties:Kh(r,e,i),geometry:{type:"Point",coordinates:[$p(r[e]),Gp(r[e+1])]}}}function Kh(r,e,i){const s=r[e+5],o=s>=1e4?`${Math.round(s/1e3)}
2k`:s>=1e3?Math.round(s/100)/10+"k":s,l=r[e+6],h=l===-1?{}:Object.assign({},i[l]);return Object.assign(h,{cluster:!0,cluster_id:r[e+3],point_count:s,point_count_abbreviated:o})}const Jh="geojsonvt_clip_start",Qh="geojsonvt_clip_end";function Xp(r,e,i,s,o){const l=e===o.maxZoom?0:o.tolerance/((1<<e)*o.extent),h={transformed:!1,features:[],source:null,x:i,y:s,z:e,minX:2,minY:1,maxX:-1,maxY:0,numPoints:0,numSimplified:0,numFeatures:r.length};for(const d of r)$_(h,d,l,o);return h}function $_(r,e,i,s){switch(r.minX=Math.min(r.minX,e.minX),r.minY=Math.min(r.minY,e.minY),r.maxX=Math.max(r.maxX,e.maxX),r.maxY=Math.max(r.maxY,e.maxY),e.type){case"Point":case"MultiPoint":(function(o,l){const h=[];for(let g=0;g<l.geometry.length;g+=3)h.push(l.geometry[g],l.geometry[g+1]),o.numPoints++,o.numSimplified++;if(!h.length)return;const d={type:1,tags:l.tags||null,geometry:h};l.id!==null&&(d.id=l.id),o.features.push(d)})(r,e);return;case"LineString":(function(o,l,h,d){const g=[];if(ed(g,l.geometry,o,h,!1,!1),!g.length)return;let m=l.tags||null;if(d.lineMetrics){m={};for(const _ in l.tags)m[_]=l.tags[_];m[Jh]=l.geometry.start/l.geometry.size,m[Qh]=l.geometry.end/l.geometry.size}const v={type:2,tags:m,geometry:g};l.id!==null&&(v.id=l.id),o.features.push(v)})(r,e,i,s);return;case"MultiLineString":case"Polygon":(function(o,l,h){const d=[];for(let m=0;m<l.geometry.length;m++)ed(d,l.geometry[m],o,h,l.type==="Polygon",m===0);if(!d.length)return;const g={type:l.type==="Polygon"?3:2,tags:l.tags||null,geometry:d};l.id!==null&&(g.id=l.id),o.features.push(g)})(r,e,i);return;case"MultiPolygon":(function(o,l,h){const d=[];for(let m=0;m<l.geometry.length;m++){const v=l.geometry[m];for(let _=0;_<v.length;_++)ed(d,v[_],o,h,!0,_===0)}if(!d.length)return;const g={type:3,tags:l.tags||null,geometry:d};l.id!==null&&(g.id=l.id),o.features.push(g)})(r,e,i);return}}function ed(r,e,i,s,o,l){const h=s*s;if(s>0&&e.size<(o?h:s))return void(i.numPoints+=e.length/3);const d=[];for(let g=0;g<e.length;g+=3)(s===0||e[g+2]>h)&&(i.numSimplified++,d.push(e[g],e[g+1])),i.numPoints++;o&&(function(g,m){let v=0;for(let _=0,T=g.length,x=T-2;_<T;x=_,_+=2)v+=(g[_]-g[x])*(g[_+1]+g[x+1]);if(v>0===m)for(let _=0,T=g.length;_<T/2;_+=2){const x=g[_],I=g[_+1];g[_]=g[T-2-_],g[_+1]=g[T-1-_],g[T-2-_]=x,g[T-1-_]=I}})(d,l),r.push(d)}function Yp(r,e){if(r.transformed)return r;const i=1<<r.z,s=r.x,o=r.y;for(const l of r.features)l.type===1?G_(l,e,i,s,o):q_(l,e,i,s,o);return r.transformed=!0,r}function G_(r,e,i,s,o){const l=r,h=r.geometry,d=[];for(let g=0;g<h.length;g+=2)d.push(Kp(h[g],h[g+1],e,i,s,o));return l.geometry=d,l}function q_(r,e,i,s,o){const l=r,h=r.geometry,d=[];for(const g of h){const m=[];for(let v=0;v<g.length;v+=2)m.push(Kp(g[v],g[v+1],e,i,s,o));d.push(m)}return l.geometry=d,l}function Kp(r,e,i,s,o,l){return[Math.round(i*(r*s-o)),Math.round(i*(e*s-l))]}class Z_{constructor(e){this.options=e,this.stats={},this.total=0,this.tiles={},this.tileCoords=[],this.stats={},this.total=0}initialize(e){this.splitTile(e,0,0,0),this.options.debug&&(e.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(e,i,s){s.debug>1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(i),s.debug>1&&console.timeEnd("invalidating");const[o,l,h]=[0,0,0],d=Xp(e,o,l,h,s);d.source=e;const g=Au(o,l,h);if(this.tiles[g]=d,this.tileCoords.push({z:o,x:l,y:h,id:g}),s.debug){const m=`z${o}`;this.stats[m]=(this.stats[m]||0)+1,this.total++}}getClusterExpansionZoom(e){return null}getChildren(e){return null}getLeaves(e,i,s){return null}getTile(e,i,s){const{extent:o,debug:l}=this.options,h=1<<e,d=Au(e,i=i+h&h-1,s);if(this.tiles[d])return Yp(this.tiles[d],o);l>1&&console.log("drilling down to z%d-%d-%d",e,i,s);let g,m=e,v=i,_=s;for(;!g&&m>0;)m--,v>>=1,_>>=1,g=this.tiles[Au(m,v,_)];return g?.source?(l>1&&(console.log("found parent tile z%d-%d-%d",m,v,_),console.time("drilling down")),this.splitTile(g.source,m,v,_,e,i,s),l>1&&console.timeEnd("drilling down"),this.tiles[d]?Yp(this.tiles[d],o):null):null}splitTile(e,i,s,o,l,h,d){const g=[e,i,s,o],m=this.options,v=m.debug;for(;g.length;){o=g.pop(),s=g.pop(),i=g.pop(),e=g.pop();const _=1<<i,T=Au(i,s,o);let x=this.tiles[T];if(!x&&(v>1&&console.time("creation"),x=this.tiles[T]=Xp(e,i,s,o,m),this.tileCoords.push({z:i,x:s,y:o,id:T}),v)){v>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",i,s,o,x.numFeatures,x.numPoints,x.numSimplified),console.timeEnd("creation"));const ne=`z${i}`;this.stats[ne]=(this.stats[ne]||0)+1,this.total++}if(x.source=e,l==null){if(i===m.indexMaxZoom||x.numPoints<=m.indexMaxPoints)continue}else{if(i===m.maxZoom||i===l)continue;if(l!=null){const ne=l-i;if(s!==h>>ne||o!==d>>ne)continue}}if(x.source=null,!e.length)continue;v>1&&console.time("clipping");const I=.5*m.buffer/m.extent,M=.5-I,D=.5+I,k=1+I;let O=null,B=null,N=null,$=null;const W=Fn(e,_,s-I,s+D,Ii.X,x.minX,x.maxX,m),ie=Fn(e,_,s+M,s+k,Ii.X,x.minX,x.maxX,m);W&&(O=Fn(W,_,o-I,o+D,Ii.Y,x.minY,x.maxY,m),B=Fn(W,_,o+M,o+k,Ii.Y,x.minY,x.maxY,m)),ie&&(N=Fn(ie,_,o-I,o+D,Ii.Y,x.minY,x.maxY,m),$=Fn(ie,_,o+M,o+k,Ii.Y,x.minY,x.maxY,m)),v>
21&&console.timeEnd("clipping"),g.push(O||[],i+1,2*s,2*o),g.push(B||[],i+1,2*s,2*o+1),g.push(N||[],i+1,2*s+1,2*o),g.push($||[],i+1,2*s+1,2*o+1)}}invalidateTiles(e){if(!e.length)return;const i=this.options,{debug:s}=i;let o=1/0,l=-1/0,h=1/0,d=-1/0;for(const v of e)o=Math.min(o,v.minX),l=Math.max(l,v.maxX),h=Math.min(h,v.minY),d=Math.max(d,v.maxY);const g=i.buffer/i.extent,m=new Set;for(const v in this.tiles){const _=this.tiles[v],T=1<<_.z,x=(_.x-g)/T,I=(_.x+1+g)/T,M=(_.y-g)/T,D=(_.y+1+g)/T;if(l<x||o>=I||d<M||h>=D)continue;let k=!1;for(const O of e)if(O.maxX>=x&&O.minX<I&&O.maxY>=M&&O.minY<D){k=!0;break}if(k){if(s){s>1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",_.z,_.x,_.y,_.numFeatures,_.numPoints,_.numSimplified);const O=`z${_.z}`;this.stats[O]=(this.stats[O]||0)-1,this.total--}delete this.tiles[v],m.add(v)}}m.size&&(this.tileCoords=this.tileCoords.filter((v=>!m.has(v.id))))}}function Au(r,e,i){return 32*((1<<r)*i+e)+r}const W_={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,updateable:!1,cluster:!1,clusterOptions:Yh,debug:0},{members:H_}=Zt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:X_}=Zt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),Y_=Math.cos(Math.PI/180*37.5),Jp=Math.pow(2,14)/.5;class td{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((i=>i.id)),this.index=e.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach((i=>{this.gradients[i.id]={}})),this.layoutVertexArray=new Q,this.layoutVertexArray2=new te,this.indexArray=new Se,this.programConfigurations=new Ln(e.layers,e.zoom),this.segments=new je,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter((i=>i.isStateDependent())).map((i=>i.id))}populate(e,i,s){this.hasDependencies=wu("line",this.layers,i)||this.hasLineDasharray(this.layers);const o=this.layers[0].layout.get("line-sort-key"),l=!o.isConstant(),h=[];for(const{feature:d,id:g,index:m,sourceLayerIndex:v}of e){const _=this.layers[0]._featureFilter.needGeometry,T=Qr(d,_);if(!this.layers[0]._featureFilter.filter(new vt(this.zoom),T,s))continue;const x=l?o.evaluate(T,{},s):void 0,I={id:g,properties:d.properties,type:d.type,sourceLayerIndex:v,index:m,geometry:_?T.geometry:Jr(d),patterns:{},dashes:{},sortKey:x};h.push(I)}l&&h.sort(((d,g)=>d.sortKey-g.sortKey));for(const d of h){const{geometry:g,index:m,sourceLayerIndex:v}=d;this.hasDependencies?(wu("line",this.layers,i)?Lh("line",this.layers,d,{zoom:this.zoom},i):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,d,this.zoom,i),this.patternFeatures.push(d)):this.addFeature(d,g,m,s,{},{},i.subdivisionGranularity),i.featureIndex.insert(e[m].feature,g,m,v,this.index)}}update(e,i,s,o){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,i,this.stateDependentLayers,{imagePositions:s,dashPositions:o})}addFeatures(e,i,s,o){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,i,s,o,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,X_)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,H_),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.prototype.hasOwnProperty.call(e.properties,Jh)&&Object.prototype.hasOwnProperty.call(e.properties,Qh))return{start:+e.properties[Jh],end:+e.properties[Qh]}}addFeature(e,i,s,o,l,h,d){const g=this.layers[0].layout,m=g.get("line-join").evaluate(e,{}),v=g.get("line-cap").evaluate(e,{}),_=g.get("line-miter-limit").evaluate(e,{}),T=g.get("line-round-limit").evaluate(e,{});this.lineClips=this.lineFeatureClips(e);for(const x of i)this.addLine(x,e,m,v,_,T,o,d);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,s,{imagePositions:l,dashPositions:h,canonical:o})}addLine(e,i,s,o,l,h,d,g){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,e=fo(e,d?g.line.getGranularityForZoomLevel(d.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let B=0;B<e.length-1;B++)this.totalDistance+=e[B].dist(e[B+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const m=tc.types[i.type]==="Polygon";let v=e.length;for(;v>=2&&e[v-1].equals(e[v-2]);)v--;let _=0;for(;_<v-1&&e[_].equals(e[_+1]);)_++;if(v<(m?3:2))return;s==="bevel"&&(l=1.05);const T=this.overscaling<=16?122880/(512*this.overscaling):0,x=this.segments.prepareSegment(10*v,this.layoutVertexArray,this.indexArray);let I,M,D,k,O;this.e1=this.e2=-1,m&&(I=e[v-2],O=e[_].sub(I)._unit()._perp());for(let B=_;B<v;B++){if(D=B===v-1?m?e[_+1]:void 0:e[B+1],D&&e[B].equals(D))continue;O&&(k=O),I&&(M=I),I=e[B],O=D?D.sub(I)._unit()._perp():k,k=k||O;let N=k.add(O);N.x===0&&N.y===0||N._unit();const $=k.x*O.x+k.y*O.y,W=N.x*O.x+N.y*O.y,ie=W!==0?1/W:1/0,ne=2*Math.sqrt(2-2*W),ae=W<Y_&&M&&D,ue=k.x*O.y-k.y*O.x>0;if(ae&&B>_){const _e=I.dist(M);if(_e>
vendor: 6,014 bytes, line 2
22*T){const de=I.sub(I.sub(M)._mult(T/_e)._round());this.updateDistance(M,de),this.addCurrentVertex(de,k,0,0,x),M=de}}const ye=M&&D;let ge=ye?s:m?"butt":o;if(ye&&ge==="round"&&(ie<h?ge="miter":ie<=2&&(ge="fakeround")),ge==="miter"&&ie>l&&(ge="bevel"),ge==="bevel"&&(ie>2&&(ge="flipbevel"),ie<l&&(ge="miter")),M&&this.updateDistance(M,I),ge==="miter")N._mult(ie),this.addCurrentVertex(I,N,0,0,x);else if(ge==="flipbevel"){if(ie>100)N=O.mult(-1);else{const _e=ie*k.add(O).mag()/k.sub(O).mag();N._perp()._mult(_e*(ue?-1:1))}this.addCurrentVertex(I,N,0,0,x),this.addCurrentVertex(I,N.mult(-1),0,0,x)}else if(ge==="bevel"||ge==="fakeround"){const _e=-Math.sqrt(ie*ie-1),de=ue?_e:0,Ie=ue?0:_e;if(M&&this.addCurrentVertex(I,k,de,Ie,x),ge==="fakeround"){const Fe=Math.round(180*ne/Math.PI/20);for(let ke=1;ke<Fe;ke++){let Pe=ke/Fe;if(Pe!==.5){const lt=Pe-.5;Pe+=Pe*lt*(Pe-1)*((1.0904+$*($*(3.55645-1.43519*$)-3.2452))*lt*lt+(.848013+$*(.215638*$-1.06021)))}const qe=O.sub(k)._mult(Pe)._add(k)._unit()._mult(ue?-1:1);this.addHalfVertex(I,qe.x,qe.y,!1,ue,0,x)}}D&&this.addCurrentVertex(I,O,-de,-Ie,x)}else if(ge==="butt")this.addCurrentVertex(I,N,0,0,x);else if(ge==="square"){const _e=M?1:-1;this.addCurrentVertex(I,N,_e,_e,x)}else ge==="round"&&(M&&(this.addCurrentVertex(I,k,0,0,x),this.addCurrentVertex(I,k,1,1,x,!0)),D&&(this.addCurrentVertex(I,O,-1,-1,x,!0),this.addCurrentVertex(I,O,0,0,x)));if(ae&&B<v-1){const _e=I.dist(D);if(_e>2*T){const de=I.add(D.sub(I)._mult(T/_e)._round());this.updateDistance(I,de),this.addCurrentVertex(de,O,0,0,x),I=de}}}}addCurrentVertex(e,i,s,o,l,h=!1){const d=i.y*o-i.x,g=-i.y-i.x*o;this.addHalfVertex(e,i.x+i.y*s,i.y-i.x*s,h,!1,s,l),this.addHalfVertex(e,d,g,h,!0,-o,l),this.distance>Jp/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(e,i,s,o,l,h))}addHalfVertex({x:e,y:i},s,o,l,h,d,g){const m=.5*(this.lineClips?this.scaledDistance*(Jp-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(l?1:0),(i<<1)+(h?1:0),Math.round(63*s)+128,Math.round(63*o)+128,1+(d===0?0:d<0?-1:1)|(63&m)<<2,m>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const v=g.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,v,this.e2),g.primitiveLength++),h?this.e2=v:this.e1=v}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}hasLineDasharray(e){for(const i of e){const s=i.paint.get("line-dasharray");if(s&&!s.isConstant())return!0}return!1}addLineDashDependencies(e,i,s,o){for(const l of e){const h=l.paint.get("line-dasharray");if(!h||h.value.kind==="constant")continue;const d=l.layout.get("line-cap").evaluate(i,{})==="round",g={dasharray:h.value.evaluate({zoom:s-1},i,{}),round:d},m={dasharray:h.value.evaluate({zoom:s},i,{}),round:d},v={dasharray:h.value.evaluate({zoom:s+1},i,{}),round:d},_=`${g.dasharray.join(",")},${g.round}`,T=`${m.dasharray.join(",")},${m.round}`,x=`${v.dasharray.join(",")},${v.round}`;o.dashDependencies[_]=g,o.dashDependencies[T]=m,o.dashDependencies[x]=v,i.dashes[l.id]={min:_,mid:T,max:x}}}}let Qp,ef;Re("LineBucket",td,{omit:["layers","patternFeatures"]});var tf={get paint(){return ef=ef||new xi({"line-opacity":new $e(ve.paint_line["line-opacity"]),"line-color":new $e(ve.paint_line["line-color"]),"line-translate":new Ve(ve.paint_line["line-translate"]),"line-translate-anchor":new Ve(ve.paint_line["line-translate-anchor"]),"line-width":new $e(ve.paint_line["line-width"]),"line-gap-width":new $e(ve.paint_line["line-gap-width"]),"line-offset":new $e(ve.paint_line["line-offset"]),"line-blur":new $e(ve.paint_line["line-blur"]),"line-dasharray":new Cn(ve.paint_line["line-dasharray"]),"line-pattern":new Cn(ve.paint_line["line-pattern"]),"line-gradient":new aa(ve.paint_line["line-gradient"])})},get layout(){return Qp=Qp||new xi({"line-cap":new $e(ve.layout_line["line-cap"]),"line-join":new $e(ve.layout_line["line-join"]),"line-miter-limit":new $e(ve.layout_line["line-miter-limit"]),"line-round-limit":new $e(ve.layout_line["line-round-limit"]),"line-sort-key":new $e(ve.layout_line["line-sort-key"])})}};class K_ extends $e{possiblyEvaluate(e,i){return i=new vt(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,zoomHistory:i.zoomHistory,transition:i.transition}),super.possiblyEvaluate(e,i)}evaluate(e,i,s,o){return i=Bi({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,s,o)}}let Du;class J_ extends pr{constructor(e,i){super(e,tf,i),this.gradientVersion=0,Du||(Du=new K_(tf.paint.properties["line-width"].specification),Du.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){const i=this.gradientExpression();this.stepInterpolant=!!(function(s){return s._styleExpression!==void 0})(i)&&i._styleExpression.expression instanceof gn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,i){super.recalculate(e,i),this.paint._values["line-floorwidth"]=Du.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new td(e)}queryRadius(e){const i=e,s=rf(_a("line-width",this,i),_a("line-gap-width",this,i)),o=_a("line-offset",this,i);return s/2+Math.abs(o)+xu(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:e,feature:i,featureState:s,geometry:o,transform:l,pixelsToTileUnits:h}){const d=bu(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-l.bearingInRadians,h),g=h/2*rf(this.paint.get("line-width").evaluate(i,s),this.paint.get("line-gap-width").evaluate(i,s)),m=this.paint.get("line-offset").evaluate(i,s);return m&&(o=(function(v,_){const T=[];for(let x=0;x<v.length;x++){const I=qg(v[x]),M=[];for(let D=0;D<I.length;
2D++){const k=I[D],O=I[D-1],B=I[D+1],N=D===0?new H(0,0):k.sub(O)._unit()._perp(),$=D===I.length-1?new H(0,0):B.sub(k)._unit()._perp(),W=N._add($)._unit(),ie=W.x*$.x+W.y*$.y;ie!==0&&W._mult(1/ie),M.push(W._mult(_)._add(k))}T.push(M)}return T})(o,m*h)),(function(v,_,T){for(let x=0;x<_.length;x++){const I=_[x];if(v.length>=3){for(let M=0;M<I.length;M++)if(ga(v,I[M]))return!0}if(Ug(v,I,T))return!0}return!1})(d,o,g)}isTileClipped(){return!0}}function rf(r,e){return e>0?e+2*r:r}const Q_=Zt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),ey=Zt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Zt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const ty=Zt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Zt([{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"}]);const nf=Zt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),iy=Zt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function ry(r,e,i){return r.sections.forEach((s=>{s.text=(function(o,l,h){const d=l.layout.get("text-transform").evaluate(h,{});return d==="uppercase"?o=o.toLocaleUpperCase():d==="lowercase"&&(o=o.toLocaleLowerCase()),Lr.applyArabicShaping&&(o=Lr.applyArabicShaping(o)),o})(s.text,e,i)})),r}Zt([{name:"triangle",components:3,type:"Uint16"}]),Zt([{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"}]),Zt([{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"}]),Zt([{type:"Float32",name:"offsetX"}]),Zt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Zt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var li=24;const sc={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â¯":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹"},ny={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},sy={40:!0};function sf(r,e,i,s,o,l){if("fontStack"in e){const h=i[e.fontStack],d=h&&h[r];return d?d.metrics.advance*e.scale+o:0}{const h=s[e.imageName];return h?h.displaySize[0]*e.scale*li/l+o:0}}function of(r,e,i,s){const o=Math.pow(r-e,2);return s?r<e?o/2:2*o:o+Math.abs(i)*i}function oy(r,e,i){let s=0;return r===10&&(s-=1e4),i&&(s+=150),r!==40&&r!==65288||(s+=50),e!==41&&e!==65289||(s+=50),s}function af(r,e,i,s,o,l){let h=null,d=of(e,i,o,l);for(const g of s){const m=of(e-g.x,i,o,l)+g.badness;
2m<=d&&(h=g,d=m)}return{index:r,x:e,priorBreak:h,badness:d}}function lf(r){return r?lf(r.priorBreak).concat(r.index):[]}class Sa{constructor(e="",i=[],s=[]){this.text=e,this.sections=i,this.sectionIndex=s,this.imageSectionID=null}static fromFeature(e,i){const s=new Sa;for(let o=0;o<e.sections.length;o++){const l=e.sections[o];l.image?s.addImageSection(l):s.addTextSection(l,i)}return s}length(){return[...this.text].length}getSection(e){return this.sections[this.sectionIndex[e]]}getSectionIndex(e){return this.sectionIndex[e]}verticalizePunctuation(){this.text=(function(e){let i="",s={premature:!0,value:void 0};const o=e[Symbol.iterator]();let l=o.next();const h=e[Symbol.iterator]();h.next();let d=h.next();for(;!l.done;)i+=!d.done&&Bl(d.value.codePointAt(0))&&!sc[d.value]||!s.premature&&Bl(s.value.codePointAt(0))&&!sc[s.value]||!sc[l.value]?l.value:sc[l.value],s={value:l.value,premature:!1},l=o.next(),d=h.next();return i})(this.text)}hasZeroWidthSpaces(){return this.text.includes("â")}trim(){const e=this.text.match(/^\s*/),i=e?e[0].length:0,s=this.text.match(/\S\s*$/),o=s?s[0].length-1:0;this.text=this.text.substring(i,this.text.length-o),this.sectionIndex=this.sectionIndex.slice(i,this.sectionIndex.length-o)}substring(e,i){const s=[...this.text].slice(e,i).join(""),o=this.sectionIndex.slice(e,i);return new Sa(s,this.sections,o)}toCodeUnitIndex(e){return[...this.text].slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce(((e,i)=>Math.max(e,this.sections[i].scale)),0)}getMaxImageSize(e){let i=0,s=0;for(let o=0;o<this.length();o++){const l=this.getSection(o);if("imageName"in l){const h=e[l.imageName];if(!h)continue;const d=h.displaySize;i=Math.max(i,d[0]),s=Math.max(s,d[1])}}return{maxImageWidth:i,maxImageHeight:s}}addTextSection(e,i){this.text+=e.text,this.sections.push({scale:e.scale||1,verticalAlign:e.verticalAlign||"bottom",fontStack:e.fontStack||i});const s=this.sections.length-1;this.sectionIndex.push(...[...e.text].map((()=>s)))}addImageSection(e){const i=e.image?e.image.name:"";if(i.length===0)return void et("Can't add FormattedSection with an empty image.");const s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCharCode(s),this.sections.push({scale:1,verticalAlign:e.verticalAlign||"bottom",imageName:i}),this.sectionIndex.push(this.sections.length-1)):et("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,i,s,o,l){const h=[],d=this.determineAverageLineWidth(e,i,s,o,l),g=this.hasZeroWidthSpaces();let m=0,v=0;const _=this.text[Symbol.iterator]();let T=_.next();const x=this.text[Symbol.iterator]();x.next();let I=x.next();const M=this.text[Symbol.iterator]();M.next(),M.next();let D=M.next();for(;!T.done;){const k=this.getSection(v),O=T.value.codePointAt(0);if(no(O)||(m+=sf(O,k,s,o,e,l)),!I.done){const B=bh(O),N=I.value.codePointAt(0);(ny[O]||B||"imageName"in k||!D.done&&sy[N])&&h.push(af(v+1,m,d,h,oy(O,N,B&&g),!1))}v++,T=_.next(),I=x.next(),D=M.next()}return lf(af(this.length(),m,d,h,0,!0))}determineAverageLineWidth(e,i,s,o,l){let h=0,d=0;for(const g of this.text){const m=this.getSection(d);h+=sf(g.codePointAt(0),m,s,o,e,l),d++}return h/Math.max(1,Math.ceil(h/i))}}const id=4294967296,cf=1/id,uf=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class ku{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,i,s=this.length){for(;this.pos<s;){const o=this.readVarint(),l=o>>3,h=this.pos;this.type=7&o,e(l,i,this),this.pos===h&&this.skip(o)}return i}readMessage(e,i){return this.readFields(e,i,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*id;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*id;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const i=this.buf;let s,o;return o=i[this.pos++],s=127&o,o<128?s:(o=i[this.pos++],s|=(127&o)<<7,o<128?s:(o=i[this.pos++],s|=(127&o)<<14,o<128?s:(o=i[this.pos++],s|=(127&o)<<21,o<128?s:(o=i[this.pos],s|=(15&o)<<28,(function(l,h,d){const g=d.buf;let m,v;if(v=g[d.pos++],m=(112&v)>>4,v<128||(v=g[d.pos++],m|=(127&v)<<3,v<128)||(v=g[d.pos++],m|=(127&v)<<10,v<128)||(v=g[d.pos++],m|=(127&v)<<17,v<128)||(v=g[d.pos++],m|=(127&v)<<24,v<128)||(v=g[d.pos++],m|=(1&v)<<31,v<128))return Pa(l,m,h);throw new Error("Expected varint not more than 10 bytes")})(s,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,i=this.pos;return this.pos=e,e-i>=12&&uf?uf.decode(this.buf.subarray(i,e)):(function(s,o,l){let h="",d=o;for(;d<l;){const g=s[d];let m,v,_,T=null,x=g>239?4:g>223?3:g>191?2:1;if(d+x>l)break;x===1?g<128&&(T=g):x===2?(m=s[d+1],(192&m)==128&&(T=(31&g)<<6|63&m,T<=127&&(T=null))):x===3?(m=s[d+1],v=s[d+2],(192&m)==128&&(192&v)==128&&(T=(15&g)<<12|(63&m)<<6|63&v,(T<=2047||T>=55296&&T<=57343)&&(T=null))):x===4&&(m=s[d+1],v=s[d+2],_=s[d+3],(192&m)==128&&(192&v)==128&&(192&_)==128&&(T=(15&g)<<18|(63&m)<<12|(63&v)<<6|63&_,(T<=65535||T>=1114112)&&(T=null))),T===null?(T=65533,x=1):T>65535&&(T-=65536,h+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),h+=String.fromCharCode(T),d+=x}return h})(this.buf,i,e)}readBytes(){const e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i}readPackedVarint(e=[],i){const s=this.readPackedEnd();for(;this.pos<s;)e.push(this.readVarint(i));return e}readPackedSVarint(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(e){const i=7&e;if(i===0)for(;this.buf[this.pos++]>127;);else if(i===2)this.pos=this.readVarint()+this.pos;else if(i===5)this.pos+=4;else{if(i!==1)throw new Error(`Unimplemented type: ${i}`);this.pos+=8}}writeTag(e,i){this.writeVarint(e<<3|i)}realloc(e){let i=this.length||16;for(;i<this.pos+e;)i*=2;if(i!==this.length){const s=new Uint8Array(i);s.set(this.buf),this.buf=s,this.dataView=new DataView(s.buffer),this.length=i}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}
vendor: 4,424 bytes, line 2
2writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*cf),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*cf),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?(function(i,s){let o,l;if(i>=0?(o=i%4294967296|0,l=i/4294967296|0):(o=~(-i%4294967296),l=~(-i/4294967296),4294967295^o?o=o+1|0:(o=0,l=l+1|0)),i>=18446744073709552e3||i<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),(function(h,d,g){g.buf[g.pos++]=127&h|128,h>>>=7,g.buf[g.pos++]=127&h|128,h>>>=7,g.buf[g.pos++]=127&h|128,h>>>=7,g.buf[g.pos++]=127&h|128,g.buf[g.pos]=127&(h>>>=7)})(o,0,s),(function(h,d){const g=(7&h)<<4;d.buf[d.pos++]|=g|((h>>>=3)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h|((h>>>=7)?128:0),h&&(d.buf[d.pos++]=127&h)))))})(l,s)})(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const i=this.pos;this.pos=(function(o,l,h){for(let d,g,m=0;m<l.length;m++){if(d=l.charCodeAt(m),d>55295&&d<57344){if(!g){d>56319||m+1===l.length?(o[h++]=239,o[h++]=191,o[h++]=189):g=d;continue}if(d<56320){o[h++]=239,o[h++]=191,o[h++]=189,g=d;continue}d=g-55296<<10|d-56320|65536,g=null}else g&&(o[h++]=239,o[h++]=191,o[h++]=189,g=null);d<128?o[h++]=d:(d<2048?o[h++]=d>>6|192:(d<65536?o[h++]=d>>12|224:(o[h++]=d>>18|240,o[h++]=d>>12&63|128),o[h++]=d>>6&63|128),o[h++]=63&d|128)}return h})(this.buf,e,this.pos);const s=this.pos-i;s>=128&&hf(i,s,this),this.pos=i-1,this.writeVarint(s),this.pos+=s}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const i=e.length;this.writeVarint(i),this.realloc(i);for(let s=0;s<i;s++)this.buf[this.pos++]=e[s]}writeRawMessage(e,i){this.pos++;const s=this.pos;e(i,this);const o=this.pos-s;o>=128&&hf(s,o,this),this.pos=s-1,this.writeVarint(o),this.pos+=o}writeMessage(e,i,s){this.writeTag(e,2),this.writeRawMessage(i,s)}writePackedVarint(e,i){i.length&&this.writeMessage(e,ay,i)}writePackedSVarint(e,i){i.length&&this.writeMessage(e,ly,i)}writePackedBoolean(e,i){i.length&&this.writeMessage(e,hy,i)}writePackedFloat(e,i){i.length&&this.writeMessage(e,cy,i)}writePackedDouble(e,i){i.length&&this.writeMessage(e,uy,i)}writePackedFixed32(e,i){i.length&&this.writeMessage(e,dy,i)}writePackedSFixed32(e,i){i.length&&this.writeMessage(e,py,i)}writePackedFixed64(e,i){i.length&&this.writeMessage(e,fy,i)}writePackedSFixed64(e,i){i.length&&this.writeMessage(e,my,i)}writeBytesField(e,i){this.writeTag(e,2),this.writeBytes(i)}writeFixed32Field(e,i){this.writeTag(e,5),this.writeFixed32(i)}writeSFixed32Field(e,i){this.writeTag(e,5),this.writeSFixed32(i)}writeFixed64Field(e,i){this.writeTag(e,1),this.writeFixed64(i)}writeSFixed64Field(e,i){this.writeTag(e,1),this.writeSFixed64(i)}writeVarintField(e,i){this.writeTag(e,0),this.writeVarint(i)}writeSVarintField(e,i){this.writeTag(e,0),this.writeSVarint(i)}writeStringField(e,i){this.writeTag(e,2),this.writeString(i)}writeFloatField(e,i){this.writeTag(e,5),this.writeFloat(i)}writeDoubleField(e,i){this.writeTag(e,1),this.writeDouble(i)}writeBooleanField(e,i){this.writeVarintField(e,+i)}}function Pa(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function hf(r,e,i){const s=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(s);for(let o=i.pos-1;o>=r;o--)i.buf[o+s]=i.buf[o]}function ay(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function ly(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function cy(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function uy(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function hy(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function dy(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function py(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function fy(r,e){for(let i=0;i<r.length;
2i++)e.writeFixed64(r[i])}function my(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}function gy(r,e,i){r===1&&i.readMessage(_y,e)}function _y(r,e,i){if(r===3){const{id:s,bitmap:o,width:l,height:h,left:d,top:g,advance:m}=i.readMessage(yy,{});e.push({id:s,bitmap:new Hl({width:l+6,height:h+6},o),metrics:{width:l,height:h,left:d,top:g,advance:m}})}}function yy(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}function df(r){let e=0,i=0;for(const h of r)e+=h.w*h.h,i=Math.max(i,h.w);r.sort(((h,d)=>d.h-h.h));const s=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let o=0,l=0;for(const h of r)for(let d=s.length-1;d>=0;d--){const g=s[d];if(!(h.w>g.w||h.h>g.h)){if(h.x=g.x,h.y=g.y,l=Math.max(l,h.y+h.h),o=Math.max(o,h.x+h.w),h.w===g.w&&h.h===g.h){const m=s.pop();m&&d<s.length&&(s[d]=m)}else h.h===g.h?(g.x+=h.w,g.w-=h.w):h.w===g.w?(g.y+=h.h,g.h-=h.h):(s.push({x:g.x+h.w,y:g.y,w:g.w-h.w,h:h.h}),g.y+=h.h,g.h-=h.h);break}}return{w:o,h:l,fill:e/(o*l)||0}}class rd{constructor(e,{pixelRatio:i,version:s,stretchX:o,stretchY:l,content:h,textFitWidth:d,textFitHeight:g}){this.paddedRect=e,this.pixelRatio=i,this.stretchX=o,this.stretchY=l,this.content=h,this.version=s,this.textFitWidth=d,this.textFitHeight=g}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]}}class pf{constructor(e,i){const s={},o={};this.haveRenderCallbacks=[];const l=[];this.addImages(e,s,l),this.addImages(i,o,l);const{w:h,h:d}=df(l),g=new Gi({width:h||1,height:d||1});for(const m in e){const v=e[m],_=s[m].paddedRect;Gi.copy(v.data,g,{x:0,y:0},{x:_.x+1,y:_.y+1},v.data)}for(const m in i){const v=i[m],_=o[m].paddedRect,T=_.x+1,x=_.y+1,I=v.data.width,M=v.data.height;Gi.copy(v.data,g,{x:0,y:0},{x:T,y:x},v.data),Gi.copy(v.data,g,{x:0,y:M-1},{x:T,y:x-1},{width:I,height:1}),Gi.copy(v.data,g,{x:0,y:0},{x:T,y:x+M},{width:I,height:1}),Gi.copy(v.data,g,{x:I-1,y:0},{x:T-1,y:x},{width:1,height:M}),Gi.copy(v.data,g,{x:0,y:0},{x:T+I,y:x},{width:1,height:M})}this.image=g,this.iconPositions=s,this.patternPositions=o}addImages(e,i,s){for(const o in e){const l=e[o],h={x:0,y:0,w:l.data.width+2,h:l.data.height+2};s.push(h),i[o]=new rd(h,l),l.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}patchUpdatedImages(e,i){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const s in e.updatedImages)this.patchUpdatedImage(this.iconPositions[s],e.getImage(s),i),this.patchUpdatedImage(this.patternPositions[s],e.getImage(s),i)}patchUpdatedImage(e,i,s){if(!e||!i||e.version===i.version)return;e.version=i.version;const[o,l]=e.tl;s.update(i.data,void 0,{x:o,y:l})}}var _s;function zu(r,e,i,s,o,l,h,d,g,m,v,_,T,x,I){const M=Sa.fromFeature(r,o);let D;_===E.aw.vertical&&M.verticalizePunctuation();let k=M.determineLineBreaks(m,l,e,s,x);const{processBidirectionalText:O,processStyledBidirectionalText:B}=Lr;if(O&&M.sections.length===1){D=[],k=k.map((ie=>M.toCodeUnitIndex(ie)));const W=O(M.toString(),k);for(const ie of W){const ne=[...ie].map((()=>0));D.push(new Sa(ie,M.sections,ne))}}else if(B){D=[],k=k.map((ae=>M.toCodeUnitIndex(ae)));let W=0;const ie=[];for(const ae of M.text)ie.push(...Array(ae.length).fill(M.sectionIndex[W])),W++;const ne=B(M.text,ie,k);for(const ae of ne){const ue=[];let ye="";for(const ge of ae[0])ue.push(ae[1][ye.length]),ye+=ge;D.push(new Sa(ae[0],M.sections,ue))}}else D=(function(W,ie){const ne=[];let ae=0;for(const ue of ie)ne.push(W.substring(ae,ue)),ae=ue;return ae<W.length()&&ne.push(W.substring(ae,W.length())),ne})(M,k);const N=[],$={positionedLines:N,text:M.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:_,iconsInText:!1,verticalizable:!1};return(function(W,ie,ne,ae,ue,ye,ge,_e,de,Ie,Fe,ke){let Pe=0,qe=0,lt=0,ut=0;const _t=_e==="right"?1:_e==="left"?0:.5,Si=li/ke;let jt=0;for(const kt of ue){kt.trim();const gi=kt.getMaxScale(),Ei={positionedGlyphs:[],lineOffset:0};W.positionedLines[jt]=Ei;const Ci=Ei.positionedGlyphs;let qi=0;if(!kt.length()){qe+=ye,++jt;continue}const Pi=vy(ae,kt,Si);let Zi=0;for(const hi of kt.text){const Ot=kt.getSection(Zi),ei=hi.codePointAt(0),Nt=xy(de,Fe,ei),di={glyph:ei,imageName:null,x:Pe,y:qe+-17,vertical:Nt,scale:1,fontStack:"",sectionIndex:kt.getSectionIndex(Zi),metrics:null,rect:null};let On;if("fontStack"in Ot){if(On=by(Ot,ei,Nt,Pi,ie,ne),!On)continue;di.fontStack=Ot.fontStack}else{if(W.iconsInText=!0,Ot.scale*=Si,On=wy(Ot,Nt,gi,Pi,ae),!On)continue;qi=Math.max(qi,On.imageOffset),di.imageName=Ot.imageName}const{rect:Vr,metrics:uc,baselineOffset:Ss}=On;di.y+=Ss,di.scale=Ot.scale,di.metrics=uc,di.rect=Vr,Ci.push(di),Nt?(W.verticalizable=!0,Pe+=("imageName"in Ot?uc.advance:li)*Ot.scale+Ie):Pe+=uc.advance*Ot.scale+Ie,Zi++}Ci.length!==0&&(lt=Math.max(Pe-Ie,lt),Ty(Ci,0,Ci.length-1,_t)),Pe=0,Ei.lineOffset=Math.max(qi,(gi-1)*li);const Ir=ye*gi+qi;qe+=Ir,ut=Math.max(Ir,ut),++jt}const{horizontalAlign:ni,verticalAlign:ui}=nd(ge);(function(kt,gi,Ei,Ci,qi,Pi,Zi,Ir,hi){const Ot=(gi-Ei)*qi;let ei=0;ei=Pi!==Zi?-Ir*Ci- -17:-Ci*hi*Zi+.5*Zi;
vendor: 24,364 bytes, line 2
2for(const Nt of kt)for(const di of Nt.positionedGlyphs)di.x+=Ot,di.y+=ei})(W.positionedLines,_t,ni,ui,lt,ut,ye,qe,ue.length),W.top+=-ui*qe,W.bottom=W.top+qe,W.left+=-ni*lt,W.right=W.left+lt})($,e,i,s,D,h,d,g,_,m,T,I),!(function(W){for(const ie of W)if(ie.positionedGlyphs.length!==0)return!1;return!0})(N)&&$}function nd(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function vy(r,e,i){const s=e.getMaxScale()*li,{maxImageWidth:o,maxImageHeight:l}=e.getMaxImageSize(r),h=Math.max(s,l*i);return{verticalLineContentWidth:Math.max(s,o*i),horizontalLineContentHeight:h}}function ff(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function xy(r,e,i){return!(r===E.aw.horizontal||!e&&!Ll(i)||e&&(no(i)||(s=i,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(s)))));var s}function by(r,e,i,s,o,l){const h=l[r.fontStack],d=(function(m,v,_,T){if(m&&m.rect)return m;const x=v[_.fontStack],I=x&&x[T];return I?{rect:null,metrics:I.metrics}:null})(h&&h[e],o,r,e);if(d===null)return null;let g;if(i)g=s.verticalLineContentWidth-r.scale*li;else{const m=ff(r.verticalAlign);g=(s.horizontalLineContentHeight-r.scale*li)*m}return{rect:d.rect,metrics:d.metrics,baselineOffset:g}}function wy(r,e,i,s,o){const l=o[r.imageName];if(!l)return null;const h=l.paddedRect,d=l.displaySize,g={width:d[0],height:d[1],left:1,top:-3,advance:e?d[1]:d[0]};let m;if(e)m=s.verticalLineContentWidth-d[1]*r.scale;else{const v=ff(r.verticalAlign);m=(s.horizontalLineContentHeight-d[1]*r.scale)*v}return{rect:h,metrics:g,baselineOffset:m,imageOffset:(e?d[0]:d[1])*r.scale-li*i}}function Ty(r,e,i,s){if(s===0)return;const o=r[i],l=(r[i].x+o.metrics.advance*o.scale)*s;for(let h=e;h<=i;h++)r[h].x-=l}function Sy(r,e,i){const{horizontalAlign:s,verticalAlign:o}=nd(i),l=e[0]-r.displaySize[0]*s,h=e[1]-r.displaySize[1]*o;return{image:r,top:h,bottom:h+r.displaySize[1],left:l,right:l+r.displaySize[0]}}function mf(r){var e,i;let s=r.left,o=r.top,l=r.right-s,h=r.bottom-o;const d=(e=r.image.textFitWidth)!==null&&e!==void 0?e:"stretchOrShrink",g=(i=r.image.textFitHeight)!==null&&i!==void 0?i:"stretchOrShrink",m=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(g==="proportional"){if(d==="stretchOnly"&&l/h<m||d==="proportional"){const v=Math.ceil(h*m);s*=v/l,l=v}}else if(d==="proportional"&&g==="stretchOnly"&&m!==0&&l/h>m){const v=Math.ceil(l/m);o*=v/h,h=v}return{x1:s,y1:o,x2:s+l,y2:o+h}}function gf(r,e,i,s,o,l){const h=r.image;let d;if(h.content){const D=h.content,k=h.pixelRatio||1;d=[D[0]/k,D[1]/k,h.displaySize[0]-D[2]/k,h.displaySize[1]-D[3]/k]}const g=e.left*l,m=e.right*l;let v,_,T,x;i==="width"||i==="both"?(x=o[0]+g-s[3],_=o[0]+m+s[1]):(x=o[0]+(g+m-h.displaySize[0])/2,_=x+h.displaySize[0]);const I=e.top*l,M=e.bottom*l;return i==="height"||i==="both"?(v=o[1]+I-s[0],T=o[1]+M+s[2]):(v=o[1]+(I+M-h.displaySize[1])/2,T=v+h.displaySize[1]),{image:h,top:v,right:_,bottom:T,left:x,collisionPadding:d}}Re("ImagePosition",rd),Re("ImageAtlas",pf),E.aw=void 0,(_s=E.aw||(E.aw={}))[_s.none=0]="none",_s[_s.horizontal=1]="horizontal",_s[_s.vertical=2]="vertical",_s[_s.horizontalOnly=3]="horizontalOnly";const Rn=128,ys=32640;function _f(r,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new vt(r+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:s,interpolationType:o}=i;let l=0;for(;l<s.length&&s[l]<=r;)l++;l=Math.max(0,l-1);let h=l;for(;h<s.length&&s[h]<r+1;)h++;h=Math.min(s.length-1,h);const d=s[l],g=s[h];return i.kind==="composite"?{kind:"composite",minZoom:d,maxZoom:g,interpolationType:o}:{kind:"camera",minZoom:d,maxZoom:g,minSize:i.evaluate(new vt(d)),maxSize:i.evaluate(new vt(g)),interpolationType:o}}}function sd(r,e,i){let s="never";const o=r.get(e);return o?s=o:r.get(i)&&(s="always"),s}const Py=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Lu(r,e,i,s,o,l,h,d,g,m,v,_,T){const x=d?Math.min(ys,Math.round(d[0])):0,I=d?Math.min(ys,Math.round(d[1])):0;r.emplaceBack(e,i,Math.round(32*s),Math.round(32*o),l,h,(x<<1)+(g?1:0),I,16*m,16*v,256*_,256*T)}function od(r,e,i){r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i),r.emplaceBack(e.x,e.y,i)}function Iy(r){for(const e of r.sections)if(wh(e.text))return!0;return!1}class ad{constructor(e){this.layoutVertexArray=new me,this.indexArray=new Se,this.programConfigurations=e,this.segments=new je,this.dynamicLayoutVertexArray=new pe,this.opacityVertexArray=new ce,this.hasVisibleVertices=!1,this.placedSymbolArray=new w}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(e,i,s,o){this.isEmpty()||(s&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Q_.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,ey.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Py,!0),this.opacityVertexBuffer.itemSize=1),(s||o)&&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())}}Re("SymbolBuffers",ad);class ld{constructor(e,i,s){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new s,this.segments=new je,this.collisionVertexArray=new Te}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,ty.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Re("CollisionBuffers",ld);class Ia{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map((h=>h.id)),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasDependencies=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=_f(this.zoom,i["text-size"]),this.iconSizeData=_f(this.zoom,i["icon-size"]);const s=this.layers[0].layout,o=s.get("symbol-sort-key"),l=s.get("symbol-z-order");this.canOverlap=sd(s,"text-overlap","text-allow-overlap")!=="never"||sd(s,"icon-overlap","icon-allow-overlap")!=="never"||s.get("text-ignore-placement")||s.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&!o.isConstant(),this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,s.get("symbol-placement")==="point"&&(this.writingModes=s.get("text-writing-mode").map((h=>E.aw[h]))),this.stateDependentLayerIds=this.layers.filter((h=>h.isStateDependent())).map((h=>h.id)),this.sourceID=e.sourceID}createArrays(){this.text=new ad(new Ln(this.layers,this.zoom,(e=>/^text/.test(e)))),this.icon=new ad(new Ln(this.layers,this.zoom,(e=>/^icon/.test(e)))),this.glyphOffsetArray=new C,this.lineVertexArray=new A,this.symbolInstances=new P,this.textAnchorOffsets=new V}calculateGlyphDependencies(e,i,s,o,l){for(const h of e)if(i[h.codePointAt(0)]=!0,(s||o)&&l){const d=sc[h];d&&(i[d.codePointAt(0)]=!0)}}populate(e,i,s){const o=this.layers[0],l=o.layout,h=l.get("text-font"),d=l.get("text-field"),g=l.get("icon-image"),m=(d.value.kind!=="constant"||d.value.value instanceof Gt&&!d.value.value.isEmpty()||d.value.value.toString().length>0)&&(h.value.kind!=="constant"||h.value.value.length>0),v=g.value.kind!=="constant"||!!g.value.value||Object.keys(g.parameters).length>0,_=l.get("symbol-sort-key");if(this.features=[],!m&&!v)return;const T=i.iconDependencies,x=i.glyphDependencies,I=i.availableImages,M=new vt(this.zoom);for(const{feature:D,id:k,index:O,sourceLayerIndex:B}of e){const N=o._featureFilter.needGeometry,$=Qr(D,N);if(!o._featureFilter.filter(M,$,s))continue;let W,ie;if(N||($.geometry=Jr(D)),m){const ae=o.getValueAndResolveTokens("text-field",$,s,I),ue=Gt.factory(ae),ye=this.hasRTLText=this.hasRTLText||Iy(ue);(!ye||Lr.getRTLTextPluginStatus()==="unavailable"||ye&&Lr.isParsed())&&(W=ry(ue,o,$))}if(v){const ae=o.getValueAndResolveTokens("icon-image",$,s,I);ie=ae instanceof yi?ae:yi.fromString(ae)}if(!W&&!ie)continue;const ne=this.sortFeaturesByKey?_.evaluate($,{},s):void 0;if(this.features.push({id:k,text:W,icon:ie,index:O,sourceLayerIndex:B,geometry:$.geometry,properties:D.properties,type:tc.types[D.type],sortKey:ne}),ie&&(T[ie.name]=!0),W){const ae=h.evaluate($,{},s).join(","),ue=l.get("text-rotation-alignment")!=="viewport"&&l.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(E.aw.vertical)>=0;for(const ye of W.sections)if(ye.image)T[ye.image.name]=!0;else{const ge=Fl(W.toString()),_e=ye.fontStack||ae,de=x[_e]=x[_e]||{};this.calculateGlyphDependencies(ye.text,de,ue,this.allowVerticalPlacement,ge)}}}l.get("symbol-placement")==="line"&&(this.features=(function(D){const k={},O={},B=[];let N=0;function $(ae){B.push(D[ae]),N++}function W(ae,ue,ye){const ge=O[ae];return delete O[ae],O[ue]=ge,B[ge].geometry[0].pop(),B[ge].geometry[0]=B[ge].geometry[0].concat(ye[0]),ge}function ie(ae,ue,ye){const ge=k[ue];return delete k[ue],k[ae]=ge,B[ge].geometry[0].shift(),B[ge].geometry[0]=ye[0].concat(B[ge].geometry[0]),ge}function ne(ae,ue,ye){const ge=ye?ue[0][ue[0].length-1]:ue[0][0];return`${ae}:${ge.x}:${ge.y}`}for(let ae=0;ae<D.length;ae++){const ue=D[ae],ye=ue.geometry,ge=ue.text?ue.text.toString():null;if(!ge){$(ae);continue}const _e=ne(ge,ye),de=ne(ge,ye,!0);if(_e in O&&de in k&&O[_e]!==k[de]){const Ie=ie(_e,de,ye),Fe=W(_e,de,B[Ie].geometry);delete k[_e],delete O[de],O[ne(ge,B[Fe].geometry,!0)]=Fe,B[Ie].geometry=null}else _e in O?W(_e,de,ye):de in k?ie(_e,de,ye):($(ae),k[_e]=N-1,O[de]=N-1)}return B.filter((ae=>ae.geometry))})(this.features)),this.sortFeaturesByKey&&this.features.sort(((D,k)=>D.sortKey-k.sortKey))}update(e,i,s){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:s}),this.icon.programConfigurations.updatePaintArrays(e,i,this.layers,{imagePositions:s}))}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,i){const s=this.lineVertexArray.length;if(e.segment!==void 0){let o=e.dist(i[e.segment+1]),l=e.dist(i[e.segment]);const h={};for(let d=e.segment+1;d<i.length;d++)h[d]={x:i[d].x,y:i[d].y,tileUnitDistanceFromAnchor:o},d<i.length-1&&(o+=i[d+1].dist(i[d]));for(let d=e.segment||0;d>=0;d--)h[d]={x:i[d].x,y:i[d].y,tileUnitDistanceFromAnchor:l},d>0&&(l+=i[d-1].dist(i[d]));for(let d=0;d<i.length;d++){const g=h[d];this.lineVertexArray.emplaceBack(g.x,g.y,g.tileUnitDistanceFromAnchor)}}return{lineStartIndex:s,lineLength:this.lineVertexArray.length-s}}addSymbols(e,i,s,o,l,h,d,g,m,v,_,T){const x=e.indexArray,I=e.layoutVertexArray,M=e.segments.prepareSegment(4*i.length,I,x,this.canOverlap?h.sortKey:void 0),D=this.glyphOffsetArray.length,k=M.vertexLength,O=this.allowVerticalPlacement&&d===E.aw.vertical?Math.PI/2:0,B=h.text&&h.text.sections;for(let N=0;N<i.length;N++){const{tl:$,tr:W,bl:ie,br:ne,tex:ae,pixelOffsetTL:ue,pixelOffsetBR:ye,minFontScaleX:ge,minFontScaleY:_e,glyphOffset:de,isSDF:Ie,sectionIndex:Fe}=i[N],ke=M.vertexLength,Pe=de[1];Lu(I,g.x,g.y,$.x,Pe+$.y,ae.x,ae.y,s,Ie,ue.x,ue.y,ge,_e),Lu(I,g.x,g.y,W.x,Pe+W.y,ae.x+ae.w,ae.y,s,Ie,ye.x,ue.y,ge,_e),Lu(I,g.x,g.y,ie.x,Pe+ie.y,ae.x,ae.y+ae.h,s,Ie,ue.x,ye.y,ge,_e),Lu(I,g.x,g.y,ne.x,Pe+ne.y,ae.x+ae.w,ae.y+ae.h,s,Ie,ye.x,ye.y,ge,_e),od(e.dynamicLayoutVertexArray,g,O),x.emplaceBack(ke,ke+2,ke+1),x.emplaceBack(ke+1,ke+2,ke+3),M.vertexLength+=4,M.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(de[0]),N!==i.length-1&&Fe===i[N+1].sectionIndex||e.programConfigurations.populatePaintArrays(I.length,h,h.index,{imagePositions:{},canonical:T,formattedSection:B&&B[Fe]})}e.placedSymbolArray.emplaceBack(g.x,g.y,D,this.glyphOffsetArray.length-D,k,m,v,g.segment,s?s[0]:0,s?s[1]:0,o[0],o[1],d,0,!1,0,_)}_addCollisionDebugVertex(e,i,s,o,l,h){return i.emplaceBack(0,0),e.emplaceBack(s.x,s.y,o,l,Math.round(h.x),Math.round(h.y))}addCollisionDebugVertices(e,i,s,o,l,h,d){const g=l.segments.prepareSegment(4,l.layoutVertexArray,l.indexArray),m=g.vertexLength,v=l.layoutVertexArray,_=l.collisionVertexArray,T=d.anchorX,x=d.anchorY;this._addCollisionDebugVertex(v,_,h,T,x,new H(e,i)),this._addCollisionDebugVertex(v,_,h,T,x,new H(s,i)),this._addCollisionDebugVertex(v,_,h,T,x,new H(s,o)),this._addCollisionDebugVertex(v,_,h,T,x,new H(e,o)),g.vertexLength+=4;const I=l.indexArray;I.emplaceBack(m,m+1),I.emplaceBack(m+1,m+2),I.emplaceBack(m+2,m+3),I.emplaceBack(m+3,m),g.primitiveLength+=4}addDebugCollisionBoxes(e,i,s,o){for(let l=e;l<i;l++){const h=this.collisionBoxArray.get(l);this.addCollisionDebugVertices(h.x1,h.y1,h.x2,h.y2,o?this.textCollisionBox:this.iconCollisionBox,h.anchorPoint,s)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new ld(fe,nf.members,we),this.iconCollisionBox=new ld(fe,nf.members,we);for(let e=0;e<this.symbolInstances.length;e++){const i=this.symbolInstances.get(e);this.addDebugCollisionBoxes(i.textBoxStartIndex,i.textBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.verticalTextBoxStartIndex,i.verticalTextBoxEndIndex,i,!0),this.addDebugCollisionBoxes(i.iconBoxStartIndex,i.iconBoxEndIndex,i,!1),this.addDebugCollisionBoxes(i.verticalIconBoxStartIndex,i.verticalIconBoxEndIndex,i,!1)}}_deserializeCollisionBoxesForSymbol(e,i,s,o,l,h,d,g,m){const v={};for(let _=i;_<s;_++){const T=e.get(_);v.textBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.textFeatureIndex=T.featureIndex;break}for(let _=o;_<l;_++){const T=e.get(_);v.verticalTextBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.verticalTextFeatureIndex=T.featureIndex;break}for(let _=h;_<d;_++){const T=e.get(_);v.iconBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.iconFeatureIndex=T.featureIndex;break}for(let _=g;_<m;_++){const T=e.get(_);v.verticalIconBox={x1:T.x1,y1:T.y1,x2:T.x2,y2:T.y2,anchorPointX:T.anchorPointX,anchorPointY:T.anchorPointY},v.verticalIconFeatureIndex=T.featureIndex;break}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const s=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,s.textBoxStartIndex,s.textBoxEndIndex,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s.iconBoxStartIndex,s.iconBoxEndIndex,s.verticalIconBoxStartIndex,s.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,i){const s=e.placedSymbolArray.get(i),o=s.vertexStartIndex+4*s.numGlyphs;for(let l=s.vertexStartIndex;l<o;l+=4)e.indexArray.emplaceBack(l,l+2,l+1),e.indexArray.emplaceBack(l+1,l+2,l+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),s=Math.cos(e),o=[],l=[],h=[];for(let d=0;d<this.symbolInstances.length;++d){h.push(d);const g=this.symbolInstances.get(d);o.push(0|Math.round(i*g.anchorX+s*g.anchorY)),l.push(g.featureIndex)}return h.sort(((d,g)=>o[d]-o[g]||l[g]-l[d])),h}addToSortKeyRanges(e,i){const s=this.sortKeyRanges[this.sortKeyRanges.length-1];s&&s.sortKey===i?s.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const s=this.symbolInstances.get(i);this.featureSortOrder.push(s.featureIndex),[s.rightJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.leftJustifiedTextSymbolIndex].forEach(((o,l,h)=>{o>=0&&h.indexOf(o)===l&&this.addIndicesForPlacedSymbol(this.text,o)})),s.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,s.verticalPlacedTextSymbolIndex),s.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.placedIconSymbolIndex),s.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,s.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let yf,vf;Re("SymbolBucket",Ia,{omit:["layers","collisionBoxArray","features","compareText"]}),Ia.MAX_GLYPHS=65535,Ia.addDynamicAttributes=od;var cd={get paint(){return vf=vf||new xi({"icon-opacity":new $e(ve.paint_symbol["icon-opacity"]),"icon-color":new $e(ve.paint_symbol["icon-color"]),"icon-halo-color":new $e(ve.paint_symbol["icon-halo-color"]),"icon-halo-width":new $e(ve.paint_symbol["icon-halo-width"]),"icon-halo-blur":new $e(ve.paint_symbol["icon-halo-blur"]),"icon-translate":new Ve(ve.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ve(ve.paint_symbol["icon-translate-anchor"]),"text-opacity":new $e(ve.paint_symbol["text-opacity"]),"text-color":new $e(ve.paint_symbol["text-color"],{runtimeType:Vi,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new $e(ve.paint_symbol["text-halo-color"]),"text-halo-width":new $e(ve.paint_symbol["text-halo-width"]),"text-halo-blur":new $e(ve.paint_symbol["text-halo-blur"]),"text-translate":new Ve(ve.paint_symbol["text-translate"]),"text-translate-anchor":new Ve(ve.paint_symbol["text-translate-anchor"])})},get layout(){return yf=yf||new xi({"symbol-placement":new Ve(ve.layout_symbol["symbol-placement"]),"symbol-spacing":new Ve(ve.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ve(ve.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new $e(ve.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ve(ve.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ve(ve.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ve(ve.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ve(ve.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ve(ve.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ve(ve.layout_symbol["icon-rotation-alignment"]),"icon-size":new $e(ve.layout_symbol["icon-size"]),"icon-text-fit":new Ve(ve.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ve(ve.layout_symbol["icon-text-fit-padding"]),"icon-image":new $e(ve.layout_symbol["icon-image"]),"icon-rotate":new $e(ve.layout_symbol["icon-rotate"]),"icon-padding":new $e(ve.layout_symbol["icon-padding"]),"icon-keep-upright":new Ve(ve.layout_symbol["icon-keep-upright"]),"icon-offset":new $e(ve.layout_symbol["icon-offset"]),"icon-anchor":new $e(ve.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ve(ve.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ve(ve.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ve(ve.layout_symbol["text-rotation-alignment"]),"text-field":new $e(ve.layout_symbol["text-field"]),"text-font":new $e(ve.layout_symbol["text-font"]),"text-size":new $e(ve.layout_symbol["text-size"]),"text-max-width":new $e(ve.layout_symbol["text-max-width"]),"text-line-height":new Ve(ve.layout_symbol["text-line-height"]),"text-letter-spacing":new $e(ve.layout_symbol["text-letter-spacing"]),"text-justify":new $e(ve.layout_symbol["text-justify"]),"text-radial-offset":new $e(ve.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ve(ve.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new $e(ve.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new $e(ve.layout_symbol["text-anchor"]),"text-max-angle":new Ve(ve.layout_symbol["text-max-angle"]),"text-writing-mode":new Ve(ve.layout_symbol["text-writing-mode"]),"text-rotate":new $e(ve.layout_symbol["text-rotate"]),"text-padding":new Ve(ve.layout_symbol["text-padding"]),"text-keep-upright":new Ve(ve.layout_symbol["text-keep-upright"]),"text-transform":new $e(ve.layout_symbol["text-transform"]),"text-offset":new $e(ve.layout_symbol["text-offset"]),"text-allow-overlap":new Ve(ve.layout_symbol["text-allow-overlap"]),"text-overlap":new Ve(ve.layout_symbol["text-overlap"]),"text-ignore-placement":new Ve(ve.layout_symbol["text-ignore-placement"]),"text-optional":new Ve(ve.layout_symbol["text-optional"])})}};class xf{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:Zr,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Re("FormatSectionOverride",xf,{omit:["defaultValue"]});class Fu extends pr{constructor(e,i){super(e,cd,i)}recalculate(e,i){if(super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const s=this.layout.get("text-writing-mode");if(s){const o=[];for(const l of s)o.indexOf(l)<0&&o.push(l);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,i,s,o){const l=this.layout.get(e).evaluate(i,{},s,o),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||Yo(h.value)||!l?l:(function(d,g){return g.replace(/{([^{}]+)}/g,((m,v)=>d&&v in d?String(d[v]):""))})(i.properties,l)}createBucket(e){return new Ia(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of cd.paint.overridableProperties){if(!Fu.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),s=new qs(new xf(i),i.property.specification);let o=null;o=i.value.kind==="constant"||i.value.kind==="source"?new Ko("source",s):new Jo("c
2omposite",s,i.value.zoomStops),this.paint._values[e]=new dr(i.property,o,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,s){return!(!this.layout||i.isDataDriven()||s.isDataDriven())&&Fu.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const s=e.get("text-field"),o=cd.paint.properties[i];let l=!1;const h=d=>{for(const g of d)if(o.overrides&&o.overrides.hasOverride(g))return void(l=!0)};if(s.value.kind==="constant"&&s.value.value instanceof Gt)h(s.value.value.sections);else if(s.value.kind==="source"||s.value.kind==="composite"){const d=m=>{l||(m instanceof xr&&Rt(m.value)===Yn?h(m.value.sections):m instanceof yn?h(m.sections):m.eachChild(d))},g=s.value;g._styleExpression&&d(g._styleExpression.expression)}return l}}let bf;var My={get paint(){return bf=bf||new xi({"background-color":new Ve(ve.paint_background["background-color"]),"background-pattern":new pu(ve.paint_background["background-pattern"]),"background-opacity":new Ve(ve.paint_background["background-opacity"])})}};class Ey extends pr{constructor(e,i){super(e,My,i)}}class Cy extends pr{constructor(e,i){super(e,{},i),this.onAdd=s=>{this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)},this.onRemove=s=>{this.implementation.onRemove&&this.implementation.onRemove(s,s.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 new Error("Custom layers cannot be serialized")}}class Ay{constructor(e){this._methodToThrottle=e,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var e;this._triggered||(this._triggered=!0,(e=this._channel)===null||e===void 0||e.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Dy={once:!0},ud=63710088e-1;class vs{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new vs(Ms(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,s=this.lat*i,o=e.lat*i,l=Math.sin(s)*Math.sin(o)+Math.cos(s)*Math.cos(o)*Math.cos((e.lng-this.lng)*i);return ud*Math.acos(Math.min(l,1))}static convert(e){if(e instanceof vs)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new vs(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new vs(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const wf=2*Math.PI*ud;function Tf(r){return wf*Math.cos(r*Math.PI/180)}function Sf(r){return(180+r)/360}function Pf(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function If(r,e){return r/Tf(e)}function Mf(r){return 360*r-180}function Ru(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Ef(r,e){return r*Tf(Ru(e))}class oc{constructor(e,i,s=0){this.x=+e,this.y=+i,this.z=+s}static fromLngLat(e,i=0){const s=vs.convert(e);return new oc(Sf(s.lng),Pf(s.lat),If(i,s.lat))}toLngLat(){return new vs(Mf(this.x),Ru(this.y))}toAltitude(){return Ef(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/wf*(e=Ru(this.y),1/Math.cos(e*Math.PI/180));var e}}function Cf(r,e,i){var s=2*Math.PI*6378137/256/Math.pow(2,i);return[r*s-2*Math.PI*6378137/2,e*s-2*Math.PI*6378137/2]}class hd{constructor(e,i,s){if(!(function(o,l,h){return!(o<0||o>25||h<0||h>=Math.pow(2,o)||l<0||l>=Math.pow(2,o))})(e,i,s))throw new Error(`x=${i}, y=${s}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=i,this.y=s,this.key=Ma(0,e,e,i,s)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i,s){const o=(h=this.y,d=this.z,g=Cf(256*(l=this.x),256*(h=Math.pow(2,d)-h-1),d),m=Cf(256*(l+1),256*(h+1),d),g[0]+","+g[1]+","+m[0]+","+m[1]);var l,h,d,g,m;const v=(function(_,T,x){let I,M="";for(let D=_;D>0;D--)I=1<<D-1,M+=(T&I?1:0)+(x&I?2:0);return M})(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(s==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,i>1?"@2x":"").replace(/{quadkey}/g,v).replace(/{bbox-epsg-3857}/g,o)}isChildOf(e){const i=this.z-e.z;return i>0&&e.x===this.x>>i&&e.y===this.y>>i}getTilePoint(e){const i=Math.pow(2,this.z);return new H((e.x*i-this.x)*Ge,(e.y*i-this.y)*Ge)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Af{constructor(e,i){this.wrap=e,this.canonical=i,this.key=Ma(e,i.z,i.z,i.x,i.y)}}class ir{constructor(e,i,s,o,l){if(this.terrainRttPosMatrix32f=null,e<s)throw new Error(`overscaledZ should be >= z; overscaledZ = ${e}; z = ${s}`);this.overscaledZ=e,this.wrap=i,this.canonical=new hd(s,+o,+l),this.key=Ma(i,e,s,o,l)}clone(){return new ir(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>
vendor: 4,250 bytes, line 2
2this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const i=this.canonical.z-e;return e>this.canonical.z?new ir(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ir(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,i){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?Ma(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y):Ma(this.wrap*+i,e,e,this.canonical.x>>s,this.canonical.y>>s)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;const i=this.canonical.z-e.canonical.z;return!(i<0)&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new ir(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,s=2*this.canonical.x,o=2*this.canonical.y;return[new ir(i,this.wrap,i,s,o),new ir(i,this.wrap,i,s+1,o),new ir(i,this.wrap,i,s,o+1),new ir(i,this.wrap,i,s+1,o+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new ir(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new ir(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Af(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(e){return this.canonical.getTilePoint(new oc(e.x-this.wrap,e.y))}normalizeCoordinates(e,i,s=8192){if(e>=0&&e<s&&i>=0&&i<s)return{tileID:this,x:e,y:i};const o=Math.floor(e/s),l=Math.floor(i/s),h=e-o*s,d=i-l*s,g=this.canonical.z,m=1<<g,v=this.canonical.y+l;if(v<0||v>=m)return null;let _=this.canonical.x+o,T=this.wrap;return _<0?(T-=Math.ceil(-_/m),_=(_%m+m)%m):_>=m&&(T+=Math.floor(_/m),_%=m),{tileID:new ir(this.overscaledZ,T,g,_,v),x:h,y:d}}}function Ma(r,e,i,s,o){(r*=2)<0&&(r=-1*r-1);const l=1<<i;return(l*l*r+l*o+s).toString(36)+i.toString(36)+e.toString(36)}Re("CanonicalTileID",hd),Re("OverscaledTileID",ir,{omit:["terrainRttPosMatrix32f"]});class mo{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){const i=new mo;return i.extend(e(new H(this.minX,this.minY))),i.extend(e(new H(this.maxX,this.minY))),i.extend(e(new H(this.minX,this.maxY))),i.extend(e(new H(this.maxX,this.maxY))),i}static fromPoints(e){const i=new mo;for(const s of e)i.extend(s);return i}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}}class Df{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const s=e[i];this._stringToNumber[s]=i,this._numberToString[i]=s}}encode(e){return this._stringToNumber[e]}decode(e){if(e>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class kf{constructor(e,i,s,o,l){this.type="Feature",this._vectorTileFeature=e,this._x=s,this._y=o,this._z=i,this.properties=e.properties,this.id=l}
2projectPoint(e,i,s,o){return[360*(e.x+i)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/o)*Math.PI))-90]}projectLine(e,i,s,o){return e.map((l=>this.projectPoint(l,i,s,o)))}get geometry(){if(this._geometry)return this._geometry;const e=this._vectorTileFeature,i=e.extent*Math.pow(2,this._z),s=e.extent*this._x,o=e.extent*this._y,l=e.loadGeometry();switch(e.type){case 1:{const h=[];for(const g of l)h.push(g[0]);const d=this.projectLine(h,s,o,i);this._geometry=h.length===1?{type:"Point",coordinates:d[0]}:{type:"MultiPoint",coordinates:d};break}case 2:{const h=l.map((d=>this.projectLine(d,s,o,i)));this._geometry=h.length===1?{type:"LineString",coordinates:h[0]}:{type:"MultiLineString",coordinates:h};break}case 3:{const h=Lp(l),d=[];for(const g of h)d.push(g.map((m=>this.projectLine(m,s,o,i))));this._geometry=d.length===1?{type:"Polygon",coordinates:d[0]}:{type:"MultiPolygon",coordinates:d};break}default:throw new Error(`unknown feature type: ${e.type}`)}return this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const i in this)i!=="_geometry"&&i!=="_vectorTileFeature"&&i!=="_x"&&i!=="_y"&&i!=="_z"&&(e[i]=this[i]);return e}}class Ea{constructor(e,i,s){this._name=e,this.dataBuffer=i,typeof s=="number"?this._size=s:(this.nullabilityBuffer=s,this._size=s.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}}class Bu extends Ea{}class dd extends Bu{getValueFromBuffer(e){return this.dataBuffer[e]}}class pd extends Bu{getValueFromBuffer(e){return this.dataBuffer[e]}}class zf extends Ea{constructor(e,i,s,o){super(e,i,o),this.delta=s}}class fd extends zf{constructor(e,i,s,o){super(e,Int32Array.of(i),s,o)}getValueFromBuffer(e){return this.dataBuffer[0]+e*this.delta}}
2class md extends Ea{constructor(e,i,s,o){super(e,o?Int32Array.of(i):Uint32Array.of(i),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}class ky{constructor(e,i,s,o,l=4096){this._name=e,this._geometryVector=i,this._idVector=s,this._propertyVectors=o,this._extent=l}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((i=>[i.name,i])))),this.propertyVectorsMap.get(e)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){const e=[],i=this.geometryVector.getGeometries();for(let s=0;s<this.numFeatures;s++){let o;if(this.idVector){const d=this.idVector.getValue(s);o=this.containsMaxSafeIntegerValues(this.idVector)&&d!==null?Number(d):d}const l={coordinates:i[s],type:this.geometryVector.geometryType(s)},h={};for(const d of this.propertyVectors){if(!d)continue;const g=d.name,m=d.getValue(s);m!==null&&(h[g]=m)}e.push({id:o,geometry:l,properties:h})}return e}containsMaxSafeIntegerValues(e){return e instanceof dd||e instanceof md||e instanceof fd||e instanceof pd}}class Lf{constructor(e){this.value=e}get(){return this.value}set(e){this.value=e}increment(){return this.value++}add(e){this.value+=e}}var tt,xs;(function(r){r.NONE="NONE",r.DELTA="DELTA",r.COMPONENTWISE_DELTA="COMPONENTWISE_DELTA",r.RLE="RLE",r.MORTON="MORTON",r.PDE="PDE"})(tt||(tt={})),(function(r){r.NONE="NONE",r.FAST_PFOR="FAST_PFOR",r.VARINT="VARINT",r.ALP="ALP"})(xs||(xs={}));const gd=new Uint32Array(33);gd[0]=0;for(let r=1;r<=32;r++)gd[r]=r===32?4294967295:4294967295>>>32-r;const _d=gd,Bn=256;function yd(r,e){return r-r%e}function zy(r){const e=r>>>0;return((255&e)<<24|(65280&e)<<8|e>>>8&65280|e>>>24&255)>>>0}const vd=(function(){const r=yd(Math.floor(65536),Bn);return r===0?Bn:r})(),Ly=3*vd/Bn+vd|0;function Ff(){const r=new Uint8Array(Ly);return{dataToBePacked:new Array(33),dataPointers:new Int32Array(33),byteContainer:r,byteContainerI32:new Int32Array(r.buffer,r.byteOffset,r.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function Fy(r,e,i,s,o){switch(o){case 1:(function(l,h,d,g){let m=g,v=h;for(let _=0;_<8;_++){const T=l[v++]>>>0;d[m++]=T>>>0&1,d[m++]=T>>>1&1,d[m++]=T>>>2&1,d[m++]=T>>>3&1,d[m++]=T>>>4&1,d[m++]=T>>>5&1,d[m++]=T>>>6&1,d[m++]=T>>>7&1,d[m++]=T>>>8&1,d[m++]=T>>>9&1,d[m++]=T>>>10&1,d[m++]=T>>>11&1,d[m++]=T>>>12&1,d[m++]=T>>>13&1,d[m++]=T>>>14&1,d[m++]=T>>>15&1,d[m++]=T>>>16&1,d[m++]=T>>>17&1,d[m++]=T>>>18&1,d[m++]=T>>>19&1,d[m++]=T>>>20&1,d[m++]=T>>>21&1,d[m++]=T>>>22&1,d[m++]=T>>>23&1,d[m++]=T>>>24&1,d[m++]=T>>>25&1,d[m++]=T>>>26&1,d[m++]=T>>>27&1,d[m++]=T>>>28&1,d[m++]=T>>>29&1,d[m++]=T>>>30&1,d[m++]=T>>>31&1}})(r,e,i,s);break;case 2:(function(l,h,d,g){let m=g,v=h;for(let _=0;_<8;_++){const T=l[v++]>>>0,x=l[v++]>>>0;d[m++]=T>>>0&3,d[m++]=T>>>2&3,d[m++]=T>>>4&3,d[m++]=T>>>6&3,d[m++]=T>>>8&3,d[m++]=T>>>10&3,d[m++]=T>>>12&3,d[m++]=T>>>14&3,d[m++]=T>>>16&3,d[m++]=T>>>18&3,d[m++]=T>>>20&3,d[m++]=T>>>22&3,d[m++]=T>>>24&3,d[m++]=T>>>26&3,d[m++]=T>>>28&3,d[m++]=T>>>30&3,d[m++]=x>>>0&3,d[m++]=x>>>2&3,d[m++]=x>>>4&3,d[m++]=x>>>6&3,d[m++]=x>>>8&3,d[m++]=x>>>10&3,d[m++]=x>>>12&3,d[m++]=x>>>14&3,d[m++]=x>>>16&3,d[m++]=x>>>18&3,d[m++]=x>>>20&3,d[m++]=x>>>22&3,d[m++]=x>>>24&3,d[m++]=x>>>26&3,d[m++]=x>>>28&3,d[m++]=x>>>30&3}})(r,e,i,s);break;case 3:(function(l,h,d,g){let m=g,v=h;for(let _=0;_<8;_++){const T=l[v++]>>>0,x=l[v++]>>>0,I=l[v++]>>>0;d[m++]=T>>>0&7,d[m++]=T>>>3&7,d[m++]=T>>>6&7,d[m++]=T>>>9&7,d[m++]=T>>>12&7,d[m++]=T>>>15&7,d[m++]=T>>>18&7,d[m++]=T>>>21&7,d[m++]=T>>>24&7,d[m++]=T>>>27&7,d[m++]=7&(T>>>30|(1&x)<<2),d[m++]=x>>>1&7,d[m++]=x>>>4&7,d[m++]=x>>>7&7,d[m++]=x>>>10&7,d[m++]=x>>>13&7,d[m++]=x>>>16&7,d[m++]=x>>>19&7,d[m++]=x>>>22&7,d[m++]=x>>>25&7,d[m++]=x>>>28&7,d[m++]=7&(x>>>31|(3&I)<<1),d[m++]=I>>>2&7,d[m++]=I>>>5&7,d[m++]=I>>>8&7,d[m++]=I>>>11&7,d[m++]=I>>>14&7,d[m++]=I>>>17&7,d[m++]=I>>>20&7,d[m++]=I>>>23&7,d[m++]=I>>>26&7,d[m++]=I>>>29&7}})(r,e,i,s);break;case 4:(function(l,h,d,g){let m=g,v=h;for(let _=0;_<8;_++){const T=l[v++]>>>0,x=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0;d[m++]=T>>>0&15,d[m++]=T>>>4&15,d[m++]=T>>>8&15,d[m++]=T>>>12&15,d[m++]=T>>>16&15,d[m++]=T>>>20&15,d[m++]=T>>>
224&15,d[m++]=T>>>28&15,d[m++]=x>>>0&15,d[m++]=x>>>4&15,d[m++]=x>>>8&15,d[m++]=x>>>12&15,d[m++]=x>>>16&15,d[m++]=x>>>20&15,d[m++]=x>>>24&15,d[m++]=x>>>28&15,d[m++]=I>>>0&15,d[m++]=I>>>4&15,d[m++]=I>>>8&15,d[m++]=I>>>12&15,d[m++]=I>>>16&15,d[m++]=I>>>20&15,d[m++]=I>>>24&15,d[m++]=I>>>28&15,d[m++]=M>>>0&15,d[m++]=M>>>4&15,d[m++]=M>>>8&15,d[m++]=M>>>12&15,d[m++]=M>>>16&15,d[m++]=M>>>20&15,d[m++]=M>>>24&15,d[m++]=M>>>28&15}})(r,e,i,s);break;case 5:(function(l,h,d,g){let m=g,v=h;for(let _=0;_<8;_++){const T=l[v++]>>>0,x=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,D=l[v++]>>>0;d[m++]=T>>>0&31,d[m++]=T>>>5&31,d[m++]=T>>>10&31,d[m++]=T>>>15&31,d[m++]=T>>>20&31,d[m++]=T>>>25&31,d[m++]=31&(T>>>30|(7&x)<<2),d[m++]=x>>>3&31,d[m++]=x>>>8&31,d[m++]=x>>>13&31,d[m++]=x>>>18&31,d[m++]=x>>>23&31,d[m++]=31&(x>>>28|(1&I)<<4),d[m++]=I>>>1&31,d[m++]=I>>>6&31,d[m++]=I>>>11&31,d[m++]=I>>>16&31,d[m++]=I>>>21&31,d[m++]=I>>>26&31,d[m++]=31&(I>>>31|(15&M)<<1),d[m++]=M>>>4&31,d[m++]=M>>>9&31,d[m++]=M>>>14&31,d[m++]=M>>>19&31,d[m++]=M>>>24&31,d[m++]=31&(M>>>29|(3&D)<<3),d[m++]=D>>>2&31,d[m++]=D>>>7&31,d[m++]=D>>>12&31,d[m++]=D>>>17&31,d[m++]=D>>>22&31,d[m++]=D>>>27&31}})(r,e,i,s);break;case 6:(function(l,h,d,g){let m=g,v=h;for(let _=0;_<8;_++){const T=l[v++]>>>0,x=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,D=l[v++]>>>0,k=l[v++]>>>0;d[m++]=T>>>0&63,d[m++]=T>>>6&63,d[m++]=T>>>12&63,d[m++]=T>>>18&63,d[m++]=T>>>24&63,d[m++]=63&(T>>>30|(15&x)<<2),d[m++]=x>>>4&63,d[m++]=x>>>10&63,d[m++]=x>>>16&63,d[m++]=x>>>22&63,d[m++]=63&(x>>>28|(3&I)<<4),d[m++]=I>>>2&63,d[m++]=I>>>8&63,d[m++]=I>>>14&63,d[m++]=I>>>20&63,d[m++]=I>>>26&63,d[m++]=M>>>0&63,d[m++]=M>>>6&63,d[m++]=M>>>12&63,d[m++]=M>>>18&63,d[m++]=M>>>24&63,d[m++]=63&(M>>>30|(15&D)<<2),d[m++]=D>>>4&63,d[m++]=D>>>10&63,d[m++]=D>>>16&63,d[m++]=D>>>22&63,d[m++]=63&(D>>>28|(3&k)<<4),d[m++]=k>>>2&63,d[m++]=k>>>8&63,d[m++]=k>>>14&63,d[m++]=k>>>20&63,d[m++]=k>>>26&63}})(r,e,i,s);break;case 7:(function(l,h,d,g){let m=g,v=h;for(let _=0;_<8;_++){const T=l[v++]>>>0,x=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,D=l[v++]>>>0,k=l[v++]>>>0,O=l[v++]>>>0;d[m++]=T>>>0&127,d[m++]=T>>>7&127,d[m++]=T>>>14&127,d[m++]=T>>>21&127,d[m++]=127&(T>>>28|(7&x)<<4),d[m++]=x>>>3&127,d[m++]=x>>>10&127,d[m++]=x>>>17&127,d[m++]=x>>>24&127,d[m++]=127&(x>>>31|(63&I)<<1),d[m++]=I>>>6&127,d[m++]=I>>>13&127,d[m++]=I>>>20&127,d[m++]=127&(I>>>27|(3&M)<<5),d[m++]=M>>>2&127,d[m++]=M>>>9&127,d[m++]=M>>>16&127,d[m++]=M>>>23&127,d[m++]=127&(M>>>30|(31&D)<<2),d[m++]=D>>>5&127,d[m++]=D>>>12&127,d[m++]=D>>>19&127,d[m++]=127&(D>>>26|(1&k)<<6),d[m++]=k>>>1&127,d[m++]=k>>>8&127,d[m++]=k>>>15&127,d[m++]=k>>>22&127,d[m++]=127&(k>>>29|(15&O)<<3),d[m++]=O>>>4&127,d[m++]=O>>>11&127,d[m++]=O>>>18&127,d[m++]=O>>>25&127}})(r,e,i,s);break;case 8:(function(l,h,d,g){let m=g,v=h;for(let _=0;_<8;_++){const T=l[v++]>>>0,x=l[v++]>>>0,I=l[v++]>>>0,M=l[v++]>>>0,D=l[v++]>>>0,k=l[v++]>>>0,O=l[v++]>>>0,B=l[v++]>>>0;d[m++]=T>>>0&255,d[m++]=T>>>8&255,d[m++]=T>>>16&255,d[m++]=T>>>24&255,d[m++]=x>>>0&255,d[m++]=x>>>8&255,d[m++]=x>>>16&255,d[m++]=x>>>24&255,d[m++]=I>>>0&255,d[m++]=I>>>8&255,d[m++]=I>>>16&255,d[m++]=I>>>24&255,d[m++]=M>>>0&255,d[m++]=M>>>8&255,d[m++]=M>>>16&255,d[m++]=M>>>24&255,d[m++]=D>>>0&255,d[m++]=D>>>8&255,d[m++]=D>>>16&255,d[m++]=D>>>24&255,d[m++]=k>>>0&255,d[m++]=k>>>8&255,d[m++]=k>>>16&255,d[m++]=k>>>24&255,d[m++]=O>>>0&255,d[m++]=O>>>8&255,d[m++]=O>>>16&255,d[m++]=O>>>24&255,d[m++]=B>>>0&255,d[m++]=B>>>8&255,d[m++]=B>>>16&255,d[m++]=B>>>24&255}})(r,e,i,s);break;case 16:(function(l,h,d,g){let m=g,v=h;for(let _=0;_<128;_++){const T=l[v++]>>>0;d[m++]=65535&T,d[m++]=T>>>16&65535}})(r,e,i,s);break;default:(function(l,h,d,g,m){const v=_d[m]>>>0;let _=h,T=0,x=l[_]>>>0,I=g;for(let M=0;M<8;M++){for(let D=0;D<32;D++)if(T+m<=32)d[I+D]=x>>>T&v,T+=m,T===32&&(T=0,_++,D!==31&&(x=l[_]>>>0));
2else{const k=32-T,O=x>>>T;_++,x=l[_]>>>0;const B=m-k;d[I+D]=(O|(x&-1>>>32-B>>>0)<<k)&v,T=B}I+=32,T=0,M<7&&(x=l[_]>>>0)}})(r,e,i,s,o)}return e+(o<<3)|0}function Ry(r,e,i,s){if(i+2>e)throw new Error(`FastPFOR decode: byteContainer underflow at block=${s} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${i}, byteSize=${e})`);const o=r[i++],l=r[i++];if(o>32)throw new Error(`FastPFOR decode: invalid bitWidth=${o} at block=${s} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:o,exceptionCount:l,bytePosIn:i}}function By(r,e,i,s,o,l,h,d,g){const{maxBits:m,exceptionBitWidth:v,bytePosIn:_}=(function(D,k,O,B,N,$){if(O+1>k)throw new Error(`FastPFOR decode: exception header underflow at block=${$} (need 1 byte for maxBits, bytePos=${O}, byteSize=${k})`);const W=D[O++];if(W<B||W>32)throw new Error(`FastPFOR decode: invalid maxBits=${W} at block=${$} (bitWidth=${B}, expected ${B}..32)`);const ie=W-B|0;if(ie<1||ie>32)throw new Error(`FastPFOR decode: invalid exceptionBitWidth=${ie} at block=${$} (bitWidth=${B}, maxBits=${W})`);if(O+N>k)throw new Error(`FastPFOR decode: exception positions underflow at block=${$} (need=${N}, have=${k-O})`);return{maxBits:W,exceptionBitWidth:ie,bytePosIn:O}})(o,l,h,i,s,g);if(h=_,v===1){const D=1<<i;for(let k=0;k<s;k=k+1|0)r[o[h++]+e|0]|=D;return h}const T=d.dataToBePacked[v];if(!T)throw new Error(`FastPFOR decode: missing exception stream for exceptionBitWidth=${v} (bitWidth=${i}, maxBits=${m}) at block ${g}`);const x=d.dataPointers;let I=0|x[v];const M=0|d.exceptionSizes[v];if(I+s>M)throw new Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${v} (ptr=${I}, need ${s}, size=${M}) at block ${g}`);for(let D=0;D<s;D=D+1|0){const k=o[h++],O=0|T[I++];r[k+e|0]|=O<<i}return x[v]=I,h}function Oy(r,e,i,s,o,l){const h=0|i,d=0|r[h];if(d<=0||h+d>r.length-1)throw new Error(`FastPFOR decode: invalid whereMeta=${d} at pageStart=${h} (expected > 0 and pageStart+whereMeta < encoded.length=${r.length})`);const g=h+1|0,m=h+d|0,v=r[m]>>>0,_=v+3>>>2,T=m+1,x=T+_;if(x>=r.length)throw new Error(`FastPFOR decode: invalid byteSize=${v} (metaInts=${_}, pageStart=${h}, packedEnd=${m}, byteContainerStart=${T}) causes bitmapPos=${x} out of bounds (encoded.length=${r.length})`);const I=(function(k,O,B,N){N.byteContainer.length<B&&(N.byteContainer=new Uint8Array(2*B),N.byteContainerI32=void 0);const $=N.byteContainer,W=B>>>2;if(3&$.byteOffset)for(let ne=0;ne<W;ne=ne+1|0){const ae=0|k[O+ne|0],ue=ne<<2;$[ue]=255&ae,$[ue+1|0]=ae>>>8&255,$[ue+2|0]=ae>>>16&255,$[ue+3|0]=ae>>>24&255}else{let ne=N.byteContainerI32;(!ne||ne.buffer!==$.buffer||ne.byteOffset!==$.byteOffset||ne.length<W)&&(ne=N.byteContainerI32=new Int32Array($.buffer,$.byteOffset,$.byteLength>>>2)),ne.set(k.subarray(O,O+W))}const ie=3&B;if(ie>0){const ne=0|k[O+W|0],ae=W<<2;for(let ue=0;ue<ie;ue=ue+1|0)$[ae+ue|0]=ne>>>(ue<<3)&255}return $})(r,T,v,l),M=v,D=(function(k,O,B){const N=0|k[O++],$=B.dataToBePacked;for(let W=2;W<=32;W=W+1|0){if(!(N>>>W-1&1))continue;if(O>=k.length)throw new Error(`FastPFOR decode: truncated exception stream header (bitWidth=${W}, streamWordIndex=${O}, needWords=1, availableWords=${k.length-O}, encodedWords=${k.length})`);const ie=k[O++]>>>0,ne=yd(ie+31,32),ae=ie*W+31>>>5;if(O+ae>k.length)throw new Error(`FastPFOR decode: truncated exception stream (bitWidth=${W}, size=${ie}, streamWordIndex=${O}, needWords=${ae}, availableWords=${k.length-O}, encodedWords=${k.length})`);let ue=$[W];(!ue||ue.length<ne)&&(ue=$[W]=new Uint32Array(ne));let ye=0;for(;ye<ie;ye=ye+32|0)Vy(k,O,ue,ye,W),O=O+W|0;O=O-((ye-ie|0)*W>>>5)|0,B.exceptionSizes[W]=ie}return O})(r,x,l);return l.dataPointers.fill(0),(function(k,O,B,N,$,W,ie,ne,ae,ue){let ye=0|B,ge=0;for(let _e=0;_e<ie;_e=_e+1|0){const de=Ry(ne,ae,ge,_e);ge=de.bytePosIn;const Ie=de.bitWidth,Fe=de.exceptionCount,ke=W+_e*Bn|0;switch(Ie){case 0:$.fill(0,ke,ke+Bn);break;case 32:for(let Pe=0;Pe<Bn;Pe=Pe+1|0)$[ke+Pe|0]=0|k[ye+Pe|0];ye=ye+Bn|0;break;default:ye=Fy(k,ye,$,ke,Ie)}Fe>0&&(ge=By($,ke,Ie,Fe,ne,ae,ge,ue,_e))}if(ye!==N)throw new Error(`FastPFOR decode: packed region mismatch (pageStart=${O}, packedStart=${B}, consumedPackedEnd=${ye}, expectedPackedEnd=${N}, packedWords=${N-B}, encoded.length=${k.length})`)})(r,h,g,m,e,0|s,o/Bn|0,I,M,l),D}function Vy(r,e,i,s,o){switch(o){case 2:(function(m,v,_,T){let x=T;const I=m[v]>>>0,M=m[v+1]>>>0;_[x++]=I>>>0&3,_[x++]=I>>>2&3,_[x++]=I>>>4&3,_[x++]=I>>>6&3,_[x++]=I>>>8&3,_[x++]=I>>>10&3,_[x++]=I>>>12&3,_[x++]=I>>>14&3,_[x++]=I>>>16&3,_[x++]=I>>>18&3,_[x++]=I>>>20&3,_[x++]=I>>>22&3,_[x++]=I>>>24&3,_[x++]=I>>>26&3,_[x++]=I>>>28&3,_[x++]=I>>>30&3,_[x++]=M>>>0&3,_[x++]=M>>>2&3,_[x++]=M>>>4&3,_[x++]=M>>>6&3,_[x++]=M>>>8&3,_[x++]=M>>>10&3,_[x++]=M>>>12&3,_[x++]=M>>>14&3,_[x++]=M>>>16&3,_[x++]=M>>>18&3,_[x++]=M>>>20&3,_[x++]=M>>>22&3,_[x++]=M>>>24&3,_[x++]=M>>>26&3,_[x++]=M>>>28&3,_[x]=M>>>30&3})(r,e,i,s);return;case 3:(function(m,v,_,T){let x=T;const I=m[v]>>>0,M=m[v+1]>>>0,D=m[v+2]>>>0;_[x++]=I>>>0&7,_[x++]=I>>>3&7,_[x++]=I>>>6&7,_[x++]=I>>>9&7,_[x++]=I>>>12&7,_[x++]=I>>>15&7,_[x++]=I>>>18&7,_[x++]=I>>>21&7,_[x++]=I>>>24&7,_[x++]=I>>>27&7,_[x++]=7&(I>>>30|(1&M)<<2),_[x++]=M>>>1&7,_[x++]=M>>>4&7,_[x++]=M>>>7&7,_[x++]=M>>>10&7,_[x++]=M>>>13&7,_[x++]=M>>>16&7,_[x++]=M>>>19&7,_[x++]=M>>>22&7,_[x++]=M>>>25&7,_[x++]=M>>>28&7,_[x++]=7&(M>>>31|(3&D)<<1),_[x++]=D>>>2&7,_[x++]=D>>>5&7,_[x++]=D>>>8&7,_[x++]=D>>>11&7,_[x++]=D>>>14&7,_[x++]=D>>>17&7,_[x++]=D>>>20&7,_[x++]=D>>>23&7,_[x++]=D>>>26&7,_[x]=D>>>29&7})(r,e,i,s);return;case 4:(function(m,v,_,T){let x=T;const I=m[v]>>>0,M=m[v+1]>>>0,D=m[v+2]>>>0,k=m[v+3]>>>0;_[x++]=I>>>0&15,_[x++]=I>>>4&15,_[x++]=I>>>8&15,_[x++]=I>>>12&15,_[x++]=I>>>16&15,_[x++]=I>>>20&15,_[x++]=I>>>24&15,_[x++]=I>>>28&15,_[x++]=M>>>0&15,_[x++]=M>>>4&15,_[x++]=M>>>8&15,_[x++]=M>>>12&15,_[x++]=M>>>16&15,_[x++]=M>>>20&15,_[x++]=M>>>24&15,_[x++]=M>>>28&15,_[x++]=D>>>0&15,_[x++]=D>>>4&15,_[x++]=D>>>8&15,_[x++]=D>>>12&15,_[x++]=D>>>16&15,_[x++]=D>>>20&15,_[x++]=D>>>24&15,_[x++]=D>>>28&15,_[x++]=k>>>0&15,_[x++]=k>>>4&15,_[x++]=k>>>8&15,_[x++]=k>>>12&15,_[x++]=k>>>16&15,_[x++]=k>>>20&15,_[x++]=k>>>24&15,_[x]=k>>>28&15})(r,e,i,s);return;case 5:(function(m,v,_,T){let x=T;const I=m[v]>>>0,M=m[v+1]>>>0,D=m[v+2]>>>0,k=m[v+3]>>>0,O=m[v+4]>>>0;_[x++]=I>>>0&31,_[x++]=I>>>5&31,_[x++]=I>>>10&31,_[x++]=I>>>15&31,_[x++]=I>>>20&31,_[x++]=I>>>25&31,_[x++]=31&(I>>>30|(7&M)<<2),_[x++]=M>>>3&31,_[x++]=M>>>8&31,_[x++]=M>>>13&31,_[x++]=M>>>18&31,_[x++]=M>>>23&31,_[x++]=31&(M>>>28|(1&D)<<4),_[x++]=D>>>1&31,_[x++]=D>>>6&31,_[x++]=D>>>11&31,_[x++]=D>>>16&31,_[x++]=D>>>21&31,_[x++]=D>>>26&31,_[x++]=31&(D>>>31|(15&k)<<1),_[x++]=k>>>4&31,_[x++]=k>>>9&31,_[x++]=k>>>14&31,_[x++]=k>>>19&31,_[x++]=k>>>24&31,_[x++]=31&(k>>>29|(3&O)<<3),_[x++]=O>>>2&31,_[x++]=O>>>7&31,_[x++]=O>>>12&31,_[x++]=O>>>17&31,_[x++]=O>>>22&31,_[x]=O>>>27&31})(r,e,i,s);return;case 6:(function(m,v,_,T){let x=T;const I=m[v]>>>0,M=m[v+1]>>>0,D=m[v+2]>>>0,k=m[v+3]>>>0,O=m[v+4]>>>0,B=m[v+5]>>>0;_[x++]=I>>>0&63,_[x++]=I>>>6&63,_[x++]=I>>>12&63,_[x++]=I>>>18&63,_[x++]=I>>>24&63,_[x++]=63&(I>>>30|(15&M)<<2),_[x++]=M>>>4&63,_[x++]=M>>>10&63,_[x++]=M>>>16&63,_[x++]=M>>>22&63,_[x++]=63&(M>>>28|(3&D)<<4),_[x++]=D>>>2&63,_[x++]=D>>>8&63,_[x++]=D>>>14&63,_[x++]=D>>>20&63,_[x++]=D>>>26&63,_[x++]=k>>>0&63,_[x++]=k>>>6&63,_[x++]=k>>>12&63,_[x++]=k>>>18&63,_[x++]=k>>>24&63,_[x++]=63&(k>>>30|(15&O)<<2),_[x++]=O>>>4&63,_[x++]=O>>>10&63,_[x++]=O>>>16&63,_[x++]=O>>>22&63,_[x++]=63&(O>>>28|(3&B)<<4),_[x++]=B>>>2&63,_[x++]=B>>>8&63,_[x++]=B>>>14&63,_[x++]=B>>>20&63,_[x]=B>>>26&63})(r,e,i,s);return;case 7:(function(m,v,_,T){let x=T;const I=m[v]>>>0,M=m[v+1]>>>0,D=m[v+2]>>>0,k=m[v+3]>>>0,O=m[v+4]>>>0,B=m[v+5]>>>0,N=m[v+6]>>>0;_[x++]=I>>>0&127,_[x++]=I>>>7&127,_[x++]=I>>>14&127,_[x++]=I>>>21&127,_[x++]=127&(I>>>28|(7&M)<<4),_[x++]=M>>>3&127,_[x++]=M>>>10&127,_[x++]=M>>>17&127,_[x++]=M>>>24&127,_[x++]=127&(M>>>31|(63&D)<<1),_[x++]=D>>>6&127,_[x++]=D>>>13&127,_[x++]=D>>>20&127,_[x++]=127&(D>>>27|(3&k)<<5),_[x++]=k>>>2&127,_[x++]=k>>>9&127,_[x++]=k>>>16&127,_[x++]=k>>>23&127,_[x++]=127&(k>>>30|(31&O)<<2),_[x++]=O>>>5&127,_[x++]=O>>>12&127,_[x++]=O>>>19&127,_[x++]=127&(O>>>26|(1&B)<<6),_[x++]=B>>>1&127,_[x++]=B>>>8&127,_[x++]=B>>>15&127,_[x++]=B>>>22&127,_[x++]=127&(B>>>29|(15&N)<<3),_[x++]=N>>>4&127,_[x++]=N>>>11&127,_[x++]=N>>>18&127,_[x]=N>>>25&127})(r,e,i,s);return;case 8:(function(m,v,_,T){let x=T;const I=m[v]>>>0,M=m[v+1]>>>0,D=m[v+2]>>>0,k=m[v+3]>>>0,O=m[v+4]>>>0,B=m[v+5]>>>0,N=m[v+6]>>>0,$=m[v+7]>>>0;_[x++]=I>>>0&255,_[x++]=I>>>8&255,_[x++]=I>>>16&255,_[x++]=I>>>24&255,_[x++]=M>>>0&255,_[x++]=M>>>8&255,_[x++]=M>>>16&255,_[x++]=M>>>24&255,_[x++]=D>>>0&255,_[x++]=D>>>8&255,_[x++]=D>>>16&255,_[x++]=D>>>24&255,_[x++]=k>>>0&255,_[x++]=k>>>8&255,_[x++]=k>>>16&255,_[x++]=k>>>24&255,_[x++]=O>>>0&255,_[x++]=O>>>8&255,_[x++]=O>>>16&255,_[x++]=O>>>24&255,_[x++]=B>>>0&255,_[x++]=B>>>8&255,_[x++]=B>>>16&255,_[x++]=B>>>24&255,_[x++]=N>>>0&255,_[x++]=N>>>8&255,_[x++]=N>>>16&255,_[x++]=N>>>24&255,_[x++]=$>>>0&255,_[x++]=$>>>8&255,_[x++]=$>>>16&255,_[x]=$>>>24&255})(r,e,i,s);return;case 9:(function(m,v,_,T){let x=T;const I=m[v]>>>0,M=m[v+1]>>>0,D=m[v+2]>>>0,k=m[v+3]>>>0,O=m[v+4]>>>0,B=m[v+5]>>>0,N=m[v+6]>>>0,$=m[v+7]>>>0,W=m[v+8]>>>0;_[x++]=I>>>0&511,_[x++]=I>>>9&511,_[x++]=I>>>18&511,_[x++]=511&(I>>>27|(15&M)<<5),_[x++]=M>>>4&511,_[x++]=M>>>13&511,_[x++]=M>>>22&511,_[x++]=511&(M>>>31|(255&D)<<1),_[x++]=D>>>8&511,_[x++]=D>>>17&511,_[x++]=511&(D>>>26|(7&k)<<6),_[x++]=k>>>3&511,_[x++]=k>>>12&511,_[x++]=k>>>21&511,_[x++]=511&(k>>>30|(127&O)<<2),_[x++]=O>>>7&511,_[x++]=O>>>16&511,_[x++]=511&(O>>>25|(3&B)<<7),_[x++]=B>>>2&511,_[x++]=B>>>11&511,_[x++]=B>>>20&511,_[x++]=511&(B>>>29|(63&N)<<3),_[x++]=N>>>6&511,_[x++]=N>>>15&511,_[x++]=511&(N>>>24|(1&$)<<8),_[x++]=$>>>1&511,_[x++]=$>>>10&511,_[x++]=$>>>19&511,_[x++]=511&($>>>28|(31&W)<<4),_[x++]=W>>>5&511,_[x++]=W>>>14&511,_[x]=W>>>23&511}
2)(r,e,i,s);return;case 10:(function(m,v,_,T){let x=T;const I=m[v]>>>0,M=m[v+1]>>>0,D=m[v+2]>>>0,k=m[v+3]>>>0,O=m[v+4]>>>0,B=m[v+5]>>>0,N=m[v+6]>>>0,$=m[v+7]>>>0,W=m[v+8]>>>0,ie=m[v+9]>>>0;_[x++]=I>>>0&1023,_[x++]=I>>>10&1023,_[x++]=I>>>20&1023,_[x++]=1023&(I>>>30|(255&M)<<2),_[x++]=M>>>8&1023,_[x++]=M>>>18&1023,_[x++]=1023&(M>>>28|(63&D)<<4),_[x++]=D>>>6&1023,_[x++]=D>>>16&1023,_[x++]=1023&(D>>>26|(15&k)<<6),_[x++]=k>>>4&1023,_[x++]=k>>>14&1023,_[x++]=1023&(k>>>24|(3&O)<<8),_[x++]=O>>>2&1023,_[x++]=O>>>12&1023,_[x++]=O>>>22&1023,_[x++]=B>>>0&1023,_[x++]=B>>>10&1023,_[x++]=B>>>20&1023,_[x++]=1023&(B>>>30|(255&N)<<2),_[x++]=N>>>8&1023,_[x++]=N>>>18&1023,_[x++]=1023&(N>>>28|(63&$)<<4),_[x++]=$>>>6&1023,_[x++]=$>>>16&1023,_[x++]=1023&($>>>26|(15&W)<<6),_[x++]=W>>>4&1023,_[x++]=W>>>14&1023,_[x++]=1023&(W>>>24|(3&ie)<<8),_[x++]=ie>>>2&1023,_[x++]=ie>>>12&1023,_[x]=ie>>>22&1023})(r,e,i,s);return;case 11:(function(m,v,_,T){let x=T;const I=m[v]>>>0,M=m[v+1]>>>0,D=m[v+2]>>>0,k=m[v+3]>>>0,O=m[v+4]>>>0,B=m[v+5]>>>0,N=m[v+6]>>>0,$=m[v+7]>>>0,W=m[v+8]>>>0,ie=m[v+9]>>>0,ne=m[v+10]>>>0;_[x++]=I>>>0&2047,_[x++]=I>>>11&2047,_[x++]=2047&(I>>>22|(1&M)<<10),_[x++]=M>>>1&2047,_[x++]=M>>>12&2047,_[x++]=2047&(M>>>23|(3&D)<<9),_[x++]=D>>>2&2047,_[x++]=D>>>13&2047,_[x++]=2047&(D>>>24|(7&k)<<8),_[x++]=k>>>3&2047,_[x++]=k>>>14&2047,_[x++]=2047&(k>>>25|(15&O)<<7),_[x++]=O>>>4&2047,_[x++]=O>>>15&2047,_[x++]=2047&(O>>>26|(31&B)<<6),_[x++]=B>>>5&2047,_[x++]=B>>>16&2047,_[x++]=2047&(B>>>27|(63&N)<<5),_[x++]=N>>>6&2047,_[x++]=N>>>17&2047,_[x++]=2047&(N>>>28|(127&$)<<4),_[x++]=$>>>7&2047,_[x++]=$>>>18&2047,_[x++]=2047&($>>>29|(255&W)<<3),_[x++]=W>>>8&2047,_[x++]=W>>>19&2047,_[x++]=2047&(W>>>30|(511&ie)<<2),_[x++]=ie>>>9&2047,_[x++]=ie>>>20&2047,_[x++]=2047&(ie>>>31|(1023&ne)<<1),_[x++]=ne>>>10&2047,_[x]=ne>>>21&2047})(r,e,i,s);return;case 12:(function(m,v,_,T){let x=T;const I=m[v]>>>0,M=m[v+1]>>>0,D=m[v+2]>>>0,k=m[v+3]>>>0,O=m[v+4]>>>0,B=m[v+5]>>>0,N=m[v+6]>>>0,$=m[v+7]>>>0,W=m[v+8]>>>0,ie=m[v+9]>>>0,ne=m[v+10]>>>0,ae=m[v+11]>>>0;_[x++]=I>>>0&4095,_[x++]=I>>>12&4095,_[x++]=4095&(I>>>24|(15&M)<<8),_[x++]=M>>>4&4095,_[x++]=M>>>16&4095,_[x++]=4095&(M>>>28|(255&D)<<4),_[x++]=D>>>8&4095,_[x++]=D>>>20&4095,_[x++]=k>>>0&4095,_[x++]=k>>>12&4095,_[x++]=4095&(k>>>24|(15&O)<<8),_[x++]=O>>>4&4095,_[x++]=O>>>16&4095,_[x++]=4095&(O>>>28|(255&B)<<4),_[x++]=B>>>8&4095,_[x++]=B>>>20&4095,_[x++]=N>>>0&4095,_[x++]=N>>>12&4095,_[x++]=4095&(N>>>24|(15&$)<<8),_[x++]=$>>>4&4095,_[x++]=$>>>16&4095,_[x++]=4095&($>>>28|(255&W)<<4),_[x++]=W>>>8&4095,_[x++]=W>>>20&4095,_[x++]=ie>>>0&4095,_[x++]=ie>>>12&4095,_[x++]=4095&(ie>>>24|(15&ne)<<8),_[x++]=ne>>>4&4095,_[x++]=ne>>>16&4095,_[x++]=4095&(ne>>>28|(255&ae)<<4),_[x++]=ae>>>8&4095,_[x]=ae>>>20&4095})(r,e,i,s);return;case 16:(function(m,v,_,T){let x=T;const I=m[v]>>>0,M=m[v+1]>>>0,D=m[v+2]>>>0,k=m[v+3]>>>0,O=m[v+4]>>>0,B=m[v+5]>>>0,N=m[v+6]>>>0,$=m[v+7]>>>0,W=m[v+8]>>>0,ie=m[v+9]>>>0,ne=m[v+10]>>>0,ae=m[v+11]>>>0,ue=m[v+12]>>>0,ye=m[v+13]>>>0,ge=m[v+14]>>>0,_e=m[v+15]>>>0;_[x++]=I>>>0&65535,_[x++]=I>>>16&65535,_[x++]=M>>>0&65535,_[x++]=M>>>16&65535,_[x++]=D>>>0&65535,_[x++]=D>>>16&65535,_[x++]=k>>>0&65535,_[x++]=k>>>16&65535,_[x++]=O>>>0&65535,_[x++]=O>>>16&65535,_[x++]=B>>>0&65535,_[x++]=B>>>16&65535,_[x++]=N>>>0&65535,_[x++]=N>>>16&65535,_[x++]=$>>>0&65535,_[x++]=$>>>16&65535,_[x++]=W>>>0&65535,_[x++]=W>>>16&65535,_[x++]=ie>>>0&65535,_[x++]=ie>>>16&65535,_[x++]=ne>>>0&65535,_[x++]=ne>>>16&65535,_[x++]=ae>>>0&65535,_[x++]=ae>>>16&65535,_[x++]=ue>>>0&65535,_[x++]=ue>>>16&65535,_[x++]=ye>>>0&65535,_[x++]=ye>>>16&65535,_[x++]=ge>>>0&65535,_[x++]=ge>>>16&65535,_[x++]=_e>>>0&65535,_[x]=_e>>>16&65535})(r,e,i,s);return;case 32:for(let m=0;m<32;m=m+1|0)i[s+m|0]=0|r[e+m|0];return}const l=_d[o]>>>0;let h=e,d=0,g=r[h]>>>0;for(let m=0;m<32;m++)if(d+o<=32)i[s+m]=g>>>d&l,d+=o,d===32&&(d=0,h++,m!==31&&(g=r[h]>>>0));else{const v=32-d,_=g>>>d;h++,g=r[h]>>>0,i[s+m]=(_|(g&_d[o-v]>>>0)<<v)&l,d=o-v}}function Mi(r,e,i){const s=new Uint32Array(i);let o=0,l=e.get();for(let h=0;h<s.length;h++){let d=r[l++],g=127&d;d<128||(d=r[l++],g|=(127&d)<<7,d<128||(d=r[l++],g|=(127&d)<<14,d<128||(d=r[l++],g|=(127&d)<<21,d<128||(d=r[l++],g|=(15&d)<<28)))),s[o++]=g}return e.set(l),s}function Ca(r,e,i){const s=new BigUint64Array(i);for(let o=0;o<s.length;o++)s[o]=jy(r,e);return s}function jy(r,e){let i=0n,s=0,o=e.get();for(;o<r.length;){const l=r[o++];if(i|=BigInt(127&l)<<BigInt(s),!(128&l))break;if(s+=7,s>=64)throw new Error("Varint too long")}return e.set(o),i}function Ny(r,e){let i,s;return s=r[e.get()],e.increment(),i=127&s,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<7,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<14,s<128?i:(s=r[e.get()],e.increment(),i|=(127&s)<<21,s<128?i:(s=r[e.get()],i|=(15&s)<<28,(function(o,l,h){let d,g;if(g=l[h.get()],h.increment(),d=(112&g)>>4,g<128||(g=l[h.get()],h.increment(),d|=(127&g)<<3,g<128)||(g=l[h.get()],h.increment(),d|=(127&g)<<10,g<128)||(g=l[h.get()],h.increment(),d|=(127&g)<<17,g<128)||(g=l[h.get()],h.increment(),d|=(127&g)<<24,g<128)||(g=l[h.get()],h.increment(),d|=(1&g)<<31,g<128))return 4294967296*d+(o>>>0);throw new Error("Expected varint not more than 10 bytes")})(i,r,e)))))}function yt(r){return r>>>1^-(1&r)}function Li(r){return r>>1n^-(1n&r)}function Aa(r){return r%2==1?(r+1)/-2:r/2}function xd(r,e,i){if(i===void 0){i=0;for(let l=0;l<e;l++)i+=r[l]}const s=new Uint32Array(i);let o=0;for(let l=0;l<e;l++){const h=r[l];s.fill(r[l+e],o,o+h),o+=h}return s}function bd(r,e,i){if(i===void 0){i=0;for(let l=0;l<e;l++)i+=Number(r[l])}const s=new BigUint64Array(i);let o=0;for(let l=0;l<e;l++){const h=Number(r[l]);s.fill(r[l+e],o,o+h),o+=h}return s}function Rf(r,e,i){const s=new Float64Array(i);let o=0;for(let l=0;l<e;l++){const h=r[l];s.fill(r[l+e],o,o+h),o+=h}return s}function Bf(r){const e=new Int32Array(r.length);e[0]=yt(r[0]);const i=r.length/4*4;let s=1;if(i>=4)for(;s<i-4;s+=4){const o=r[s+1],l=r[s+2],h=r[s+3];e[s]=yt(r[s])+e[s-1],e[s+1]=yt(o)+e[s],e[s+2]=yt(l)+e[s+1],e[s+3]=yt(h)+e[s+2]}for(;s!==r.length;++s)e[s]=yt(r[s])+e[s-1];return e}function Of(r){const e=new BigInt64Array(r.length);e[0]=Li(r[0]);const i=r.length/4*4;let s=1;if(i>=4)for(;s<i-4;s+=4){const o=r[s+1],l=r[s+2],h=r[s+3];e[s]=Li(r[s])+e[s-1],e[s+1]=Li(o)+e[s],e[s+2]=Li(l)+e[s+1],e[s+3]=Li(h)+e[s+2]}for(;s!==e.length;++s)e[s]=Li(r[s])+e[s-1];return e}function wd(r){const e=r.length/4*4;let i=1;if(e>=4)for(let s=r[0];i<e-4;i+=4)s=r[i]+=s,s=r[i+1]+=s,s=r[i+2]+=s,s=r[i+3]+=s;for(;i!==r.length;)r[i]+=r[i-1],++i}var wi,Br,go,rr,Dt,ci,Vf,bs;function Fi(r,e){const i=(function(s,o){const l=s[o.get()],h=Object.values(wi)[l>>4];let d=null;switch(h){case wi.DATA:d={dictionaryType:Object.values(Br)[15&l]};break;case wi.OFFSET:d={offsetType:Object.values(go)[15&l]};break;case wi.LENGTH:d={lengthType:Object.values(rr)[15&l]}}o.increment();const g=s[o.get()],m=Object.values(tt)[g>>5],v=Object.values(tt)[g>>2&7],_=Object.values(xs)[3&g];o.increment();const T=Mi(s,o,2),x=T[0];return{physicalStreamType:h,logicalStreamType:d,logicalLevelTechnique1:m,logicalLevelTechnique2:v,physicalLevelTechnique:_,numValues:x,byteLength:T[1],decompressedCount:x}})(r,e);return i.logicalLevelTechnique1===tt.MORTON?(function(s,o,l){const h=Mi(o,l,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:s.decompressedCount,numBits:h[0],coordinateShift:h[1]}})(i,r,e):tt.RLE!==i.logicalLevelTechnique1&&tt.RLE!==i.logicalLevelTechnique2||xs.NONE===i.physicalLevelTechnique?i:(function(s,o,l){const h=Mi(o,l,2);return{physicalStreamType:s.physicalStreamType,logicalStreamType:s.logicalStreamType,logicalLevelTechnique1:s.logicalLevelTechnique1,logicalLevelTechnique2:s.logicalLevelTechnique2,physicalLevelTechnique:s.physicalLevelTechnique,numValues:s.numValues,byteLength:s.byteLength,decompressedCount:h[1],runs:h[0],numRleValues:h[1]}})(i,r,e)}(function(r){r.PRESENT="PRESENT",r.DATA="DATA",r.OFFSET="OFFSET",r.LENGTH="LENGTH"})(wi||(wi={})),(function(r){r.NONE="NONE",r.SINGLE="SINGLE",r.SHARED="SHARED",r.VERTEX="VERTEX",r.MORTON="MORTON",r.FSST="FSST"})(Br||(Br={})),(function(r){r.VERTEX="VERTEX",r.INDEX="INDEX",r.STRING="STRING",r.KEY="KEY"})(go||(go={})),(function(r){r.VAR_BINARY="VAR_BINARY",r.GEOMETRIES="GEOMETRIES",r.PARTS="PARTS",r.RINGS="RINGS",r.TRIANGLES="TRIANGLES",r.SYMBOL="SYMBOL",r.DICTIONARY="DICTIONARY"})(rr||(rr={})),(function(r){r[r.FLAT=0]="FLAT",r[r.CONST=1]="CONST",r[r.SEQUENCE=2]="SEQUENCE",r[r.DICTIONARY=3]="DICTIONARY",r[r.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(Dt||(Dt={}));class Or{constructor(e,i){this.values=e,this._size=i}get(e){const i=Math.floor(e/8);return(this.values[i]>>e%8&1)==1}set(e,i){const s=Math.floor(e/8);this.values[s]=this.values[s]|(i?1:0)<<e%8}getInt(e){const i=Math.floor(e/8);return this.values[i]>>e%8&1}size(){return this._size}getBuffer(){return this.values}}function Da(r,e,i){if(!e)return r;const s=e.size(),o=new r.constructor(s);let l=0;for(let h=0;h<s;h++)o[h]=e.get(h)?r[l++]:i;return o}function Td(r,e,i,s,o){return(function(l,h,d,g){let m;switch(h.logicalLevelTechnique1){case tt.DELTA:if(h.logicalLevelTechnique2===tt.RLE){const v=h;if(!g)return(function(_,T,x){const I=new Int32Array(x);let M=0,D=0;for(let k=0;k<T;k++){const O=_[k],B=yt(_[k+T]);for(let N=0;N<O;N++)D+=B,I[M++]=D}return I})(l,v.runs,v.numRleValues);m=Bf(l=xd(l,v.runs,v.numRleValues))}else m=Bf(l);break;case tt.RLE:m=(function(v,_,T){if(T===void 0){T=0;for(let M=0;M<_;M++)T+=v[M]}const x=new Int32Array(T);let I=0;for(let M=0;M<_;M++){const D=v[M];let k=v[M+_];k=yt(k),x.fill(k,I,I+D),I+=D}return x})(l,h.runs,h.numRleValues);break;case tt.MORTON:wd(l),m=new Int32Array(l);break;case tt.COMPONENTWISE_DELTA:m=(function(v){if(v.length<2)return new Int32Array(v);const _=new Int32Array(v.length);_[0]=yt(v[0]),_[1]=yt(v[1]);const T=v.length/4*4;let x=2;if(T>=4)for(;x<T-4;x+=4){const I=v[x+1],M=v[x+2],D=v[x+3];
2_[x]=yt(v[x])+_[x-2],_[x+1]=yt(I)+_[x-1],_[x+2]=yt(M)+_[x],_[x+3]=yt(D)+_[x+1]}for(;x!==v.length;x+=2)_[x]=yt(v[x])+_[x-2],_[x+1]=yt(v[x+1])+_[x-1];return _})(l);break;case tt.NONE:m=(function(v){const _=new Int32Array(v.length);for(let T=0;T<v.length;T++)_[T]=yt(v[T]);return _})(l);break;default:throw new Error(`The specified Logical level technique is not supported: ${h.logicalLevelTechnique1}`)}return g?Da(m,g,0):m})(ka(r,e,i),i,0,o)}function nr(r,e,i,s,o){return(function(l,h,d,g){let m;switch(h.logicalLevelTechnique1){case tt.DELTA:m=(function(v){const _=new Uint32Array(v.length);_[0]=yt(v[0])>>>0;for(let T=1;T<v.length;T++)_[T]=_[T-1]+yt(v[T])>>>0;return _})(h.logicalLevelTechnique2===tt.RLE?xd(l,h.runs,h.numRleValues):l);break;case tt.RLE:m=xd(l,h.runs,h.numRleValues);break;case tt.MORTON:wd(l),m=l;break;case tt.COMPONENTWISE_DELTA:m=(function(v){if(v.length<2)return new Uint32Array(v);const _=new Uint32Array(v.length);_[0]=yt(v[0])>>>0,_[1]=yt(v[1])>>>0;for(let T=2;T<v.length;T+=2)_[T]=_[T-2]+yt(v[T])>>>0,_[T+1]=_[T-1]+yt(v[T+1])>>>0;return _})(l);break;case tt.NONE:m=l;break;default:throw new Error(`The specified Logical level technique is not supported: ${h.logicalLevelTechnique1}`)}return g?Da(m,g,0):m})(ka(r,e,i),i,0,o)}function ws(r,e,i){return(function(s,o){if(o.logicalLevelTechnique1===tt.DELTA&&o.logicalLevelTechnique2===tt.NONE)return(function(l){const h=new Int32Array(l.length+1);h[0]=0,h[1]=yt(l[0]);let d=h[1];for(let g=2;g!==h.length;++g)d+=yt(l[g-1]),h[g]=h[g-1]+d;return new Uint32Array(h)})(s);if(o.logicalLevelTechnique1===tt.RLE&&o.logicalLevelTechnique2===tt.NONE)return(function(l,h,d){const g=new Uint32Array(d+1);g[0]=0;let m=1,v=g[0];for(let _=0;_<h;_++){const T=l[_],x=l[_+h];for(let I=m;I<m+T;I++)g[I]=x+v,v=g[I];m+=T}return g})(s,o.runs,o.numRleValues);if(o.logicalLevelTechnique1===tt.NONE&&o.logicalLevelTechnique2===tt.NONE){(function(h){let d=0;for(let g=0;g<h.length;g++)h[g]+=d,d=h[g]})(s);const l=new Uint32Array(o.numValues+1);return l[0]=0,l.set(s,1),l}if(o.logicalLevelTechnique1===tt.DELTA&&o.logicalLevelTechnique2===tt.RLE){const l=(function(h,d,g){const m=new Int32Array(g+1);m[0]=0;let v=1,_=m[0];for(let T=0;T<d;T++){const x=h[T];let I=h[T+d];I=yt(I);for(let M=v;M<v+x;M++)m[M]=I+_,_=m[M];v+=x}return m})(s,o.runs,o.numRleValues);return wd(l),new Uint32Array(l)}throw new Error("Only delta encoding is supported for transforming length to offset streams yet.")})(ka(r,e,i),i)}function ka(r,e,i){const s=i.physicalLevelTechnique;switch(s){case xs.FAST_PFOR:return(function(o,l,h,d){return(function(g,m,v,_,T){const x=_.get();if(3&v)throw new Error(`FastPFOR: invalid encodedByteLength=${v} at offset=${x} (encodedBytes.length=${g.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);const I=v>>>2,M=(function(k,O){if(O<=k.encodedWords.length)return k.encodedWords;const B=new Uint32Array(Math.max(16,2*O));return k.encodedWords=B,B})(T,I);(function(k,O,B,N){if(O<0||B<0||O+B>k.length)throw new RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${O}, byteLength=${B}, bytes.length=${k.length})`);const $=Math.floor(B/4),W=B%4!=0,ie=W?$+1:$;if(N.length<ie)throw new RangeError(`decodeBigEndianInt32sInto: out.length=${N.length} < ${ie}`);if($>0){const ne=k.byteOffset+O;if(3&ne)for(let ae=0;ae<$;ae++){const ue=O+4*ae;N[ae]=k[ue]<<24|k[ue+1]<<16|k[ue+2]<<8|k[ue+3]}else{const ae=new Uint32Array(k.buffer,ne,$);for(let ue=0;ue<$;ue++)N[ue]=0|zy(ae[ue])}}if(W){const ne=O+4*$,ae=B-4*$;let ue=0;for(let ye=0;ye<ae;ye++)ue|=k[ne+ye]<<24-8*ye;N[$]=0|ue}})(g,x,v,M);const D=(function(k,O,B){let N=0,$=0;const W=new Uint32Array(O),ie=B??Ff();if(k.length>0){const ne=0|k[N];if(N=N+1|0,255&ne)throw new Error(`FastPFOR decode: invalid alignedLength=${ne} (expected multiple of 256)`);if($+ne>W.length)throw new Error(`FastPFOR decode: output buffer too small (outPos=${$}, alignedLength=${ne}, out.length=${W.length})`);N=(function(ae,ue,ye,ge,_e,de){const Ie=ge+yd(_e,Bn);let Fe=ge,ke=ye;for(;Fe!==Ie;){const Pe=Math.min(vd,Ie-Fe);ke=Oy(ae,ue,ke,Fe,Pe,de),Fe=Fe+Pe|0}return ke})(k,W,N,$,ne,ie),$=$+ne|0}return(function(ne,ae,ue,ye,ge,_e){if(_e===0)return ae;let de=0,Ie=ae;const Fe=ae+ue,ke=ge;let Pe=ge;const qe=ge+_e;let lt=0,ut=0;for(;Ie<Fe&&Pe<qe;){const _t=ne[Ie]>>>de&255;if(de+=8,Ie+=de>>>5,de&=31,lt|=(127&_t)<<ut,128&_t)ye[Pe++]=0|lt,lt=0,ut=0;else if(ut+=7,ut>28)throw new Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${ut}, partial=${lt}, decoded=${Pe-ke}/${_e}, inPos=${Ie}, inEnd=${Fe})`)}if(Pe!==qe)throw new Error(`FastPFOR VByte: truncated stream (decoded=${Pe-ke}, expected=${_e}, consumedWords=${Ie-ae}/${ue}, vbyteStart=${ae}, vbyteEnd=${Fe})`)})(k,N,k.length-N|0,W,$,O-$|0),W})(M.subarray(0,I),m,T.decoderWorkspace);return _.add(v),D})(o,l,h,d,(function(g=16){if(g<0)throw new RangeError(`initialEncodedWordCapacity must be >= 0, got ${g}`);const m=Math.max(16,0|g);return{encodedWords:new Uint32Array(m),decoderWorkspace:Ff()}})(h>>>2))})(r,i.numValues,i.byteLength,e);case xs.VARINT:return Mi(r,e,i.numValues);case xs.NONE:{const o=e.get();e.add(i.byteLength);const l=r.subarray(o,e.get());return new Uint32Array(l)}default:throw new Error(`Specified physicalLevelTechnique ${s} is not supported (yet).`)}}function Sd(r,e,i){const s=ka(r,e,i);return s.length===1?s[0]:(function(o){return o[1]})(s)}function jf(r,e,i){return(function(s){if(s.length===2){const o=yt(s[1]);return[o,o]}return[yt(s[2]),yt(s[3])]})(ka(r,e,i))}function Nf(r,e,i){return(function(s){if(s.length===2){const o=Li(s[1]);return[o,o]}return[Li(s[2]),Li(s[3])]})(Ca(r,e,i.numValues))}function Uf(r,e,i,s){return(function(o,l,h){let d;switch(l.logicalLevelTechnique1){case tt.DELTA:d=(function(g){const m=new BigUint64Array(g.length);m[0]=BigInt.asUintN(64,Li(g[0]));for(let v=1;v<g.length;v++)m[v]=BigInt.asUintN(64,m[v-1]+Li(g[v]));return m})(l.logicalLevelTechnique2===tt.RLE?bd(o,l.runs,l.numRleValues):o);break;case tt.RLE:d=bd(o,l.runs,l.numRleValues);break;case tt.NONE:d=o;break;default:throw new Error(`The specified Logical level technique is not supported: ${l.logicalLevelTechnique1}`)}return h?Da(d,h,0n):d})(Ca(r,e,i.numValues),i,s)}function $f(r,e,i){const s=Ca(r,e,i.numValues);return s.length===1?s[0]:(function(o){return o[1]})(s)}function Ou(r,e,i,s,o="int32"){const l=r.logicalLevelTechnique1;if(l===tt.RLE)return r.runs===1?Dt.CONST:Dt.FLAT;if(l!==tt.DELTA||r.logicalLevelTechnique2!==tt.RLE)return r.numValues===1?Dt.CONST:Dt.FLAT;const h=e instanceof Or?e.size():e;
2if(r.numRleValues!==h)return Dt.FLAT;if(r.runs===1)return Dt.SEQUENCE;if(r.runs!==2)return r.numValues===1?Dt.CONST:Dt.FLAT;const d=s.get();if(r.physicalLevelTechnique===xs.VARINT)return(function(v,_,T){const x=new Lf(_.get());if(T==="int64"){const M=Ca(v,x,4);return M[2]===2n&&M[3]===2n}const I=Mi(v,x,4);return I[2]===2&&I[3]===2})(i,s,o)?Dt.SEQUENCE:r.numValues===1?Dt.CONST:Dt.FLAT;const g=s.get(),m=new Int32Array(i.buffer,i.byteOffset+g,4);return s.set(d),m[2]===2&&m[3]===2?Dt.SEQUENCE:r.numValues===1?Dt.CONST:Dt.FLAT}class Gf extends Bu{getValueFromBuffer(e){return this.dataBuffer[e]}}class qf extends zf{constructor(e,i,s,o){super(e,BigInt64Array.of(i),s,o)}getValueFromBuffer(e){return this.dataBuffer[0]+BigInt(e)*this.delta}}function Pd(r,e,i){return{x:Zf(r,e)-i,y:Zf(r>>1,e)-i}}function Zf(r,e){let i=0;for(let s=0;s<e;s++)i|=(r&1<<2*s)>>s;return i}function za(r,e,i,s,o,l,h){return r===bs.MORTON?(function(d,g,m,v,_,T){const x=new Array(_?v+1:v);for(let I=0;I<v;I++){const M=Pd(d[g[m+I]],T.numBits,T.coordinateShift);x[I]=new H(M.x,M.y)}return _&&(x[x.length-1]=x[0]),x})(e,i,s,o,l,h):(function(d,g,m,v,_){const T=new Array(_?v+1:v);for(let x=0;x<2*v;x+=2){const I=2*g[m+x/2];T[x/2]=new H(d[I],d[I+1])}return _&&(T[T.length-1]=T[0]),T})(e,i,s,o,l)}function La(r,e,i,s){const o=new Array(s?i+1:i);for(let l=0;l<2*i;l+=2)o[l/2]=new H(r[e+l],r[e+l+1]);return s&&(o[o.length-1]=o[0]),o}(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON",r[r.MULTIPOINT=3]="MULTIPOINT",r[r.MULTILINESTRING=4]="MULTILINESTRING",r[r.MULTIPOLYGON=5]="MULTIPOLYGON"})(ci||(ci={})),(function(r){r[r.POINT=0]="POINT",r[r.LINESTRING=1]="LINESTRING",r[r.POLYGON=2]="POLYGON"})(Vf||(Vf={})),(function(r){r[r.MORTON=0]="MORTON",r[r.VEC_2=1]="VEC_2",r[r.VEC_3=2]="VEC_3"})(bs||(bs={}));class Wf{constructor(e,i,s,o,l){this._vertexBufferType=e,this._topologyVector=i,this._vertexOffsets=s,this._vertexBuffer=o,this._mortonSettings=l}get vertexBufferType(){return this._vertexBufferType}get topologyVector(){return this._topologyVector}get vertexOffsets(){return this._vertexOffsets}get vertexBuffer(){return this._vertexBuffer}getSimpleEncodedVertex(e){const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getVertex(e){if(this.vertexOffsets&&this.mortonSettings){const s=Pd(this.vertexBuffer[this.vertexOffsets[e]],this.mortonSettings.numBits,this.mortonSettings.coordinateShift);return[s.x,s.y]}const i=this.vertexOffsets?2*this.vertexOffsets[e]:2*e;return[this.vertexBuffer[i],this.vertexBuffer[i+1]]}getGeometries(){return(function(e){const i=new Array(e.numGeometries);let s=1,o=1,l=1,h=0,d=0,g=0;const m=e.mortonSettings,v=e.topologyVector,_=v.geometryOffsets,T=v.partOffsets,x=v.ringOffsets,I=e.vertexOffsets,M=!I||I.length===0,D=e.containsPolygonGeometry(),k=e.vertexBuffer;for(let O=0;O<e.numGeometries;O++)switch(e.geometryType(O)){case ci.POINT:{let B,N;if(M)B=k[d++],N=k[d++];else if(e.vertexBufferType===bs.MORTON){const $=Pd(k[I[g++]],m.numBits,m.coordinateShift);B=$.x,N=$.y}else{const $=2*I[g++];B=k[$],N=k[$+1]}i[h++]=[[new H(B,N)]],_&&l++,T&&s++,x&&o++}break;case ci.MULTIPOINT:{const B=_[l]-_[l-1];l++;const N=new Array(B);if(M)for(let $=0;$<B;$++){const W=k[d++],ie=k[d++];N[$]=new H(W,ie)}else for(let $=0;$<B;$++){const W=2*I[g++];N[$]=new H(k[W],k[W+1])}i[h++]=N.map(($=>[$])),s+=B,o+=B}break;case ci.LINESTRING:{let B,N;D?(B=x[o]-x[o-1],o++):B=T[s]-T[s-1],s++,M?(N=La(k,d,B,!1),d+=2*B):(N=za(e.vertexBufferType,k,I,g,B,!1,m),g+=B),i[h++]=[N],_&&l++}break;case ci.POLYGON:{const B=T[s]-T[s-1];s++;const N=new Array(B-1);let $,W=x[o]-x[o-1];if(o++,M){$=La(k,d,W,!0),d+=2*W;for(let ie=0;ie<N.length;ie++)W=x[o]-x[o-1],o++,N[ie]=La(k,d,W,!0),d+=2*W}else{$=za(e.vertexBufferType,k,I,g,W,!0,m),g+=W;for(let ie=0;ie<N.length;ie++)W=x[o]-x[o-1],o++,N[ie]=za(e.vertexBufferType,k,I,g,W,!0,m),g+=W}i[h++]=[$].concat(N),_&&l++}break;case ci.MULTILINESTRING:{const B=_[l]-_[l-1];l++;const N=new Array(B);for(let $=0;$<B;$++){let W;D?(W=x[o]-x[o-1],o++):W=T[s]-T[s-1],s++,M?(N[$]=La(k,d,W,!1),d+=2*W):(N[$]=za(e.vertexBufferType,k,I,g,W,!1,m),g+=W)}i[h++]=N}break;case ci.MULTIPOLYGON:{const B=_[l]-_[l-1];l++;const N=new Array(B);for(let $=0;$<B;$++){const W=T[s]-T[s-1];let ie;s++;const ne=new Array(W-1),ae=x[o]-x[o-1];o++,M?(ie=La(k,d,ae,!0),d+=2*ae):(ie=za(e.vertexBufferType,k,I,g,ae,!0,m),g+=ae);for(let ue=0;ue<ne.length;ue++){const ye=x[o]-x[o-1];o++,M?(ne[ue]=La(k,d,ye,!0),d+=2*ye):(ne[ue]=za(e.vertexBufferType,k,I,g,ye,!0,m),g+=ye)}N[$]=[ie].concat(ne)}i[h++]=N.flat()}break;default:throw new Error("The specified geometry type is currently not supported.")}return i})(this)}get mortonSettings(){return this._mortonSettings}}class Hf extends Wf{constructor(e,i,s,o,l,h,d){super(s,o,l,h,d),this._numGeometries=e,this._geometryType=i}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsPolygonGeometry(){return this._geometryType===ci.POLYGON||this._geometryType===ci.MULTIPOLYGON}containsSingleGeometryType(){return!0}}class Xf extends Wf{constructor(e,i,s,o,l,h){super(e,s,o,l,h),this._geometryTypes=i}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)===ci.POLYGON||this.geometryType(e)===ci.MULTIPOLYGON)return!0;return!1}containsSingleGeometryType(){return!1}}class Yf{constructor(e,i,s,o){this._triangleOffsets=e,this._indexBuffer=i,this._vertexBuffer=s,this._topologyVector=o}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 new Error("Cannot convert GpuVector to coordinates without topology information");const e=new Array(this.numGeometries),i=this._topologyVector,s=i.partOffsets,o=i.ringOffsets,l=i.geometryOffsets;let h=0,d=1,g=1,m=1;for(let v=0;v<this.numGeometries;v++)switch(this.geometryType(v)){case ci.POLYGON:{const _=s[d]-s[d-1];d++;const T=[];for(let x=0;x<_;x++){const I=o[g]-o[g-1];g++;const M=[];for(let D=0;D<I;D++){const k=this._vertexBuffer[h++],O=this._vertexBuffer[h++];M.push(new H(k,O))}M.length>0&&M.push(M[0]),T.push(M)}e[v]=T,l&&m++}break;case ci.MULTIPOLYGON:{const _=l[m]-l[m-1];m++;const T=[];for(let x=0;x<_;x++){const I=s[d]-s[d-1];d++;for(let M=0;M<I;M++){const D=o[g]-o[g-1];g++;const k=[];for(let O=0;O<D;O++){const B=this._vertexBuffer[h++],N=this._vertexBuffer[h++];k.push(new H(B,N))}k.length>0&&k.push(k[0]),T.push(k)}}e[v]=T}}return e}[Symbol.iterator](){return null}}function Kf(r,e,i,s,o,l){return new Uy(r,e,i,s,o,l)}class Uy extends Yf{constructor(e,i,s,o,l,h){super(s,o,l,h),this._numGeometries=e,this._geometryType=i}geometryType(e){return this._geometryType}get numGeometries(){return this._numGeometries}containsSingleGeometryType(){return!0}}function Jf(r,e,i,s,o){return new $y(r,e,i,s,o)}class $y extends Yf{constructor(e,i,s,o,l){super(i,s,o,l),this._geometryTypes=e}geometryType(e){return this._geometryTypes[e]}get numGeometries(){return this._geometryTypes.length}containsSingleGeometryType(){return!1}}function Gy(r,e,i,s,o){const l=Fi(r,i);let h,d,g,m;if(Ou(l,s,r,i)===Dt.CONST){const O=Sd(r,i,l);let B,N,$,W;for(let ie=0;ie<e-1;ie++){const ne=Fi(r,i);switch(ne.physicalStreamType){case wi.LENGTH:switch(ne.logicalStreamType.lengthType){case rr.GEOMETRIES:B=ws(r,i,ne);break;case rr.PARTS:N=ws(r,i,ne);break;case rr.RINGS:$=ws(r,i,ne);break;case rr.TRIANGLES:W=ws(r,i,ne)}break;case wi.OFFSET:switch(ne.logicalStreamType.offsetType){case go.VERTEX:h=nr
2(r,i,ne);break;case go.INDEX:m=nr(r,i,ne)}break;case wi.DATA:Br.VERTEX===ne.logicalStreamType.dictionaryType?d=Td(r,i,ne):(g={numBits:ne.numBits,coordinateShift:ne.coordinateShift},d=nr(r,i,ne))}}return m?B!==void 0||N!==void 0?Kf(s,O,W,m,d,{geometryOffsets:B,partOffsets:N,ringOffsets:$}):Kf(s,O,W,m,d):g===void 0?(function(ie,ne,ae,ue,ye){return new Hf(ie,ne,bs.VEC_2,ae,ue,ye)})(s,O,{geometryOffsets:B,partOffsets:N,ringOffsets:$},h,d):(function(ie,ne,ae,ue,ye,ge){return new Hf(ie,ne,bs.MORTON,ae,ue,ye,ge)})(s,O,{geometryOffsets:B,partOffsets:N,ringOffsets:$},h,d,g)}const v=nr(r,i,l);let _,T,x,I,M,D,k;for(let O=0;O<e-1;O++){const B=Fi(r,i);switch(B.physicalStreamType){case wi.LENGTH:switch(B.logicalStreamType.lengthType){case rr.GEOMETRIES:_=nr(r,i,B);break;case rr.PARTS:T=nr(r,i,B);break;case rr.RINGS:x=nr(r,i,B);break;case rr.TRIANGLES:I=ws(r,i,B)}break;case wi.OFFSET:switch(B.logicalStreamType.offsetType){case go.VERTEX:h=nr(r,i,B);break;case go.INDEX:m=nr(r,i,B)}break;case wi.DATA:Br.VERTEX===B.logicalStreamType.dictionaryType?d=Td(r,i,B):(g={numBits:B.numBits,coordinateShift:B.coordinateShift},d=nr(r,i,B))}}return _?(M=Id(v,_,2),T&&x?(D=Qf(v,M,T,!1),k=(function(O,B,N,$){const W=new Uint32Array(N[N.length-1]+1);let ie=0;W[0]=ie;let ne=1,ae=1,ue=0;for(let ye=0;ye<O.length;ye++){const ge=O[ye],_e=B[ye+1]-B[ye];if(ge!==0&&ge!==3)for(let de=0;de<_e;de++){const Ie=N[ne]-N[ne-1];ne++;for(let Fe=0;Fe<Ie;Fe++)ie=W[ae++]=ie+$[ue++]}else for(let de=0;de<_e;de++)W[ae++]=++ie,ne++}return W})(v,M,D,x)):T&&(D=(function(O,B,N){const $=new Uint32Array(B[B.length-1]+1);let W=0;$[0]=W;let ie=1,ne=0;for(let ae=0;ae<O.length;ae++){const ue=O[ae],ye=B[ae+1]-B[ae];if(ue===4||ue===1)for(let ge=0;ge<ye;ge++)W=$[ie++]=W+N[ne++];else for(let ge=0;ge<ye;ge++)$[ie++]=++W}return $})(v,M,T))):T&&x?(D=Id(v,T,1),k=Qf(v,D,x,!0)):T&&(D=Id(v,T,0)),m&&!D?Jf(v,I,m,d):m?Jf(v,I,m,d,{geometryOffsets:M,partOffsets:D,ringOffsets:k}):g===void 0?(function(O,B,N,$){return new Xf(bs.VEC_2,O,B,N,$)})(v,{geometryOffsets:M,partOffsets:D,ringOffsets:k},h,d):(function(O,B,N,$,W){return new Xf(bs.MORTON,O,B,N,$,W)})(v,{geometryOffsets:M,partOffsets:D,ringOffsets:k},h,d,g)}function Id(r,e,i){const s=new Uint32Array(r.length+1);let o=0;s[0]=o;let l=0;for(let h=0;h<r.length;h++)o=s[h+1]=o+(r[h]>i?e[l++]:1);return s}function Qf(r,e,i,s){const o=new Uint32Array(e[e.length-1]+1);let l=0;o[0]=l;let h=1,d=0;for(let g=0;g<r.length;g++){const m=r[g],v=e[g+1]-e[g];if(m===5||m===2||s&&(m===4||m===1))for(let _=0;_<v;_++)l=o[h++]=l+i[d++];else for(let _=0;_<v;_++)o[h++]=++l}return o}class qy extends Ea{constructor(e,i,s){super(e,i.getBuffer(),s),this.dataVector=i}getValueFromBuffer(e){return this.dataVector.get(e)}}class Zy extends Bu{getValueFromBuffer(e){return this.dataBuffer[e]}}class em extends Ea{constructor(e,i,s,o){super(e,o?BigInt64Array.of(i):BigUint64Array.of(i),s)}getValueFromBuffer(e){return this.dataBuffer[0]}}function ac(r,e,i,s,o){const l=(function(h,d,g,m){const v=new Uint8Array(d);let _=0;const T=m.get()+g;for(;_<d&&!(m.get()>=T);){const x=h[m.increment()];if(x<=127){const I=x+3,M=h[m.increment()],D=Math.min(_+I,d);v.fill(M,_,D),_=D}else{const I=256-x;for(let M=0;M<I&&_<d;M++)v[_++]=h[m.increment()]}}return m.set(T),v})(r,Math.ceil(e/8),i,s);return o?(function(h,d,g){if(!g)return h;const m=g.size(),v=new Or(h,d),_=new Or(new Uint8Array(Math.ceil(m/8)),m);let T=0;for(let x=0;x<m;x++){const I=!!g.get(x)&&v.get(T++);_.set(x,I)}return _.getBuffer()})(l,e,o):l}const Wy=new TextDecoder;function Md(r,e,i){return i-e>=12?Wy.decode(r.subarray(e,i)):(function(s,o,l){let h="",d=o;for(;d<l;){const g=s[d];let m,v,_,T=null,x=g>239?4:g>223?3:g>191?2:1;if(d+x>l)break;x===1?g<128&&(T=g):x===2?(m=s[d+1],(192&m)==128&&(T=(31&g)<<6|63&m,T<=127&&(T=null))):x===3?(m=s[d+1],v=s[d+2],(192&m)==128&&(192&v)==128&&(T=(15&g)<<12|(63&m)<<6|63&v,(T<=2047||T>=55296&&T<=57343)&&(T=null))):x===4&&(m=s[d+1],v=s[d+2],_=s[d+3],(192&m)==128&&(192&v)==128&&(192&_)==128&&(T=(15&g)<<18|(63&m)<<12|(63&v)<<6|63&_,(T<=65535||T>=1114112)&&(T=null))),T===null?(T=65533,x=1):T>65535&&(T-=65536,h+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),h+=String.fromCharCode(T),d+=x}return h})(r,e,i)}
2class Ed extends Ea{constructor(e,i,s,o){super(e,s,o),this.offsetBuffer=i}}class tm extends Ed{constructor(e,i,s,o){super(e,i,s,o??i.length-1)}getValueFromBuffer(e){return Md(this.dataBuffer,this.offsetBuffer[e],this.offsetBuffer[e+1])}}class Fa extends Ed{constructor(e,i,s,o,l){super(e,s,o,l??i.length),this.indexBuffer=i,this.indexBuffer=i}getValueFromBuffer(e){const i=this.indexBuffer[e];return Md(this.dataBuffer,this.offsetBuffer[i],this.offsetBuffer[i+1])}}class im extends Ed{constructor(e,i,s,o,l,h,d){super(e,s,o,d),this.indexBuffer=i,this.symbolOffsetBuffer=l,this.symbolTableBuffer=h}getValueFromBuffer(e){this.decodedDictionary??(this.symbolLengthBuffer??=this.offsetToLengthBuffer(this.symbolOffsetBuffer),this.decodedDictionary=(function(s,o,l){const h=[],d=new Array(o.length).fill(0);for(let g=1;g<o.length;g++)d[g]=d[g-1]+o[g-1];for(let g=0;g<l.length;g++)if(l[g]===255)h.push(l[++g]);else{const m=o[l[g]],v=d[l[g]];for(let _=0;_<m;_++)h.push(s[v+_])}return new Uint8Array(h)})(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer));const i=this.indexBuffer[e];return Md(this.decodedDictionary,this.offsetBuffer[i],this.offsetBuffer[i+1])}offsetToLengthBuffer(e){const i=new Uint32Array(e.length-1);let s=e[0];for(let o=1;o<e.length;o++){const l=e[o];i[o-1]=l-s,s=l}return i}}function Hy(r,e,i,s,o,l){return i.type==="scalarType"?(function(h,d,g,m,v,_){let T=null;if(h===0)return null;if(_.nullable){const I=Fi(d,g),M=I.numValues,D=g.get(),k=ac(d,M,I.byteLength,g);g.set(D+I.byteLength),T=new Or(k,I.numValues)}const x=T??m;switch(v.physicalType){case 4:case 3:return(function(I,M,D,k,O){const B=Fi(I,M),N=Ou(B,O,I,M),$=k.physicalType===3;if(N===Dt.FLAT){const ie=lc(O)?O:void 0,ne=$?Td(I,M,B,0,ie):nr(I,M,B,0,ie);return new dd(D.name,ne,O)}if(N===Dt.SEQUENCE){const ie=jf(I,M,B);return new fd(D.name,ie[0],ie[1],B.numRleValues)}const W=$?(function(ie,ne,ae){const ue=ka(ie,ne,ae);return ue.length===1?yt(ue[0]):(function(ye){return yt(ye[1])})(ue)})(I,M,B):Sd(I,M,B);return new md(D.name,W,O,$)})(d,g,_,v,x);case 9:return(function(I,M,D,k,O){let B=null,N=null,$=null,W=null,ie=null,ne=O??null,ae=null,ue=null;for(let ye=0;ye<k;ye++){const ge=Fi(M,D);switch(ge.physicalStreamType){case wi.PRESENT:{const _e=new Or(ac(M,ge.numValues,ge.byteLength,D),ge.numValues);ne=O??_e;break}case wi.OFFSET:N=nr(M,D,ge,0,ne);break;case wi.LENGTH:{const _e=ws(M,D,ge);rr.DICTIONARY===ge.logicalStreamType.lengthType?B=_e:rr.SYMBOL===ge.logicalStreamType.lengthType?W=_e:ae=_e;break}case wi.DATA:{const _e=M.subarray(D.get(),D.get()+ge.byteLength);D.add(ge.byteLength);const de=ge.logicalStreamType.dictionaryType;Br.FSST===de?ie=_e:Br.SINGLE===de||Br.SHARED===de?$=_e:Br.NONE===de&&(ue=_e);break}}}return(function(ye,ge,_e,de,Ie,Fe,ke){return ge?new im(ye,_e,de,Ie,Fe,ge,ke):null})(I,ie,N,B,$,W,ne)??(function(ye,ge,_e,de,Ie){return ge?Ie?new Fa(ye,_e,de,ge,Ie):new Fa(ye,_e,de,ge):null})(I,$,N,B,ne)??(function(ye,ge,_e,de,Ie){if(!ge||!_e)return null;if(de)return Ie?new Fa(ye,de,ge,_e,Ie):new Fa(ye,de,ge,_e);if(Ie&&Ie.size()!==ge.length-1){const Fe=new Uint32Array(Ie.size());let ke=0;for(let Pe=0;Pe<Ie.size();Pe++)Fe[Pe]=Ie.get(Pe)?ke++:0;return new Fa(ye,Fe,ge,_e,Ie)}return Ie?new tm(ye,ge,_e,Ie):new tm(ye,ge,_e)})(I,ae,ue,N,ne)})(_.name,d,g,_.nullable?h-1:h,T);case 0:return(function(I,M,D,k,O){const B=Fi(I,M),N=B.numValues,$=M.get(),W=lc(O)?O:void 0,ie=ac(I,N,B.byteLength,M,W);M.set($+B.byteLength);const ne=new Or(ie,N);return new qy(D.name,ne,O)})(d,g,_,0,x);case 6:case 5:return(function(I,M,D,k,O){const B=Fi(I,M),N=Ou(B,k,I,M,"int64"),$=O.physicalType===5;if(N===Dt.FLAT){const ie=lc(k)?k:void 0,ne=$?(function(ae,ue,ye,ge){return(function(_e,de,Ie){let Fe;switch(de.logicalLevelTechnique1){case tt.DELTA:if(de.logicalLevelTechnique2===tt.RLE){const ke=de;if(!Ie)return(function(Pe,qe,lt){const ut=new BigInt64Array(lt);let _t=0,Si=0n;for(let jt=0;jt<qe;jt++){const ni=Number(Pe[jt]),ui=Li(Pe[jt+qe]);for(let kt=0;kt<ni;kt++)Si+=ui,ut[_t++]=Si}return ut})(_e,ke.runs,ke.numRleValues);Fe=Of(_e=bd(_e,ke.runs,ke.numRleValues))}else Fe=Of(_e);break;case tt.RLE:Fe=(function(ke,Pe,qe){if(qe===void 0){qe=0;for(let _t=0;_t<Pe;_t++)qe+=Number(ke[_t])}const lt=new BigInt64Array(qe);let ut=0;for(let _t=0;_t<Pe;_t++){const Si=Number(ke[_t]);let jt=ke[_t+Pe];jt=Li(jt),lt.fill(jt,ut,ut+Si),ut+=Si}return lt})(_e,de.runs,de.numRleValues);break;case tt.NONE:Fe=(function(ke){const Pe=new BigInt64Array(ke.length);for(let qe=0;qe<ke.length;qe++)Pe[qe]=Li(ke[qe]);return Pe})(_e);break;default:throw new Error(`The specified Logical level technique is not supported: ${de.logicalLevelTechnique1}`)}return Ie?Da(Fe,Ie,0n):Fe})(Ca(ae,ue,ye.numValues),ye,ge)})(I,M,B,ie):Uf(I,M,B,ie);return new Gf(D.name,ne,k)}if(N===Dt.SEQUENCE){const ie=Nf(I,M,B);
2return new qf(D.name,ie[0],ie[1],B.numRleValues)}const W=$?(function(ie,ne,ae){const ue=Ca(ie,ne,ae.numValues);return ue.length===1?Li(ue[0]):(function(ye){return Li(ye[1])})(ue)})(I,M,B):$f(I,M,B);return new em(D.name,W,k,$)})(d,g,_,x,v);case 7:return(function(I,M,D,k){const O=Fi(I,M),B=lc(k)?k:void 0,N=(function($,W,ie,ne){const ae=W.get(),ue=ae+ie*Float32Array.BYTES_PER_ELEMENT,ye=new Uint8Array($.subarray(ae,ue)).buffer,ge=new Float32Array(ye);return W.set(ue),ne?Da(ge,ne,0):ge})(I,M,O.numValues,B);return new Zy(D.name,N,k)})(d,g,_,x);case 8:return(function(I,M,D,k){const O=Fi(I,M),B=lc(k)?k:void 0,N=(function($,W,ie,ne){const ae=W.get(),ue=ae+ie*Float64Array.BYTES_PER_ELEMENT,ye=new Uint8Array($.subarray(ae,ue)).buffer,ge=new Float64Array(ye);return W.set(ue),ne?Da(ge,ne,0):ge})(I,M,O.numValues,B);return new pd(D.name,N,k)})(d,g,_,x);default:throw new Error(`The specified data type for the field is currently not supported: ${v}`)}})(s,r,e,o,i.scalarType,i):s===0?null:(function(h,d,g,m){let v=null,_=null,T=null,x=null,I=!1;for(;!I;){const O=Fi(h,d);switch(O.physicalStreamType){case wi.LENGTH:rr.DICTIONARY===O.logicalStreamType.lengthType?v=ws(h,d,O):T=ws(h,d,O);break;case wi.DATA:Br.SINGLE===O.logicalStreamType.dictionaryType||Br.SHARED===O.logicalStreamType.dictionaryType?(_=h.subarray(d.get(),d.get()+O.byteLength),I=!0):x=h.subarray(d.get(),d.get()+O.byteLength),d.add(O.byteLength)}}const M=g.complexType.children,D=[];let k=0;for(const O of M){const B=Mi(h,d,1)[0];if(B===0)continue;const N=O.name?`${g.name}${O.name}`:g.name;if(B!==2||O.type!=="scalarField"||O.scalarField.physicalType!==9)throw new Error("Currently only optional string fields are implemented for a struct.");const $=Fi(h,d),W=ac(h,$.numValues,$.byteLength,d),ie=Fi(h,d),ne=nr(h,d,ie,0,ie.decompressedCount!==m?new Or(W,$.numValues):void 0);D[k++]=x?new im(N,ne,v,_,T,x,new Or(W,$.numValues)):new Fa(N,ne,v,_,new Or(W,$.numValues))}return D})(r,e,i,o)}function lc(r){return r instanceof Or}function rm(r){switch(r){case 0:case 1:case 2:case 3:{const e={};e.nullable=!!(1&r),e.columnScope=0;const i={type:"logicalType",logicalType:0};return i.longID=!!(2&r),e.scalarType=i,e.type="scalarType",e}case 4:{const e={nullable:!1,columnScope:0};return e.type="complexType",e.complexType={type:"physicalType",physicalType:0},e}case 30:{const e={nullable:!1,columnScope:0};return e.type="complexType",e.complexType={type:"physicalType",physicalType:1},e}default:return(function(e){let i;switch(e){case 10:case 11:i=0;break;case 12:case 13:i=1;break;case 14:case 15:i=2;break;case 16:case 17:i=3;break;case 18:case 19:i=4;break;case 20:case 21:i=5;break;case 22:case 23:i=6;break;case 24:case 25:i=7;break;case 26:case 27:i=8;break;case 28:case 29:i=9;break;default:return null}const s={};s.nullable=!!(1&e),s.columnScope=0;const o={type:"physicalType"};return o.physicalType=i,s.type="scalarType",s.scalarType=o,s})(r)}}function nm(r){return r>=10}function sm(r){return r===30}function Xy(r){if(r.type==="scalarType"){const e=r.scalarType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:default:return!1;case 9:return!0}if(e.type==="logicalType")return!1}else if(r.type==="complexType"){const e=r.complexType;if(e.type==="physicalType")switch(e.physicalType){case 0:case 1:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",r),!1}function Yy(r){return r.type==="complexType"&&r.complexType?.type==="physicalType"&&r.complexType.physicalType===0}const Ky=new TextDecoder;function Cd(r,e){const i=Mi(r,e,1)[0];if(i===0)return"";const s=e.get(),o=r.subarray(s,s+i);return e.add(i),Ky.decode(o)}function om(r,e){const i=Mi(r,e,1)[0]>>>0;if(i<10||i>30)throw new Error(`Unsupported field type code ${i}. Supported: 10-29(scalars), 30(STRUCT)`);const s=rm(i);if(nm(i)&&(s.name=Cd(r,e)),sm(i)){const o=Mi(r,e,1)[0]>>>0;s.complexType.children=new Array(o);for(let l=0;l<o;l++)s.complexType.children[l]=om(r,e)}return(function(o){return{name:o.name,nullable:o.nullable,scalarField:o.scalarType,complexField:o.complexType,type:o.type==="scalarType"?"scalarField":"complexField"}})(s)}function Jy(r,e){const i=Mi(r,e,1)[0]>>>0,s=rm(i);
2if(!s)throw new Error(`Unsupported column type code ${i}. Supported: 0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT)`);if(nm(i)?s.name=Cd(r,e):i>=0&&i<=3?s.name="id":i===4&&(s.name="geometry"),sm(i)){const o=Mi(r,e,1)[0]>>>0,l=s.complexType;l.children=new Array(o);for(let h=0;h<o;h++)l.children[h]=om(r,e)}return s}function Qy(r,e){const i={featureTables:[]},s={};s.name=Cd(r,e);const o=Mi(r,e,1)[0]>>>0,l=Mi(r,e,1)[0]>>>0;s.columns=new Array(l);for(let h=0;h<l;h++)s.columns[h]=Jy(r,e);return i.featureTables.push(s),[i,o]}function e0(r,e,i,s,o,l,h=!1){const d=e.scalarType;if(!d||d.type!=="logicalType"||d.logicalType!==0)throw new Error(`ID column must be a logical ID scalar type: ${s}`);const g=d.longID?6:4,m=typeof l=="number"?void 0:l,v=Ou(o,l,r,i,g===6?"int64":"int32");if(g===4)switch(v){case Dt.FLAT:return new dd(s,nr(r,i,o,0,m),l);case Dt.SEQUENCE:{const _=jf(r,i,o);return new fd(s,_[0],_[1],o.numRleValues)}case Dt.CONST:return new md(s,Sd(r,i,o),l,!1)}switch(v){case Dt.FLAT:return h?new pd(s,(function(_,T,x){return(function(I,M){switch(M.logicalLevelTechnique1){case tt.DELTA:return M.logicalLevelTechnique2===tt.RLE&&(I=Rf(I,M.runs,M.numRleValues)),(function(D){D[0]=Aa(D[0]);const k=D.length/4*4;let O=1;if(k>=4)for(;O<k-4;O+=4){const B=D[O+1],N=D[O+2],$=D[O+3];D[O]=Aa(D[O])+D[O-1],D[O+1]=Aa(B)+D[O],D[O+2]=Aa(N)+D[O+1],D[O+3]=Aa($)+D[O+2]}for(;O!==D.length;++O)D[O]=Aa(D[O])+D[O-1]})(I),I;case tt.RLE:return(function(D,k){return Rf(D,k.runs,k.numRleValues)})(I,M);case tt.NONE:return I;default:throw new Error(`The specified Logical level technique is not supported: ${M.logicalLevelTechnique1}`)}})((function(I,M,D){const k=new Float64Array(D);for(let O=0;O<D;O++)k[O]=Ny(I,M);return k})(_,T,x.numValues),x)})(r,i,o),l):new Gf(s,Uf(r,i,o,m),l);case Dt.SEQUENCE:{const _=Nf(r,i,o);return new qf(s,_[0],_[1],o.numRleValues)}case Dt.CONST:return new em(s,$f(r,i,o),l,!1)}throw new Error("Vector type not supported for id column.")}class t0{constructor(e,i){var s;switch(this._featureData=e,this.properties=this._featureData.properties||{},(s=this._featureData.geometry)===null||s===void 0?void 0:s.type){case ci.POINT:case ci.MULTIPOINT:this.type=1;break;case ci.LINESTRING:case ci.MULTILINESTRING:this.type=2;break;case ci.POLYGON:case ci.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=i,this.id=Number(this._featureData.id)}loadGeometry(){const e=[];for(const i of this._featureData.geometry.coordinates){const s=[];for(const o of i)s.push(new H(o.x,o.y));e.push(s)}return e}}class i0{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 t0(this.features[e],this.extent)}}class am{constructor(e){this.layers={},this.layers=(function(i,s,o=!0){const l=new Lf(0),h=[];for(;l.get()<i.length;){const g=Mi(i,l,1)[0]>>>0,m=l.get()+g;if(m>i.length)throw new Error(`Block overruns tile: ${m} > ${i.length}`);if(Mi(i,l,1)[0]>>>0!=1){l.set(m);continue}const[v,_]=Qy(i,l),T=v.featureTables[0];let x=null,I=null;const M=[];let D=0;for(const O of T.columns){const B=O.name;if((d=O).type==="scalarType"&&d.scalarType?.type==="logicalType"&&d.scalarType.logicalType===0){let N=null;if(O.nullable){const W=Fi(i,l),ie=l.get(),ne=ac(i,W.numValues,W.byteLength,l);l.set(ie+W.byteLength),N=new Or(ne,W.numValues)}const $=Fi(i,l);D=N?N.size():$.decompressedCount,x=e0(i,O,l,B,$,N??D,o)}else if(Yy(O)){const N=Mi(i,l,1)[0];if(D===0){const $=l.get();D=Fi(i,l).decompressedCount,l.set($)}I=Gy(i,N,l,D)}else{const N=Xy(O)?Mi(i,l,1)[0]:1;if(N===0)continue;const $=Hy(i,l,O,N,D);if($)if(Array.isArray($))for(const W of $)M.push(W);else M.push($)}}const k=new ky(T.name,I,x,M,_);h.push(k),l.set(m)}var d;return h})(new Uint8Array(e)).reduce(((i,s)=>Object.assign(Object.assign({},i),{[s.name]:new i0(s)})),{})}}class r0{constructor(e,i){this.feature=e,this.type=e.type,this.properties=e.tags?e.tags:{}
vendor: 44,343 bytes, line 2
2,this.extent=i,"id"in e&&(typeof e.id=="string"?this.id=parseInt(e.id,10):typeof e.id!="number"||isNaN(e.id)||(this.id=e.id))}loadGeometry(){const e=[],i=this.feature.type===1?[this.feature.geometry]:this.feature.geometry;for(const s of i){const o=[];for(const l of s)o.push(new H(l[0],l[1]));e.push(o)}return e}}const cc="_geojsonTileLayer";function n0(r,e,i=""){e.writeVarintField(15,r.version||1),e.writeStringField(1,r.name||""),e.writeVarintField(5,r.extent||4096);const s={jsonPrefix:i,keys:[],values:[],keycache:{},valuecache:{}};for(let h=0;h<r.length;h++)s.feature=r.feature(h),e.writeMessage(2,s0,s);const o=s.keys;for(const h of o)e.writeStringField(3,h);const l=s.values;for(const h of l)e.writeMessage(4,l0,h)}function s0(r,e){if(!r.feature)return;const i=r.feature;i.id!==void 0&&e.writeVarintField(1,i.id),e.writeMessage(2,o0,r),e.writeVarintField(3,i.type),e.writeMessage(4,a0,i)}function o0(r,e){for(const i in r.feature?.properties){let s=r.feature.properties[i],o=r.keycache[i];if(s==null)continue;o===void 0&&(r.keys.push(i),o=r.keys.length-1,r.keycache[i]=o),e.writeVarint(o),typeof s!="string"&&typeof s!="boolean"&&typeof s!="number"&&(s=r.jsonPrefix+JSON.stringify(s));const l=typeof s+":"+s;let h=r.valuecache[l];h===void 0&&(r.values.push(s),h=r.values.length-1,r.valuecache[l]=h),e.writeVarint(h)}}function Ad(r,e){return(e<<3)+(7&r)}function lm(r){return r<<1^r>>31}function a0(r,e){const i=r.loadGeometry(),s=r.type;let o=0,l=0;for(const h of i){let d=1;s===1&&(d=h.length),e.writeVarint(Ad(1,d));const g=s===3?h.length-1:h.length;for(let m=0;m<g;m++){m===1&&s!==1&&e.writeVarint(Ad(2,g-1));const v=h[m].x-o,_=h[m].y-l;e.writeVarint(lm(v)),e.writeVarint(lm(_)),o+=v,l+=_}r.type===3&&e.writeVarint(Ad(7,1))}}function l0(r,e){const i=typeof r;i==="string"?e.writeStringField(1,r):i==="boolean"?e.writeBooleanField(7,r):i==="number"&&(r%1!=0?e.writeDoubleField(3,r):r<0?e.writeSVarintField(6,r):e.writeVarintField(5,r))}class cm{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new In(Ge,16,0),this.grid3D=new In(Ge,16,0),this.featureIndexArray=new q,this.promoteId=i}insert(e,i,s,o,l,h){const d=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(s,o,l);const g=h?this.grid3D:this.grid;for(let m=0;m<i.length;m++){const v=i[m],_=[1/0,1/0,-1/0,-1/0];for(let T=0;T<v.length;T++){const x=v[T];_[0]=Math.min(_[0],x.x),_[1]=Math.min(_[1],x.y),_[2]=Math.max(_[2],x.x),_[3]=Math.max(_[3],x.y)}_[0]<Ge&&_[1]<Ge&&_[2]>=0&&_[3]>=0&&g.insert(d,_[0],_[1],_[2],_[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=this.encoding!=="mlt"?new Fp(new ku(this.rawTileData)).layers:new am(this.rawTileData).layers,this.sourceLayerCoder=new Df(this.vtLayers?Object.keys(this.vtLayers).sort():[cc])),this.vtLayers}query(e,i,s,o){this.loadVTLayers();const l=e.params,h=Ge/e.tileSize/e.scale,d=Ws(l.filter,l.globalState),g=e.queryGeometry,m=e.queryPadding*h,v=mo.fromPoints(g),_=this.grid.query(v.minX-m,v.minY-m,v.maxX+m,v.maxY+m),T=mo.fromPoints(e.cameraQueryGeometry).expandBy(m),x=this.grid3D.query(T.minX,T.minY,T.maxX,T.maxY,((D,k,O,B)=>(function(N,$,W,ie,ne){for(const ue of N)if($<=ue.x&&W<=ue.y&&ie>=ue.x&&ne>=ue.y)return!0;const ae=[new H($,W),new H($,ne),new H(ie,ne),new H(ie,W)];if(N.length>2){for(const ue of ae)if(ga(N,ue))return!0}for(let ue=0;ue<N.length-1;ue++)if(Gg(N[ue],N[ue+1],ae))return!0;return!1})(e.cameraQueryGeometry,D-m,k-m,O+m,B+m)));for(const D of x)_.push(D);_.sort(c0);const I={};let M;for(let D=0;D<_.length;D++){const k=_[D];if(k===M)continue;M=k;const O=this.featureIndexArray.get(k);let B=null;this.loadMatchingFeature(I,O.bucketIndex,O.sourceLayerIndex,O.featureIndex,d,l.layers,l.availableImages,i,s,o,((N,$,W)=>(B||(B=Jr(N)),$.queryIntersectsFeature({queryGeometry:g,feature:N,featureState:W,geometry:B,zoom:this.z,transform:e.transform,pixelsToTileUnits:h,pixelPosMatrix:e.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:e.getElevation}))))}return I}loadMatchingFeature(e,i,s,o,l,h,d,g,m,v,_){const T=this.bucketLayerIDs[i];if(h&&!T.some((D=>h.has(D))))return;const x=this.sourceLayerCoder.decode(s),I=this.vtLayers[x].feature(o);if(l.needGeometry){const D=Qr(I,!0);if(!l.filter(new vt(this.tileID.overscaledZ),D,this.tileID.canonical))return}else if(!l.filter(new vt(this.tileID.overscaledZ),I))return;const M=this.getId(I,x);for(let D=0;D<T.length;D++){const k=T[D];if(h&&!h.has(k))continue;const O=g[k];if(!O)continue;let B={};M&&v&&(B=v.getState(O.sourceLayer||cc,M));const N=Bi({},m[k]);N.paint=um(N.paint,O.paint,I,B,d),N.layout=um(N.layout,O.layout,I,B,d);const $=!_||_(I,O,B);if(!$)continue;const W=new kf(I,this.z,this.x,this.y,M);W.layer=N;let ie=e[k];ie===void 0&&(ie=e[k]=[]),ie.push({featureIndex:o,feature:W,intersectionZ:$})}}lookupSymbolFeatures(e,i,s,o,l,h,d,g){const m={};this.loadVTLayers();const v=Ws(l.filterSpec,l.globalState);for(const _ of e)this.loadMatchingFeature(m,s,o,_,v,h,d,g,i);return m}hasLayer(e){for(const i of this.bucketLayerIDs)for(const s of i)if(e===s)return!0;return!1}getId(e,i){var s;let o=e.id;return this.promoteId&&(o=e.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[i]],typeof o=="boolean"&&(o=Number(o)),o===void 0&&!((s=e.properties)===null||s===void 0)&&s.cluster&&this.promoteId&&(o=Number(e.properties.cluster_id))),o}}function um(r,e,i,s,o){return $n(r,((l,h)=>{const d=e instanceof ao?e.get(h):null;return d&&d.evaluate?d.evaluate(i,s,o):d}))}function c0(r,e){return e-r}function hm(r,e,i,s,o){const l=[];for(let h=0;h<r.length;h++){const d=r[h];let g;for(let m=0;m<d.length-1;m++){let v=d[m],_=d[m+1];v.x<e&&_.x<e||(v.x<e?v=new H(e,v.y+(e-v.x)/(_.x-v.x)*(_.y-v.y))._round():_.x<e&&(_=new H(e,v.y+(e-v.x)/(_.x-v.x)*(_.y-v.y))._round()),v.y<i&&_.y<i||(v.y<i?v=new H(v.x+(i-v.y)/(_.y-v.y)*(_.x-v.x),i)._round():_.y<i&&(_=new H(v.x+(i-v.y)/(_.y-v.y)*(_.x-v.x),i)._round()),v.x>=s&&_.x>=s||(v.x>=s?v=new H(s,v.y+(s-v.x)/(_.x-v.x)*(_.y-v.y))._round():_.x>=s&&(_=new H(s,v.y+(s-v.x)/(_.x-v.x)*(_.y-v.y))._round()),v.y>=o&&_.y>=o||(v.y>=o?v=new H(v.x+(o-v.y)/(_.y-v.y)*(_.x-v.x),o)._round():_.y>=o&&(_=new H(v.x+(o-v.y)/(_.y-v.y)*(_.x-v.x),o)._round()),g&&v.equals(g[g.length-1])||(g=[v],l.push(g)),g.push(_)))))}}return l}function dm(r,e,i,s,o){switch(e){case 1:return(function(l,h,d,g){const m=[];for(const v of l)for(const _ of v){const T=g===0?_.x:_.y;T>=h&&T<=d&&m.push([_])}return m})(r,i,s,o);case 2:return pm(r,i,s,o,!1);case 3:return pm(r,i,s,o,!0)}return[]}function u0(r,e,i,s,o){const l=s===0?h0:d0;let h=[];const d=[];for(let v=0;v<r.length-1;v++){const _=r[v],T=r[v+1],x=s===0?_.x:_.y,I=s===0?T.x:T.y;let M=!1;x<e?I>e&&h.push(l(_,T,e)):x>i?I<i&&h.push(l(_,T,i)):h.push(_),I<e&&x>=e&&(h.push(l(_,T,e)),M=!0),I>i&&x<=i&&(h.push(l(_,T,i)),M=!0),!o&&M&&(d.push(h),h=[])}const g=r.length-1,m=s===0?r[g].x:r[g].y;return m>=e&&m<=i&&h.push(r[g]),o&&h.length>0&&!h[0].equals(h[h.length-1])&&h.push(new H(h[0].x,h[0].y)),h.length>0&&d.push(h),d}function pm(r,e,i,s,o){const l=[];for(const h of r){const d=u0(h,e,i,s,o);d.length>0&&l.push(...d)}return l}function h0(r,e,i){return new H(i,r.y+(i-r.x)/(e.x-r.x)*(e.y-r.y))}function d0(r,e,i){return new H(r.x+(i-r.y)/(e.y-r.y)*(e.x-r.x),i)}Re("FeatureIndex",cm,{omit:["rawTileData","sourceLayerCoder"]});class Ts extends H{constructor(e,i,s,o){super(e,i),this.angle=s,o!==void 0&&(this.segment=o)}clone(){return new Ts(this.x,this.y,this.angle,this.segment)}}function fm(r,e,i,s,o){if(e.segment===void 0||i===0)return!0;let l=e,h=e.segment+1,d=0;for(;d>-i/2;){if(h--,h<0)return!1;d-=r[h].dist(l),l=r[h]}d+=r[h].dist(r[h+1]),h++;const g=[];let m=0;for(;d<i/2;){const v=r[h],_=r[h+1];if(!_)return!1;let T=r[h-1].angleTo(v)-v.angleTo(_);for(T=Math.abs((T+3*Math.PI)%(2*Math.PI)-Math.PI),g.push({distance:d,angleDelta:T}),m+=T;d-g[0].distance>s;)m-=g.shift().angleDelta;if(m>o)return!1;h++,d+=v.dist(_)}return!0}function mm(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function gm(r,e,i){return r?.6*e*i:0}function _m(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function p0(r,e,i,s,o,l){const h=gm(i,o,l),d=_m(i,s)*l;let g=0;const m=mm(r)/2;for(let v=0;v<r.length-1;v++){const _=r[v],T=r[v+1],x=_.dist(T);if(g+x>m){const I=(m-g)/x,M=new Ts(Ni.number(_.x,T.x,I),Ni.number(_.y,T.y,I),T.angleTo(_),v);return M._round(),!h||fm(r,M,d,h,e)?M:void 0}g+=x}}function f0(r,e,i,s,o,l,h,d,g){const m=gm(s,l,h),v=_m(s,o),_=v*h,T=r[0].x===0||r[0].x===g||r[0].y===0||r[0].y===g;return e-_<e/4&&(e=_+e/4),ym(r,T?e/2*d%e:(v/2+2*l)*h*d%e,e,m,i,_,T,!1,g)}function ym(r,e,i,s,o,l,h,d,g){const m=l/2,v=mm(r);let _=0,T=e-i,x=[];for(let I=0;I<r.length-1;I++){const M=r[I],D=r[I+1],k=M.dist(D),O=D.angleTo(M);for(;T+i<_+k;){T+=i;const B=(T-_)/k,N=Ni.number(M.x,D.x,B),$=Ni.number(M.y,D.y,B);if(N>=0&&N<g&&$>=0&&$<g&&T-m>=0&&T+m<=v){const W=new Ts(N,$,O,I);W._round(),s&&!fm(r,W,l,s,o)||x.push(W)}}_+=k}return d||x.length||h||(x=ym(r,_/2,i,s,o,l,h,!0,g)),x}function vm(r,e,i,s){const o=[],l=r.image,h=l.pixelRatio,d=l.paddedRect.w-2,g=l.paddedRect.h-2;let m={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const v=l.stretchX||[[0,d]],_=l.stretchY||[[0,g]],T=(de,Ie)=>de+Ie[1]-Ie[0],x=v.reduce(T,0),I=_.reduce(T,0),M=d-x,D=g-I;let k=0,O=x,B=0,N=I,$=0,W=M,ie=0,ne=D;if(l.content&&s){const de=l.content,Ie=de[2]-de[0],Fe=de[3]-de[1];(l.textFitWidth||l.textFitHeight)&&(m=mf(r)),k=Vu(v,0,de[0]),B=Vu(_,0,de[1]),O=Vu(v,de[0],de[2]),N=Vu(_,de[1],de[3]),$=de[0]-k,ie=de[1]-B,W=Ie-O,ne=Fe-N}const ae=m.x1,ue=m.y1,ye=m.x2-ae,ge=m.y2-ue,_e=(de,Ie,Fe,ke)=>{const Pe=ju(de.stretch-k,O,ye,ae),qe=Nu(de.fixed-$,W,de.stretch,x),lt=ju(Ie.stretch-B,N,ge,ue),ut=Nu(Ie.fixed-ie,ne,Ie.stretch,I),_t=ju(Fe.stretch-k,O,ye,ae),Si=Nu(Fe.fixed-$,W,Fe.stretch,x),jt=ju(ke.stretch-B,N,ge,ue),ni=Nu(ke.fixed-ie,ne,ke.stretch,I),ui=new H(Pe,lt),kt=new H(_t,lt),gi=new H(_t,jt),Ei=new H(Pe,jt),Ci=new H(qe/h,ut/h),qi=new H(Si/h,ni/h),Pi=e*Math.PI/180;if(Pi){const hi=Math.sin(Pi),Ot=Math.cos(Pi),ei=[Ot,-hi,hi,Ot];ui._matMult(ei),kt._matMult(ei),Ei._matMult(ei),gi._matMult(ei)}const Zi=de.stretch+de.fixed,Ir=Ie.stretch+Ie.fixed;return{tl:ui,tr:kt,bl:Ei,br:gi,tex:{x:l.paddedRect.x+1+Zi,y:l.paddedRect.y+1+Ir,w:Fe.stretch+Fe.fixed-Zi,h:ke.stretch+ke.fixed-Ir},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ci,pixelOffsetBR:qi,minFontScaleX:W/h/ye,minFontScaleY:ne/h/ge,isSDF:i}};if(s&&(l.stretchX||l.stretchY)){const de=xm(v,M,x),Ie=xm(_,D,I);for(let Fe=0;Fe<de.length-1;Fe++){const ke=de[Fe],Pe=de[Fe+1];for(let qe=0;qe<Ie.length-1;qe++)o.push(_e(ke,Ie[qe],Pe,Ie[qe+1]))}}else o.push(_e({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:d+1},{fixed:0,stretch:g+1}));return o}function Vu(r,e,i){let s=0;for(const o of r)s+=Math.max(e,Math.min(i,o[1]))-Math.max(e,Math.min(i,o[0]));return s}function xm(r,e,i){const s=[{fixed:-1,stretch:0}];for(const[o,l]of r){const h=s[s.length-1];s.push({fixed:o-h.stretch,stretch:h.stretch}),s.push({fixed:o-h.stretch,stretch:h.stretch+(l-o)})}return s.push({fixed:e+1,stretch:i}),s}function ju(r,e,i,s){return r/e*i+s}function Nu(r,e,i,s){return r-e*i/s}Re("Anchor",Ts);class Uu{constructor(e,i,s,o,l,h,d,g,m,v){var _;if(this.boxStartIndex=e.length,m){let T=h.top,x=h.bottom;const I=h.collisionPadding;I&&(T-=I[1],x+=I[3]);let M=x-T;M>0&&(M=Math.max(10,M),this.circleDiameter=M)}else{const T=!((_=h.image)===null||_===void 0)&&_.content&&(h.image.textFitWidth||h.image.textFitHeight)?mf(h):{x1:h.left,y1:h.top,x2:h.right,y2:h.bottom};T.y1=T.y1*d-g[0],T.y2=T.y2*d+g[2],T.x1=T.x1*d-g[3],T.x2=T.x2*d+g[1];const x=h.collisionPadding;if(x&&(T.x1-=x[0]*d,T.y1-=x[1]*d,T.x2+=x[2]*d,T.y2+=x[3]*d),v){const I=new H(T.x1,T.y1),M=new H(T.x2,T.y1),D=new H(T.x1,T.y2),k=new H(T.x2,T.y2),O=v*Math.PI/180;I._rotate(O),M._rotate(O),D._rotate(O),k._rotate(O),T.x1=Math.min(I.x,M.x,D.x,k.x),T.x2=Math.max(I.x,M.x,D.x,k.x),T.y1=Math.min(I.y,M.y,D.y,k.y),T.y2=Math.max(I.y,M.y,D.y,k.y)}e.emplaceBack(i.x,i.y,T.x1,T.y1,T.x2,T.y2,s,o,l)}this.boxEndIndex=e.length}}class m0{constructor(e=[],i=(s,o)=>s<o?-1:s>o?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let s=(this.length>>1)-1;s>=0;s--)this._down(s)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:s}=this,o=i[e];for(;e>0;){const l=e-1>>1,h=i[l];if(s(o,h)>=0)break;i[e]=h,e=l}i[e]=o}_down(e){const{data:i,compare:s}=this,o=this.length>>1,l=i[e];for(;e<o;){let h=1+(e<<1);const d=h+1;if(d<this.length&&s(i[d],i[h])<0&&(h=d),s(i[h],l)>=0)break;i[e]=i[h],e=h}i[e]=l}}function g0(r,e=1,i=!1){const s=mo.fromPoints(r[0]),o=Math.min(s.width(),s.height());let l=o/2;const h=new m0([],_0),{minX:d,minY:g,maxX:m,maxY:v}=s;if(o===0)return new H(d,g);for(let x=d;x<m;x+=o)for(let I=g;I<v;I+=o)h.push(new Ra(x+l,I+l,l,r));let _=(function(x){let I=0,M=0,D=0;const k=x[0];for(let O=0,B=k.length,N=B-1;O<B;N=O++){const $=k[O],W=k[N],ie=$.x*W.y-W.x*$.y;M+=($.x+W.x)*ie,D+=($.y+W.y)*ie,I+=3*ie}return new Ra(M/I,D/I,0,x)})(r),T=h.length;for(;h.length;){const x=h.pop();(x.d>_.d||!_.d)&&(_=x,i&&console.log("found best %d after %d probes",Math.round(1e4*x.d)/1e4,T)),x.max-_.d<=e||(l=x.h/2,h.push(new Ra(x.p.x-l,x.p.y-l,l,r)),h.push(new Ra(x.p.x+l,x.p.y-l,l,r)),h.push(new Ra(x.p.x-l,x.p.y+l,l,r)),h.push(new Ra(x.p.x+l,x.p.y+l,l,r)),T+=4)}return i&&(console.log(`num probes: ${T}`),console.log(`best distance: ${_.d}`)),_.p}function _0(r,e){return e.max-r.max}function Ra(r,e,i,s){this.p=new H(r,e),this.h=i,this.d=(function(o,l){let h=!1,d=1/0;for(let g=0;g<l.length;g++){const m=l[g];for(let v=0,_=m.length,T=_-1;v<_;T=v++){const x=m[v],I=m[T];x.y>o.y!=I.y>o.y&&o.x<(I.x-x.x)*(o.y-x.y)/(I.y-x.y)+x.x&&(h=!h),d=Math.min(d,up(o,x,I))}}return(h?1:-1)*Math.sqrt(d)})(this.p,s),this.max=this.d+this.h*Math.SQRT2}var Ti;E.aM=void 0,(Ti=E.aM||(E.aM={}))[Ti.center=1]="center",Ti[Ti.left=2]="left",Ti[Ti.right=3]="right",Ti[Ti.top=4]="top",Ti[Ti.bottom=5]="bottom",Ti[Ti["top-left"]=6]="top-left",Ti[Ti["top-right"]=7]="top-right",Ti[Ti["bottom-left"]=8]="bottom-left",Ti[Ti["bottom-right"]=9]="bottom-right";const Dd=Number.POSITIVE_INFINITY;function bm(r,e){return e[1]!==Dd?(function(i,s,o){let l=0,h=0;switch(s=Math.abs(s),o=Math.abs(o),i){case"top-right":case"top-left":case"top":h=o-7;break;case"bottom-right":case"bottom-left":case"bottom":h=7-o}switch(i){case"top-right":case"bottom-right":case"right":l=-s;break;case"top-left":case"bottom-left":case"left":l=s}return[l,h]})(r,e[0],e[1]):(function(i,s){let o=0,l=0;s<0&&(s=0);const h=s/Math.SQRT2;switch(i){case"top-right":case"top-left":l=h-7;break;case"bottom-right":case"bottom-left":l=7-h;break;case"bottom":l=7-s;break;case"top":l=s-7}switch(i){case"top-right":case"bottom-right":o=-h;break;case"top-left":case"bottom-left":o=h;break;case"left":o=s;break;case"right":o=-s}return[o,l]})(r,e[0])}function wm(r,e,i){var s;const o=r.layout,l=(s=o.get("text-variable-anchor-offset"))===null||s===void 0?void 0:s.evaluate(e,{},i);if(l){const d=l.values,g=[];for(let m=0;m<d.length;m+=2){const v=g[m]=d[m],_=d[m+1].map((T=>T*li));v.startsWith("top")?_[1]-=7:v.startsWith("bottom")&&(_[1]+=7),g[m+1]=_}return new _i(g)}const h=o.get("text-variable-anchor");if(h){let d;d=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[o.get("text-radial-offset").evaluate(e,{},i)*li,Dd]:o.get("text-offset").evaluate(e,{},i).map((m=>m*li));const g=[];for(const m of h)g.push(m,bm(m,d));return new _i(g)}return null}function kd(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function y0(r,e,i,s,o,l,h,d,g,m,v,_){let T=l.textMaxSize.evaluate(e,{});T===void 0&&(T=h);const x=r.layers[0].layout,I=x.get("icon-offset").evaluate(e,{},v),M=Sm(i.horizontal),D=h/24,k=r.tilePixelRatio*D,O=r.tilePixelRatio*T/24,B=r.tilePixelRatio*d,N=r.tilePixelRatio*x.get("symbol-spacing"),$=x.get("text-padding")*r.tilePixelRatio,W=(function(Fe,ke,Pe,qe=1){const lt=Fe.get("icon-padding").evaluate(ke,{},Pe),ut=lt&<.values;return[ut[0]*qe,ut[1]*qe,ut[2]*qe,ut[3]*qe]})(x,e,v,r.tilePixelRatio),ie=x.get("text-max-angle")/180*Math.PI,ne=x.get("text-rotation-alignment")!=="viewport"&&x.get("symbol-placement")!=="point",ae=x.get("icon-rotation-alignment")==="map"&&x.get("symbol-placement")!=="point",ue=x.get("symbol-placement"),ye=N/2,ge=x.get("icon-text-fit");let _e;s&&ge!=="none"&&(r.allowVerticalPlacement&&i.vertical&&(_e=gf(s,i.vertical,ge,x.get("icon-text-fit-padding"),I,D)),M&&(s=gf(s,M,ge,x.get("icon-text-fit-padding"),I,D)));const de=v?_.line.getGranularityForZoomLevel(v.z):1,Ie=(Fe,ke)=>{ke.x<0||ke.x>=Ge||ke.y<0||ke.y>=Ge||(function(Pe,qe,lt,ut,_t,Si,jt,ni,ui,kt,gi,Ei,Ci,qi,Pi,Zi,Ir,hi,Ot,ei,Nt,di,On,Vr,uc){const Ss=Pe.addToLineVertexArray(qe,lt);let _o,Ba,Oa,Va,Pm=0,Im=0,Mm=0,Em=0,zd=-1,Ld=-1;const Vn={};let Cm=Ht("");if(Pe.allowVerticalPlacement&&ut.vertical){const Ai=ni.layout.get("text-rotate").evaluate(Nt,{},Vr)+90;Oa=new Uu(ui,qe,kt,gi,Ei,ut.vertical,Ci,qi,Pi,Ai),jt&&(Va=new Uu(ui,qe,kt,gi,Ei,jt,Ir,hi,Pi,Ai))}if(_t){const Ai=ni.layout.get("icon-rotate").evaluate(Nt,{}),gr=ni.layout.get("icon-text-fit")!=="none",yo=vm(_t,Ai,On,gr),jn=jt?vm(jt,Ai,On,gr):void 0;Ba=new Uu(ui,qe,kt,gi,Ei,_t,Ir,hi,!1,Ai),Pm=4*yo.length;const vo=Pe.iconSizeData;let en=null;vo.kind==="source"?(en=[Rn*ni.layout.get("icon-size").evaluate(Nt,{})],en[0]>ys&&et(`${Pe.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):vo.kind==="composite"&&(en=[Rn*di.compositeIconSizes[0].evaluate(Nt,{},Vr),Rn*di.compositeIconSizes[1].evaluate(Nt,{},Vr)],(en[0]>ys||en[1]>ys)&&et(`${Pe.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Pe.addSymbols(Pe.icon,yo,en,ei,Ot,Nt,E.aw.none,qe,Ss.lineStartIndex,Ss.lineLength,-1,Vr),zd=Pe.icon.placedSymbolArray.length-1,jn&&(Im=4*jn.length,Pe.addSymbols(Pe.icon,jn,en,ei,Ot,Nt,E.aw.vertical,qe,Ss.lineStartIndex,Ss.lineLength,-1,Vr),Ld=Pe.icon.placedSymbolArray.length-1)}const Am=Object.keys(ut.horizontal);for(const Ai of Am){const gr=ut.horizontal[Ai];_o||(Cm=Ht(gr.text),_o=new Uu(ui,qe,kt,gi,Ei,gr,Ci,qi,Pi,ni.layout.get("text-rotate").evaluate(Nt,{},Vr)));const yo=gr.positionedLines.length===1;if(Mm+=Tm(Pe,qe,gr,Si,ni,Pi,Nt,Zi,Ss,ut.vertical?E.aw.horizontal:E.aw.horizontalOnly,yo?Am:[Ai],Vn,zd,di,Vr),yo)break}ut.vertical&&(Em+=Tm(Pe,qe,ut.vertical,Si,ni,Pi,Nt,Zi,Ss,E.aw.vertical,["vertical"],Vn,Ld,di,Vr));const x0=_o?_o.boxStartIndex:Pe.collisionBoxArray.length,b0=_o?_o.boxEndIndex:Pe.collisionBoxArray.length,w0=Oa?Oa.boxStartIndex:Pe.collisionBoxArray.length,T0=Oa?Oa.boxEndIndex:Pe.collisionBoxArray.length,S0=Ba?Ba.boxStartIndex:Pe.collisionBoxArray.length,P0=Ba?Ba.boxEndIndex:Pe.collisionBoxArray.length,I0=Va?Va.boxStartIndex:Pe.collisionBoxArray.length,M0=Va?Va.boxEndIndex:Pe.collisionBoxArray.length;let jr=-1;const $u=(Ai,gr)=>Ai&&Ai.circleDiameter?Math.max(Ai.circleDiameter,gr):gr;jr=$u(_o,jr),jr=$u(Oa,jr),jr=$u(Ba,jr),jr=$u(Va,jr);const Dm=jr>-1?1:0;Dm&&(jr*=uc/li),Pe.glyphOffsetArray.length>=Ia.MAX_GLYPHS&&et("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Nt.sortKey!==void 0&&Pe.addToSortKeyRanges(Pe.symbolInstances.length,Nt.sortKey);const E0=wm(ni,Nt,Vr),[C0,A0]=(function(Ai,gr){const yo=Ai.length,jn=gr?.values;if(jn?.length>0)for(let vo=0;vo<jn.length;vo+=2){const en=jn[vo+1];Ai.emplaceBack(E.aM[jn[vo]],en[0],en[1])}return[yo,Ai.length]})(Pe.textAnchorOffsets,E0);Pe.symbolInstances.emplaceBack(qe.x,qe.y,Vn.right>=0?Vn.right:-1,Vn.center>=0?Vn.center:-1,Vn.left>=0?Vn.left:-1,Vn.vertical||-1,zd,Ld,Cm,x0,b0,w0,T0,S0,P0,I0,M0,kt,Mm,Em,Pm,Im,Dm,0,Ci,jr,C0,A0)})(r,ke,Fe,i,s,o,_e,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,k,[$,$,$,$],ne,g,B,W,ae,I,e,l,m,v,h)};if(ue==="line")for(const Fe of hm(e.geometry,0,0,Ge,Ge)){const ke=fo(Fe,de),Pe=f0(ke,N,ie,i.vertical||M,s,24,O,r.overscaling,Ge);for(const qe of Pe)M&&v0(r,M.text,ye,qe)||Ie(ke,qe)}else if(ue==="line-center"){for(const Fe of e.geometry)if(Fe.length>1){const ke=fo(Fe,de),Pe=p0(ke,ie,i.vertical||M,s,24,O);Pe&&Ie(ke,Pe)}}else if(e.type==="Polygon")for(const Fe of No(e.geometry,0)){const ke=g0(Fe,16);Ie(fo(Fe[0],de,!0),new Ts(ke.x,ke.y,0))}else if(e.type==="LineString")for(const Fe of e.geometry){const ke=fo(Fe,de);Ie(ke,new Ts(ke[0].x,ke[0].y,0))}else if(e.type==="Point")for(const Fe of e.geometry)for(const ke of Fe)Ie([ke],new Ts(ke.x,ke.y,0))}function Tm(r,e,i,s,o,l,h,d,g,m,v,_,T,x,I){const M=(function(O,B,N,$,W,ie,ne,ae){const ue=$.layout.get("text-rotate").evaluate(ie,{})*Math.PI/180,ye=[];for(const ge of B.positionedLines)for(const _e of ge.positionedGlyphs){if(!_e.rect)continue;const de=_e.rect||{};let Ie=4,Fe=!0,ke=1,Pe=0;const qe=(W||ae)&&_e.vertical,lt=_e.metrics.advance*_e.scale/2;if(ae&&B.verticalizable&&(Pe=ge.lineOffset/2-(_e.imageName?-(li-_e.metrics.width*_e.scale)/2:(_e.scale-1)*li)),_e.imageName){const hi=ne[_e.imageName];Fe=hi.sdf,ke=hi.pixelRatio,Ie=1/ke}const ut=W?[_e.x+lt,_e.y]:[0,0];let _t=W?[0,0]:[_e.x+lt+N[0],_e.y+N[1]-Pe],Si=[0,0];qe&&(Si=_t,_t=[0,0]);const jt=_e.metrics.isDoubleResolution?2:1,ni=(_e.metrics.left-Ie)*_e.scale-lt+_t[0],ui=(-_e.metrics.top-Ie)*_e.scale+_t[1],kt=ni+de.w/jt*_e.scale/ke,gi=ui+de.h/jt*_e.scale/ke,Ei=new H(ni,ui),Ci=new H(kt,ui),qi=new H(ni,gi),Pi=new H(kt,gi);if(qe){const hi=new H(-lt,lt- -17),Ot=-Math.PI/2,ei=12-lt,Nt=new H(22-ei,-(_e.imageName?ei:0)),di=new H(...Si);Ei._rotateAround(Ot,hi)._add(Nt)._add(di),Ci._rotateAround(Ot,hi)._add(Nt)._add(di),qi._rotateAround(Ot,hi)._add(Nt)._add(di),Pi._rotateAround(Ot,hi)._add(Nt)._add(di)}if(ue){const hi=Math.sin(ue),Ot=Math.cos(ue),ei=[Ot,-hi,hi,Ot];Ei._matMult(ei),Ci._matMult(ei),qi._matMult(ei),Pi._matMult(ei)}const Zi=new H(0,0),Ir=new H(0,0);ye.push({tl:Ei,tr:Ci,bl:qi,br:Pi,tex:de,writingMode:B.writingMode,glyphOffset:ut,sectionIndex:_e.sectionIndex,isSDF:Fe,pixelOffsetTL:Zi,pixelOffsetBR:Ir,minFontScaleX:0,minFontScaleY:0})}return ye})(0,i,d,o,l,h,s,r.allowVerticalPlacement),D=r.textSizeData;let k=null;D.kind==="source"?(k=[Rn*o.layout.get("text-size").evaluate(h,{})],k[0]>ys&&et(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):D.kind==="composite"&&(k=[Rn*x.compositeTextSizes[0].evaluate(h,{},I),Rn*x.compositeTextSizes[1].evaluate(h,{},I)],(k[0]>ys||k[1]>ys)&&et(`${r.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),r.addSymbols(r.text,M,k,d,l,h,m,e,g.lineStartIndex,g.lineLength,T,I);for(const O of v)_[O]=r.text.placedSymbolArray.length-1;return 4*M.length}function Sm(r){for(const e in r)return r[e];return null}function v0(r,e,i,s){const o=r.compareText;if(e in o){const l=o[e];for(let h=l.length-1;h>=0;h--)if(s.dist(l[h])<i)return!0}else o[e]=[];return o[e].push(s),!1}E.$=be,E.A=Ne,E.B=zl,E.C=wr,E.D=Ve,E.E=Mo,E.F=function([r,e,i]){return e+=90,e*=Math.PI/180,i*=Math.PI/180,{x:r*Math.cos(e)*Math.sin(i),y:r*Math.sin(e)*Math.sin(i),z:r*Math.cos(i)}},E.G=Ni,E.H=vt,E.I=rd,E.J=vh,E.K=function(r){if(Ur==null){const e=r.navigator?r.navigator.userAgent:null;Ur=!!r.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return Ur},E.L=class{constructor(r,e){this.target=r,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Ay((()=>this.process())),this.subscription=So(this.target,"message",(i=>this.receive(i)),!1),this.globalScope=_r(self)?r:window}registerMessageHandler(r,e){this.messageHandlers[r]=e}unregisterMessageHandler(r){delete this.messageHandlers[r]}sendAsync(r,e){return new Promise(((i,s)=>{const o=Math.round(1e18*Math.random()).toString(36).substring(0,10),l=e?So(e.signal,"abort",(()=>{l?.unsubscribe(),delete this.resolveRejects[o];const g={id:o,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(g)}),Dy):null;this.resolveRejects[o]={resolve:g=>{l?.unsubscribe(),i(g)},reject:g=>{l?.unsubscribe(),s(g)}};const h=[],d=Object.assign(Object.assign({},r),{id:o,sourceMapId:this.mapId,origin:location.origin,data:io(r.data,h)});this.target.postMessage(d,{transfer:h})}))}receive(r){const e=r.data,i=e.id,s=["file://","resource://android","null"],o=[e.origin,location.origin],l=e.origin===location.origin,h=o.some((d=>s.includes(d)));if((l||h)&&(!e.targetMapId||this.mapId===e.targetMapId)){if(e.type==="<cancel>"){delete this.tasks[i];const d=this.abortControllers[i];delete this.abortControllers[i],d&&d.abort();return}if(_r(self)||e.mustQueue)return this.tasks[i]=e,this.taskQueue.push(i),void this.invoker.trigger();this.processTask(i,e)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),e=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(r,e)}processTask(r,e){return c(this,void 0,void 0,(function*(){if(e.type==="<response>"){const o=this.resolveRejects[r];if(delete this.resolveRejects[r],!o)return;e.error?o.reject(ro(e.error)):o.resolve(ro(e.data));return}if(!this.messageHandlers[e.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${e.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const i=ro(e.data),s=new AbortController;this.abortControllers[r]=s;try{const o=yield this.messageHandlers[e.type](e.sourceMapId,i,s);this.completeTask(r,null,o)}catch(o){this.completeTask(r,o)}}))}completeTask(r,e,i){const s=[];delete this.abortControllers[r];const o={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:e?io(e):null,data:io(i,s)};this.target.postMessage(o,{transfer:s})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},E.M=Yi,E.N=function(){var r=new Ne(16);return Ne!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},E.O=function(r,e,i){var s,o,l,h,d,g,m,v,_,T,x,I,M=i[0],D=i[1],k=i[2];return e===r?(r[12]=e[0]*M+e[4]*D+e[8]*k+e[12],r[13]=e[1]*M+e[5]*D+e[9]*k+e[13],r[14]=e[2]*M+e[6]*D+e[10]*k+e[14],r[15]=e[3]*M+e[7]*D+e[11]*k+e[15]):(o=e[1],l=e[2],h=e[3],d=e[4],g=e[5],m=e[6],v=e[7],_=e[8],T=e[9],x=e[10],I=e[11],r[0]=s=e[0],r[1]=o,r[2]=l,r[3]=h,r[4]=d,r[5]=g,r[6]=m,r[7]=v,r[8]=_,r[9]=T,r[10]=x,r[11]=I,r[12]=s*M+d*D+_*k+e[12],r[13]=o*M+g*D+T*k+e[13],r[14]=l*M+m*D+x*k+e[14],r[15]=h*M+v*D+I*k+e[15]),r},E.P=H,E.Q=function(r,e,i){var s=i[0],o=i[1],l=i[2];return r[0]=e[0]*s,r[1]=e[1]*s,r[2]=e[2]*s,r[3]=e[3]*s,r[4]=e[4]*o,r[5]=e[5]*o,r[6]=e[6]*o,r[7]=e[7]*o,r[8]=e[8]*l,r[9]=e[9]*l,r[10]=e[10]*l,r[11]=e[11]*l,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},E.R=Gi,E.S=function(r,e,i){var s=e[0],o=e[1],l=e[2],h=e[3],d=e[4],g=e[5],m=e[6],v=e[7],_=e[8],T=e[9],x=e[10],I=e[11],M=e[12],D=e[13],k=e[14],O=e[15],B=i[0],N=i[1],$=i[2],W=i[3];return r[0]=B*s+N*d+$*_+W*M,r[1]=B*o+N*g+$*T+W*D,r[2]=B*l+N*m+$*x+W*k,r[3]=B*h+N*v+$*I+W*O,r[4]=(B=i[4])*s+(N=i[5])*d+($=i[6])*_+(W=i[7])*M,r[5]=B*o+N*g+$*T+W*D,r[6]=B*l+N*m+$*x+W*k,r[7]=B*h+N*v+$*I+W*O,r[8]=(B=i[8])*s+(N=i[9])*d+($=i[10])*_+(W=i[11])*M,r[9]=B*o+N*g+$*T+W*D,r[10]=B*l+N*m+$*x+W*k,r[11]=B*h+N*v+$*I+W*O,r[12]=(B=i[12])*s+(N=i[13])*d+($=i[14])*_+(W=i[15])*M,r[13]=B*o+N*g+$*T+W*D,r[14]=B*l+N*m+$*x+W*k,r[15]=B*h+N*v+$*I+W*O,r},E.T=zh,E.U=function(r,e){const i={};for(let s=0;s<e.length;s++){const o=e[s];o in r&&(i[o]=r[o])}return i},E.V=vs,E.W=Ms,E.X=Pf,E.Y=Sf,E.Z=pc,E._=c,E.a=Es,E.a$=function(r){var e=new Ne(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e},E.a0=le,E.a1=sn,E.a2=ir,E.a3=Mf,E.a4=Ru,E.a5=Ge,E.a6=oc,E.a7=mo,E.a8=25,E.a9=hd,E.aA=function(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)},E.aB=function(r){return r[0]=0,r[1]=0,r},E.aC=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r},E.aD=od,E.aE=Ue,E.aF=function(r,e,i,s){const o=e.y-r.y,l=e.x-r.x,h=s.y-i.y,d=s.x-i.x,g=h*l-d*o;if(g===0)return null;const m=(d*(r.y-i.y)-h*(r.x-i.x))/g;return new H(r.x+m*l,r.y+m*o)},E.aG=hm,E.aH=ma,E.aI=function(r){let e=1/0,i=1/0,s=-1/0,o=-1/0;for(const l of r)e=Math.min(e,l.x),i=Math.min(i,l.y),s=Math.max(s,l.x),o=Math.max(o,l.y);return[e,i,s,o]},E.aJ=li,E.aK=it,E.aL=function(r,e,i,s,o=!1){if(!i[0]&&!i[1])return[0,0];const l=o?s==="map"?-r.bearingInRadians:0:s==="viewport"?r.bearingInRadians:0;if(l){const h=Math.sin(l),d=Math.cos(l);i=[i[0]*d-i[1]*h,i[0]*h+i[1]*d]}return[o?i[0]:it(e,i[0],r.zoom),o?i[1]:it(e,i[1],r.zoom)]},E.aN=sd,E.aO=kd,E.aP=nd,E.aQ=r=>r.type==="symbol",E.aR=Iu,E.aS=Zt,E.aT=Pu,E.aU=G,E.aV=je,E.aW=Se,E.aX=on,E.aY=Ef,E.aZ=J,E.a_=nt,E.aa=r=>{const e=window.document.createElement("video");return e.muted=!0,new Promise((i=>{e.onloadstart=()=>{i(e)};for(const s of r){const o=window.document.createElement("source");ar(s)||(e.crossOrigin="Anonymous"),o.src=s,e.appendChild(o)}}))},E.ab=Me,E.ac=function(){return Un++},E.ad=y,E.ae=Ia,E.af=cc,E.ag=Ws,E.ah=Qr,E.ai=kf,E.aj=function(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,((i,s,o,l)=>{const h=o||l;return e[s]=!h||h.toLowerCase(),""})),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e},E.ak=Ri,E.al=85.051129,E.am=Gr,E.an=function(r){return Math.pow(2,r)},E.ao=dt,E.ap=If,E.aq=function(r){return Math.log(r)/Math.LN2},E.ar=function(r){var e=r[0],i=r[1];return e*e+i*i},E.as=function(r){if(!r.length)return new Set;const e=Math.max(...r.map((g=>g.canonical.z)));let i=1/0,s=-1/0,o=1/0,l=-1/0;const h=[];for(const g of r){const{x:m,y:v,z:_}=g.canonical,T=Math.pow(2,e-_),x=m*T,I=v*T;h.push({id:g,x,y:I}),x<i&&(i=x),x>s&&(s=x),I<o&&(o=I),I>l&&(l=I)}const d=new Set;for(const g of h)g.x!==i&&g.x!==s&&g.y!==o&&g.y!==l||d.add(g.id);return d},E.at=function(r,e){const i=Math.abs(2*r.wrap)-+(r.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return r.overscaledZ-e.overscaledZ||s-i||e.canonical.y-r.canonical.y||e.canonical.x-r.canonical.x},E.au=class{constructor(r,e){this.max=r,this.onRemove=e,this.reset()}reset(){for(const r in this.data)for(const e of this.data[r])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(r,e,i){const s=r.wrapped().key;this.data[s]===void 0&&(this.data[s]=[]);const o={value:e,timeout:void 0};if(i!==void 0&&(o.timeout=setTimeout((()=>{this.remove(r,o)}),i)),this.data[s].push(o),this.order.push(s),this.order.length>this.max){const l=this._getAndRemoveByKey(this.order[0]);l&&this.onRemove(l)}return this}has(r){return r.wrapped().key in this.data}getAndRemove(r){return this.has(r)?this._getAndRemoveByKey(r.wrapped().key):null}_getAndRemoveByKey(r){const e=this.data[r].shift();return e.timeout&&clearTimeout(e.timeout),this.data[r].length===0&&delete this.data[r],this.order.splice(this.order.indexOf(r),1),e.value}getByKey(r){const e=this.data[r];return e?e[0].value:null}get(r){return this.has(r)?this.data[r.wrapped().key][0].value:null}remove(r,e){if(!this.has(r))return this;const i=r.wrapped().key,s=e===void 0?0:this.data[i].indexOf(e),o=this.data[i][s];return this.data[i].splice(s,1),o.timeout&&clearTimeout(o.timeout),this.data[i].length===0&&delete this.data[i],this.onRemove(o.value),this.order.splice(this.order.indexOf(i),1),this}setMaxSize(r){for(this.max=r;this.order.length>this.max;){const e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(r){const e=[];for(const i in this.data)for(const s of this.data[i])r(s.value)||e.push(s);for(const i of e)this.remove(i.value.tileID,i)}},E.av=function(r,e){let i=0,s=0;if(r.kind==="constant")s=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:o,minZoom:l,maxZoom:h}=r,d=o?Ri(Xt.interpolationFactor(o,e,l,h),0,1):0;r.kind==="camera"?s=Ni.number(r.minSize,r.maxSize,d):i=d}return{uSizeT:i,uSize:s}},E.ax=function(r,{uSize:e,uSizeT:i},{lowerSize:s,upperSize:o}){return r.kind==="source"?s/Rn:r.kind==="composite"?Ni.number(s/Rn,o/Rn,i):e},E.ay=function(r,e){var i=e[0],s=e[1],o=e[2],l=e[3],h=e[4],d=e[5],g=e[6],m=e[7],v=e[8],_=e[9],T=e[10],x=e[11],I=e[12],M=e[13],D=e[14],k=e[15],O=i*d-s*h,B=i*g-o*h,N=i*m-l*h,$=s*g-o*d,W=s*m-l*d,ie=o*m-l*g,ne=v*M-_*I,ae=v*D-T*I,ue=v*k-x*I,ye=_*D-T*M,ge=_*k-x*M,_e=T*k-x*D,de=O*_e-B*ge+N*ye+$*ue-W*ae+ie*ne;return de?(r[0]=(d*_e-g*ge+m*ye)*(de=1/de),r[1]=(o*ge-s*_e-l*ye)*de,r[2]=(M*ie-D*W+k*$)*de,r[3]=(T*W-_*ie-x*$)*de,r[4]=(g*ue-h*_e-m*ae)*de,r[5]=(i*_e-o*ue+l*ae)*de,r[6]=(D*N-I*ie-k*B)*de,r[7]=(v*ie-T*N+x*B)*de,r[8]=(h*ge-d*ue+m*ne)*de,r[9]=(s*ue-i*ge-l*ne)*de,r[10]=(I*W-M*N+k*O)*de,r[11]=(_*N-v*W-x*O)*de,r[12]=(d*ae-h*ye-g*ne)*de,r[13]=(i*ye-s*ae+o*ne)*de,r[14]=(M*B-I*$-D*O)*de,r[15]=(v*$-_*B+T*O)*de,r):null},E.az=ot,E.b=Oi,E.b$=class extends zi{constructor(r,e){super(r,e),this.current=tr}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let e=1;e<16;e++)if(r[e]!==this.current[e]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},E.b0=function(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r},E.b1=function(r,e){var i=e[0],s=e[1],o=e[2],l=i*i+s*s+o*o;return l>0&&(l=1/Math.sqrt(l)),r[0]=e[0]*l,r[1]=e[1]*l,r[2]=e[2]*l,r},E.b2=re,E.b3=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]},E.b4=function(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r[3]=e[3]*i[3],r},E.b5=Ut,E.b6=function(r,e,i){const s=e[0]*i[0]+e[1]*i[1]+e[2]*i[2];return s===0?null:(-(r[0]*i[0]+r[1]*i[1]+r[2]*i[2])-i[3])/s},E.b7=Ce,E.b8=function(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r},E.b9=function(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]},E.bA=function(r,e,i){var s=i[0],o=i[1],l=i[2],h=i[3],d=e[0],g=e[1],m=e[2],v=o*m-l*g,_=l*d-s*m,T=s*g-o*d;return r[0]=d+h*(v+=v)+o*(T+=T)-l*(_+=_),r[1]=g+h*_+l*v-s*T,r[2]=m+h*T+s*_-o*v,r},E.bB=function(r,e,i){const s=(o=[r[0],r[1],r[2],e[0],e[1],e[2],i[0],i[1],i[2]])[0]*((v=o[8])*(h=o[4])-(d=o[5])*(m=o[7]))+o[1]*(-v*(l=o[3])+d*(g=o[6]))+o[2]*(m*l-h*g);var o,l,h,d,g,m,v;if(s===0)return null;const _=re([],[e[0],e[1],e[2]],[i[0],i[1],i[2]]),T=re([],[i[0],i[1],i[2]],[r[0],r[1],r[2]]),x=re([],[r[0],r[1],r[2]],[e[0],e[1],e[2]]),I=J([],_,-r[3]);return nt(I,I,J([],T,-e[3])),nt(I,I,J([],x,-i[3])),J(I,I,1/s),I},E.bC=ud,E.bD=function(){return new Float64Array(4)},E.bE=function(r,e,i,s){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[0]*Math.cos(s)-o[1]*Math.sin(s),l[1]=o[0]*Math.sin(s)+o[1]*Math.cos(s),l[2]=o[2],r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},E.bF=function(r,e,i,s){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[0],l[1]=o[1]*Math.cos(s)-o[2]*Math.sin(s),l[2]=o[1]*Math.sin(s)+o[2]*Math.cos(s),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},E.bG=function(r,e,i,s){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[2]*Math.sin(s)+o[0]*Math.cos(s),l[1]=o[1],l[2]=o[2]*Math.cos(s)-o[0]*Math.sin(s),r[0]=l[0]+i[0],r[1]=l[1]+i[1],r[2]=l[2]+i[2],r},E.bH=function(r,e,i){var s=Math.sin(i),o=Math.cos(i),l=e[0],h=e[1],d=e[2],g=e[3],m=e[8],v=e[9],_=e[10],T=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=l*o-m*s,r[1]=h*o-v*s,r[2]=d*o-_*s,r[3]=g*o-T*s,r[8]=l*s+m*o,r[9]=h*s+v*o,r[10]=d*s+_*o,r[11]=g*s+T*o,r},E.bI=function(r,e){const i=$t(r,360),s=$t(e,360),o=s-i,l=s>i?o-360:o+360;return Math.abs(o)<Math.abs(l)?o:l},E.bJ=function(r){return r[0]=0,r[1]=0,r[2]=0,r},E.bK=function(r,e,i,s){const o=Math.sqrt(r*r+e*e),l=Math.sqrt(i*i+s*s);r/=o,e/=o,i/=l,s/=l;const h=Math.acos(r*i+e*s);return-e*i+r*s>0?h:-h},E.bL=function(r,e){const i=$t(r,2*Math.PI),s=$t(e,2*Math.PI);return Math.min(Math.abs(i-s),Math.abs(i-s+2*Math.PI),Math.abs(i-s-2*Math.PI))},E.bM=function(){const r={},e=ve.$version;for(const i in ve.$root){const s=ve.$root[i];if(s.required){let o=null;o=i==="version"?e:s.type==="array"?[]:{},o!=null&&(r[i]=o)}}return r},E.bN=Za,E.bO=En,E.bP=function r(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return!1;for(let s=0;s<e.length;s++)if(!r(e[s],i[s]))return!1;return!0}if(typeof e=="object"&&e!==null&&i!==null){if(typeof i!="object"||Object.keys(e).length!==Object.keys(i).length)return!1;for(const s in e)if(!r(e[s],i[s]))return!1;return!0}return e===i},E.bQ=Io,E.bR=function(r){r=r.slice();const e=Object.create(null);for(let i=0;i<r.length;i++)e[r[i].id]=r[i];for(let i=0;i<r.length;i++)"ref"in r[i]&&(r[i]=Ha(r[i],e[r[i].ref]));return r},E.bS=function(r,e){if(r.type==="custom")return new Cy(r,e);switch(r.type){case"background":return new Ey(r,e);case"circle":return new Kg(r,e);case"color-relief":return new r_(r,e);case"fill":return new __(r,e);case"fill-extrusion":return new C_(r,e);case"heatmap":return new Qg(r,e);case"hillshade":return new t_(r,e);case"line":return new J_(r,e);case"raster":return new Sh(r,e);case"symbol":return new Fu(r,e)}},E.bT=r=>r.type==="raster",E.bU=mt,E.bV=function(r,e){if(!r)return[{command:"setStyle",args:[e]}];let i=[];try{if(!gt(r.version,e.version))return[{command:"setStyle",args:[e]}];gt(r.center,e.center)||i.push({command:"setCenter",args:[e.center]}),gt(r.state,e.state)||i.push({command:"setGlobalState",args:[e.state]}),gt(r.centerAltitude,e.centerAltitude)||i.push({command:"setCenterAltitude",args:[e.centerAltitude]}),gt(r.zoom,e.zoom)||i.push({command:"setZoom",args:[e.zoom]}),gt(r.bearing,e.bearing)||i.push({command:"setBearing",args:[e.bearing]}),gt(r.pitch,e.pitch)||i.push({command:"setPitch",args:[e.pitch]}),gt(r.roll,e.roll)||i.push({command:"setRoll",args:[e.roll]}),gt(r.sprite,e.sprite)||i.push({command:"setSprite",args:[e.sprite]}),gt(r.glyphs,e.glyphs)||i.push({command:"setGlyphs",args:[e.glyphs]}),gt(r.transition,e.transition)||i.push({command:"setTransition",args:[e.transition]}),gt(r.light,e.light)||i.push({command:"setLight",args:[e.light]}),gt(r.terrain,e.terrain)||i.push({command:"setTerrain",args:[e.terrain]}),gt(r.sky,e.sky)||i.push({command:"setSky",args:[e.sky]}),gt(r.projection,e.projection)||i.push({command:"setProjection",args:[e.projection]});const s={},o=[];(function(h,d,g,m){let v;for(v in d=d||{},h=h||{})Object.prototype.hasOwnProperty.call(h,v)&&(Object.prototype.hasOwnProperty.call(d,v)||fc(v,g,m));for(v in d)Object.prototype.hasOwnProperty.call(d,v)&&(Object.prototype.hasOwnProperty.call(h,v)?gt(h[v],d[v])||(h[v].type==="geojson"&&d[v].type==="geojson"&&Ku(h,d,v)?Di(g,{command:"setGeoJSONSourceData",args:[v,d[v].data]}):mc(v,d,g,m)):cn(v,d,g))})(r.sources,e.sources,o,s);const l=[];r.layers&&r.layers.forEach((h=>{"source"in h&&s[h.source]?i.push({command:"removeLayer",args:[h.id]}):l.push(h)})),i=i.concat(o),(function(h,d,g){d=d||[];const m=(h=h||[]).map(Xa),v=d.map(Xa),_=h.reduce(gc,{}),T=d.reduce(gc,{}),x=m.slice(),I=Object.create(null);let M,D,k,O,B;for(let N=0,$=0;N<m.length;N++)M=m[N],Object.prototype.hasOwnProperty.call(T,M)?$++:(Di(g,{command:"removeLayer",args:[M]}),x.splice(x.indexOf(M,$),1));for(let N=0,$=0;N<v.length;N++)M=v[v.length-1-N],x[x.length-1-N]!==M&&(Object.prototype.hasOwnProperty.call(_,M)?(Di(g,{command:"removeLayer",args:[M]}),x.splice(x.lastIndexOf(M,x.length-$),1)):$++,O=x[x.length-N],Di(g,{command:"addLayer",args:[T[M],O]}),x.splice(x.length-N,0,M),I[M]=!0);for(let N=0;N<v.length;N++)if(M=v[N],D=_[M],k=T[M],!I[M]&&!gt(D,k))if(gt(D.source,k.source)&>(D["source-layer"],k["source-layer"])&>(D.type,k.type)){for(B in Eo(D.layout,k.layout,g,M,null,"setLayoutProperty"),Eo(D.paint,k.paint,g,M,null,"setPaintProperty"),gt(D.filter,k.filter)||Di(g,{command:"setFilter",args:[M,k.filter]}),gt(D.minzoom,k.minzoom)&>(D.maxzoom,k.maxzoom)||Di(g,{command:"setLayerZoomRange",args:[M,k.minzoom,k.maxzoom]}),D)Object.prototype.hasOwnProperty.call(D,B)&&B!=="layout"&&B!=="paint"&&B!=="filter"&&B!=="metadata"&&B!=="minzoom"&&B!=="maxzoom"&&(B.indexOf("paint.")===0?Eo(D[B],k[B],g,M,B.slice(6),"setPaintProperty"):gt(D[B],k[B])||Di(g,{command:"setLayerProperty",args:[M,B,k[B]]}));for(B in k)Object.prototype.hasOwnProperty.call(k,B)&&!Object.prototype.hasOwnProperty.call(D,B)&&B!=="layout"&&B!=="paint"&&B!=="filter"&&B!=="metadata"&&B!=="minzoom"&&B!=="maxzoom"&&(B.indexOf("paint.")===0?Eo(D[B],k[B],g,M,B.slice(6),"setPaintProperty"):gt(D[B],k[B])||Di(g,{command:"setLayerProperty",args:[M,B,k[B]]}))}else Di(g,{command:"removeLayer",args:[M]}),O=x[x.lastIndexOf(M)+1],Di(g,{command:"addLayer",args:[k,O]})})(l,e.layers,i)}catch(s){console.warn("Unable to compute style diff:",s),i=[{command:"setStyle",args:[e]}]}return i},E.bW=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},E.bX=$n,E.bY=Gn,E.bZ=class extends zi{constructor(r,e){super(r,e),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},E.b_=zn,E.ba=Af,E.bb=Ma,E.bc=function(r,e,i,s,o){var l=1/Math.tan(e/2);if(r[0]=l/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,o!=null&&o!==1/0){var h=1/(s-o);r[10]=(o+s)*h,r[14]=2*o*s*h}else r[10]=-1,r[14]=-2*s;return r},E.bd=function(r){var e=new Ne(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},E.be=function(r,e,i){var s=Math.sin(i),o=Math.cos(i),l=e[0],h=e[1],d=e[2],g=e[3],m=e[4],v=e[5],_=e[6],T=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=l*o+m*s,r[1]=h*o+v*s,r[2]=d*o+_*s,r[3]=g*o+T*s,r[4]=m*o-l*s,r[5]=v*o-h*s,r[6]=_*o-d*s,r[7]=T*o-g*s,r},E.bf=function(r,e,i){var s=Math.sin(i),o=Math.cos(i),l=e[4],h=e[5],d=e[6],g=e[7],m=e[8],v=e[9],_=e[10],T=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=l*o+m*s,r[5]=h*o+v*s,r[6]=d*o+_*s,r[7]=g*o+T*s,r[8]=m*o-l*s,r[9]=v*o-h*s,r[10]=_*o-d*s,r[11]=T*o-g*s,r},E.bg=function(){const r=new Float32Array(16);return dt(r),r},E.bh=function(){const r=new Float64Array(16);return dt(r),r},E.bi=function(){return new Float64Array(16)},E.bj=function(r,e,i){const s=new Float64Array(4);return We(s,r,e-90,i),s},E.bk=function(r,e,i,s){var o,l,h,d,g,m=e[0],v=e[1],_=e[2],T=e[3],x=i[0],I=i[1],M=i[2],D=i[3];return(l=m*x+v*I+_*M+T*D)<0&&(l=-l,x=-x,I=-I,M=-M,D=-D),1-l>Be?(o=Math.acos(l),h=Math.sin(o),d=Math.sin((1-s)*o)/h,g=Math.sin(s*o)/h):(d=1-s,g=s),r[0]=d*m+g*x,r[1]=d*v+g*I,r[2]=d*_+g*M,r[3]=d*T+g*D,r},E.bl=function(r){const e=new Float64Array(9);var i,s,o,l,h,d,g,m,v,_=(o=(s=r)[0])*(g=o+o),T=(l=s[1])*g,x,I=(h=s[2])*g,M=h*(m=l+l),D,k=(d=s[3])*g,O=d*m,B=d*(v=h+h);(i=e)[0]=1-(x=l*m)-(D=h*v),i[3]=T-B,i[6]=I+O,i[1]=T+B,i[4]=1-_-D,i[7]=M-k,i[2]=I-O,i[5]=M+k,i[8]=1-_-x;const N=on(-Math.asin(Ri(e[2],-1,1)));let $,W;return Math.hypot(e[5],e[8])<.001?($=0,W=-on(Math.atan2(e[3],e[4]))):($=on(e[5]===0&&e[8]===0?0:Math.atan2(e[5],e[8])),W=on(e[1]===0&&e[0]===0?0:Math.atan2(e[1],e[0]))),{roll:$,pitch:N+90,bearing:W}},E.bm=function(r,e){return r.roll==e.roll&&r.pitch==e.pitch&&r.bearing==e.bearing},E.bn=rt,E.bo=kn,E.bp=xa,E.bq=Ql,E.br=va,E.bs=Kt,E.bt=or,E.bu=vi,E.bv=function(r,e,i,s,o){return Kt(s,o,Ri((r-e)/(i-e),0,1))},E.bw=function(r,e,i,s){return r[0]=e[0]+i[0]*s,r[1]=e[1]+i[1]*s,r[2]=e[2]+i[2]*s,r},E.bx=$t,E.by=function(){return new Float64Array(3)},E.bz=We,E.c=qr,E.c$=class{get tiles(){return this.tileIndex?.tiles??{}}get stats(){return this.tileIndex.stats}get total(){return this.tileIndex.total}constructor(r,e){const i=(e=this.options=Object.assign({},W_,e)).debug;if(i&&console.time("preprocess data"),e.maxZoom<0||e.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw new Error("promoteId and generateId cannot be used together.");let s=$h(r,e);i&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),s=Hh(s,e),e.updateable&&(this.source=s),this.initializeIndex(s,e)}initializeIndex(r,e){this.tileIndex=e.cluster?new j_(e.clusterOptions):new Z_(e),r.length&&this.tileIndex.initialize(r)}
2getTile(r,e,i){return e=+e,i=+i,(r=+r)<0||r>24?null:this.tileIndex.getTile(r,e,i)}updateData(r,e){const i=this.options;if(!i.updateable)throw new Error("to update tile geojson `updateable` option must be set to true");let{affected:s,source:o}=(function(l,h,d){const g=(function(v){return v?{removeAll:v.removeAll,remove:new Set(v.remove||[]),add:new Map(v.add?.map((_=>[_.id,_]))),update:new Map(v.update?.map((_=>[_.id,_])))}:{remove:new Set,add:new Map,update:new Map}})(h);let m=[];if(g.removeAll&&(m=l,l=[]),g.remove.size||g.add.size){const v=[];for(const _ of l)(g.remove.has(_.id)||g.add.has(_.id))&&v.push(_);if(v.length){m.push(...v);const _=new Set(v.map((T=>T.id)));l=l.filter((T=>!_.has(T.id)))}if(g.add.size){let _=$h({type:"FeatureCollection",features:Array.from(g.add.values())},d);_=Hh(_,d),m.push(..._),l.push(..._)}}if(g.update.size)for(const[v,_]of g.update){const T=[],x=[];for(const M of l)M.id===v?T.push(M):x.push(M);if(!T.length)continue;const I=V_(T,_,d);I.length&&(m.push(...T,...I),x.push(...I),l=x)}return{affected:m,source:l}})(this.source,r,i);e&&({affected:s,source:o}=this.filterUpdate(o,s,e)),s.length&&(this.source=o,this.tileIndex.updateIndex(o,s,i))}filterUpdate(r,e,i){const s=new Set;for(const o of r)o.id!=null&&(i(Cu(o))||(e.push(o),s.add(o.id)));return{affected:e,source:r=r.filter((o=>!s.has(o.id)))}}getData(){if(!this.options.updateable)throw new Error("to retrieve data the `updateable` option must be set to true");return{type:"FeatureCollection",features:this.source.map((r=>Cu(r)))}}updateClusterOptions(r,e){const i=this.options.cluster;this.options.cluster=r,this.options.clusterOptions=e,i!=r?this.initializeIndex(this.source,this.options):this.tileIndex.updateIndex(this.source,[],this.options)}getClusterExpansionZoom(r){return this.tileIndex.getClusterExpansionZoom(r)}getClusterChildren(r){return this.tileIndex.getChildren(r)}getClusterLeaves(r,e,i){return this.tileIndex.getLeaves(r,e,i)}},E.c0=ho,E.c1=class extends zi{constructor(r,e){super(r,e),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},E.c2=class extends zi{constructor(r,e){super(r,e),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},E.c3=ht,E.c4=function(r,e){var i=Math.sin(e),s=Math.cos(e);return r[0]=s,r[1]=i,r[2]=0,r[3]=-i,r[4]=s,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},E.c5=function(r,e,i){var s=e[0],o=e[1],l=e[2];return r[0]=s*i[0]+o*i[3]+l*i[6],r[1]=s*i[1]+o*i[4]+l*i[7],r[2]=s*i[2]+o*i[5]+l*i[8],r},E.c6=function(r,e,i,s,o,l,h){var d=1/(e-i),g=1/(s-o),m=1/(l-h);return r[0]=-2*d,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*g,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*m,r[11]=0,r[12]=(e+i)*d,r[13]=(o+s)*g,r[14]=(h+l)*m,r[15]=1,r},E.c7=class extends zi{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(4*r.length);for(let i=0;i<r.length;i++)e[4*i]=r[i].r,e[4*i+1]=r[i].g,e[4*i+2]=r[i].b,e[4*i+3]=r[i].a;this.gl.uniform4fv(this.location,e)}}},E.c8=class extends zi{constructor(r,e){super(r,e),this.current=new Array}set(r){if(r!=this.current){this.current=r;const e=new Float32Array(r);this.gl.uniform1fv(this.location,e)}}},E.c9=class extends ua{},E.cA=function(r){return Ga[r]||qa[r]},E.cB=function(r,e,i){var s=e[0],o=e[1];return r[0]=i[0]*s+i[4]*o+i[12],r[1]=i[1]*s+i[5]*o+i[13],r},E.cC=function(r,e){const{x:i,y:s}=oc.fromLngLat(e);return!(r<0||r>25||s<0||s>=1||i<0||i>=1)},E.cD=function(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},E.cE=class extends lo{},E.cF=Zn,E.cG=function(r,e){qr.REGISTERED_PROTOCOLS[r]=e},E.cH=function(r){delete qr.REGISTERED_PROTOCOLS[r]},E.cI=function(r,e){const i={};for(let o=0;o<r.length;o++){const l=e&&e[r[o].id]||yh(r[o]);e&&(e[r[o].id]=l);let h=i[l];h||(h=i[l]=[]),h.push(r[o])}const s=[];for(const o in i)s.push(i[o]);return s},E.cJ=Re,E.cK=Df,E.cL=cm,E.cM=pf,E.cN=function(r){var e;
vendor: 5,329 bytes, line 2
2r.bucket.createArrays(),r.bucket.tilePixelRatio=Ge/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const i=r.bucket.layers[0],s=i.layout,o=i._unevaluatedLayout._values,l={layoutIconSize:o["icon-size"].possiblyEvaluate(new vt(r.bucket.zoom+1),r.canonical),layoutTextSize:o["text-size"].possiblyEvaluate(new vt(r.bucket.zoom+1),r.canonical),textMaxSize:o["text-size"].possiblyEvaluate(new vt(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:v,maxZoom:_}=r.bucket.textSizeData;l.compositeTextSizes=[o["text-size"].possiblyEvaluate(new vt(v),r.canonical),o["text-size"].possiblyEvaluate(new vt(_),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:v,maxZoom:_}=r.bucket.iconSizeData;l.compositeIconSizes=[o["icon-size"].possiblyEvaluate(new vt(v),r.canonical),o["icon-size"].possiblyEvaluate(new vt(_),r.canonical)]}const h=s.get("text-line-height")*li,d=s.get("text-rotation-alignment")!=="viewport"&&s.get("symbol-placement")!=="point",g=s.get("text-keep-upright"),m=s.get("text-size");for(const v of r.bucket.features){const _=s.get("text-font").evaluate(v,{},r.canonical).join(","),T=m.evaluate(v,{},r.canonical),x=l.layoutTextSize.evaluate(v,{},r.canonical),I=l.layoutIconSize.evaluate(v,{},r.canonical),M={horizontal:{},vertical:void 0},D=v.text;let k,O=[0,0];if(D){const $=D.toString(),W=s.get("text-letter-spacing").evaluate(v,{},r.canonical)*li,ie=Rl($)?W:0,ne=s.get("text-anchor").evaluate(v,{},r.canonical),ae=wm(i,v,r.canonical);if(!ae){const _e=s.get("text-radial-offset").evaluate(v,{},r.canonical);O=_e?bm(ne,[_e*li,Dd]):s.get("text-offset").evaluate(v,{},r.canonical).map((de=>de*li))}let ue=d?"center":s.get("text-justify").evaluate(v,{},r.canonical);const ye=s.get("symbol-placement")==="point"?s.get("text-max-width").evaluate(v,{},r.canonical)*li:1/0,ge=()=>{r.bucket.allowVerticalPlacement&&Fl($)&&(M.vertical=zu(D,r.glyphMap,r.glyphPositions,r.imagePositions,_,ye,h,ne,"left",ie,O,E.aw.vertical,!0,x,T))};if(!d&&ae){const _e=new Set;if(ue==="auto")for(let Ie=0;Ie<ae.values.length;Ie+=2)_e.add(kd(ae.values[Ie]));else _e.add(ue);let de=!1;for(const Ie of _e)if(!M.horizontal[Ie])if(de)M.horizontal[Ie]=M.horizontal[0];else{const Fe=zu(D,r.glyphMap,r.glyphPositions,r.imagePositions,_,ye,h,"center",Ie,ie,O,E.aw.horizontal,!1,x,T);Fe&&(M.horizontal[Ie]=Fe,de=Fe.positionedLines.length===1)}ge()}else{ue==="auto"&&(ue=kd(ne));const _e=zu(D,r.glyphMap,r.glyphPositions,r.imagePositions,_,ye,h,ne,ue,ie,O,E.aw.horizontal,!1,x,T);_e&&(M.horizontal[ue]=_e),ge(),Fl($)&&d&&g&&(M.vertical=zu(D,r.glyphMap,r.glyphPositions,r.imagePositions,_,ye,h,ne,ue,ie,O,E.aw.vertical,!1,x,T))}}let B=!1;if(v.icon&&v.icon.name){const $=r.imageMap[v.icon.name];$&&(k=Sy(r.imagePositions[v.icon.name],s.get("icon-offset").evaluate(v,{},r.canonical),s.get("icon-anchor").evaluate(v,{},r.canonical)),B=!!$.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=B:r.bucket.sdfIcons!==B&&et("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),($.pixelRatio!==r.bucket.pixelRatio||s.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const N=Sm(M.horizontal)||M.vertical;(e=r.bucket).iconsInText||(e.iconsInText=!!N&&N.iconsInText),(N||k)&&y0(r.bucket,v,M,k,r.imageMap,l,x,I,O,B,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},E.cO=Bh,E.cP=Vh,E.cQ=td,E.cR=function(r,e=""){const i=new ku;return(function(s,o,l=""){for(const h in s.layers)o.writeMessage(3,((d,g)=>n0(d,g,l)),s.layers[h])})(r,i,e),i.finish()},E.cS=function(r,e,i,s,o,l){let h=dm(r,e,i,o,0);return h=dm(h,e,s,l,1),h},E.cT=class{constructor(r){this.maxEntries=r,this.map=new Map}get(r){const e=this.map.get(r);return e!==void 0&&(this.map.delete(r),this.map.set(r,e)),e}set(r,e){if(this.map.has(r))this.map.delete(r);else if(this.map.size>=this.maxEntries){const i=this.map.keys().next().value;this.map.delete(i)}this.map.set(r,e)}clear(){this.map.clear()}},E.cU=Fp,E.cV=ku,E.cW=am,E.cX=function(r,e,i,s,o){return c(this,void 0,void 0,(function*(){if(le())try{return yield sn(r,e,i,s,o)}catch{}return(function(l,h,d,g,m){const v=l.width,_=l.height;$r&&qn||($r=new OffscreenCanvas(v,_),qn=$r.getContext("2d",{willReadFrequently:!0})),$r.width=v,$r.height=_,qn.drawImage(l,0,0,v,_);const T=qn.getImageData(h,d,g,m);return qn.clearRect(0,0,v,_),T.data})(r,e,i,s,o)}))},E.cY=Tp,E.cZ=class{constructor(r,e){this.layers={[cc]:this},this.name=cc,this.version=e?e.version:1,this.extent=e?e.extent:4096,this.length=r.length,this.features=r}feature(r){return new r0(this.features[r],this.extent)}},E.c_=Zs,E.ca=iy,E.cb=class extends ha{},E.cc=kh,E.cd=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},E.ce=vp,E.cf=function(r,e,i){var s=e[0],o=e[1],l=e[2],h=i[3]*s+i[7]*o+i[11]*l+i[15];return r[0]=(i[0]*s+i[4]*o+i[8]*l+i[12])/(h=h||1),r[1]=(i[1]*s+i[5]*o+i[9]*l+i[13])/h,r[2]=(i[2]*s+i[6]*o+i[10]*l+i[14])/h,r},E.cg=class extends jl{},E.ch=class extends a{},E.ci=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]&&r[4]===e[4]&&r[5]===e[5]&&r[6]===e[6]&&r[7]===e[7]&&r[8]===e[8]&&r[9]===e[9]&&r[10]===e[10]&&r[11]===e[11]&&r[12]===e[12]&&r[13]===e[13]&&r[14]===e[14]&&r[15]===e[15]},E.cj=function(r,e){var i=r[0],s=r[1],o=r[2],l=r[3],h=r[4],d=r[5],g=r[6],m=r[7],v=r[8],_=r[9],T=r[10],x=r[11
2],I=r[12],M=r[13],D=r[14],k=r[15],O=e[0],B=e[1],N=e[2],$=e[3],W=e[4],ie=e[5],ne=e[6],ae=e[7],ue=e[8],ye=e[9],ge=e[10],_e=e[11],de=e[12],Ie=e[13],Fe=e[14],ke=e[15];return Math.abs(i-O)<=Be*Math.max(1,Math.abs(i),Math.abs(O))&&Math.abs(s-B)<=Be*Math.max(1,Math.abs(s),Math.abs(B))&&Math.abs(o-N)<=Be*Math.max(1,Math.abs(o),Math.abs(N))&&Math.abs(l-$)<=Be*Math.max(1,Math.abs(l),Math.abs($))&&Math.abs(h-W)<=Be*Math.max(1,Math.abs(h),Math.abs(W))&&Math.abs(d-ie)<=Be*Math.max(1,Math.abs(d),Math.abs(ie))&&Math.abs(g-ne)<=Be*Math.max(1,Math.abs(g),Math.abs(ne))&&Math.abs(m-ae)<=Be*Math.max(1,Math.abs(m),Math.abs(ae))&&Math.abs(v-ue)<=Be*Math.max(1,Math.abs(v),Math.abs(ue))&&Math.abs(_-ye)<=Be*Math.max(1,Math.abs(_),Math.abs(ye))&&Math.abs(T-ge)<=Be*Math.max(1,Math.abs(T),Math.abs(ge))&&Math.abs(x-_e)<=Be*Math.max(1,Math.abs(x),Math.abs(_e))&&Math.abs(I-de)<=Be*Math.max(1,Math.abs(I),Math.abs(de))&&Math.abs(M-Ie)<=Be*Math.max(1,Math.abs(M),Math.abs(Ie))&&Math.abs(D-Fe)<=Be*Math.max(1,Math.abs(D),Math.abs(Fe))&&Math.abs(k-ke)<=Be*Math.max(1,Math.abs(k),Math.abs(ke))},E.ck=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r},E.cl=r=>r.type==="circle",E.cm=r=>r.type==="heatmap",E.cn=r=>r.type==="line",E.co=r=>r.type==="fill",E.cp=r=>r.type==="fill-extrusion",E.cq=r=>r.type==="hillshade",E.cr=r=>r.type==="color-relief",E.cs=r=>r.type==="background",E.ct=r=>r.type==="custom",E.cu=rn,E.cv=function(r,e,i){if(e<=0)return r;const s=1/e;return i===void 0||Math.abs(i)<1e-10?Math.round(r*s)/s:(i>0?Math.ceil(r*s-1e-9):Math.floor(r*s+1e-10))/s},E.cw=function(r,e,i){const s=Ye(e.x-i.x,e.y-i.y),o=Ye(r.x-i.x,r.y-i.y);var l,h;return on(Math.atan2(s[0]*o[1]-s[1]*o[0],(l=s)[0]*(h=o)[0]+l[1]*h[1]))},E.cx=Is,E.cy=function(r,e){var i;if(!qa[e])return!1;const s=r?.target,o=((i=s?.ownerDocument)===null||i===void 0?void 0:i.defaultView)||window;return r instanceof o.MouseEvent||r instanceof o.WheelEvent},E.cz=function(r,e){return Ga[e]&&"touches"in r},E.d=ar,E.d0=Lr,E.e=Bi,E.f=r=>c(void 0,void 0,void 0,(function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const e=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(e)}catch(i){throw new Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}})),E.g=Er,E.h=r=>new Promise(((e,i)=>{const s=new Image;s.onload=()=>{e(s),URL.revokeObjectURL(s.src),s.onload=null,window.requestAnimationFrame((()=>{s.src=Xi}))},s.onerror=()=>i(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const o=new Blob([new Uint8Array(r)],{type:"image/png"});s.src=r.byteLength?URL.createObjectURL(o):Xi})),E.i=_r,E.j=(r,e)=>an(Bi(r,{type:"json"}),e),E.k=Hn,E.l=Cs,E.m=an,E.n=(r,e)=>an(Bi(r,{type:"arrayBuffer"}),e),E.o=function(r){return new ku(r).readFields(gy,[])},E.p=df,E.q=function(r){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(r))},E.r=Hl,E.s=So,E.t=xi,E.u=ve,E.v=$i,E.w=et,E.x=uu,E.y=iu,E.z=sa})),Z("worker",["./shared"],(function(E){"use strict";class c{constructor(J,re){this.keyCache={},J&&this.replace(J,re)}replace(J,re){this._layerConfigs={},this._layers={},this.update(J,[],re)}update(J,re,oe){for(const Ue of J){this._layerConfigs[Ue.id]=Ue;const ct=this._layers[Ue.id]=E.bS(Ue,oe);ct._featureFilter=E.ag(ct.filter,oe),this.keyCache[Ue.id]&&delete this.keyCache[Ue.id]}for(const Ue of re)delete this.keyCache[Ue],delete this._layerConfigs[Ue],delete this._layers[Ue];this.familiesBySource={};const Ce=E.cI(Object.values(this._layerConfigs),this.keyCache);for(const Ue of Ce){const ct=Ue.map(($t=>this._layers[$t.id])),We=ct[0];if(We.isHidden())continue;const ot=We.source||"";let Ye=this.familiesBySource[ot];Ye||(Ye=this.familiesBySource[ot]={});const Ge=We.sourceLayer||E.af;let it=Ye[Ge];it||(it=Ye[Ge]=[]),it.push(ct)}}}class H{constructor(J){const re={},oe=[];for(const We in J){const ot=J[We],Ye=re[We]={};for(const Ge in ot){const it=ot[+Ge];if(!it||it.bitmap.width===0||it.bitmap.height===0)continue;const $t={x:0,y:0,w:it.bitmap.width+2,h:it.bitmap.height+2};oe.push($t),Ye[Ge]={rect:$t,metrics:it.metrics}}}const{w:Ce,h:Ue}=E.p(oe),ct=new E.r({width:Ce||1,height:Ue||1});for(const We in J){const ot=J[We];for(const Ye in ot){const Ge=ot[+Ye];if(!Ge||Ge.bitmap.width===0||Ge.bitmap.height===0)continue;const it=re[We][Ye].rect;E.r.copy(Ge.bitmap,ct,{x:0,y:0},{x:it.x+1,y:it.y+1},Ge.bitmap)}}this.image=ct,this.positions=re}}E.cJ("GlyphAtlas",H);class he{constructor(J){this.tileID=new E.a2(J.tileID.overscaledZ,J.tileID.wrap,J.tileID.canonical.z,J.tileID.canonical.x,J.tileID.canonical.y),this.uid=J.uid,this.zoom=J.zoom,this.pixelRatio=J.pixelRatio,this.tileSize=J.tileSize,this.source=J.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=J.showCollisionBoxes,this.collectResourceTiming=!!J.collectResourceTiming,this.returnDependencies=!!J.returnDependencies,this.promoteId=J.promoteId,this.inFlightDependencies=[]}parse(J,re,oe,Ce,Ue){return E._(this,void 0,void 0,(function*(){this.status="parsing",this.data=J,this.collisionBoxArray=new E.ad;
2const ct=new E.cK(Object.keys(J.layers).sort()),We=new E.cL(this.tileID,this.promoteId);We.bucketLayerIDs=[];const ot={},Ye={featureIndex:We,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:oe,subdivisionGranularity:Ue},Ge=re.familiesBySource[this.source];for(const et in Ge){const Et=J.layers[et];if(!Et)continue;Et.version===1&&E.w(`Vector tile source "${this.source}" layer "${et}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const _r=ct.encode(et),Ur=[];for(let Oi=0;Oi<Et.length;Oi++){const Xi=Et.feature(Oi),sn=We.getId(Xi,et);Ur.push({feature:Xi,id:sn,index:Oi,sourceLayerIndex:_r})}for(const Oi of Ge[et]){const Xi=Oi[0];Xi.source!==this.source&&E.w(`layer.source = ${Xi.source} does not equal this.source = ${this.source}`),Xi.isHidden(this.zoom,!0)||(xe(Oi,this.zoom,oe),(ot[Xi.id]=Xi.createBucket({index:We.bucketLayerIDs.length,layers:Oi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_r,sourceID:this.source})).populate(Ur,Ye,this.tileID.canonical),We.bucketLayerIDs.push(Oi.map((sn=>sn.id))))}}const it=E.bX(Ye.glyphDependencies,(et=>Object.keys(et).map(Number)));this.inFlightDependencies.forEach((et=>et?.abort())),this.inFlightDependencies=[];let $t=Promise.resolve({});if(Object.keys(it).length){const et=new AbortController;this.inFlightDependencies.push(et),$t=Ce.sendAsync({type:"GG",data:{stacks:it,source:this.source,tileID:this.tileID,type:"glyphs"}},et)}const Kt=Object.keys(Ye.iconDependencies);let or=Promise.resolve({});if(Kt.length){const et=new AbortController;this.inFlightDependencies.push(et),or=Ce.sendAsync({type:"GI",data:{icons:Kt,source:this.source,tileID:this.tileID,type:"icons"}},et)}const rn=Object.keys(Ye.patternDependencies);let Is=Promise.resolve({});if(rn.length){const et=new AbortController;this.inFlightDependencies.push(et),Is=Ce.sendAsync({type:"GI",data:{icons:rn,source:this.source,tileID:this.tileID,type:"patterns"}},et)}const Ri=Ye.dashDependencies;let Ms=Promise.resolve({});if(Object.keys(Ri).length){const et=new AbortController;this.inFlightDependencies.push(et),Ms=Ce.sendAsync({type:"GDA",data:{dashes:Ri}},et)}const[Bi,Un,$n,Gn]=yield Promise.all([$t,or,Is,Ms]),mt=new H(Bi),nn=new E.cM(Un,$n);for(const et in ot){const Et=ot[et];Et instanceof E.ae?(xe(Et.layers,this.zoom,oe),E.cN({bucket:Et,glyphMap:Bi,glyphPositions:mt.positions,imageMap:Un,imagePositions:nn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Ye.subdivisionGranularity})):Et.hasDependencies&&(Et instanceof E.cO||Et instanceof E.cP||Et instanceof E.cQ)&&(xe(Et.layers,this.zoom,oe),Et.addFeatures(Ye,this.tileID.canonical,nn.patternPositions,Gn))}return this.status="done",{buckets:Object.values(ot).filter((et=>!et.isEmpty())),featureIndex:We,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:mt.image,imageAtlas:nn,dashPositions:Gn,glyphMap:this.returnDependencies?Bi:null,iconMap:this.returnDependencies?Un:null,glyphPositions:this.returnDependencies?mt.positions:null}}))}}function xe(nt,J,re){const oe=new E.H(J);for(const Ce of nt)Ce.recalculate(oe,re)}class Ae{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(J,re){this.loading[J]=re}finishLoading(J){delete this.loading[J]}abort(J){const re=this.loading[J];re!=null&&re.abort&&(re.abort.abort(),delete this.loading[J])}setParsing(J,re){this.parsing[J]=re}consumeParsing(J){const re=this.parsing[J];if(re)return delete this.parsing[J],re}clearParsing(J){delete this.parsing[J]}markLoaded(J,re){this.loaded[J]=re}getLoaded(J){const re=this.loaded[J];if(re)return re}removeLoaded(J){delete this.loaded[J]}clearLoaded(){this.loaded={}}}class Le{constructor(J){this.start=`${J}#start`,this.end=`${J}#end`,this.measure=J,performance.mark(this.start)}finish(){performance.mark(this.end);let J=performance.getEntriesByName(this.measure);return J.length===0&&(performance.measure(this.measure,this.start,this.end),J=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),J}}class Ee{constructor(J,re,oe,Ce,Ue){this.type=J,this.properties=oe||{},this.extent=Ue,this.pointsArray=re,this.id=Ce}loadGeometry(){return this.pointsArray.map((J=>J.map((re=>new E.P(re.x,re.y)))))}}class ze{constructor(J,re,oe){this.version=2,this._myFeatures=J,this.name=re,this.length=J.length,this.extent=oe}feature(J){return this._myFeatures[J]}}class be{constructor(){this.layers={}}addLayer(J){this.layers[J.name]=J}}function le(nt){let J=E.cR(nt);return J.byteOffset===0&&J.byteLength===J.buffer.byteLength||(J=new Uint8Array(J)),{vectorTile:nt,rawData:J.buffer}}function Be(nt,J,re){const{extent:oe}=nt,Ce=Math.pow(2,re.z-J.z),Ue=(re.x-J.x*Ce)*oe,ct=(re.y-J.y*Ce)*oe,We=[];for(let ot=0;ot<nt.length;ot++){const Ye=nt.feature(ot);let Ge=Ye.loadGeometry();for(const $t of Ge)for(const Kt of $t)Kt.x=Kt.x*Ce-Ue,Kt.y=Kt.y*Ce-ct;const it=128;Ge=E.cS(Ge,Ye.type,-it,-it,oe+it,oe+it),Ge.length!==0&&We.push(new Ee(Ye.type,Ge,Ye.properties,Ye.id,oe))}return new ze(We,nt.name,oe)}class Ne{constructor(J,re,oe){this.actor=J,this.layerIndex=re,this.availableImages=oe,this.tileState=new Ae,this.overzoomedTileResultCache=new E.cT(1e3)}loadVectorTile(J,re){try{return{vectorTile:J.encoding!=="mlt"?new E.cU(new E.cV(re)):new E.cW(re),rawData:re}}catch(oe){const Ce=new Uint8Array(re);let Ue=`Unable to parse the tile at ${J.request.url}, `;throw Ue+=Ce[0]===31&&Ce[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${oe.message}`,new Error(Ue)}}loadTile(J){return E._(this,void 0,void 0,(function*(){const{uid:re,overzoomParameters:oe}=J;oe&&(J.request=oe.overzoomRequest);const Ce=this._startRequestTiming(J),Ue=new he(J);this.tileState.startLoading(re,Ue);const ct=new AbortController;Ue.abort=ct;try{const We=yield E.n(J.request,ct);if(J.etag&&J.etag===We.etag)return this.tileState.finishLoading(re),this._getEtagUnmodifiedResult(We,Ce);const ot=this.loadVectorTile(J,We.data);if(this.tileState.finishLoading(re),!ot)return null;let{vectorTile:Ye,rawData:Ge}=ot;oe&&({vectorTile:Ye,rawData:Ge}=this._getOverzoomTile(J,Ye));const it=this._getExpiryData(We),$t=this._finishRequestTiming(Ce);Ue.vectorTile=Ye,this.tileState.markLoaded(re,Ue);const Kt={rawData:Ge,cacheControl:it,resourceTiming:$t};this.tileState.setParsing(re,Kt);try{return yield this._parseWorkerTile(Ue,J,Kt)}finally{this.tileState.clearParsing(re)}}catch(We){throw this.tileState.finishLoading(re),Ue.status="done",this.tileState.markLoaded(re,Ue),We}}))}_getEtagUnmodifiedResult(J,re){const oe=this._getExpiryData(J),Ce=this._finishRequestTiming(re);return E.e({etagUnmodified:!0},oe,Ce)}_parseWorkerTile(J,re,oe){return E._(this,void 0,void 0,(function*(){let Ce=yield J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor,re.subdivisionGranularity);if(oe){const{rawData:Ue,cacheControl:ct,resourceTiming:We}=oe;Ce=E.e({rawTileData:Ue.slice(0),encoding:re.encoding},Ce,ct,We)}return Ce}))}_getExpiryData({expires:J,cacheControl:re,etag:oe}){const Ce={};return J&&(Ce.expires=J),re&&(Ce.cacheControl=re),oe&&(Ce.etag=oe),Ce}_startRequestTiming(J){var re;if(!((re=J.request)===null||re===void 0)&&re.collectResourceTiming)return new Le(J.request.url)}_finishRequestTiming(J){const re=J?.finish();return re?{resourceTiming:JSON.parse(JSON.stringify(re))}:{}}_getOverzoomTile(J,re){const{tileID:oe,source:Ce,overzoomParameters:Ue}=J,{maxZoomTileID:ct}=Ue,We=`${ct.key}_${oe.key}`,ot=this.overzoomedTileResultCache.get(We);if(ot)return ot;const Ye=new be,Ge=this.layerIndex.familiesBySource[Ce];for(const $t in Ge){const Kt=re.layers[$t];if(!Kt)continue;const or=Be(Kt,ct,oe.canonical);or.length>0&&Ye.addLayer(or)}const it=le(Ye);return this.overzoomedTileResultCache.set(We,it),it}reloadTile(J){return E._(this,void 0,void 0,(function*(){const re=J.uid,oe=this.tileState.getLoaded(re);if(!oe)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(oe.showCollisionBoxes=J.showCollisionBoxes,oe.status==="parsing"){const Ce=this.tileState.consumeParsing(re);return yield this._parseWorkerTile(oe,J,Ce)}if(oe.status==="done"&&oe.vectorTile)return yield this._parseWorkerTile(oe,J)}))}abortTile(J){return E._(this,void 0,void 0,(function*(){this.tileState.abort(J.uid)}))}removeTile(J){return E._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(J.uid)}))}}class ht{constructor(){this.loaded={}}loadTile(J){return E._(this,void 0,void 0,(function*(){const{uid:re,encoding:oe,rawImageData:Ce,redFactor:Ue,greenFactor:ct,blueFactor:We,baseShift:ot}=J,Ye=Ce.width+2,Ge=Ce.height+2,it=E.b(Ce)?new E.R({width:Ye,height:Ge},yield E.cX(Ce,-1,-1,Ye,Ge)):Ce,$t=new E.cY(re,it,oe,Ue,ct,We,ot);return this.loaded=this.loaded||{},this.loaded[re]=$t,$t}))}removeTile(J){const re=this.loaded,oe=J.uid;re&&re[oe]&&delete re[oe]}}class dt{constructor(J,re,oe,Ce=Vt){this.actor=J,this.layerIndex=re,this.availableImages=oe,this.tileState=new Ae,this._createGeoJSONIndex=Ce}loadVectorTile(J){if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const{z:re,x:oe,y:Ce}=J.tileID.canonical,Ue=this._geoJSONIndex.getTile(re,oe,Ce);return Ue?le(new E.cZ(Ue.features,{version:2,extent:E.a5})):null}loadTile(J){return E._(this,void 0,void 0,(function*(){const{uid:re}=J,oe=new he(J);oe.abort=new AbortController;try{const Ce=this.loadVectorTile(J);if(!Ce)return null;const{vectorTile:Ue,rawData:ct}=Ce;oe.vectorTile=Ue,this.tileState.markLoaded(re,oe);const We={rawData:ct};this.tileState.setParsing(re,We);try{return yield this._parseWorkerTile(oe,J,We)}finally{this.tileState.clearParsing(re)}}catch(Ce){throw oe.status="done",this.tileState.markLoaded(re,oe),Ce}}
2))}_reloadLoadedTile(J){return E._(this,void 0,void 0,(function*(){const re=J.uid,oe=this.tileState.getLoaded(re);if(!oe)throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");if(oe.showCollisionBoxes=J.showCollisionBoxes,oe.status==="parsing"){const Ce=this.tileState.consumeParsing(re);return yield this._parseWorkerTile(oe,J,Ce)}if(oe.status==="done"&&oe.vectorTile)return yield this._parseWorkerTile(oe,J)}))}_parseWorkerTile(J,re,oe){return E._(this,void 0,void 0,(function*(){let Ce=yield J.parse(J.vectorTile,this.layerIndex,this.availableImages,this.actor,re.subdivisionGranularity);if(oe){const{rawData:Ue}=oe;Ce=E.e({rawTileData:Ue.slice(0),encoding:"mvt"},Ce)}return Ce}))}abortTile(J){return E._(this,void 0,void 0,(function*(){this.tileState.abort(J.uid)}))}removeTile(J){return E._(this,void 0,void 0,(function*(){this.tileState.removeLoaded(J.uid)}))}loadData(J){return E._(this,void 0,void 0,(function*(){var re;(re=this._pendingRequest)===null||re===void 0||re.abort();const oe=this._startRequestTiming(J);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(J,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();const Ce={};return J.request&&(Ce.data=J.data),this._finishRequestTiming(oe,J,Ce),Ce}catch(Ce){if(delete this._pendingRequest,!E.Z(Ce))throw Ce;return{abandoned:!0}}}))}_startRequestTiming(J){var re;if(!((re=J.request)===null||re===void 0)&&re.collectResourceTiming)return new Le(J.request.url)}_finishRequestTiming(J,re,oe){const Ce=J?.finish();Ce&&(oe.resourceTiming={[re.source]:JSON.parse(JSON.stringify(Ce))})}reloadTile(J){return this.tileState.getLoaded(J.uid)?this._reloadLoadedTile(J):this.loadTile(J)}loadAndProcessGeoJSON(J,re){return E._(this,void 0,void 0,(function*(){var oe;if(J.request&&(J.data=(yield E.j(J.request,re)).data),J.data)return J.data=this._filterGeoJSON(J.data,J.filter),void(this._geoJSONIndex=this._createGeoJSONIndex(J.data,J));if(J.dataDiff)return(oe=this._geoJSONIndex)!==null&&oe!==void 0||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},J)),void this._geoJSONIndex.updateData(J.dataDiff,this._getFilterPredicate(J.filter));if(J.updateCluster&&this._geoJSONIndex.updateClusterOptions(J.geojsonVtOptions.cluster,Ut(J)),this._geoJSONIndex==null)throw new Error(`Input data given to '${J.source}' is not a valid GeoJSON object.`)}))}_filterGeoJSON(J,re){if(J.type!=="FeatureCollection")return J;const oe=this._getFilterPredicate(re);return oe?{type:"FeatureCollection",features:J.features.filter((Ce=>oe(Ce)))}:J}_getFilterPredicate(J){if(typeof J!="boolean"&&!J?.length)return;const re=E.c_(J,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(re.result==="error")throw new Error(re.value.map((oe=>`${oe.key}: ${oe.message}`)).join(", "));return oe=>re.value.evaluate({zoom:0},oe)}removeSource(J){return E._(this,void 0,void 0,(function*(){var re;
vendor: 31,351 bytes, line 2
2(re=this._pendingRequest)===null||re===void 0||re.abort()}))}getClusterExpansionZoom(J){return this._geoJSONIndex.getClusterExpansionZoom(J.clusterId)}getClusterChildren(J){return this._geoJSONIndex.getClusterChildren(J.clusterId)}getClusterLeaves(J){return this._geoJSONIndex.getClusterLeaves(J.clusterId,J.limit,J.offset)}}function Vt(nt,J){const re=E.e(J.geojsonVtOptions||{},{updateable:!0,clusterOptions:Ut(J)});return new E.c$(nt,re)}function Ut({geojsonVtOptions:nt,clusterProperties:J}){if(!J||!nt.clusterOptions)return nt.clusterOptions;const re={},oe={},Ce={accumulated:null,zoom:0},Ue={properties:null},ct=Object.keys(J);for(const We of ct){const[ot,Ye]=J[We],Ge=E.c_(Ye),it=E.c_(typeof ot=="string"?[ot,["accumulated"],["get",We]]:ot);re[We]=Ge.value,oe[We]=it.value}return nt.clusterOptions.map=We=>{Ue.properties=We;const ot={};for(const Ye of ct)ot[Ye]=re[Ye].evaluate(Ce,Ue);return ot},nt.clusterOptions.reduce=(We,ot)=>{Ue.properties=ot;for(const Ye of ct)Ce.accumulated=We[Ye],We[Ye]=oe[Ye].evaluate(Ce,Ue)},nt.clusterOptions}class Tt{constructor(J){this.self=J,this.actor=new E.L(J),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(re,oe)=>{if(this.externalWorkerSourceTypes[re])throw new Error(`Worker source with name "${re}" already registered.`);this.externalWorkerSourceTypes[re]=oe},this.self.addProtocol=E.cG,this.self.removeProtocol=E.cH,this.self.registerRTLTextPlugin=re=>{E.d0.setMethods(re)},this.actor.registerMessageHandler("LDT",((re,oe)=>this._getDEMWorkerSource(re,oe.source).loadTile(oe))),this.actor.registerMessageHandler("RDT",((re,oe)=>E._(this,void 0,void 0,(function*(){this._getDEMWorkerSource(re,oe.source).removeTile(oe)})))),this.actor.registerMessageHandler("GCEZ",((re,oe)=>E._(this,void 0,void 0,(function*(){return this._getWorkerSource(re,oe.type,oe.source).getClusterExpansionZoom(oe)})))),this.actor.registerMessageHandler("GCC",((re,oe)=>E._(this,void 0,void 0,(function*(){return this._getWorkerSource(re,oe.type,oe.source).getClusterChildren(oe)})))),this.actor.registerMessageHandler("GCL",((re,oe)=>E._(this,void 0,void 0,(function*(){return this._getWorkerSource(re,oe.type,oe.source).getClusterLeaves(oe)})))),this.actor.registerMessageHandler("LD",((re,oe)=>this._getWorkerSource(re,oe.type,oe.source).loadData(oe))),this.actor.registerMessageHandler("LT",((re,oe)=>this._getWorkerSource(re,oe.type,oe.source).loadTile(oe))),this.actor.registerMessageHandler("RT",((re,oe)=>this._getWorkerSource(re,oe.type,oe.source).reloadTile(oe))),this.actor.registerMessageHandler("AT",((re,oe)=>this._getWorkerSource(re,oe.type,oe.source).abortTile(oe))),this.actor.registerMessageHandler("RMT",((re,oe)=>this._getWorkerSource(re,oe.type,oe.source).removeTile(oe))),this.actor.registerMessageHandler("RS",((re,oe)=>E._(this,void 0,void 0,(function*(){if(!this.workerSources[re]||!this.workerSources[re][oe.type]||!this.workerSources[re][oe.type][oe.source])return;const Ce=this.workerSources[re][oe.type][oe.source];delete this.workerSources[re][oe.type][oe.source],Ce.removeSource!==void 0&&Ce.removeSource(oe)})))),this.actor.registerMessageHandler("RM",(re=>E._(this,void 0,void 0,(function*(){delete this.layerIndexes[re],delete this.availableImages[re],delete this.workerSources[re],delete this.demWorkerSources[re],this.globalStates.delete(re)})))),this.actor.registerMessageHandler("SR",((re,oe)=>E._(this,void 0,void 0,(function*(){this.referrer=oe})))),this.actor.registerMessageHandler("SRPS",((re,oe)=>this._syncRTLPluginState(re,oe))),this.actor.registerMessageHandler("IS",((re,oe)=>E._(this,void 0,void 0,(function*(){this.self.importScripts(oe)})))),this.actor.registerMessageHandler("SI",((re,oe)=>this._setImages(re,oe))),this.actor.registerMessageHandler("UL",((re,oe)=>E._(this,void 0,void 0,(function*(){this._getLayerIndex(re).update(oe.layers,oe.removedIds,this._getGlobalState(re))})))),this.actor.registerMessageHandler("UGS",((re,oe)=>E._(this,void 0,void 0,(function*(){const Ce=this._getGlobalState(re);for(const Ue in oe)Ce[Ue]=oe[Ue]})))),this.actor.registerMessageHandler("SL",((re,oe)=>E._(this,void 0,void 0,(function*(){this._getLayerIndex(re).replace(oe,this._getGlobalState(re))}))))}_getGlobalState(J){let re=this.globalStates.get(J);return re||(re={},this.globalStates.set(J,re)),re}_setImages(J,re){return E._(this,void 0,void 0,(function*(){this.availableImages[J]=re;for(const oe in this.workerSources[J]){const Ce=this.workerSources[J][oe];for(const Ue in Ce)Ce[Ue].availableImages=re}}))}_syncRTLPluginState(J,re){return E._(this,void 0,void 0,(function*(){return yield E.d0.syncState(re,this.self.importScripts)}))}_getAvailableImages(J){let re=this.availableImages[J];return re||(re=[]),re}_getLayerIndex(J){let re=this.layerIndexes[J];return re||(re=this.layerIndexes[J]=new c),re}_getWorkerSource(J,re,oe){if(this.workerSources[J]||(this.workerSources[J]={}),this.workerSources[J][re]||(this.workerSources[J][re]={}),!this.workerSources[J][re][oe]){const Ce={sendAsync:(Ue,ct)=>(Ue.targetMapId=J,this.actor.sendAsync(Ue,ct))};switch(re){case"vector":this.workerSources[J][re][oe]=new Ne(Ce,this._getLayerIndex(J),this._getAvailableImages(J));break;case"geojson":this.workerSources[J][re][oe]=new dt(Ce,this._getLayerIndex(J),this._getAvailableImages(J));break;default:this.workerSources[J][re][oe]=new this.externalWorkerSourceTypes[re](Ce,this._getLayerIndex(J),this._getAvailableImages(J))}}return this.workerSources[J][re][oe]}_getDEMWorkerSource(J,re){return this.demWorkerSources[J]||(this.demWorkerSources[J]={}),this.demWorkerSources[J][re]||(this.demWorkerSources[J][re]=new ht),this.demWorkerSources[J][re]}}return E.i(self)&&(self.worker=new Tt(self)),Tt})),Z("index",["exports","./shared"],(function(E,c){"use strict";var H="5.22.0";function he(){var p=new c.A(4);return c.A!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p}let xe,Ae,Le;const Ee={frame(p,t,n,a){const u=a||window,f=u.requestAnimationFrame((b=>{y(),t(b)})),{unsubscribe:y}=c.s(p.signal,"abort",(()=>{y(),u.cancelAnimationFrame(f),n(new c.a(p.signal.reason))}),!1)},frameAsync(p,t){return new Promise(((n,a)=>{this.frame(p,n,a,t)}))},getImageData(p,t=0){return this.getImageCanvasContext(p).getImageData(-t,-t,p.width+2*t,p.height+2*t)},getImageCanvasContext(p){const t=window.document.createElement("canvas"),n=t.getContext("2d",{willReadFrequently:!0});if(!n)throw new Error("failed to create canvas 2d context");return t.width=p.width,t.height=p.height,n.drawImage(p,0,0,p.width,p.height),n},resolveURL:p=>(xe||(xe=document.createElement("a")),xe.href=p,xe.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return Le!==void 0?Le:!!matchMedia&&(Ae??=matchMedia("(prefers-reduced-motion: reduce)"),Ae.matches)},set prefersReducedMotion(p){Le=p}},ze=new class{constructor(){this._frozenAt=null}getCurrentTime(){return this._frozenAt!==null?this._frozenAt:performance.now()}setNow(p){this._frozenAt=p}restoreNow(){this._frozenAt=null}isFrozen(){return this._frozenAt!==null}};function be(){return ze.getCurrentTime()}class le{static create(t,n,a){const u=window.document.createElement(t);return n!==void 0&&(u.className=n),a&&a.appendChild(u),u}static createNS(t,n){return window.document.createElementNS(t,n)}static disableDrag(){le.docStyle&&le.selectProp&&(le.userSelect=le.docStyle[le.selectProp],le.docStyle[le.selectProp]="none")}static enableDrag(){le.docStyle&&le.selectProp&&(le.docStyle[le.selectProp]=le.userSelect)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",le.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",le.suppressClickInternal,!0),window.setTimeout((()=>{window.removeEventListener("click",le.suppressClickInternal,!0)}),0)}static getScale(t){const n=t.getBoundingClientRect();return{x:n.width/t.offsetWidth||1,y:n.height/t.offsetHeight||1,boundingClientRect:n}}static getPoint(t,n,a){const u=n.boundingClientRect;return new c.P((a.clientX-u.left)/n.x-t.clientLeft,(a.clientY-u.top)/n.y-t.clientTop)}static mousePos(t,n){const a=le.getScale(t);return le.getPoint(t,a,n)}static touchPos(t,n){const a=[],u=le.getScale(t);for(let f=0;f<n.length;f++)a.push(le.getPoint(t,u,n[f]));return a}static sanitize(t){const n=new DOMParser().parseFromString(t,"text/html").body||document.createElement("body"),a=n.querySelectorAll("script");for(const u of a)u.remove();return le.clean(n),n.innerHTML}static isPossiblyDangerous(t,n){const a=n.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(t)||!a.includes("javascript:")&&!a.includes("data:"))||!!t.startsWith("on")||void 0}static clean(t){const n=t.children;for(const a of n)le.removeAttributes(a),le.clean(a)}static removeAttributes(t){for(const{name:n,value:a}of t.attributes)le.isPossiblyDangerous(n,a)&&t.removeAttribute(n)}}var Be;le.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,le.selectProp=!le.docStyle||"userSelect"in le.docStyle?"userSelect":"webkitUserSelect",(function(p){let t,n,a,u;p.resetRequestQueue=()=>{t=[],n=0,a=0,u={}},p.addThrottleControl=w=>{const S=a++;return u[S]=w,S},p.removeThrottleControl=w=>{delete u[w],y()},p.getImage=(w,S,P=!0)=>new Promise(((C,A)=>{w.headers||(w.headers={}),w.headers.accept="image/webp,*/*",c.e(w,{type:"image"}),t.push({abortController:S,requestParameters:w,supportImageRefresh:P,state:"queued",onError:F=>{A(F)},onSuccess:F=>{C(F)}}),y()}));const f=w=>c._(this,void 0,void 0,(function*(){w.state="running";const{requestParameters:S,supportImageRefresh:P,onError:C,onSuccess:A,abortController:F}=w,V=P===!1&&!c.i(self)&&!c.g(S.url)&&(!S.headers||Object.keys(S.headers).reduce(((G,Y)=>G&&Y==="accept"),!0));n++;const U=V?b(S,F):c.m(S,F);try{const G=yield U;delete w.abortController,w.state="completed",G.data instanceof HTMLImageElement||c.b(G.data)?A(G):G.data&&A({data:yield(q=G.data,typeof createImageBitmap=="function"?c.f(q):c.h(q)),cacheControl:G.cacheControl,expires:G.expires})}catch(G){delete w.abortController,C(G)}finally{n--,y()}var q})),y=()=>{const w=(()=>{for(const S of Object.keys(u))if(u[S]())return!0;return!1})()?c.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let S=n;S<w&&t.length>0;S++){const P=t.shift();P.abortController.signal.aborted?S--:f(P)}},b=(w,S)=>new Promise(((P,C)=>{const A=new Image,F=w.url,V=w.credentials;V&&V==="include"?A.crossOrigin="use-credentials":(V&&V==="same-origin"||!c.d(F))&&(A.crossOrigin="anonymous"),S.signal.addEventListener("abort",(()=>{A.src="",C(new c.a(S.signal.reason))})),A.fetchPriority="high",A.onload=()=>{A.onerror=A.onload=null,P({data:A})},A.onerror=()=>{A.onerror=A.onload=null,S.signal.aborted||C(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},A.src=F}))})(Be||(Be={})),Be.resetRequestQueue();class Ne{constructor(t){this._transformRequestFn=t??null}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}setTransformRequest(t){this._transformRequestFn=t}}function ht(p){const t=[];if(typeof p=="string")t.push({id:"default",url:p});else if(p&&p.length>0){const n=[];for(const{id:a,url:u}of p){const f=`${a}${u}`;n.indexOf(f)===-1&&(n.push(f),t.push({id:a,url:u}))}}return t}function dt(p,t,n){try{const a=new URL(p);return a.pathname+=`${t}${n}`,a.toString()}catch{throw new Error(`Invalid sprite URL "${p}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}function Vt(p){const{userImage:t}=p;return!!(t&&t.render&&t.render())&&(p.data.replace(new Uint8Array(t.data.buffer)),!0)}class Ut extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}destroy(){this.atlasTexture&&(this.atlasTexture.destroy(),this.atlasTexture=null);for(const t of Object.keys(this.images))this.removeImage(t);this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(t){if(this.loaded!==t&&(this.loaded=t,t)){for(const{ids:n,promiseResolve:a}of this.requestors)a(this._getImagesForIds(n));this.requestors=[]}}getImage(t){const n=this.images[t];if(n&&!n.data&&n.spriteData){const a=n.spriteData;n.data=new c.R({width:a.width,height:a.height},a.context.getImageData(a.x,a.y,a.width,a.height).data),n.spriteData=null}return n}addImage(t,n){if(this.images[t])throw new Error(`Image id ${t} already exist, use updateImage instead`);this._validate(t,n)&&(this.images[t]=n)}_validate(t,n){let a=!0;const u=n.data||n.spriteData;return this._validateStretch(n.stretchX,u&&u.width)||(this.fire(new c.k(new Error(`Image "${t}" has invalid "stretchX" value`))),a=!1),this._validateStretch(n.stretchY,u&&u.height)||(this.fire(new c.k(new Error(`Image "${t}" has invalid "stretchY" value`))),a=!1),this._validateContent(n.content,n)||(this.fire(new c.k(new Error(`Image "${t}" has invalid "content" value`))),a=!1),a}_validateStretch(t,n){if(!t)return!0;let a=0;for(const u of t){if(u[0]<a||u[1]<u[0]||n<u[1])return!1;a=u[1]}return!0}_validateContent(t,n){if(!t)return!0;if(t.length!==4)return!1;const a=n.spriteData,u=a&&a.width||n.data.width,f=a&&a.height||n.data.height;return!(t[0]<0||u<t[0]||t[1]<0||f<t[1]||t[2]<0||u<t[2]||t[3]<0||f<t[3]||t[2]<t[0]||t[3]<t[1])}updateImage(t,n,a=!0){const u=this.getImage(t);if(a&&(u.data.width!==n.data.width||u.data.height!==n.data.height))throw new Error(`size mismatch between old image (${u.data.width}x${u.data.height}) and new image (${n.data.width}x${n.data.height}).`);n.version=u.version+1,this.images[t]=n,this.updatedImages[t]=!0}removeImage(t){const n=this.images[t];delete this.images[t],delete this.patterns[t],n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(t){return new Promise(((n,a)=>{let u=!0;if(!this.isLoaded())for(const f of t)this.images[f]||(u=!1);this.isLoaded()||u?n(this._getImagesForIds(t)):this.requestors.push({ids:t,promiseResolve:n})}))}_getImagesForIds(t){const n={};for(const a of t){let u=this.getImage(a);u||(this.fire(new c.l("styleimagemissing",{id:a})),u=this.getImage(a)),u?n[a]={data:u.data.clone(),pixelRatio:u.pixelRatio,sdf:u.sdf,version:u.version,stretchX:u.stretchX,stretchY:u.stretchY,content:u.content,textFitWidth:u.textFitWidth,textFitHeight:u.textFitHeight,hasRenderCallback:!!(u.userImage&&u.userImage.render)}:c.w(`Image "${a}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return n}getPixelSize(){const{width:t,height:n}=this.atlasImage;return{width:t,height:n}}getPattern(t){const n=this.patterns[t],a=this.getImage(t);if(!a)return null;if(n&&n.position.version===a.version)return n.position;if(n)n.position.version=a.version;else{const u={w:a.data.width+2,h:a.data.height+2,x:0,y:0},f=new c.I(u,a);this.patterns[t]={bin:u,position:f}}return this._updatePatternAtlas(),this.patterns[t].position}bind(t){const n=t.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new c.T(t,this.atlasImage,n.RGBA),this.atlasTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(){const t=[];for(const f in this.patterns)t.push(this.patterns[f].bin);const{w:n,h:a}=c.p(t),u=this.atlasImage;u.resize({width:n||1,height:a||1});for(const f in this.patterns){const{bin:y}=this.patterns[f],b=y.x+1,w=y.y+1,S=this.getImage(f).data,P=S.width,C=S.height;c.R.copy(S,u,{x:0,y:0},{x:b,y:w},{width:P,height:C}),c.R.copy(S,u,{x:0,y:C-1},{x:b,y:w-1},{width:P,height:1}),c.R.copy(S,u,{x:0,y:0},{x:b,y:w+C},{width:P,height:1}),c.R.copy(S,u,{x:P-1,y:0},{x:b-1,y:w},{width:1,height:C}),c.R.copy(S,u,{x:0,y:0},{x:b+P,y:w},{width:1,height:C})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(t){for(const n of t){if(this.callbackDispatchedThisFrame[n])continue;this.callbackDispatchedThisFrame[n]=!0;const a=this.getImage(n);a||c.w(`Image with ID: "${n}" was not found`),Vt(a)&&this.updateImage(n,a)}}cloneImages(){const t={};for(const n in this.images){const a=this.images[n];t[n]=Object.assign(Object.assign({},a),{data:a.data?a.data.clone():null})}return t}}const Tt=1e20;function nt(p,t,n,a,u,f,y,b,w){for(let S=t;S<t+a;S++)J(p,n*f+S,f,u,y,b,w);for(let S=n;S<n+u;S++)J(p,S*f+t,1,a,y,b,w)}function J(p,t,n,a,u,f,y){f[0]=0,y[0]=-Tt,y[1]=Tt,u[0]=p[t];for(let b=1,w=0,S=0;b<a;b++){u[b]=p[t+b*n];const P=b*b;do{const C=f[w];S=(u[b]-u[C]+P-C*C)/(b-C)/2}while(S<=y[w]&&--w>-1);w++,f[w]=b,y[w]=S,y[w+1]=Tt}for(let b=0,w=0;b<a;b++){for(;y[w+1]<b;)w++;const S=f[w],P=b-S;p[t+b*n]=u[S]+P*P}}const re=c.v.layout_symbol["text-font"].default.join(",");class oe{constructor(t,n,a){this.requestManager=t,this.localIdeographFontFamily=n,this.entries={},this.lang=a}setURL(t){this.url=t}getGlyphs(t){return c._(this,void 0,void 0,(function*(){const n=[];for(const f in t)for(const y of t[f])n.push(this._getAndCacheGlyphsPromise(f,y));const a=yield Promise.all(n),u={};for(const{stack:f,id:y,glyph:b}of a)u[f]||(u[f]={}),u[f][y]=b&&{id:b.id,bitmap:b.bitmap.clone(),metrics:b.metrics};return u}))}_getAndCacheGlyphsPromise(t,n){return c._(this,void 0,void 0,(function*(){let a=this.entries[t];a||(a=this.entries[t]={glyphs:{},requests:{},ranges:{}});let u=a.glyphs[n];return u!==void 0?{stack:t,id:n,glyph:u}:!this.url||this._charUsesLocalIdeographFontFamily(n)?(u=a.glyphs[n]=this._drawGlyph(a,t,n),{stack:t,id:n,glyph:u}):yield this._downloadAndCacheRangePromise(t,n)}))}_downloadAndCacheRangePromise(t,n){return c._(this,void 0,void 0,(function*(){const a=this.entries[t],u=Math.floor(n/256);if(a.ranges[u])return{stack:t,id:n,glyph:null};if(!a.requests[u]){const f=oe.loadGlyphRange(t,u,this.url,this.requestManager);a.requests[u]=f}try{const f=yield a.requests[u];for(const y in f)a.glyphs[+y]=f[+y];return a.ranges[u]=!0,{stack:t,id:n,glyph:f[n]||null}}catch(f){const y=a.glyphs[n]=this._drawGlyph(a,t,n);return this._warnOnMissingGlyphRange(y,u,n,f),{stack:t,id:n,glyph:y}}}))}_warnOnMissingGlyphRange(t,n,a,u){const f=256*n,y=f+255,b=a.toString(16).padStart(4,"0").toUpperCase();c.w(`Unable to load glyph range ${n}, ${f}-${y}. Rendering codepoint U+${b} locally instead. ${u}`)}_charUsesLocalIdeographFontFamily(t){return!!this.localIdeographFontFamily&&c.q(t)}_drawGlyph(t,n,a){const u=n===re&&this.localIdeographFontFamily!==""&&this._charUsesLocalIdeographFontFamily(a),f=u?"ideographTinySDF":"tinySDF";t[f]||(t[f]=this._createTinySDF(u?this.localIdeographFontFamily:n));const y=t[f].draw(String.fromCodePoint(a)),b=new RegExp("^\\p{gc=Cf}+$","u").test(String.fromCodePoint(a));return{id:a,bitmap:new c.r({width:y.width||60,height:y.height||60},y.data),metrics:{width:b?0:y.glyphWidth/2||24,height:y.glyphHeight/2||24,left:y.glyphLeft/2+.5||0,top:y.glyphTop/2-27.5||-8,advance:b?0:y.glyphAdvance/2||24,isDoubleResolution:!0}}}_createTinySDF(t){const n=t?t.split(","):[];n.push("sans-serif");const a=n.map((u=>/[-\w]+/.test(u)?u:`'${CSS.escape(u)}'`)).join(",");return new oe.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:a,fontWeight:this._fontWeight(n[0]),fontStyle:this._fontStyle(n[0]),lang:this.lang})}_fontStyle(t){return/italic/i.test(t)?"italic":/oblique/i.test(t)?"oblique":"normal"}_fontWeight(t){const n={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};let a;for(const[u,f]of Object.entries(n))new RegExp(`\\b${u}\\b`,"i").test(t)&&(a=`${f}`);return a}destroy(){for(const t in this.entries){const n=this.entries[t];n.tinySDF&&(n.tinySDF=null),n.ideographTinySDF&&(n.ideographTinySDF=null),n.glyphs={},n.requests={},n.ranges={}}this.entries={}}}oe.loadGlyphRange=function(p,t,n,a){return c._(this,void 0,void 0,(function*(){const u=256*t,f=u+255,y=yield a.transformRequest(n.replace("{fontstack}",p).replace("{range}",`${u}-${f}`),"Glyphs"),b=yield c.n(y,new AbortController);if(!b||!b.data)throw new Error(`Could not load glyph range. range: ${t}, ${u}-${f}`);const w={};for(const S of c.o(b.data))w[S.id]=S;return w}))},oe.TinySDF=class{constructor({fontSize:p=24,buffer:t=3,radius:n=8,cutoff:a=.25,fontFamily:u="sans-serif",fontWeight:f="normal",fontStyle:y="normal",lang:b=null}={}){this.buffer=t,this.cutoff=a,this.radius=n,this.lang=b;const w=this.size=p+4*t,S=this.ctx=this._createCanvas(w).getContext("2d",{willReadFrequently:!0});S.font=`${y} ${f} ${p}px ${u}`,S.textBaseline="alphabetic",S.textAlign="left",S.fillStyle="black",this.gridOuter=new Float64Array(w*w),this.gridInner=new Float64Array(w*w),this.f=new Float64Array(w),this.z=new Float64Array(w+1),this.v=new Uint16Array(w)}_createCanvas(p){const t=document.createElement("canvas");return t.width=t.height=p,t}draw(p){const{width:t,actualBoundingBoxAscent:n,actualBoundingBoxDescent:a,actualBoundingBoxLeft:u,actualBoundingBoxRight:f}=this.ctx.measureText(p),y=Math.ceil(n),b=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(f-u))),w=Math.min(this.size-this.buffer,y+Math.ceil(a)),S=b+2*this.buffer,P=w+2*this.buffer,C=Math.max(S*P,0),A=new Uint8ClampedArray(C),F={data:A,width:S,height:P,glyphWidth:b,glyphHeight:w,glyphTop:y,glyphLeft:0,glyphAdvance:t};if(b===0||w===0)return F;const{ctx:V,buffer:U,gridInner:q,gridOuter:G}=this;this.lang&&(V.lang=this.lang),V.clearRect(U,U,b,w),V.fillText(p,U,U+y);const Y=V.getImageData(U,U,b,w);G.fill(Tt,0,C),q.fill(0,0,C);for(let ee=0;ee<w;ee++)for(let X=0;X<b;X++){const Q=Y.data[4*(ee*b+X)+3]/255;if(Q===0)continue;const te=(ee+U)*S+X+U;if(Q===1)G[te]=0,q[te]=Tt;else{const K=.5-Q;G[te]=K>0?K*K:0,q[te]=K<0?K*K:0}}nt(G,0,0,S,P,S,this.f,this.v,this.z),nt(q,U,U,b,w,S,this.f,this.v,this.z);for(let ee=0;ee<C;ee++){const X=Math.sqrt(G[ee])-Math.sqrt(q[ee]);A[ee]=Math.round(255-255*(X/this.radius+this.cutoff))}return F}};class Ce{constructor(){this.specification=c.u.light.position}possiblyEvaluate(t,n){return c.F(t.expression.evaluate(n))}interpolate(t,n,a){return{x:c.G.number(t.x,n.x,a),y:c.G.number(t.y,n.y,a),z:c.G.number(t.z,n.z,a)}}}let Ue;class ct extends c.E{constructor(t){super(),Ue=Ue||new c.t({anchor:new c.D(c.u.light.anchor),position:new Ce,color:new c.D(c.u.light.color),intensity:new c.D(c.u.light.intensity)}),this._transitionable=new c.x(Ue,void 0),this.setLight(t),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n={}){if(!this._validate(c.y,t,n))for(const a in t){const u=t[a];a.endsWith(c.z)?this._transitionable.setTransition(a.slice(0,-c.z.length),u):this._transitionable.setValue(a,u)}}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,a){return(!a||a.validate!==!1)&&c.B(this,t.call(c.C,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.u}))}}const We=new c.t({"sky-color":new c.D(c.u.sky["sky-color"]),"horizon-color":new c.D(c.u.sky["horizon-color"]),"fog-color":new c.D(c.u.sky["fog-color"]),"fog-ground-blend":new c.D(c.u.sky["fog-ground-blend"]),"horizon-fog-blend":new c.D(c.u.sky["horizon-fog-blend"]),"sky-horizon-blend":new c.D(c.u.sky["sky-horizon-blend"]),"atmosphere-blend":new c.D(c.u.sky["atmosphere-blend"])});class ot extends c.E{constructor(t){super(),this._transitionable=new c.x(We,void 0),this.setSky(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new c.H(0))}setSky(t,n={}){if(!this._validate(c.J,t,n)){t||(t={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const a in t){const u=t[a];a.endsWith(c.z)?this._transitionable.setTransition(a.slice(0,-c.z.length),u):this._transitionable.setValue(a,u)}}}getSky(){return this._transitionable.serialize()}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,a={}){return a?.validate!==!1&&c.B(this,t.call(c.C,c.e({value:n,style:{glyphs:!0,sprite:!0},styleSpec:c.u})))}calculateFogBlendOpacity(t){return t<60?0:t<70?(t-60)/10:1}}class Ye{constructor(t,n){this.width=t,this.height=n,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,n){const a=t.join(",")+String(n);return this.dashEntry[a]||(this.dashEntry[a]=this.addDash(t,n)),this.dashEntry[a]}getDashRanges(t,n,a){const u=[];let f=t.length%2==1?-t[t.length-1]*a:0,y=t[0]*a,b=!0;u.push({left:f,right:y,isDash:b,zeroLength:t[0]===0});let w=t[0];for(let S=1;S<t.length;S++){b=!b;const P=t[S];f=w*a,w+=P,y=w*a,u.push({left:f,right:y,isDash:b,zeroLength:P===0})}return u}addRoundDash(t,n,a){const u=n/2;for(let f=-a;f<=a;f++){const y=this.width*(this.nextRow+a+f);let b=0,w=t[b];for(let S=0;S<this.width;S++){S/w.right>1&&(w=t[++b]);const P=Math.abs(S-w.left),C=Math.abs(S-w.right),A=Math.min(P,C);let F;const V=f/a*(u+1);if(w.isDash){const U=u-Math.abs(V);F=Math.sqrt(A*A+U*U)}else F=u-Math.sqrt(A*A+V*V);this.data[y+S]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(t){for(let b=t.length-1;b>=0;--b){const w=t[b],S=t[b+1];w.zeroLength?t.splice(b,1):S&&S.isDash===w.isDash&&(S.left=w.left,t.splice(b,1))}const n=t[0],a=t[t.length-1];n.isDash===a.isDash&&(n.left=a.left-this.width,a.right=n.right+this.width);const u=this.width*this.nextRow;let f=0,y=t[f];for(let b=0;b<this.width;b++){b/y.right>1&&(y=t[++f]);const w=Math.abs(b-y.left),S=Math.abs(b-y.right),P=Math.min(w,S);this.data[u+b]=Math.max(0,Math.min(255,(y.isDash?P:-P)+128))}}addDash(t,n){const a=n?7:0,u=2*a+1;if(this.nextRow+u>this.height)return c.w("LineAtlas out of space"),null;let f=0;for(let b=0;b<t.length;b++)f+=t[b];if(f!==0){const b=this.width/f,w=this.getDashRanges(t,this.width,b);n?this.addRoundDash(w,b,a):this.addRegularDash(w)}const y={y:this.nextRow+a,height:2*a,width:f};return this.nextRow+=u,this.dirty=!0,y}bind(t){const n=t.gl;this.texture?(n.bindTexture(n.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,n.texSubImage2D(n.TEXTURE_2D,0,0,0,this.width,this.height,n.ALPHA,n.UNSIGNED_BYTE,this.data))):(this.texture=n.createTexture(),n.bindTexture(n.TEXTURE_2D,this.texture),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.REPEAT),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.LINEAR),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR),n.texImage2D(n.TEXTURE_2D,0,n.ALPHA,this.width,this.height,0,n.ALPHA,n.UNSIGNED_BYTE,this.data))}}const Ge="maplibre_preloaded_worker_pool";class it{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<it.workerCount;)this.workers.push(new Worker(c.c.WORKER_URL));return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach((n=>{n.terminate()})),this.workers=null)}isPreloaded(){return!!this.active[Ge]}numActive(){return Object.keys(this.active).length}}const $t=Math.floor(Ee.hardwareConcurrency/2);let Kt,or;function rn(){return Kt||(Kt=new it),Kt}it.workerCount=c.K(globalThis)?Math.max(Math.min($t,3),1):1;class Is{constructor(t,n){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=n;const a=this.workerPool.acquire(n);for(let u=0;u<a.length;u++){const f=new c.L(a[u],n);f.name=`Worker ${u}`,this.actors.push(f)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,n){const a=[];for(const u of this.actors)a.push(u.sendAsync({type:t,data:n}));return Promise.all(a)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach((n=>{n.remove()})),this.actors=[],t&&this.workerPool.release(this.id)}registerMessageHandler(t,n){for(const a of this.actors)a.registerMessageHandler(t,n)}unregisterMessageHandler(t){for(const n of this.actors)n.unregisterMessageHandler(t)}}function Ri(){return or||(or=new Is(rn(),c.M),or.registerMessageHandler("GR",((p,t,n)=>c.m(t,n)))),or}function Ms(p,t){const n=c.N();return c.O(n,n,[1,1,0]),c.Q(n,n,[.5*p.width,.5*p.height,1]),p.calculatePosMatrix?c.S(n,n,p.calculatePosMatrix(t.toUnwrapped())):n}function Bi(p,t,n,a,u,f,y){var b;const w=(function(A,F,V){if(A)for(const U of A){const q=F[U];if(q&&q.source===V&&q.type==="fill-extrusion")return!0}else for(const U in F){const q=F[U];if(q.source===V&&q.type==="fill-extrusion")return!0}return!1})((b=u?.layers)!==null&&b!==void 0?b:null,t,p.id),S=f.maxPitchScaleFactor(),P=p.tilesIn(a,S,w);P.sort(Un);const C=[];for(const A of P)C.push({wrappedTileID:A.tileID.wrapped().key,queryResults:A.tile.queryRenderedFeatures(t,n,p.getState(),A.queryGeometry,A.cameraQueryGeometry,A.scale,u,f,S,Ms(f,A.tileID),y?(F,V)=>y(A.tileID,F,V):void 0)});return(function(A,F){for(const V in A)for(const U of A[V])$n(U,F);return A})((function(A){const F={},V={};for(const U of A){const q=U.queryResults,G=U.wrappedTileID,Y=V[G]=V[G]||{};for(const ee in q){const X=q[ee],Q=Y[ee]=Y[ee]||{},te=F[ee]=F[ee]||[];for(const K of X)Q[K.featureIndex]||(Q[K.featureIndex]=!0,te.push(K))}}return F})(C),p)}function Un(p,t){const n=p.tileID,a=t.tileID;return n.overscaledZ-a.overscaledZ||n.canonical.y-a.canonical.y||n.wrap-a.wrap||n.canonical.x-a.canonical.x}function $n(p,t){const n=p.feature,a=t.getFeatureState(n.layer["source-layer"],n.id);n.source=n.layer.source,n.layer["source-layer"]&&(n.sourceLayer=n.layer["source-layer"]),n.state=a}function Gn(p,t,n,a){return c._(this,void 0,void 0,(function*(){let u=p;if(p.url?u=(yield c.j(yield t.transformRequest(p.url,"Source"),n)).data:yield Ee.frameAsync(n,a),!u)return null;const f=c.U(c.e(u,p),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in u&&u.vector_layers&&(f.vectorLayerIds=u.vector_layers.map((y=>y.id))),f}))}class mt{constructor(t,n){t&&(n?this.setSouthWest(t).setNorthEast(n):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 c.V?new c.V(t.lng,t.lat):c.V.convert(t),this}setSouthWest(t){return this._sw=t instanceof c.V?new c.V(t.lng,t.lat):c.V.convert(t),this}extend(t){const n=this._sw,a=this._ne;let u,f;if(t instanceof c.V)u=t,f=t;else{if(!(t instanceof mt))return Array.isArray(t)?t.length===4||t.every(Array.isArray)?this.extend(mt.convert(t)):this.extend(c.V.convert(t)):t&&("lng"in t||"lon"in t)&&"lat"in t?this.extend(c.V.convert(t)):this;if(u=t._sw,f=t._ne,!u||!f)return this}return n||a?(n.lng=Math.min(u.lng,n.lng),n.lat=Math.min(u.lat,n.lat),a.lng=Math.max(f.lng,a.lng),a.lat=Math.max(f.lat,a.lat)):(this._sw=new c.V(u.lng,u.lat),this._ne=new c.V(f.lng,f.lat)),this}getCenter(){return new c.V((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}
2getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new c.V(this.getWest(),this.getNorth())}getSouthEast(){return new c.V(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){const{lng:n,lat:a}=c.V.convert(t);let u=this._sw.lng<=n&&n<=this._ne.lng;return this._sw.lng>this._ne.lng&&(u=this._sw.lng>=n&&n>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&u}intersects(t){if(!((t=mt.convert(t)).getNorth()>=this.getSouth()&&t.getSouth()<=this.getNorth()))return!1;const n=Math.abs(this.getEast()-this.getWest()),a=Math.abs(t.getEast()-t.getWest());if(n>=360||a>=360)return!0;const u=c.W(this.getWest(),-180,180),f=c.W(this.getEast(),-180,180),y=c.W(t.getWest(),-180,180),b=c.W(t.getEast(),-180,180),w=u>f,S=y>b;return!(!w||!S)||(w?b>=u||y<=f:S?f>=y||u<=b:y<=f&&b>=u)}static convert(t){return t instanceof mt?t:t&&new mt(t)}static fromLngLat(t,n=0){const a=360*n/40075017,u=a/Math.cos(Math.PI/180*t.lat);return new mt(new c.V(t.lng-u,t.lat-a),new c.V(t.lng+u,t.lat+a))}adjustAntiMeridian(){const t=new c.V(this._sw.lng,this._sw.lat),n=new c.V(this._ne.lng,this._ne.lat);return new mt(t,t.lng>n.lng?new c.V(n.lng+360,n.lat):n)}}class nn{constructor(t,n,a){this.bounds=mt.convert(this.validateBounds(t)),this.minzoom=n||0,this.maxzoom=a||24}
vendor: 2,393 bytes, line 2
2validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const n=Math.pow(2,t.z),a=Math.floor(c.Y(this.bounds.getWest())*n),u=Math.floor(c.X(this.bounds.getNorth())*n),f=Math.ceil(c.Y(this.bounds.getEast())*n),y=Math.ceil(c.X(this.bounds.getSouth())*n);return t.x>=a&&t.x<f&&t.y>=u&&t.y<y}}class et extends c.E{constructor(t,n,a,u){if(super(),this.id=t,this.dispatcher=a,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,c.e(this,c.U(n,["url","scheme","tileSize","promoteId","encoding"])),this._options=c.e({type:"vector"},n),this._collectResourceTiming=n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(u)}load(){return c._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield Gn(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(c.e(this,n),n.bounds&&(this.tileBounds=new nn(n.bounds,this.minzoom,this.maxzoom)),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,c.Z(n)||this.fire(new c.k(n))}}))}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.abort(),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return c.e({},this._options)}loadTile(t){return c._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a={request:yield this.map._requestManager.transformRequest(n,"Tile"),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
2ype,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity,encoding:this.encoding,overzoomParameters:yield this._getOverzoomParameters(t),etag:t.etag};a.request.collectResourceTiming=this._collectResourceTiming;let u="RT";if(t.actor&&t.state!=="expired"){if(t.state==="loading")return new Promise(((f,y)=>{t.reloadPromise={resolve:f,reject:y}}))}else t.actor=this.dispatcher.getActor(),u="LT";t.abortController=new AbortController;try{const f=yield t.actor.sendAsync({type:u,data:a},t.abortController);if(delete t.abortController,t.aborted)return;this._afterTileLoadWorkerResponse(t,f);const y={};return f!=null&&f.etagUnmodified&&(y.unmodified=!0),y}catch(f){if(delete t.abortController,t.aborted)return;if(f&&f.status!==404)throw f;this._afterTileLoadWorkerResponse(t,null)}}))}_getOverzoomParameters(t){return c._(this,void 0,void 0,(function*(){if(t.tileID.canonical.z<=this.maxzoom||this.map._zoomLevelsToOverscale===void 0)return;const n=t.tileID.scaledTo(this.maxzoom).canonical,a=n.url(this.tiles,this.map.getPixelRatio(),this.scheme);return{maxZoomTileID:n,overzoomRequest:yield this.map._requestManager.transformRequest(a,"Tile")}}))}_afterTileLoadWorkerResponse(t,n){if(n!=null&&n.resourceTiming&&(t.resourceTiming=n.resourceTiming),n&&this.map._refreshExpiredTiles&&t.setExpiryData(n),t.etag=n?.etag,t.loadVectorData(n,this.map.painter),t.reloadPromise){const a=t.reloadPromise;t.reloadPromise=null,this.loadTile(t).then(a.resolve).catch(a.reject)}}abortTile(t){return c._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.actor&&(yield t.actor.sendAsync({type:"AT",data:{uid:t.uid,type:this.t
2ype,source:this.id}}))}))}unloadTile(t){return c._(this,void 0,void 0,(function*(){t.unloadVectorData(),t.actor&&(yield t.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.type,source:this.id}}))}))}hasTransition(){return!1}}class Et extends c.E{constructor(t,n,a,u){super(),this.id=t,this.dispatcher=a,this.setEventedParent(u),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},n),c.e(this,c.U(n,["url","scheme","tileSize"]))}load(){return c._(this,arguments,void 0,(function*(t=!1){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const n=yield Gn(this._options,this.map._requestManager,this._tileJSONRequest,this.map._ownerWindow);this._tileJSONRequest=null,this._loaded=!0,n&&(c.e(this,n),n.bounds&&(this.tileBounds=new nn(n.bounds,this.minzoom,this.maxzoom)),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:t})))}catch(n){this._tileJSONRequest=null,this._loaded=!0,c.Z(n)||this.fire(new c.k(n))}}))}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(t){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),t(),this.load(!0)}setTiles(t){return this.setSourceProperty((()=>{this._options.tiles=t})),this}setUrl(t){return this.setSourceProperty((()=>{this.url=t,this._options.url=t})),this}serialize(){return c.e({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t){return c._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.abortController=new AbortController;try{const a=yield Be.getImage(yield this.map._requestManager.transformRequest(n,"Tile"),t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(a&&a.data){this.map._refreshExpiredTiles&&(a.cacheControl||a.expires)&&t.setExpiryData({cacheControl:a.cacheControl,expires:a.expires});const u=this.map.painter.context,f=u.gl,y=a.data;t.texture=this.map.painter.getTileTexture(y.width),t.texture?t.texture.update(y,{useMipmap:!0}):(t.texture=new c.T(u,y,f.RGBA,{useMipmap:!0}),t.texture.bind(f.LINEAR,f.CLAMP_TO_EDGE,f.LINEAR_MIPMAP_NEAREST)),t.state="loaded"}}catch(a){if(delete t.abortController,t.aborted)t.state="unloaded";else if(a)throw t.state="errored",a}}))}abortTile(t){return c._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController)}))}unloadTile(t){return c._(this,void 0,void 0,(function*(){t.texture&&this.map.painter.saveTileTexture(t.texture)}))}hasTransition(){return!1}}class _r extends Et{constructor(t,n,a,u){super(t,n,a,u),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},n),this.encoding=n.encoding||"mapbox",this.redFactor=n.redFactor,this.greenFactor=n.greenFactor,this.blueFactor=n.blueFactor,this.baseShift=n.baseShift}loadTile(t){return c._(this,void 0,void 0,(function*(){const n=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),a=yield this.map._requestManager.transformRequest(n,"Tile");t.neighboringTiles=this._getNeighboringTiles(t.tileID),t.abortController=new AbortController;try{const u=yield Be.getImage(a,t.abortController,this.map._refreshExpiredTiles);if(delete t.abortController,t.aborted)return void(t.state="unloaded");if(u&&u.data){const f=u.data;this.map._refreshExpiredTiles&&(u.cacheControl||u.expires)&&t.setExpiryData({cacheControl:u.cacheControl,expires:u.expires});const y=c.b(f)&&c.$()?f:yield this.readImageNow(f),b={type:this.type,uid:t.uid,source:this.id,rawImageData:y,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(t.actor&&t.state!=="expired"&&t.state!=="reloading")return;t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor()),t.dem=yield t.actor.sendAsync({type:"LDT",data:b}
2),t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded"}}catch(u){if(delete t.abortController,t.aborted)t.state="unloaded";else if(u)throw t.state="errored",u}}))}readImageNow(t){return c._(this,void 0,void 0,(function*(){if(typeof VideoFrame<"u"&&c.a0()){const n=t.width+2,a=t.height+2;try{return new c.R({width:n,height:a},yield c.a1(t,-1,-1,n,a))}catch{}}return Ee.getImageData(t,1)}))}_getNeighboringTiles(t){const n=t.canonical,a=Math.pow(2,n.z),u=(n.x-1+a)%a,f=n.x===0?t.wrap-1:t.wrap,y=(n.x+1+a)%a,b=n.x+1===a?t.wrap+1:t.wrap,w={};return w[new c.a2(t.overscaledZ,f,n.z,u,n.y).key]={backfilled:!1},w[new c.a2(t.overscaledZ,b,n.z,y,n.y).key]={backfilled:!1},n.y>0&&(w[new c.a2(t.overscaledZ,f,n.z,u,n.y-1).key]={backfilled:!1},w[new c.a2(t.overscaledZ,t.wrap,n.z,n.x,n.y-1).key]={backfilled:!1},w[new c.a2(t.overscaledZ,b,n.z,y,n.y-1).key]={backfilled:!1}),n.y+1<a&&(w[new c.a2(t.overscaledZ,f,n.z,u,n.y+1).key]={backfilled:!1},w[new c.a2(t.overscaledZ,t.wrap,n.z,n.x,n.y+1).key]={backfilled:!1},w[new c.a2(t.overscaledZ,b,n.z,y,n.y+1).key]={backfilled:!1}),w}unloadTile(t){return c._(this,void 0,void 0,(function*(){t.demTexture&&this.map.painter.saveTileTexture(t.demTexture),t.fbo&&(t.fbo.destroy(),delete t.fbo),t.dem&&delete t.dem,delete t.neighboringTiles,t.state="unloaded",t.actor&&(yield t.actor.sendAsync({type:"RDT",data:{type:this.type,uid:t.uid,source:this.id}}))}))}}function Ur(p,t){return t?p.properties[t]:p.id}function Oi(p,t){const n={id:p.id};if(t.removeAllProperties&&(delete p.removeProperties,delete p.addOrUpdateProperties,delete t.removeProperties),t.removeProperties)for(const a of t.removeProperties){const u=p.addOrUpdateProperties.findIndex((f=>f.key===a));u>-1&&p.addOrUpdateProperties.splice(u,1)}return(p.removeAllProperties||t.removeAllProperties)&&(n.removeAllProperties=!0),(p.removeProperties||t.removeProperties)&&(n.removeProperties=[...p.removeProperties||[],...t.removeProperties||[]]),(p.addOrUpdateProperties||t.addOrUpdateProperties)&&(n.addOrUpdateProperties=[...p.addOrUpdateProperties||[],...t.addOrUpdateProperties||[]]),(p.newGeometry||t.newGeometry)&&(n.newGeometry=t.newGeometry||p.newGeometry),n}function Xi(p){var t,n;if(!p)return{};const a={};return a.removeAll=p.removeAll,a.remove=new Set(p.remove||[]),a.add=new Map((t=p.add)===null||t===void 0?void 0:t.map((u=>[u.id,u]))),a.update=new Map((n=p.update)===null||n===void 0?void 0:n.map((u=>[u.id,u]))),a}function sn(p){return p&&p.length!==0?typeof p[0]=="number"?[p]:p.flatMap((t=>sn(t))):[]}function $r(p){return p.type==="GeometryCollection"?p.geometries.flatMap((t=>$r(t))):sn(p.coordinates)}function qn(p){const t=new mt;let n;switch(p.type){case"FeatureCollection":n=p.features.flatMap((a=>$r(a.geometry)));break;case"Feature":n=$r(p.geometry);break;default:n=$r(p)}if(n.length===0)return t;for(let a=0;a<n.length;a++){const[u,f]=n[a];t.extend([u,f])}return t}class So extends c.E{constructor(t,n,a,u){super(),this.id=t,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:n.data},this.actor=a.getActor(),this.setEventedParent(u),this._data=typeof n.data=="str
2ing"?{url:n.data}:{geojson:n.data},this._options=c.e({},n),this._collectResourceTiming=n.collectResourceTiming,n.maxzoom!==void 0&&(this.maxzoom=n.maxzoom),n.type&&(this.type=n.type),n.attribution&&(this.attribution=n.attribution),this.promoteId=n.promoteId,n.clusterMaxZoom!==void 0&&this.maxzoom<=n.clusterMaxZoom&&c.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${n.clusterMaxZoom}".`),this.workerOptions=c.e({source:this.id,geojsonVtOptions:{buffer:this._pixelsToTileUnits(n.buffer!==void 0?n.buffer:128),tolerance:this._pixelsToTileUnits(n.tolerance!==void 0?n.tolerance:.375),extent:c.a5,maxZoom:this.maxzoom,lineMetrics:n.lineMetrics||!1,generateId:n.generateId||!1,promoteId:typeof n.promoteId=="string"?n.promoteId:void 0,cluster:n.cluster||!1,clusterOptions:{maxZoom:this._getClusterMaxZoom(n.clusterMaxZoom),minPoints:Math.max(2,n.clusterMinPoints||2),extent:c.a5,radius:this._pixelsToTileUnits(n.clusterRadius||50),log:!1,generateId:n.generateId||!1}},clusterProperties:n.clusterProperties,filter:n.filter},n.workerOptions)}_hasPendingWorkerUpdate(){return this._pendingWorkerUpdate.data!==void 0||this._pendingWorkerUpdate.diff!==void 0||this._pendingWorkerUpdate.updateCluster}_pixelsToTileUnits(t){return t*(c.a5/this.tileSize)}_getClusterMaxZoom(t){const n=t?Math.round(t):this.maxzoom-1;return Number.isInteger(t)||t===void 0||c.w(`Integer expected for option 'clusterMaxZoom': provided value "${t}" rounded to "${n}"`),n}load(){return c._(this,void 0,void 0,(function*(){yield this._updateWorkerData()}))}onAdd(t){this.map=t,this.load()}setData(t,n){this._data=typeof t=="string"?{url:t}:{geojson:t},this._pendingWorkerUpdate={data:t};const a=this._updateWorkerData();return n?a:this}updateData(t,n){this._pendingWorkerUpdate.diff=(function(u,f){if(!u)return f||{};if(!f)return u||{};const y=Xi(u),b=Xi(f);(function(S,P){P.removeAll&&(S.add.clear(),S.update.clear(),S.remove.clear(),P.remove.clear());for(const C of P.remove)S.add.delete(C),S.update.delete(C);for(const[C,A]of P.update){const F=S.update.get(C);F&&(P.update.set(C,Oi(F,A)),S.update.delete(C))}})(y,b);const w={};if((y.removeAll||b.removeAll)&&(w.removeAll=!0),w.remove=new Set([...y.remove,...b.remove]),w.add=new Map([...y.add,...b.add]),w.update=new Map([...y.update,...b.update]),w.remove.size&&w.add.size)for(const S of w.add.keys())w.remove.delete(S);return(function(S){const P={};return S.removeAll&&(P.removeAll=S.removeAll),S.remove&&(P.remove=Array.from(S.remove)),S.add&&(P.add=Array.from(S.add.values())),S.update&&(P.update=Array.from(S.update.values())
2),P})(w)})(this._pendingWorkerUpdate.diff,t);const a=this._updateWorkerData();return n?a:this}getData(){return c._(this,void 0,void 0,(function*(){return this._data.url&&(yield this.once("data")),this._data.geojson?this._data.geojson:{type:"FeatureCollection",features:Array.from(this._data.updateable.values())}}))}getBounds(){return c._(this,void 0,void 0,(function*(){return qn(yield this.getData())}))}setClusterOptions(t){return this.workerOptions.geojsonVtOptions.cluster=t.cluster,t.clusterRadius!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.radius=this._pixelsToTileUnits(t.clusterRadius)),t.clusterMaxZoom!==void 0&&(this.workerOptions.geojsonVtOptions.clusterOptions.maxZoom=this._getClusterMaxZoom(t.clusterMaxZoom)),this._pendingWorkerUpdate.updateCluster=!0,this._updateWorkerData(),this}getClusterExpansionZoom(t){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:t,source:this.id}})}getClusterChildren(t){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:t,source:this.id}})}getClusterLeaves(t,n,a){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:t,limit:n,offset:a}})}_updateWorkerData(){return c._(this,void 0,void 0,(function*(){if(this._isUpdatingWorker)return;if(!this._hasPendingWorkerUpdate())return void c.w(`No pending worker updates for GeoJSONSource ${this.id}.`);const{data:t,diff:n,updateCluster:a}=this._pendingWorkerUpdate,u=this._getLoadGeoJSONParameters(t,n,a);t!==void 0?this._pendingWorkerUpdate.data=void 0:n?this._pendingWorkerUpdate.diff=void 0:a&&(this._pendingWorkerUpdate.updateCluster=void 0),yield this._dispatchWorkerUpdate(u)}))}_getLoadGeoJSONParameters(t,n,a){return c._(this,void 0,void 0,(function*(){const u=c.e({type:this.type},this.workerOptions);return typeof t=="string"?(u.request=yield this.map._requestManager.transformRequest(Ee.resolveURL(t),"Source"),u.request.collectResourceTiming=this._collectResourceTiming,u):t!==void 0?(u.data=t,u):n?(u.dataDiff=n,u):a?(u.updateCluster=!0,u):void 0}))}_dispatchWorkerUpdate(t){return c._(this,void 0,void 0,(function*(){this._isUpdatingWorker=!0,this.fire(new c.l("dataloading",{dataType:"source"}));try{const n=yield t,a=yield this.actor.sendAsync({type:"LD",data:n});if(this._isUpdatingWorker=!1,this._removed||a.abandoned)return void this.fire(new c.l("dataabort",{dataType:"source"}));a.data&&(this._data={geojson:a.data});const u=this._applyDiffToSource(n.dataDiff),f=this._getShouldReloadTileOptions(u),y={dataType:"source"};this._applyResourceTiming(y,a),this.fire(new c.l("data",Object.assign(Object.assign({},y),{sourceDataType:"metadata"}))),this.fire(new c.l("data",Object.assign(Object.assign({},y),{sourceDataType:"content",shouldReloadTileOptions:f})))}catch(n){if(this._isUpdatingWorker=!1,this._removed)return void this.fire(new c.l("dataabort",{dataType:"source"}));this.fire(new c.k(n))}finally{this._hasPendingWorkerUpdate()&&this._updateWorkerData()}}))}_applyResourceTiming(t,n){var a;if(!this._collectResourceTiming)return;const u=(a=n.resourceTiming)===null||a===void 0?void 0:a[this.id];if(!u)return;const f=u.slice(0);f!=null&&f.length&&c.e(t,{resourceTiming:f})}_applyDiffToSource(t){if(!t)return;const n=typeof this.promoteId=="string"?this.promoteId:void 0;if(!this._data.url&&!this._data.updateable){const u=(function(f,y){const b=new Map;if(f==null||f.type==null)return b;if(f.type==="Feature"){const w=Ur(f,y);return w==null?void 0:(b.set(w,f),b)}if(f.type==="FeatureCollection"){const w=new Set;for(const S of f.features){const P=Ur(S,y);if(P==null||w.has(P))return;w.add(P),b.set(P,S)}return b}})(this._data.geojson,n);if(!u)throw new Error(`GeoJSONSource "${this.id}": GeoJSON data is not compatible with updateData`);this._data={updateable:u}}if(!this._data.updateable)return;const a=(function(u,f,y){var b,w;const S=[];if(f.removeAll)u.clear();else if(f.remove)for(const P of f.remove){const C=u.get(P);C&&(S.push(C.geometry),u.delete(P))}if(f.add)for(const P of f.add){const C=Ur(P,y);if(C==null)continue;const A=u.get(C);A&&S.push(A.geometry),S.push(P.geometry),u.set(C,P)}
2if(f.update)for(const P of f.update){const C=u.get(P.id);if(!C)continue;const A=!!P.newGeometry,F=P.removeAllProperties||((b=P.removeProperties)===null||b===void 0?void 0:b.length)>0||((w=P.addOrUpdateProperties)===null||w===void 0?void 0:w.length)>0;if(!A&&!F)continue;S.push(C.geometry);const V=Object.assign({},C);if(u.set(P.id,V),A&&(S.push(P.newGeometry),V.geometry=P.newGeometry),F){if(V.properties=P.removeAllProperties?{}:Object.assign({},V.properties||{}),P.removeProperties)for(const U of P.removeProperties)delete V.properties[U];if(P.addOrUpdateProperties)for(const{key:U,value:q}of P.addOrUpdateProperties)V.properties[U]=q}}return S})(this._data.updateable,t,n);return t.removeAll||this._options.cluster?void 0:a}_getShouldReloadTileOptions(t){if(t)return{affectedBounds:t.filter(Boolean).map((n=>qn(n)))}}shouldReloadTile(t,{affectedBounds:n}){if(t.state==="loading")return!0;if(t.state==="unloaded")return!1;const{buffer:a,extent:u}=this.workerOptions.geojsonVtOptions,f=(function({x:y,y:b,z:w},S=0){const P=c.a3((y-S)/Math.pow(2,w)),C=c.a4((b+1+S)/Math.pow(2,w)),A=c.a3((y+1+S)/Math.pow(2,w)),F=c.a4((b-S)/Math.pow(2,w));return new mt([P,C],[A,F])})(t.tileID.canonical,a/u);for(const y of n)if(f.intersects(y))return!0;return!1}loaded(){return!this._isUpdatingWorker&&!this._hasPendingWorkerUpdate()}loadTile(t){return c._(this,void 0,void 0,(function*(){const n=t.actor?"RT":"LT";t.actor=this.actor;const a={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.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};t.abortController=new AbortController;const u=yield this.actor.sendAsync({type:n,data:a},t.abortController);delete t.abortController,t.unloadVectorData(),t.aborted||t.loadVectorData(u,this.map.painter,n==="RT")}))}abortTile(t){return c._(this,void 0,void 0,(function*(){t.abortController&&(t.abortController.abort(),delete t.abortController),t.aborted=!0}))}unloadTile(t){return c._(this,void 0,void 0,(function*(){t.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:t.uid,type:this.t
2ype,source:this.id}})}))}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return c.e({},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}}class Gr extends c.E{constructor(t,n,a,u){super(),this.flippedWindingOrder=!1,this.id=t,this.dispatcher=a,this.coordinates=n.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(u),this.options=n}load(t){return c._(this,void 0,void 0,(function*(){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const n=yield Be.getImage(yield this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,n&&n.data&&(this.image=n.data,t&&(this.coordinates=t),this._finishLoading())}catch(n){this._request=null,this._loaded=!0,c.Z(n)||this.fire(new c.k(n))}}))}loaded(){return this._loaded}updateImage(t){return t.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=t.url,this.load(t.coordinates).finally((()=>{this.texture=null})),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(t){this.coordinates=t;const n=t.map(c.a6.fromLngLat);var a;return this.tileID=(function(u){const f=c.a7.fromPoints(u),y=f.width(),b=f.height(),w=Math.max(0,Math.floor(-Math.log(Math.max(y,b))/Math.LN2)),S=Math.pow(2,w);return new c.a9(w,Math.floor((f.minX+f.maxX)/2*S),Math.floor((f.minY+f.maxY)/2*S))})(n),this.terrainTileRanges=this._getOverlappingTileRanges(n),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=n.map((u=>this.tileID.getTilePoint(u)._round())),this.flippedWindingOrder=((a=this.tileCoords)[1].x-a[0].x)*(a[2].y-a[0].y)-(a[1].y-a[0].y)*(a[2].x-a[0].x)<0,this.fire(new c.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,n=t.gl;this.texture||(this.texture=new c.T(t,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const u in this.tiles){const f=this.tiles[u];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,a=!0)}a&&this.fire(new c.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(t){return c._(this,void 0,void 0,(function*(){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={}):t.state="errored"}))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(t){const{minX:n,minY:a,maxX:u,maxY:f}=c.a7.fromPoints(t),y={};for(let b=0;b<=c.a8;b++){const w=Math.pow(2,b),S=Math.floor(n*w),P=Math.floor(a*w),C=Math.floor(u*w),A=Math.floor(f*w),F=(S%w+w)%w,V=C%w;y[b]={minWrap:Math.floor(S/w),maxWrap:Math.floor(C/w),minTileXWrapped:F,maxTileXWrapped:V,minTileY:P,maxTileY:A}}return y}}class on extends Gr{constructor(t,n,a,u){super(t,n,a,u),this._onPlayingHandler=()=>{var f;(f=this.map)===null||f===void 0||f.triggerRepaint()},this.roundZoom=!0,this.type="video",this.options=n}load(){return c._(this,void 0,void 0,(function*(){this._loaded=!1;const t=this.options;this.urls=[];for(const n of t.urls)this.urls.push((yield this.map._requestManager.transformRequest(n,"Source")).url);try{const n=yield c.aa(this.urls);if(this._loaded=!0,!n)return;this.video=n,this.video.loop=!0,this.video.addEventListener("playing",this._onPlayingHandler),this.map&&this.video.play(),this._finishLoading()}catch(n){this.fire(new c.k(n))}}))}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const n=this.video.seekable;t<n.start(0)||t>n.end(0)?this.fire(new c.k(new c.ab(`sources.${this.id}`,null,`Playback for this video can be set only between the ${n.start(0)} and ${n.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}
vendor: 4,361 bytes, line 2
2onAdd(t){this.map||(this.map=t,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;const t=this.map.painter.context,n=t.gl;this.texture?this.video.paused||(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.video)):(this.texture=new c.T(t,this.video,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE));let a=!1;for(const u in this.tiles){const f=this.tiles[u];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,a=!0)}a&&this.fire(new c.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ga extends Gr{constructor(t,n,a,u){super(t,n,a,u),n.coordinates?Array.isArray(n.coordinates)&&n.coordinates.length===4&&!n.coordinates.some((f=>!Array.isArray(f)||f.length!==2||f.some((y=>typeof y!="number"))))||this.fire(new c.k(new c.ab(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.k(new c.ab(`sources.${t}`,null,'missing required property "coordinates"'))),n.animate&&typeof n.animate!="boolean"&&this.fire(new c.k(new c.ab(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),n.canvas?typeof n.canvas=="string"||n.canvas instanceof HTMLCanvasElement||this.fire(new c.k(new c.ab(`sources.${t}`,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 c.k(new c.ab(`sources.${t}`,null,'missing required property "canvas"'))),this.options=n,this.animate=n.animate===void 0||n.animate}load(){return c._(this,void 0,void 0,(function*(){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 c.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}))}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const n=this.map.painter.context,a=n.gl;this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):(this.texture=new c.T(n,this.canvas,a.RGBA,{premultiply:!0}),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE));let u=!1;for(const f in this.tiles){const y=this.tiles[f];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture,u=!0)}u&&this.fire(new c.l("data",{dataType:"source",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(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const qa={},Po=p=>{switch(p){case"geojson":return So;case"image":return Gr;case"raster":return Et;case"raster-dem":return _r;case"vector":return et;case"video":return on;case"canvas":return Ga}return qa[p]},Es="RTLPluginLoaded";class pc extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Ri()}_syncState(t){return this.status=t,this.dispatcher.broadcast("SRPS",{pluginStatus:t,pluginURL:this.url}).catch((n=>{throw this.status="error",n}))}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(t){return c._(this,arguments,void 0,(function*(n,a=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=Ee.resolveURL(n),!this.url)throw new Error(`requested url ${n}
2 is invalid`);if(this.status==="unavailable"){if(!a)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()}))}_requestImport(){return c._(this,void 0,void 0,(function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.l(Es))}))}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Io=null;function qr(){return Io||(Io=new pc),Io}var Er,Yi;(function(p){p[p.Base=0]="Base",p[p.Parent=1]="Parent"})(Er||(Er={})),(function(p){p[p.Departing=0]="Departing",p[p.Incoming=1]="Incoming"})(Yi||(Yi={}));class Zn{constructor(t,n){this.timeAdded=0,this.fadeEndTime=0,this.fadeOpacity=1,this.tileID=t,this.uid=c.ac(),this.uses=0,this.tileSize=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttFingerprint={},this.expiredRequestCount=0,this.state="loading"}isRenderable(t){return this.hasData()&&(!this.fadeEndTime||this.fadeOpacity>0)&&(t||!this.holdingForSymbolFade())}setCrossFadeLogic({fadingRole:t,fadingDirection:n,fadingParentID:a,fadeEndTime:u}){this.resetFadeLogic(),this.fadingRole=t,this.fadingDirection=n,this.fadingParentID=a,this.fadeEndTime=u}setSelfFadeLogic(t){this.resetFadeLogic(),this.selfFading=!0,this.fadeEndTime=t}resetFadeLogic(){this.fadingRole=null,this.fadingDirection=null,this.fadingParentID=null,this.selfFading=!1,this.timeAdded=be(),this.fadeEndTime=0,this.fadeOpacity=1}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,n,a){if(t?.etagUnmodified!==!0)if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestEncoding=t.encoding,this.latestFeatureIndex.rawTileData=t.rawTileData,this.latestFeatureIndex.encoding=t.encoding):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData,this.latestFeatureIndex.encoding=this.latestEncoding)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=(function(u,f){const y={};if(!f)return y;for(const b of u){const w=b.layerIds.map((S=>f.getLayer(S))).filter(Boolean);if(w.length!==0){b.layers=w,b.stateDependentLayerIds&&(b.stateDependentLayers=b.stateDependentLayerIds.map((S=>w.filter((P=>P.id===S))[0])));for(const S of w)y[S.id]=b}}return y})(t.buckets,n?.style),this.hasSymbolBuckets=!1;for(const u in this.buckets){const f=this.buckets[u];if(f instanceof c.ae){if(this.hasSymbolBuckets=!0,!a)break;f.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const u in this.buckets){const f=this.buckets[u];if(f instanceof c.ae&&f.hasRTLText){this.hasRTLText=!0,qr().lazyLoad();break}}this.queryPadding=0;for(const u in this.buckets){const f=this.buckets[u];this.queryPadding=Math.max(this.queryPadding,n.style.getLayer(u).queryRadius(f))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),this.dashPositions=t.dashPositions}else this.collisionBoxArray=new c.ad;else this.state="loaded"}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.dashPositions&&(this.dashPositions=null),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const a in this.buckets){const u=this.buckets[a];u.uploadPending()&&u.upload(t)}const n=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new c.T(t,this.imageAtlas.image,n.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new c.T(t,this.glyphAtlasImage,n.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,n,a,u,f,y,b,w,S,P,C){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:u,cameraQueryGeometry:f,scale:y,tileSize:this.tileSize,pixelPosMatrix:P,transform:w,params:b,queryPadding:this.queryPadding*S,getElevation:C},t,n,a):{}}
vendor: 4,831 bytes, line 2
2querySourceFeatures(t,n){const a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;const u=a.loadVTLayers(),f=n&&n.sourceLayer?n.sourceLayer:"",y=u[c.af]||u[f];if(!y)return;const b=c.ag(n?.filter,n?.globalState),{z:w,x:S,y:P}=this.tileID.canonical,C={z:w,x:S,y:P};for(let A=0;A<y.length;A++){const F=y.feature(A);if(b.needGeometry){const q=c.ah(F,!0);if(!b.filter(new c.H(this.tileID.overscaledZ),q,this.tileID.canonical))continue}else if(!b.filter(new c.H(this.tileID.overscaledZ),F))continue;const V=a.getId(F,f),U=new c.ai(F,w,S,P,V);U.tile=C,t.push(U)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const a=c.aj(t.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const a=Date.now();let u=!1;if(this.expirationTime>a)u=!1;else if(n)if(this.expirationTime<n)u=!0;else{const f=this.expirationTime-n;f?this.expirationTime=a+Math.max(f,3e4):u=!0}else u=!0;u?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;const a=this.latestFeatureIndex.loadVTLayers();for(const u in this.buckets){if(!n.style.hasLayer(u))continue;const f=this.buckets[u],y=f.layers[0].sourceLayer||c.af,b=a[y],w=t[y];if(!b||!w||Object.keys(w).length===0)continue;f.update(w,b,this.imageAtlas&&this.imageAtlas.patternPositions||{},this.dashPositions||{});const S=n&&n.style&&n.style.getLayer(u);S&&(this.queryPadding=Math.max(this.queryPadding,S.queryRadius(f)))}}holdingForSymbolFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<be()}clearSymbolFadeHold(){this.symbolFadeHoldUntil=void 0}setSymbolHoldDuration(t){this.symbolFadeHoldUntil=be()+t}setDependencies(t,n){const a={};for(const u of n)a[u]=!0;this.dependencies[t]=a}hasDependency(t,n){for(const a of t){const u=this.dependencies[a];if(u){for(const f of n)if(u[f])return!0}}return!1}}class Za{constructor(){this.state={},this.stateChanges={},this.deletedStates={},this.revision=0}updateState(t,n,a){const u=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][u]=this.stateChanges[t][u]||{},c.e(this.stateChanges[t][u],a),this.deletedStates[t]===null){this.deletedStates[t]={};for(const f in this.state[t])f!==u&&(this.deletedStates[t][f]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][u]===null){this.deletedStates[t][u]={};for(const f in this.state[t][u])a[f]||(this.deletedStates[t][u][f]=null)}else for(const f in a)this.deletedStates[t]&&this.deletedStates[t][u]&&this.deletedStates[t][u][f]===null&&delete this.deletedStates[t][u][f]}removeFeatureState(t,n,a){if(this.deletedStates[t]===null)return;const u=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},a&&n!==void 0)this.deletedStates[t][u]!==null&&(this.deletedStates[t][u]=this.deletedStates[t][u]||{},this.deletedStates[t][u][a]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][u])for(a in this.deletedStates[t][u]={},this.stateChanges[t][u])this.deletedStates[t][u][a]=null;else this.deletedStates[t][u]=null;else this.deletedStates[t]=null}getState(t,n){const a=String(n),u=c.e({},(this.state[t]||{})[a],(this.stateChanges[t]||{})[a]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const f=this.deletedStates[t][n];if(f===null)return{};for(const y in f)delete u[y]}return u}initializeTileState(t,n){t.setFeatureState(this.state,n)}coalesceChanges(t,n){const a={};for(const u in this.stateChanges){this.state[u]=this.state[u]||{};const f={};for(const y in this.stateChanges[u])this.state[u][y]||(this.state[u][y]={}),c.e(this.state[u][y],this.stateChanges[u][y]),f[y]=this.state[u][y];a[u]=f}for(const u in this.deletedStates){this.state[u]=this.state[u]||{};const f={};if(this.deletedStates[u]===null)for(const y in this.state[u])f[y]={},this.state[u][y]={};else for(const y in this.deletedStates[u]){if(this.deletedStates[u][y]===null)this.state[u][y]={};else for(const b of Object.keys(this.deletedStates[u][y]))delete this.state[u][y][b];f[y]=this.state[u][y]}a[u]=a[u]||{},c.e(a[u],f)}this.stateChanges={},this.deletedStates={},Object.keys(a).length!==0&&(this.revision++,t.setFeatureState(a,n))}}const an=89.25;function ar(p,t){const n=c.ak(t.lat,-c.al,c.al);return new c.P(c.Y(t.lng)*p,c.X(n)*p)}
2function Wn(p,t){return new c.a6(t.x/p,t.y/p).toLngLat()}function ln(p){return p.cameraToCenterDistance*Math.min(.85*Math.tan(c.am(90-p.pitch)),Math.tan(c.am(an-p.pitch)))}function Cs(p,t){const n=p.canonical,a=t/c.an(n.z),u=n.x+Math.pow(2,n.z)*p.wrap,f=c.ao(new Float64Array(16));return c.O(f,f,[u*a,n.y*a,0]),c.Q(f,f,[a/c.a5,a/c.a5,1]),f}function Hn(p,t,n,a,u){const f=c.a6.fromLngLat(p,t),y=u*c.ap(1,p.lat),{x:b,y:w,z:S}=Mo(n,a);return new c.a6(f.x+y*-b,f.y+y*-w,f.z+y*-S)}function Mo(p,t){const n=c.am(p),a=c.am(t),u=Math.cos(-n),f=Math.sin(n);return{x:f*Math.sin(a),y:-f*Math.cos(a),z:u}}function ve(p,t,n){const a=t.intersectsFrustum(p);if(!n||a===0)return a;const u=t.intersectsPlane(n);return u===0?0:a===2&&u===2?2:1}function Wa(p,t,n){let a=0;const u=(n-t)/10;for(let f=0;f<10;f++)a+=u*Math.pow(Math.cos(t+(f+.5)/10*(n-t)),p);return a}function Ha(p,t){return function(n,a,u,f,y){const b=2*((p-1)/c.aq(Math.cos(c.am(an-y))/Math.cos(c.am(an)))-1),w=Math.acos(u/f),S=2*Wa(b-1,0,c.am(y/2)),P=Math.min(c.am(an),w+c.am(y/2)),C=Wa(b-1,Math.min(P,w-c.am(y/2)),P),A=Math.atan(a/u),F=Math.hypot(a,u);let V=n;return V+=c.aq(f/F/Math.max(.5,Math.cos(c.am(y/2)))),V+=b*c.aq(Math.cos(A))/2,V-=c.aq(Math.max(1,C/S/t))/2,V}}const gt=Ha(9.314,3);function Di(p,t){const n=(t.roundZoom?Math.round:Math.floor)(p.zoom+c.aq(p.tileSize/t.tileSize));return Math.max(0,n)}function cn(p,t){const n=p.getCameraFrustum(),a=p.getClippingPlane(),u=p.screenPointToMercatorCoordinate(p.getCameraPoint()),f=c.a6.fromLngLat(p.center,p.elevation);u.z=f.z+Math.cos(p.pitchInRadians)*p.cameraToCenterDistance/p.worldSize;const y=p.getCoveringTilesDetailsProvider(),b=y.allowVariableZoom(p,t),w=Di(p,t),S=t.minzoom||0,P=t.maxzoom!==void 0?t.maxzoom:p.maxZoom,C=Math.min(Math.max(0,w),P),A=Math.pow(2,C),F=[A*u.x,A*u.y,0],V=[A*f.x,A*f.y,0],U=Math.hypot(f.x-u.x,f.y-u.y),q=Math.abs(f.z-u.z),G=Math.hypot(U,q),Y=Q=>({zoom:0,x:0,y:0,wrap:Q,fullyVisible:!1}),ee=[],X=[];if(p.renderWorldCopies&&y.allowWorldCopies())for(let Q=1;Q<=3;Q++)ee.push(Y(-Q)),ee.push(Y(Q));for(ee.push(Y(0));ee.length>0;){const Q=ee.pop(),te=Q.x,K=Q.y;let se=Q.fullyVisible;const me={x:te,y:K,z:Q.zoom},pe=y.getTileBoundingVolume(me,Q.wrap,p.elevation,t);if(!se){const Se=ve(n,pe,a);if(Se===0)continue;se=Se===2}const ce=y.distanceToTile2d(u.x,u.y,me,pe);let fe=w;b&&(fe=(t.calculateTileZoom||gt)(p.zoom+c.aq(p.tileSize/t.tileSize),ce,q,G,p.fov)),fe=(t.roundZoom?Math.round:Math.floor)(fe),fe=Math.max(0,fe);const Te=Math.min(fe,P);if(Q.wrap=y.getWrap(f,me,Q.wrap),Q.zoom>=Te){if(Q.zoom<S)continue;const Se=C-Q.zoom,we=F[0]-.5-(te<<Se),Oe=F[1]-.5-(K<<Se),je=t.reparseOverscaled?Math.max(Q.zoom,fe):Q.zoom;X.push({tileID:new c.a2(Q.zoom===P?je:Q.zoom,Q.wrap,Q.zoom,te,K),distanceSq:c.ar([V[0]-.5-te,V[1]-.5-K]),tileDistanceToCamera:Math.sqrt(we*we+Oe*Oe)})}else for(let Se=0;Se<4;Se++)ee.push({zoom:Q.zoom+1,x:(te<<1)+Se%2,y:(K<<1)+(Se>>1),wrap:Q.wrap,fullyVisible:se})}return X.sort(((Q,te)=>Q.distanceSq-te.distanceSq)).map((Q=>Q.tileID))}const fc=c.a7.fromPoints([new c.P(0,0),new c.P(c.a5,c.a5)]);function mc(p){return p==="raster"||p==="image"||p==="video"}function Ku(p,t,n,a,u,f,y){if(!t.hasData())return!1;const{tileID:b,fadingRole:w,fadingDirection:S,fadingParentID:P}=t;if(w===Er.Base&&S===Yi.Incoming&&P)return n[P.key]=P,!0;const C=Math.max(b.overscaledZ-u,f);for(let A=b.overscaledZ-1;A>=C;A--){const F=b.scaledTo(A),V=p.getLoadedTile(F);if(V)return t.setCrossFadeLogic({fadingRole:Er.Base,fadingDirection:Yi.Incoming,fadingParentID:V.tileID,fadeEndTime:a+y}),V.setCrossFadeLogic({fadingRole:Er.Parent,fadingDirection:Yi.Departing,fadeEndTime:a+y}),n[F.key]=F,!0}return!1}function Eo(p,t,n,a,u,f){if(!t.hasData())return!1;const y=t.tileID.children(u);let b=Xa(p,t,y,n,a,u,f);if(b)return!0;for(const w of y)Xa(p,t,w.children(u),n,a,u,f)&&(b=!0);return b}function Xa(p,t,n,a,u,f,y){if(n[0].overscaledZ>=f)return!1;let b=!1;for(const w of n){const S=p.getLoadedTile(w);if(!S)continue;const{fadingRole:P,fadingDirection:C,fadingParentID:A}=S;P===Er.Base&&C===Yi.Departing&&A||(S.setCrossFadeLogic({fadingRole:Er.Base,fadingDirection:Yi.Departing,fadingParentID:t.tileID,fadeEndTime:u+y}),t.setCrossFadeLogic({fadingRole:Er.Parent,fadingDirection:Yi.Incoming,fadeEndTime:u+y})),a[w.key]=w,b=!0}return b}function gc(p,t,n,a){const u=p.tileID;return!!p.selfFading||!p.hasData()&&!!t.has(u)&&(p.setSelfFadeLogic(n+a),!0)}function Me(p,t){var n;p.needsHillshadePrepare=!0,p.needsTerrainPrepare=!0;let a=t.tileID.canonical.x-p.tileID.canonical.x;const u=t.tileID.canonical.y-p.tileID.canonical.y,f=Math.pow(2,p.tileID.canonical.z),y=t.tileID.key;a===0&&u===0||Math.abs(u)>1||(Math.abs(a)>1&&(Math.abs(a+f)===1?a+=f:Math.abs(a-f)===1&&(a-=f)),t.dem&&p.dem&&(p.dem.backfillBorder(t.dem,a,u),!((n=p.neighboringTiles)===null||n===void 0)&&n[y]&&(p.neighboringTiles[y].backfilled=!0)))}class un{constructor(){this._tiles={}}handleWrapJump(t){const n={};for(const a in this._tiles){const u=this._tiles[a];u.tileID=u.tileID.unwrapTo(u.tileID.wrap+t),n[u.tileID.key]=u}this._tiles=n}setFeatureState(t,n){for(const a in this._tiles)this._tiles[a].setFeatureState(t,n)}getAllTiles(){return Object.values(this._tiles)}getAllIds(t=!1){return t?Object.values(this._tiles).map((n=>n.tileID)).sort(c.at).map((n=>n.key)):Object.keys(this._tiles)}getTileById(t){return this._tiles[t]}setTile(t,n){this._tiles[t]=n}deleteTileById(t){delete this._tiles[t]}getLoadedTile(t){const n=this.getTileById(t.key);return n?.hasData()?n:null}isIdRenderable(t,n=!1){var a;return(a=this.getTileById(t))===null||a===void 0?void 0:a.isRenderable(n)}getRenderableIds(t=0,n){const a=[];for(const u of this.getAllIds())this.isIdRenderable(u,n)&&a.push(this.getTileById(u));return n?a.sort(((u,f)=>{const y=u.tileID,b=f.tileID,w=new c.P(y.canonical.x,y.canonical.y)._rotate(-t),S=new c.P(b.canonical.x,b.canonical.y)._rotate(-t);return y.overscaledZ-b.overscaledZ||S.y-w.y||S.x-w.x})).map((u=>u.tileID.key)):a.map((u=>u.tileID)).sort(c.at).map((u=>u.key))}}class pi extends c.E{constructor(t,n,a){super(),this.id=t,this.dispatcher=a,this.on("data",(u=>this._dataHandler(u))),this.on("dataloading",(()=>{this._sourceErrored=!1})),this.on("error",(()=>{this._sourceErrored=this._source.loaded()})),this._source=((u,f,y,b)=>{const w=new(Po(f.type))(u,f,y,b);if(w.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${w.id}`);return w})(t,n,a,this),this._inViewTiles=new un,this._outOfViewCache=new c.au(0,(u=>this._unloadTile(u))),this._timers={}
2,this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._rasterFadeDuration=0,this._maxFadingAncestorLevels=5,this._state=new Za,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&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){for(const n of this._inViewTiles.getAllTiles())n.unloadVectorData();this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t),this._inViewTiles=new un}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(const 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;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,n,a){return c._(this,void 0,void 0,(function*(){try{const u=yield this._source.loadTile(t);this._tileLoaded(t,n,a,u)}catch(u){t.state="errored",u.status!==404?this._source.fire(new c.k(u,{tile:t})):this.update(this.transform,this.terrain)}}))}_unloadTile(t){this._source.unloadTile&&this._source.unloadTile(t)}_abortTile(t){this._source.abortTile&&this._source.abortTile(t),this._source.fire(new c.l("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}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(const n of this._inViewTiles.getAllTiles())n.upload(t),n.prepare(this.map.style.imageManager)}getIds(){return this._inViewTiles.getAllIds(!0)}getRenderableIds(t){var n;return this._inViewTiles.getRenderableIds((n=this.transform)===null||n===void 0?void 0:n.bearingInRadians,t)}hasRenderableParent(t){const n=t.overscaledZ-1;if(n>=this._source.minzoom){const a=this.getLoadedTile(t.scaledTo(n));if(a)return this._inViewTiles.isIdRenderable(a.tileID.key)}return!1}reload(t,n=void 0){if(this._paused)this._shouldReloadOnResume=!0;else{this._outOfViewCache.reset();for(const a of this._inViewTiles.getAllIds()){const u=this._inViewTiles.getTileById(a);n&&!this._source.shouldReloadTile(u,n)||(t?this._reloadTile(a,"expired"):u.state!=="errored"&&this._reloadTile(a,"reloading"))}}}_reloadTile(t,n){return c._(this,void 0,void 0,(function*(){const a=this._inViewTiles.getTileById(t);a&&(a.state!=="loading"&&(a.state=n),yield this._loadTile(a,t,n))}))}_tileLoaded(t,n,a,u){t.timeAdded=be(),t.selfFading&&(t.fadeEndTime=t.timeAdded+this._rasterFadeDuration),a==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),u!=null&&u.unmodified||(this.getSource().type==="raster-dem"&&t.dem&&(function(f,y){var b,w;const S=y.getRenderableIds();for(const P of S){if(!f.neighboringTiles||!f.neighboringTiles[P])continue;const C=y.getTileById(P);f.neighboringTiles[P].backfilled||Me(f,C),!((w=(b=C.neighboringTiles)===null||b===void 0?void 0:b[f.tileID.key])===null||w===void 0)&&w.backfilled||Me(C,f)}})(t,this._inViewTiles),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new c.l("data",{dataType:"source",tile:t,coord:t.tileID})))}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._inViewTiles.getTileById(t)}_retainLoadedChildren(t,n){const a=this._getLoadedDescendents(n),u=new Set;for(const f of n){const y=a[f.key];if(!y?.length){u.add(f);continue}const b=f.overscaledZ+pi.maxOverzooming,w=y.filter((C=>C.tileID.overscaledZ<=b));if(!w.length){u.add(f);continue}const S=Math.min(...w.map((C=>C.tileID.overscaledZ))),P=w.filter((C=>C.tileID.overscaledZ===S)).map((C=>C.tileID));for(const C of P)t[C.key]=C;this._areDescendentsComplete(P,S,f.overscaledZ)||u.add(f)}return u}_getLoadedDescendents(t){var n;const a={};for(const u of this._inViewTiles.getAllTiles().filter((f=>f.hasData())))for(const f of t)u.tileID.isChildOf(f)&&(a[n=f.key]||(a[n]=[])).push(u);return a}_areDescendentsComplete(t,n,a){return t.length===1&&t[0].isOverscaled()?t[0].overscaledZ===n:Math.pow(4,n-a)===t.length}getLoadedTile(t){return this._inViewTiles.getLoadedTile(t)}updateCacheSize(t){const n=Math.ceil(t.width/this._source.tileSize)+1,a=Math.ceil(t.height/this._source.tileSize)+1,u=Math.floor(n*a*(this._maxTileC
2acheZoomLevels===null?c.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),f=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,u):u;this._outOfViewCache.setMaxSize(f)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);this._prevLng=t,n&&(this._inViewTiles.handleWrapJump(n),this._resetTileReloadTimers())}update(t,n){if(!this._sourceLoaded||this._paused)return;let a;this.transform=t,this.terrain=n,this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this.used||this.usedForTerrain?this._source.tileID?a=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((w=>new c.a2(w.canonical.z,w.wrap,w.canonical.z,w.canonical.x,w.canonical.y))):(a=cn(t,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.type==="vector"&&this.map._zoomLevelsToOverscale!==void 0?t.maxZoom-this.map._zoomLevelsToOverscale:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:n,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(a=a.filter((w=>this._source.hasTile(w))))):a=[],this.usedForTerrain&&(a=this._addTerrainIdealTiles(a));const u=a.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,u&&this.fire(new c.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const f=Di(t,this._source),y=this._updateRetainedTiles(a,f),b=mc(this._source.type);b&&this._rasterFadeDuration>0&&!n&&(function(w,S,P,C,A,F,V){const U=be(),q=c.as(S);for(const G of S){const Y=w.getTileById(G.key);Y.fadingDirection!==Yi.Departing&&Y.fadeOpacity!==0||Y.resetFadeLogic(),Ku(w,Y,P,U,C,A,V)||Eo(w,Y,P,U,F,V)||gc(Y,q,U,V)||Y.resetFadeLogic()}})(this._inViewTiles,a,y,this._maxFadingAncestorLevels,this._source.minzoom,this._source.maxzoom,this._rasterFadeDuration),b?this._cleanUpRasterTiles(y):this._cleanUpVectorTiles(y)}_cleanUpRasterTiles(t){for(const n of this._inViewTiles.getAllIds())t[n]||this._removeTile(n)}_cleanUpVectorTiles(t){for(const n of this._inViewTiles.getAllIds()){const a=this._inViewTiles.getTileById(n);t[n]?a.clearSymbolFadeHold():a.hasSymbolBuckets?a.holdingForSymbolFade()?a.symbolFadeFinished()&&this._removeTile(n):a.setSymbolHoldDuration(this.map._fadeDuration):this._removeTile(n)}}_addTerrainIdealTiles(t){const n=[];for(const a of t)if(a.canonical.z>this._source.minzoom){const u=a.scaledTo(a.canonical.z-1);n.push(u);const f=a.scaledTo(Math.max(this._source.minzoom,Math.min(a.canonical.z,5)));n.push(f)}return t.concat(n)}releaseSymbolFadeTiles(){for(const t of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(t).holdingForSymbolFade()&&this._removeTile(t)}_updateRetainedTiles(t,n){var a;const u=new Set;for(const S of t)this._addTile(S).hasData()||u.add(S);const f=t.reduce(((S,P)=>(S[P.key]=P,S)),{}),y=this._retainLoadedChildren(f,u),b={},w=Math.max(n-pi.maxUnderzooming,this._source.minzoom);for(const S of y){let P=this._inViewTiles.getTileById(S.key),C=P?.wasRequested();for(let A=S.overscaledZ-1;A>=w;--A){const F=S.scaledTo(A);if(b[F.key])break;if(b[F.key]=!0,P=this.getTile(F),!P&&C&&(P=this._addTile(F)),P){const V=P.hasData();if((V||!(!((a=this.map)===null||a===void 0)&&a.cancelPendingTileRequestsWhileZooming)||C)&&(f[F.key]=F),C=P.wasRequested(),V)break}}}return f}_addTile(t){let n=this._inViewTiles.getTileById(t.key);if(n)return n;n=this._outOfViewCache.getAndRemove(t),n&&(n.resetFadeLogic(),this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null));const a=n;return n||(n=new Zn(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(n,t.key,n.state)),n.uses++,this._inViewTiles.setTile(t.key,n),a||this._source.fire(new c.l("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){this._clearTileReloadTimer(t);const a=n.getExpiryTimeout();a&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,"expired"),delete this._timers[t]}),a))}_clearTileReloadTimer(t){const n=this._timers[t];n&&(clearTimeout(n),delete this._timers[t])}_resetTileReloadTimers(){for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t of this._inViewTiles.getAllIds()){const n=this._inViewTiles.getTileById(t);this._setTileReloadTimer(t,n)}}refreshTiles(t){for(const n of this._inViewTiles.getAllIds()){const a=this._inViewTiles.getTileById(n);(this._inViewTiles.isIdRenderable(n)||a.state=="errored")&&t.some((u=>u.equals(a.tileID.canonical)))&&this._reloadTile(n,"expired")}}_removeTile(t){const n=this._inViewTiles.getTileById(t);n&&(n.uses--,this._inViewTiles.deleteTileById(t),this._clearTileReloadTimer(t),n.uses>0||(n.hasData()&&n.state!=="reloading"?this._outOfViewCache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}_dataHandler(t){t.dataType==="source"&&(t.sourceDataType!=="metadata"?t.sourceDataType==="content"&&this._sourceLoaded&&!this._paused&&(this.reload(t.sourceDataChanged,t.shouldReloadTileOptions),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0):this._sourceLoaded=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t of this._inViewTiles.getAllIds())this._removeTile(t);this._outOfViewCache.reset()}tilesIn(t,n,a){const u=[],f=this.transform;if(!f)return u;const y=f.getCoveringTilesDetailsProvider().allowWorldCopies(),b=a?f.getCameraQueryGeometry(t):t,w=F=>f.screenPointToMercatorCoordinate(F,this.terrain),S=this.transformBbox(t,w,!y),P=this.transformBbox(b,w,!y),C=this.getIds(),A=c.a7.fromPoints(P);for(let F=0;F<C.length;F++){const V=this._inViewTiles.getTileById(C[F]);if(V.holdingForSymbolFade())continue;const U=y?[V.tileID]:[V.tileID.unwrapTo(-1),V.tileID.unwrapTo(0)],q=Math.pow(2,f.zoom-V.tileID.overscaledZ
2),G=n*V.queryPadding*c.a5/V.tileSize/q;for(const Y of U){const ee=A.map((X=>Y.getTilePoint(new c.a6(X.x,X.y))));if(ee.expandBy(G),ee.intersects(fc)){const X=S.map((te=>Y.getTilePoint(te))),Q=P.map((te=>Y.getTilePoint(te)));u.push({tile:V,tileID:y?Y:Y.unwrapTo(0),queryGeometry:X,cameraQueryGeometry:Q,scale:q})}}}return u}transformBbox(t,n,a){let u=t.map(n);if(a){const f=c.a7.fromPoints(t);f.shrinkBy(.001*Math.min(f.width(),f.height()));const y=f.map(n);c.a7.fromPoints(u).covers(y)||(u=u.map((b=>b.x>.5?new c.a6(b.x-1,b.y,b.z):b)))}return u}getVisibleCoordinates(t){const n=this.getRenderableIds(t).map((a=>this._inViewTiles.getTileById(a).tileID));return this.transform&&this.transform.populateCache(n),n}hasTransition(){return!!this._source.hasTransition()||!(!mc(this._source.type)||!(function(t,n){if(n<=0)return!1;const a=be();for(const u of t.getAllTiles())if(u.fadeEndTime>=a)return!0;return!1})(this._inViewTiles,this._rasterFadeDuration))}setRasterFadeDuration(t){this._rasterFadeDuration=t}setFeatureState(t,n,a){this._state.updateState(t=t||c.af,n,a)}removeFeatureState(t,n,a){this._state.removeFeatureState(t=t||c.af,n,a)}getFeatureState(t,n){return this._state.getState(t=t||c.af,n)}setDependencies(t,n,a){const u=this._inViewTiles.getTileById(t);u&&u.setDependencies(n,a)}reloadTilesForDependencies(t,n){for(const a of this._inViewTiles.getAllIds())this._inViewTiles.getTileById(a).hasDependency(t,n)&&this._reloadTile(a,"reloading");this._outOfViewCache.filter((a=>!a.hasDependency(t,n)))}areTilesLoaded(){for(const t of this._inViewTiles.getAllTiles())if(t.state!=="loaded"&&t.state!=="errored")return!1;return!0}}pi.maxUnderzooming=10,pi.maxOverzooming=3;class Ya{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let a=1;a<this.points.length;a++)this._distances[a]=this._distances[a-1]+this.points[a].dist(this.points[a-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=c.ak(t,0,1);let n=1,a=this._distances[n];const u=t*this.paddedLength+this.padding;for(;a<u&&n<this._distances.length;)a=this._distances[++n];const f=n-1,y=this._distances[f],b=a-y,w=b>0?(u-y)/b:0;return this.points[f].mult(1-w).add(this.points[n].mult(w))}}function Zr(p,t){let n=!0;return p==="always"||p!=="never"&&t!=="never"||(n=!1),n}class De{constructor(t,n,a){const u=this.boxCells=[],f=this.circleCells=[];this.xCellCount=Math.ceil(t/a),this.yCellCount=Math.ceil(n/a);for(let y=0;y<this.xCellCount*this.yCellCount;y++)u.push([]),f.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,a,u,f){this._forEachCell(n,a,u,f,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(u),this.bboxes.push(f)}
vendor: 42,142 bytes, lines 2-29
2insertCircle(t,n,a,u){this._forEachCell(n-u,a-u,n+u,a+u,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(a),this.circles.push(u)}_insertBoxCell(t,n,a,u,f,y){this.boxCells[f].push(y)}_insertCircleCell(t,n,a,u,f,y){this.circleCells[f].push(y)}_query(t,n,a,u,f,y,b){if(a<0||t>this.width||u<0||n>this.height)return[];const w=[];if(t<=0&&n<=0&&this.width<=a&&this.height<=u){if(f)return[{key:null,x1:t,y1:n,x2:a,y2:u}];for(let S=0;S<this.boxKeys.length;S++)w.push({key:this.boxKeys[S],x1:this.bboxes[4*S],y1:this.bboxes[4*S+1],x2:this.bboxes[4*S+2],y2:this.bboxes[4*S+3]});for(let S=0;S<this.circleKeys.length;S++){const P=this.circles[3*S],C=this.circles[3*S+1],A=this.circles[3*S+2];w.push({key:this.circleKeys[S],x1:P-A,y1:C-A,x2:P+A,y2:C+A})}}else this._forEachCell(t,n,a,u,this._queryCell,w,{hitTest:f,overlapMode:y,seenUids:{box:{},circle:{}}},b);return w}query(t,n,a,u){return this._query(t,n,a,u,!1,null)}hitTest(t,n,a,u,f,y){return this._query(t,n,a,u,!0,f,y).length>0}hitTestCircle(t,n,a,u,f){const y=t-a,b=t+a,w=n-a,S=n+a;if(b<0||y>this.width||S<0||w>this.height)return!1;const P=[];return this._forEachCell(y,w,b,S,this._queryCellCircle,P,{hitTest:!0,overlapMode:u,circle:{x:t,y:n,radius:a},seenUids:{box:{},circle:{}}},f),P.length>0}_queryCell(t,n,a,u,f,y,b,w){const{seenUids:S,hitTest:P,overlapMode:C}=b,A=this.boxCells[f],F=1e-6;if(A!==null){const U=this.bboxes;for(const q of A)if(!S.box[q]){S.box[q]=!0;const G=4*q,Y=this.boxKeys[q];if(t<=U[G+2]+F&&n<=U[G+3]+F&&a>=U[G+0]-F&&u>=U[G+1]-F&&(!w||w(Y))&&(!P||!Zr(C,Y.overlapMode))&&(y.push({key:Y,x1:U[G],y1:U[G+1],x2:U[G+2],y2:U[G+3]}),P))return!0}}const V=this.circleCells[f];if(V!==null){const U=this.circles;for(const q of V)if(!S.circle[q]){S.circle[q]=!0;const G=3*q,Y=this.circleKeys[q];if(this._circleAndRectCollide(U[G],U[G+1],U[G+2],t,n,a,u)&&(!w||w(Y))&&(!P||!Zr(C,Y.overlapMode))){const ee=U[G],X=U[G+1],Q=U[G+2];if(y.push({key:Y,x1:ee-Q,y1:X-Q,x2:ee+Q,y2:X+Q}),P)return!0}}}return!1}_queryCellCircle(t,n,a,u,f,y,b,w){const{circle:S,seenUids:P,overlapMode:C}=b,A=this.boxCells[f];if(A!==null){const V=this.bboxes;for(const U of A)if(!P.box[U]){P.box[U]=!0;const q=4*U,G=this.boxKeys[U];if(this._circleAndRectCollide(S.x,S.y,S.radius,V[q+0],V[q+1],V[q+2],V[q+3])&&(!w||w(G))&&!Zr(C,G.overlapMode))return y.push(!0),!0}}const F=this.circleCells[f];if(F!==null){const V=this.circles;for(const U of F)if(!P.circle[U]){P.circle[U]=!0;const q=3*U,G=this.circleKeys[U];if(this._circlesCollide(V[q],V[q+1],V[q+2],S.x,S.y,S.radius)&&(!w||w(G))&&!Zr(C,G.overlapMode))return y.push(!0),!0}}}_forEachCell(t,n,a,u,f,y,b,w){const S=this._convertToXCellCoord(t),P=this._convertToYCellCoord(n),C=this._convertToXCellCoord(a),A=this._convertToYCellCoord(u);for(let F=S;F<=C;F++)for(let V=P;V<=A;V++)if(f.call(this,t,n,a,u,this.xCellCount*V+F,y,b,w))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,a,u,f,y){const b=u-t,w=f-n,S=a+y;return S*S>b*b+w*w}_circleAndRectCollide(t,n,a,u,f,y,b){const w=(y-u)/2,S=Math.abs(t-(u+w));if(S>w+a)return!1;const P=(b-f)/2,C=Math.abs(n-(f+P));if(C>P+a)return!1;if(S<=w||C<=P)return!0;const A=S-w,F=C-P;return A*A+F*F<=a*a}}function He(p,t,n){const a=c.N();if(!p){const{vecSouth:C,vecEast:A}=Vi(t),F=he();F[0]=A[0],F[1]=A[1],F[2]=C[0],F[3]=C[1],u=F,(P=(y=(f=F)[0])*(S=f[3])-(w=f[2])*(b=f[1]))&&(u[0]=S*(P=1/P),u[1]=-b*P,u[2]=-w*P,u[3]=y*P),a[0]=F[0],a[1]=F[1],a[4]=F[2],a[5]=F[3]}var u,f,y,b,w,S,P;return c.Q(a,a,[1/n,1/n,1]),a}function Je(p,t,n,a){if(p){const u=c.N();if(!t){const{vecSouth:f,vecEast:y}=Vi(n);u[0]=y[0],u[1]=y[1],u[4]=f[0],u[5]=f[1]}return c.Q(u,u,[a,a,1]),u}return n.pixelsToClipSpaceMatrix}function Vi(p){const t=Math.cos(p.rollInRadians),n=Math.sin(p.rollInRadians),a=Math.cos(p.pitchInRadians),u=Math.cos(p.bearingInRadians),f=Math.sin(p.bearingInRadians),y=c.az();y[0]=-u*a*n-f*t,y[1]=-f*a*n+u*t;const b=c.aA(y);b<1e-9?c.aB(y):c.aC(y,y,1/b);const w=c.az();w[0]=u*a*t-f*n,w[1]=f*a*t+u*n;const S=c.aA(w);return S<1e-9?c.aB(w):c.aC(w,w,1/S),{vecEast:w,vecSouth:y}}function Xn(p,t,n,a){let u;a?(u=[p,t,a(p,t),1],c.aE(u,u,n)):(u=[p,t,0,1],Ao(u,u,n));const f=u[3];return{point:new c.P(u[0]/f,u[1]/f),signedDistanceFromCamera:f,isOccluded:!1}}function Wr(p,t){return .5+p/t*.5}function Ke(p,t){return p.x>=-t[0]&&p.x<=t[0]&&p.y>=-t[1]&&p.y<=t[1]}function Co(p,t,n,a,u,f,y,b,w,S,P,C,A){const F=n?p.textSizeData:p.iconSizeData,V=c.av(F,t.transform.zoom),U=[256/t.width*2+1,256/t.height*2+1],q=n?p.text.dynamicLayoutVertexArray:p.icon.dynamicLayoutVertexArray;q.clear();const G=p.lineVertexArray,Y=n?p.text.placedSymbolArray:p.icon.placedSymbolArray,ee=t.transform.width/t.transform.height;let X=!1;for(let Q=0;Q<Y.length;Q++){const te=Y.get(Q);if(te.hidden||te.writingMode===c.aw.vertical&&!X){ji(te.numGlyphs,q);continue}X=!1;const K=new c.P(te.anchorX,te.anchorY),se={getElevation:A,pitchedLabelPlaneMatrix:a,lineVertexArray:G,pitchWithMap:f,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:t.transform,tileAnchorPoint:K,unwrappedTileID:w,width:S,height:P,translation:C},me=Ct(te.anchorX,te.anchorY,se);if(!Ke(me.point,U)){ji(te.numGlyphs,q);continue}const pe=Wr(t.transform.cameraToCenterDistance,me.signedDistanceFromCamera),ce=c.ax(F,V,te),fe=f?ce*t.transform.getPitchedTextCorrection(te.anchorX,te.anchorY,w)/pe:ce*pe,Te=Kn({projectionContext:se,pitchedLabelPlaneMatrixInverse:u,symbol:te,fontSize:fe,flip:!1,keepUpright:y,glyphOffsetArray:p.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:b});X=Te.useVertical,(Te.notEnoughRoom||X||Te.needsFlipping&&Kn({projectionContext:se,pitchedLabelPlaneMatrixInverse:u,symbol:te,fontSize:fe,flip:!0,keepUpright:y,glyphOffsetArray:p.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:b}).notEnoughRoom)&&ji(te.numGlyphs,q)}n?p.text.dynamicLayoutVertexBuffer.updateData(q):p.icon.dynamicLayoutVertexBuffer.updateData(q)}function Yn(p,t,n,a,u,f,y,b){const w=f.glyphStartIndex+f.numGlyphs,S=f.lineStartIndex,P=f.lineStartIndex+f.lineLength,C=t.getoffsetX(f.glyphStartIndex),A=t.getoffsetX(w-1),F=Jn(p*C,n,a,u,f.segment,S,P,b,y);if(!F)return null;const V=Jn(p*A,n,a,u,f.segment,S,P,b,y);return V?b.projectionCache.anyProjectionOccluded?null:{first:F,last:V}:null}function As(p,t,n,a){return p===c.aw.horizontal&&Math.abs(n.y-t.y)>Math.abs(n.x-t.x)*a?{useVertical:!0}:(p===c.aw.vertical?t.y<n.y:t.x>n.x)?{needsFlipping:!0}:null}function Kn(p){const{projectionContext:t,pitchedLabelPlaneMatrixInverse:n,symbol:a,fontSize:u,flip:f,keepUpright:y,glyphOffsetArray:b,dynamicLayoutVertexArray:w,aspectRatio:S,rotateToLine:P}=p,C=u/24,A=a.lineOffsetX*C,F=a.lineOffsetY*C;let V;if(a.numGlyphs>1){const U=a.glyphStartIndex+a.numGlyphs,q=a.lineStartIndex,G=a.lineStartIndex+a.lineLength,Y=Yn(C,b,A,F,f,a,P,t);if(!Y)return{notEnoughRoom:!0};const ee=si(Y.first.point.x,Y.first.point.y,t,n),X=si(Y.last.point.x,Y.last.point.y,t,n);if(y&&!f){const Q=As(a.writingMode,ee,X,S);if(Q)return Q}V=[Y.first];for(let Q=a.glyphStartIndex+1;Q<U-1;Q++){const te=Jn(C*b.getoffsetX(Q),A,F,f,a.segment,q,G,t,P);if(!te)return{notEnoughRoom:!0};V.push(te)}V.push(Y.last)}else{if(y&&!f){const q=yr(t.tileAnchorPoint.x,t.tileAnchorPoint.y,t).point,G=a.lineStartIndex+a.segment+1,Y=new c.P(t.lineVertexArray.getx(G),t.lineVertexArray.gety(G)),ee=yr(Y.x,Y.y,t),X=ee.signedDistanceFromCamera>0?ee.point:Ds(t.tileAnchorPoint,Y,q,1,t),Q=si(q.x,q.y,t,n),te=si(X.x,X.y,t,n),K=As(a.writingMode,Q,te,S);if(K)return K}const U=Jn(C*b.getoffsetX(a.glyphStartIndex),A,F,f,a.segment,a.lineStartIndex,a.lineStartIndex+a.lineLength,t,P);if(!U||t.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};V=[U]}for(const U of V)c.aD(w,U.point,U.angle);return{}}function Ds(p,t,n,a,u){const f=p.add(p.sub(t)._unit()),y=yr(f.x,f.y,u).point,b=n.sub(y);return n.add(b._mult(a/b.mag()))}function hn(p,t,n){const a=t.projectionCache;if(a.projections[p])return a.projections[p];const u=new c.P(t.lineVertexArray.getx(p),t.lineVertexArray.gety(p)),f=yr(u.x,u.y,t);if(f.signedDistanceFromCamera>0)return a.projections[p]=f.point,a.anyProjectionOccluded=a.anyProjectionOccluded||f.isOccluded,f.point;const y=p-n.direction;return Ds(n.distanceFromAnchor===0?t.tileAnchorPoint:new c.P(t.lineVertexArray.getx(y),t.lineVertexArray.gety(y)),u,n.previousVertex,n.absOffsetX-n.distanceFromAnchor+1,t)}function yr(p,t,n){const a=p+n.translation[0],u=t+n.translation[1];let f;return n.pitchWithMap?(f=Xn(a,u,n.pitchedLabelPlaneMatrix,n.getElevation),f.isOccluded=!1):(f=n.transform.projectTileCoordinates(a,u,n.unwrappedTileID,n.getElevation),f.point.x=(.5*f.point.x+.5)*n.width,f.point.y=(.5*-f.point.y+.5)*n.height),f}function si(p,t,n,a){if(n.pitchWithMap){const u=[p,t,0,1];return c.aE(u,u,a),n.transform.projectTileCoordinates(u[0]/u[3],u[1]/u[3],n.unwrappedTileID,n.getElevation).point}return{x:p/n.width*2-1,y:1-t/n.height*2}}function Ct(p,t,n){return n.transform.projectTileCoordinates(p,t,n.unwrappedTileID,n.getElevation)}function Ka(p,t,n){return p._unit()._perp()._mult(t*n)}function ks(p,t,n,a,u,f,y,b,w){if(b.projectionCache.offsets[p])return b.projectionCache.offsets[p];const S=n.add(t);if(p+w.direction<a||p+w.direction>=u)return b.projectionCache.offsets[p]=S,S;const P=hn(p+w.direction,b,w),C=Ka(P.sub(n),y,w.direction),A=n.add(C),F=P.add(C);return b.projectionCache.offsets[p]=c.aF(f,S,A,F)||S,b.projectionCache.offsets[p]}function Jn(p,t,n,a,u,f,y,b,w){const S=a?p-t:p+t;let P=S>0?1:-1,C=0;a&&(P*=-1,C=Math.PI),P<0&&(C+=Math.PI);let A,F=P>0?f+u:f+u+1;b.projectionCache.cachedAnchorPoint?A=b.projectionCache.cachedAnchorPoint:(A=yr(b.tileAnchorPoint.x,b.tileAnchorPoint.y,b).point,b.projectionCache.cachedAnchorPoint=A);let V,U,q=A,G=A,Y=0,ee=0;const X=Math.abs(S),Q=[];let te;for(;Y+ee<=X;){if(F+=P,F<f||F>=y)return null;Y+=ee,G=q,U=V;const me={absOffsetX:X,direction:P,distanceFromAnchor:Y,previousVertex:G};if(q=hn(F,b,me),n===0)Q.push(G),te=q.sub(G);else{let pe;const ce=q.sub(G);pe=ce.mag()===0?Ka(hn(F+P,b,me).sub(q),n,P):Ka(ce,n,P),U||(U=G.add(pe)),V=ks(F,pe,q,f,y,U,n,b,me),Q.push(U),te=V.sub(U)}ee=te.mag()}const K=te._mult((X-Y)/ee)._add(U||G),se=C+Math.atan2(q.y-G.y,q.x-G.x);return Q.push(K),{point:K,angle:w?se:0,path:Q}}const dn=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ji(p,t){for(let n=0;n<p;n++){const a=t.length;t.resize(a+4),t.float32.set(dn,3*a)}}function Ao(p,t,n){const a=t[0],u=t[1];return p[0]=n[0]*a+n[4]*u+n[12],p[1]=n[1]*a+n[5]*u+n[13],p[3]=n[3]*a+n[7]*u+n[15],p}const ti=100;class _c{constructor(t,n=new De(t.width+200,t.height+200,25),a=new De(t.width+200,t.height+200,25)){this.transform=t,this.grid=n,this.ignoredGrid=a,this.pitchFactor=Math.cos(t.pitch*Math.PI/180)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+ti,this.screenBottomBoundary=t.height+ti,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,n,a,u,f,y,b,w,S,P,C,A){const F=this.projectAndGetPerspectiveRatio(t.anchorPointX+w[0],t.anchorPointY+w[1],f,P,A),V=a*F.perspectiveRatio;let U;if(y||b)U=this._projectCollisionBox(t,V,u,f,y,b,w,F,P,C,A);else{const te=F.x+(C?C.x*V:0),K=F.y+(C?C.y*V:0);U={allPointsOccluded:!1,box:[te+t.x1*V,K+t.y1*V,te+t.x2*V,K+t.y2*V]}}const[q,G,Y,ee]=U.box,X=y?U.allPointsOccluded:F.isOccluded;let Q=X;return Q||(Q=F.perspectiveRatio<this.perspectiveRatioCutoff),Q||(Q=!this.isInsideGrid(q,G,Y,ee)),Q||n!=="always"&&this.grid.hitTest(q,G,Y,ee,n,S)?{box:[q,G,Y,ee],placeable:!1,offscreen:!1,occluded:X}:{box:[q,G,Y,ee],placeable:!0,offscreen:this.isOffscreen(q,G,Y,ee),occluded:X}}placeCollisionCircles(t,n,a,u,f,y,b,w,S,P,C,A,F,V){const U=[],q=new c.P(n.anchorX,n.anchorY),G=this.getPerspectiveRatio(q.x,q.y,y,V),Y=(S?f*this.transform.getPitchedTextCorrection(n.anchorX,n.anchorY,y)/G:f*G)/c.aJ,ee={getElevation:V,pitchedLabelPlaneMatrix:b,lineVertexArray:a,pitchWithMap:S,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:q,unwrappedTileID:y,width:this.transform.width,height:this.transform.height,translation:F},X=Yn(Y,u,n.lineOffsetX*Y,n.lineOffsetY*Y,!1,n,!1,ee);let Q=!1,te=!1,K=!0;if(X){const se=.5*C*G+A,me=new c.P(-100,-100),pe=new c.P(this.screenRightBoundary,this.screenBottomBoundary),ce=new Ya,fe=X.first,Te=X.last;let Se=[];for(let je=fe.path.length-1;je>=1;je--)Se.push(fe.path[je]);for(let je=1;je<Te.path.length;je++)Se.push(Te.path[je]);const we=2.5*se;if(S){const je=this.projectPathToScreenSpace(Se,ee);Se=je.some((ft=>ft.signedDistanceFromCamera<=0))?[]:je.map((ft=>ft.point))}let Oe=[];if(Se.length>0){const je=Se[0].clone(),ft=Se[0].clone();for(let Mt=1;Mt<Se.length;Mt++)je.x=Math.min(je.x,Se[Mt].x),je.y=Math.min(je.y,Se[Mt].y),ft.x=Math.max(ft.x,Se[Mt].x),ft.y=Math.max(ft.y,Se[Mt].y);Oe=je.x>=me.x&&ft.x<=pe.x&&je.y>=me.y&&ft.y<=pe.y?[Se]:ft.x<me.x||je.x>pe.x||ft.y<me.y||je.y>pe.y?[]:c.aG([Se],me.x,me.y,pe.x,pe.y)}for(const je of Oe){ce.reset(je,.25*se);let ft=0;ft=ce.length<=.5*se?1:Math.ceil(ce.paddedLength/we)+1;for(let Mt=0;Mt<ft;Mt++){const St=Mt/Math.max(ft-1,1),At=ce.lerp(St),xt=At.x+ti,Qt=At.y+ti;U.push(xt,Qt,se,0);const bt=xt-se,ai=Qt-se,Wt=xt+se,Ht=Qt+se;if(K=K&&this.isOffscreen(bt,ai,Wt,Ht),te=te||this.isInsideGrid(bt,ai,Wt,Ht),t!=="always"&&this.grid.hitTestCircle(xt,Qt,se,t,P)&&(Q=!0,!w))return{circles:[],offscreen:!1,collisionDetected:Q}}}}return{circles:!w&&Q||!te||G<this.perspectiveRatioCutoff?[]:U,offscreen:K,collisionDetected:Q}}projectPathToScreenSpace(t,n){return(function(a){let u=0,f=0,y=0,b=0;for(let w=0;w<a.length;w++)a[w].isOccluded?(y=w+1,b=0):(b++,b>f&&(f=b,u=y));return a.slice(u,u+f)})((function(a,u){const f=c.N();return c.ay(f,u.pitchedLabelPlaneMatrix),a.map((y=>{const b=Xn(y.x,y.y,f,u.getElevation),w=u.transform.projectTileCoordinates(b.point.x,b.point.y,u.unwrappedTileID,u.getElevation);return w.point.x=(.5*w.point.x+.5)*u.width,w.point.y=(.5*-w.point.y+.5)*u.height,w}))})(t,n))}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[],a=new c.a7;for(const C of t){const A=new c.P(C.x+ti,C.y+ti);a.extend(A),n.push(A)}const{minX:u,minY:f,maxX:y,maxY:b}=a,w=this.grid.query(u,f,y,b).concat(this.ignoredGrid.query(u,f,y,b)),S={},P={};for(const C of w){const A=C.key;if(S[A.bucketInstanceId]===void 0&&(S[A.bucketInstanceId]={}),S[A.bucketInstanceId][A.featureIndex])continue;const F=[new c.P(C.x1,C.y1),new c.P(C.x2,C.y1),new c.P(C.x2,C.y2),new c.P(C.x1,C.y2)];c.aH(n,F)&&(S[A.bucketInstanceId][A.featureIndex]=!0,P[A.bucketInstanceId]===void 0&&(P[A.bucketInstanceId]=[]),P[A.bucketInstanceId].push(A.featureIndex))}return P}insertCollisionBox(t,n,a,u,f,y){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:f,collisionGroupID:y,overlapMode:n},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,a,u,f,y){const b=a?this.ignoredGrid:this.grid,w={bucketInstanceId:u,featureIndex:f,collisionGroupID:y,overlapMode:n};for(let S=0;S<t.length;S+=4)b.insertCircle(w,t[S],t[S+1],t[S+2])}projectAndGetPerspectiveRatio(t,n,a,u,f){if(f){let y;u?(y=[t,n,u(t,n),1],c.aE(y,y,f)):(y=[t,n,0,1],Ao(y,y,f));const b=y[3];return{x:(y[0]/b+1)/2*this.transform.width+ti,y:(-y[1]/b+1)/2*this.transform.height+ti,perspectiveRatio:.5+this.transform.cameraToCenterDistance/b*.5,isOccluded:!1,signedDistanceFromCamera:b}}{const y=this.transform.projectTileCoordinates(t,n,a,u);return{x:(y.point.x+1)/2*this.transform.width+ti,y:(1-y.point.y)/2*this.transform.height+ti,perspectiveRatio:.5+this.transform.cameraToCenterDistance/y.signedDistanceFromCamera*.5,isOccluded:y.isOccluded,signedDistanceFromCamera:y.signedDistanceFromCamera}}}getPerspectiveRatio(t,n,a,u){const f=this.transform.projectTileCoordinates(t,n,a,u);return .5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5}isOffscreen(t,n,a,u){return a<ti||t>=this.screenRightBoundary||u<ti||n>this.screenBottomBoundary}isInsideGrid(t,n,a,u){return a>=0&&t<this.gridRightBoundary&&u>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=c.ao([]);return c.O(t,t,[-100,-100,0]),t}_projectCollisionBox(t,n,a,u,f,y,b,w,S,P,C){let A=1,F=0,V=0,U=1;const q=t.anchorPointX+b[0],G=t.anchorPointY+b[1];if(y&&!f){const Se=this.projectAndGetPerspectiveRatio(q+1,G,u,S,C),we=Se.x-w.x,Oe=Math.atan((Se.y-w.y)/we)+(we<0?Math.PI:0),je=Math.sin(Oe),ft=Math.cos(Oe);A=ft,F=je,V=-je,U=ft}else if(!y&&f){const Se=Vi(this.transform);A=Se.vecEast[0],F=Se.vecEast[1],V=Se.vecSouth[0],U=Se.vecSouth[1]}let Y=w.x,ee=w.y,X=n;f&&(Y=q,ee=G,X=Math.pow(2,-(this.transform.zoom-a.overscaledZ)),X*=this.transform.getPitchedTextCorrection(q,G,u),P||(X*=c.ak(.5+w.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&(Y+=A*P.x*X+V*P.y*X,ee+=F*P.x*X+U*P.y*X);const Q=t.x1*X,te=t.x2*X,K=(Q+te)/2,se=t.y1*X,me=t.y2*X,pe=(se+me)/2,ce=[{offsetX:Q,offsetY:se},{offsetX:K,offsetY:se},{offsetX:te,offsetY:se},{offsetX:te,offsetY:pe},{offsetX:te,offsetY:me},{offsetX:K,offsetY:me},{offsetX:Q,offsetY:me},{offsetX:Q,offsetY:pe}];let fe=[];for(const{offsetX:Se,offsetY:we}of ce)fe.push(new c.P(Y+A*Se+V*we,ee+F*Se+U*we));let Te=!1;if(f){const Se=fe.map((we=>this.projectAndGetPerspectiveRatio(we.x,we.y,u,S,C)));Te=Se.some((we=>!we.isOccluded)),fe=Se.map((we=>new c.P(we.x,we.y)))}else Te=!0;return{box:c.aI(fe),allPointsOccluded:!Te}}}class pn{constructor(t,n,a,u){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):u&&a?1:0,this.placed=a}isHidden(){return this.opacity===0&&!this.placed}}class Qn{constructor(t,n,a,u,f){this.text=new pn(t?t.text:null,n,a,f),this.icon=new pn(t?t.icon:null,n,u,f)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class yc{constructor(t,n,a){this.text=t,this.icon=n,this.skipFade=a}}class Ju{constructor(t,n,a,u,f){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=a,this.bucketIndex=u,this.tileID=f}}class Qu{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:a=>a.collisionGroupID===n}}return this.collisionGroups[t]}}function Ja(p,t,n,a,u){const{horizontalAlign:f,verticalAlign:y}=c.aP(p);return new c.P(-(f-.5)*t+a[0]*u,-(y-.5)*n+a[1]*u)}class vc{constructor(t,n,a,u,f){this.transform=t.clone(),this.terrain=n,this.collisionIndex=new _c(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Qu(u),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=f,f&&(f.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(t){const n=this.terrain;return n?(a,u)=>n.getElevation(t,a,u):null}getBucketParts(t,n,a,u){const f=a.getBucket(n),y=a.latestFeatureIndex;if(!f||!y||n.id!==f.layerIds[0])return;const b=a.collisionBoxArray,w=f.layers[0].layout,S=f.layers[0].paint,P=Math.pow(2,this.transform.zoom-a.tileID.overscaledZ),C=a.tileSize/c.a5,A=a.tileID.toUnwrapped(),F=w.get("text-rotation-alignment")==="map",V=c.aK(a,1,this.transform.zoom),U=c.aL(this.collisionIndex.transform,a,S.get("text-translate"),S.get("text-translate-anchor")),q=c.aL(this.collisionIndex.transform,a,S.get("icon-translate"),S.get("icon-translate-anchor")),G=He(F,this.transform,V);this.retainedQueryData[f.bucketInstanceId]=new Ju(f.bucketInstanceId,y,f.sourceLayerIndex,f.index,a.tileID);const Y={bucket:f,layout:w,translationText:U,translationIcon:q,unwrappedTileID:A,pitchedLabelPlaneMatrix:G,scale:P,textPixelRatio:C,holdingForFade:a.holdingForSymbolFade(),collisionBoxArray:b,partiallyEvaluatedTextSize:c.av(f.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(f.sourceID)};if(u)for(const ee of f.sortKeyRanges){const{sortKey:X,symbolInstanceStart:Q,symbolInstanceEnd:te}=ee;t.push({sortKey:X,symbolInstanceStart:Q,symbolInstanceEnd:te,parameters:Y})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:f.symbolInstances.length,parameters:Y})}attemptAnchorPlacement(t,n,a,u,f,y,b,w,S,P,C,A,F,V,U,q,G,Y,ee,X){const Q=c.aM[t.textAnchor],te=[t.textOffset0,t.textOffset1],K=Ja(Q,a,u,te,f),se=this.collisionIndex.placeCollisionBox(n,A,w,S,P,b,y,q,C.predicate,ee,K,X);if((!Y||this.collisionIndex.placeCollisionBox(Y,A,w,S,P,b,y,G,C.predicate,ee,K,X).placeable)&&se.placeable){let me;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(me=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:te,width:a,height:u,anchor:Q,textBoxScale:f,prevAnchor:me},this.markUsedJustification(V,Q,F,U),V.allowVerticalPlacement&&(this.markUsedOrientation(V,U,F),this.placedOrientations[F.crossTileID]=U),{shift:K,placedGlyphBoxes:se}}}placeLayerBucketPart(t,n,a){const{bucket:u,layout:f,translationText:y,translationIcon:b,unwrappedTileID:w,pitchedLabelPlaneMatrix:S,textPixelRatio:P,holdingForFade:C,collisionBoxArray:A,partiallyEvaluatedTextSize:F,collisionGroup:V}=t.parameters,U=f.get("text-optional"),q=f.get("icon-optional"),G=c.aN(f,"text-overlap","text-allow-overlap"),Y=G==="always",ee=c.aN(f,"icon-overlap","icon-allow-overlap"),X=ee==="always",Q=f.get("text-rotation-alignment")==="map",te=f.get("text-pitch-alignment")==="map",K=f.get("icon-text-fit")!=="none",se=f.get("symbol-z-order")==="viewport-y",me=Y&&(X||!u.hasIconData()||q),pe=X&&(Y||!u.hasTextData()||U);!u.collisionArrays&&A&&u.deserializeCollisionBoxes(A);const ce=this.retainedQueryData[u.bucketInstanceId].tileID,fe=this._getTerrainElevationFunc(ce),Te=this.transform.getFastPathSimpleProjectionMatrix(ce),Se=(we,Oe,je)=>{var ft,Mt;if(n[we.crossTileID])return;if(C)return void(this.placements[we.crossTileID]=new yc(!1,!1,!1));let St=!1,At=!1,xt=!0,Qt=null,bt={box:null,placeable:!1,offscreen:null,occluded:!1},ai={placeable:!1},Wt=null,Ht=null,fi=null,Yr=0,Rr=0,Sr=0;Oe.textFeatureIndex?Yr=Oe.textFeatureIndex:we.useRuntimeCollisionCircles&&(Yr=we.featureIndex),Oe.verticalTextFeatureIndex&&(Rr=Oe.verticalTextFeatureIndex);const zi=Oe.textBox;if(zi){const tr=Pt=>{let wt=c.aw.horizontal;if(u.allowVerticalPlacement&&!Pt&&this.prevPlacement){const ri=this.prevPlacement.placedOrientations[we.crossTileID];ri&&(this.placedOrientations[we.crossTileID]=ri,wt=ri,this.markUsedOrientation(u,wt,we))}return wt},Pr=(Pt,wt)=>{if(u.allowVerticalPlacement&&we.numVerticalGlyphVertices>0&&Oe.verticalTextBox){for(const ri of u.writingModes)if(ri===c.aw.vertical?(bt=wt(),ai=bt):bt=Pt(),bt&&bt.placeable)break}else bt=Pt()},fr=we.textAnchorOffsetStartIndex,mr=we.textAnchorOffsetEndIndex;if(mr===fr){const Pt=(wt,ri)=>{const mi=this.collisionIndex.placeCollisionBox(wt,G,P,ce,w,te,Q,y,V.predicate,fe,void 0,Te);return mi&&mi.placeable&&(this.markUsedOrientation(u,ri,we),this.placedOrientations[we.crossTileID]=ri),mi};Pr((()=>Pt(zi,c.aw.horizontal)),(()=>{const wt=Oe.verticalTextBox;return u.allowVerticalPlacement&&we.numVerticalGlyphVertices>0&&wt?Pt(wt,c.aw.vertical):{box:null,offscreen:null}})),tr(bt&&bt.placeable)}else{let Pt=c.aM[(Mt=(ft=this.prevPlacement)===null||ft===void 0?void 0:ft.variableOffsets[we.crossTileID])===null||Mt===void 0?void 0:Mt.anchor];const wt=(mi,gu,_u)=>{const Ln=mi.x2-mi.x1,Ih=mi.y2-mi.y1,yu=we.textBoxScale,ql=K&&ee==="never"?gu:null;let Kr=null,Jr=G==="never"?1:2,Qr="never";Pt&&Jr++;for(let Zl=0;Zl<Jr;Zl++){for(let Wl=fr;Wl<mr;Wl++){const fa=u.textAnchorOffsets.get(Wl);if(Pt&&fa.textAnchor!==Pt)continue;const ma=this.attemptAnchorPlacement(fa,mi,Ln,Ih,yu,Q,te,P,ce,w,V,Qr,we,u,_u,y,b,ql,fe);if(ma&&(Kr=ma.placedGlyphBoxes,Kr&&Kr.placeable))return St=!0,Qt=ma.shift,Kr}Pt?Pt=null:Qr=G}return a&&!Kr&&(Kr={box:this.collisionIndex.placeCollisionBox(zi,"always",P,ce,w,te,Q,y,V.predicate,fe,void 0,Te).box,offscreen:!1,placeable:!1,occluded:!1}),Kr};Pr((()=>wt(zi,Oe.iconBox,c.aw.horizontal)),(()=>{const mi=Oe.verticalTextBox;return u.allowVerticalPlacement&&(!bt||!bt.placeable)&&we.numVerticalGlyphVertices>0&&mi?wt(mi,Oe.verticalIconBox,c.aw.vertical):{box:null,occluded:!0,offscreen:null}})),bt&&(St=bt.placeable,xt=bt.offscreen);const ri=tr(bt&&bt.placeable);if(!St&&this.prevPlacement){const mi=this.prevPlacement.variableOffsets[we.crossTileID];mi&&(this.variableOffsets[we.crossTileID]=mi,this.markUsedJustification(u,mi.anchor,we,ri))}}}if(Wt=bt,St=Wt&&Wt.placeable,xt=Wt&&Wt.offscreen,we.useRuntimeCollisionCircles&&we.centerJustifiedTextSymbolIndex>=0){const tr=u.text.placedSymbolArray.get(we.centerJustifiedTextSymbolIndex),Pr=c.ax(u.textSizeData,F,tr),fr=f.get("text-padding");Ht=this.collisionIndex.placeCollisionCircles(G,tr,u.lineVertexArray,u.glyphOffsetArray,Pr,w,S,a,te,V.predicate,we.collisionCircleDiameter,fr,y,fe),Ht.circles.length&&Ht.collisionDetected&&!a&&c.w("Collisions detected, but collision boxes are not shown"),St=Y||Ht.circles.length>0&&!Ht.collisionDetected,xt=xt&&Ht.offscreen}if(Oe.iconFeatureIndex&&(Sr=Oe.iconFeatureIndex),Oe.iconBox){const tr=Pr=>this.collisionIndex.placeCollisionBox(Pr,ee,P,ce,w,te,Q,b,V.predicate,fe,K&&Qt?Qt:void 0,Te);ai&&ai.placeable&&Oe.verticalIconBox?(fi=tr(Oe.verticalIconBox),At=fi.placeable):(fi=tr(Oe.iconBox),At=fi.placeable),xt=xt&&fi.offscreen}const kn=U||we.numHorizontalGlyphVertices===0&&we.numVerticalGlyphVertices===0,ho=q||we.numIconVertices===0;kn||ho?ho?kn||(At=At&&St):St=At&&St:At=St=At&&St;const zn=At&&fi.placeable;if(St&&Wt.placeable&&this.collisionIndex.insertCollisionBox(Wt.box,G,f.get("text-ignore-placement"),u.bucketInstanceId,ai&&ai.placeable&&Rr?Rr:Yr,V.ID),zn&&this.collisionIndex.insertCollisionBox(fi.box,ee,f.get("icon-ignore-placement"),u.bucketInstanceId,Sr,V.ID),Ht&&St&&this.collisionIndex.insertCollisionCircles(Ht.circles,G,f.get("text-ignore-placement"),u.bucketInstanceId,Yr,V.ID),a&&this.storeCollisionData(u.bucketInstanceId,je,Oe,Wt,fi,Ht),we.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(u.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[we.crossTileID]=new yc((St||me)&&!Wt?.occluded,(At||pe)&&!fi?.occluded,xt||u.justReloaded),n[we.crossTileID]=!0};if(se){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const we=u.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let Oe=we.length-1;Oe>=0;--Oe){const je=we[Oe];Se(u.symbolInstances.get(je),u.collisionArrays[je],je)}}else for(let we=t.symbolInstanceStart;we<t.symbolInstanceEnd;we++)Se(u.symbolInstances.get(we),u.collisionArrays[we],we);u.justReloaded=!1}storeCollisionData(t,n,a,u,f,y){if(a.textBox||a.iconBox){let b,w;this.collisionBoxArrays.has(t)?b=this.collisionBoxArrays.get(t):(b=new Map,this.collisionBoxArrays.set(t,b)),b.has(n)?w=b.get(n):(w={text:null,icon:null},b.set(n,w)),a.textBox&&(w.text=u.box),a.iconBox&&(w.icon=f.box)}if(y){let b=this.collisionCircleArrays[t];b===void 0&&(b=this.collisionCircleArrays[t]=[]);for(let w=0;w<y.circles.length;w+=4)b.push(y.circles[w+0]-ti),b.push(y.circles[w+1]-ti),b.push(y.circles[w+2]),b.push(y.collisionDetected?1:0)}}markUsedJustification(t,n,a,u){let f;f=u===c.aw.vertical?a.verticalPlacedTextSymbolIndex:{left:a.leftJustifiedTextSymbolIndex,center:a.centerJustifiedTextSymbolIndex,right:a.rightJustifiedTextSymbolIndex}[c.aO(n)];const y=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex,a.verticalPlacedTextSymbolIndex];for(const b of y)b>=0&&(t.text.placedSymbolArray.get(b).crossTileID=f>=0&&b!==f?0:a.crossTileID)}markUsedOrientation(t,n,a){const u=n===c.aw.horizontal||n===c.aw.horizontalOnly?n:0,f=n===c.aw.vertical?n:0,y=[a.leftJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.rightJustifiedTextSymbolIndex];for(const b of y)t.text.placedSymbolArray.get(b).placedOrientation=u;a.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(a.verticalPlacedTextSymbolIndex).placedOrientation=f)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let a=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const u=n?n.symbolFadeChange(t):1,f=n?n.opacities:{},y=n?n.variableOffsets:{},b=n?n.placedOrientations:{};for(const w in this.placements){const S=this.placements[w],P=f[w];P?(this.opacities[w]=new Qn(P,u,S.text,S.icon),a=a||S.text!==P.text.placed||S.icon!==P.icon.placed):(this.opacities[w]=new Qn(null,u,S.text,S.icon,S.skipFade),a=a||S.text||S.icon)}for(const w in f){const S=f[w];if(!this.opacities[w]){const P=new Qn(S,u,!1,!1);P.isHidden()||(this.opacities[w]=P,a=a||S.text.placed||S.icon.placed)}}for(const w in y)this.variableOffsets[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.variableOffsets[w]=y[w]);for(const w in b)this.placedOrientations[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.placedOrientations[w]=b[w]);if(n&&n.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");a?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n){const a={};for(const u of n){const f=u.getBucket(t);f&&u.latestFeatureIndex&&t.id===f.layerIds[0]&&this.updateBucketOpacities(f,u.tileID,a,u.collisionBoxArray)}}updateBucketOpacities(t,n,a,u){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const f=t.layers[0],y=f.layout,b=new Qn(null,0,!1,!1,!0),w=y.get("text-allow-overlap"),S=y.get("icon-allow-overlap"),P=f._unevaluatedLayout.hasValue("text-variable-anchor")||f._unevaluatedLayout.hasValue("text-variable-anchor-offset"),C=y.get("text-rotation-alignment")==="map",A=y.get("text-pitch-alignment")==="map",F=y.get("icon-text-fit")!=="none",V=new Qn(null,0,w&&(S||!t.hasIconData()||y.get("icon-optional")),S&&(w||!t.hasTextData()||y.get("text-optional")),!0);!t.collisionArrays&&u&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(u);const U=(G,Y,ee)=>{for(let X=0;X<Y/4;X++)G.opacityVertexArray.emplaceBack(ee);G.hasVisibleVertices=G.hasVisibleVertices||ee!==vr},q=this.collisionBoxArrays.get(t.bucketInstanceId);for(let G=0;G<t.symbolInstances.length;G++){const Y=t.symbolInstances.get(G),{numHorizontalGlyphVertices:ee,numVerticalGlyphVertices:X,crossTileID:Q}=Y;let te=this.opacities[Q];a[Q]?te=b:te||(te=V,this.opacities[Q]=te),a[Q]=!0;const K=Y.numIconVertices>0,se=this.placedOrientations[Y.crossTileID],me=se===c.aw.vertical,pe=se===c.aw.horizontal||se===c.aw.horizontalOnly;if(ee>0||X>0){const fe=il(te.text);U(t.text,ee,me?vr:fe),U(t.text,X,pe?vr:fe);const Te=te.text.isHidden();[Y.rightJustifiedTextSymbolIndex,Y.centerJustifiedTextSymbolIndex,Y.leftJustifiedTextSymbolIndex].forEach((Oe=>{Oe>=0&&(t.text.placedSymbolArray.get(Oe).hidden=Te||me?1:0)})),Y.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(Y.verticalPlacedTextSymbolIndex).hidden=Te||pe?1:0);const Se=this.variableOffsets[Y.crossTileID];Se&&this.markUsedJustification(t,Se.anchor,Y,se);const we=this.placedOrientations[Y.crossTileID];we&&(this.markUsedJustification(t,"left",Y,we),this.markUsedOrientation(t,we,Y))}if(K){const fe=il(te.icon),Te=!(F&&Y.verticalPlacedIconSymbolIndex&&me);Y.placedIconSymbolIndex>=0&&(U(t.icon,Y.numIconVertices,Te?fe:vr),t.icon.placedSymbolArray.get(Y.placedIconSymbolIndex).hidden=te.icon.isHidden()),Y.verticalPlacedIconSymbolIndex>=0&&(U(t.icon,Y.numVerticalIconVertices,Te?vr:fe),t.icon.placedSymbolArray.get(Y.verticalPlacedIconSymbolIndex).hidden=te.icon.isHidden())}const ce=q&&q.has(G)?q.get(G):{text:null,icon:null};if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const fe=t.collisionArrays[G];if(fe){let Te=new c.P(0,0);if(fe.textBox||fe.verticalTextBox){let Se=!0;if(P){const we=this.variableOffsets[Q];we?(Te=Ja(we.anchor,we.width,we.height,we.textOffset,we.textBoxScale),C&&Te._rotate(A?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Se=!1}if(fe.textBox||fe.verticalTextBox){let we;fe.textBox&&(we=me),fe.verticalTextBox&&(we=pe),Do(t.textCollisionBox.collisionVertexArray,te.text.placed,!Se||we,ce.text,Te.x,Te.y)}}if(fe.iconBox||fe.verticalIconBox){const Se=!!(!pe&&fe.verticalIconBox);let we;fe.iconBox&&(we=Se),fe.verticalIconBox&&(we=!Se),Do(t.iconCollisionBox.collisionVertexArray,te.icon.placed,we,ce.icon,F?Te.x:0,F?Te.y:0)}}}}if(t.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);t.bucketInstanceId in this.collisionCircleArrays&&(t.collisionCircleArray=this.collisionCircleArrays[t.bucketInstanceId],delete this.collisionCircleArrays[t.bucketInstanceId])}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const a=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*a>t}setStale(){this.stale=!0}}function Do(p,t,n,a,u,f){a&&a.length!==0||(a=[0,0,0,0]);const y=a[0]-ti,b=a[1]-ti,w=a[2]-ti,S=a[3]-ti;p.emplaceBack(t?1:0,n?1:0,u||0,f||0,y,b),p.emplaceBack(t?1:0,n?1:0,u||0,f||0,w,b),p.emplaceBack(t?1:0,n?1:0,u||0,f||0,w,S),p.emplaceBack(t?1:0,n?1:0,u||0,f||0,y,S)}const Qa=Math.pow(2,25),xc=Math.pow(2,24),el=Math.pow(2,17),tl=Math.pow(2,16),eh=Math.pow(2,9),zs=Math.pow(2,8),ko=Math.pow(2,1);function il(p){if(p.opacity===0&&!p.placed)return 0;if(p.opacity===1&&p.placed)return 4294967295;const t=p.placed?1:0,n=Math.floor(127*p.opacity);return n*Qa+t*xc+n*el+t*tl+n*eh+t*zs+n*ko+t}const vr=0;class bc{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,n,a,u,f){const y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(y,u,t[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,f())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort(((b,w)=>b.sortKey-w.sortKey)));this._currentPartIndex<y.length;)if(n.placeLayerBucketPart(y[this._currentPartIndex],this._seenCrossTileIDs,a),this._currentPartIndex++,f())return!0;return!1}}class th{constructor(t,n,a,u,f,y,b,w){this.placement=new vc(t,n,y,b,w),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=u,this._showCollisionBoxes=f,this._done=!1}isDone(){return this._done}continuePlacement(t,n,a){const u=be(),f=()=>!this._forceFullPlacement&&be()-u>2;for(;this._currentPlacementIndex>=0;){const y=n[t[this._currentPlacementIndex]],b=this.placement.collisionIndex.transform.zoom;if(c.aQ(y)&&y.layout&&(!y.minzoom||y.minzoom<=b)&&(!y.maxzoom||y.maxzoom>b)){if(this._inProgressLayer||(this._inProgressLayer=new bc(y)),this._inProgressLayer.continuePlacement(a[y.source],this.placement,this._showCollisionBoxes,y,f))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ki=512/c.a5/2;class es{constructor(t,n,a){this.tileID=t,this.bucketInstanceId=a,this._symbolsByKey={};const u=new Map;for(let f=0;f<n.length;f++){const y=n.get(f),b=y.key,w=u.get(b);w?w.push(y):u.set(b,[y])}for(const[f,y]of u){const b={positions:y.map((w=>({x:Math.floor(w.anchorX*Ki),y:Math.floor(w.anchorY*Ki)}))),crossTileIDs:y.map((w=>w.crossTileID))};if(b.positions.length>128){const w=new c.aR(b.positions.length,16,Uint16Array);for(const{x:S,y:P}of b.positions)w.add(S,P);w.finish(),delete b.positions,b.index=w}this._symbolsByKey[f]=b}}getScaledCoordinates(t,n){const{x:a,y:u,z:f}=this.tileID.canonical,{x:y,y:b,z:w}=n.canonical,S=Ki/Math.pow(2,w-f),P=(b*c.a5+t.anchorY)*S,C=u*c.a5*Ki;return{x:Math.floor((y*c.a5+t.anchorX)*S-a*c.a5*Ki),y:Math.floor(P-C)}}findMatches(t,n,a){const u=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z);for(let f=0;f<t.length;f++){const y=t.get(f);if(y.crossTileID)continue;const b=this._symbolsByKey[y.key];if(!b)continue;const w=this.getScaledCoordinates(y,n);if(b.index){const S=b.index.range(w.x-u,w.y-u,w.x+u,w.y+u).sort();for(const P of S){const C=b.crossTileIDs[P];if(!a[C]){a[C]=!0,y.crossTileID=C;break}}}else if(b.positions)for(let S=0;S<b.positions.length;S++){const P=b.positions[S],C=b.crossTileIDs[S];if(Math.abs(P.x-w.x)<=u&&Math.abs(P.y-w.y)<=u&&!a[C]){a[C]=!0,y.crossTileID=C;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map((({crossTileIDs:t})=>t))}}class rt{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class rl{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const a in this.indexes){const u=this.indexes[a],f={};for(const y in u){const b=u[y];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+n),f[b.tileID.key]=b}this.indexes[a]=f}this.lng=t}addBucket(t,n,a){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let f=0;f<n.symbolInstances.length;f++)n.symbolInstances.get(f).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});const u=this.usedCrossTileIDs[t.overscaledZ];for(const f in this.indexes){const y=this.indexes[f];if(Number(f)>t.overscaledZ)for(const b in y){const w=y[b];w.tileID.isChildOf(t)&&w.findMatches(n.symbolInstances,t,u)}else{const b=y[t.scaledTo(Number(f)).key];b&&b.findMatches(n.symbolInstances,t,u)}}for(let f=0;f<n.symbolInstances.length;f++){const y=n.symbolInstances.get(f);y.crossTileID||(y.crossTileID=a.generate(),u[y.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new es(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const a of n.getCrossTileIDsLists())for(const u of a)delete this.usedCrossTileIDs[t][u]}removeStaleBuckets(t){let n=!1;for(const a in this.indexes){const u=this.indexes[a];for(const f in u)t[u[f].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,u[f]),delete u[f],n=!0)}return n}}class wc{constructor(){this.layerIndexes={},this.crossTileIDs=new rt,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,a){let u=this.layerIndexes[t.id];u===void 0&&(u=this.layerIndexes[t.id]=new rl);let f=!1;const y={};u.handleWrapJump(a);for(const b of n){const w=b.getBucket(t);w&&t.id===w.layerIds[0]&&(w.bucketInstanceId||(w.bucketInstanceId=++this.maxBucketInstanceId),u.addBucket(b.tileID,w,this.crossTileIDs)&&(f=!0),y[w.bucketInstanceId]=!0)}return u.removeStaleBuckets(y)&&(f=!0),f}pruneUnusedLayers(t){const n={};t.forEach((a=>{n[a]=!0}));for(const a in this.layerIndexes)n[a]||delete this.layerIndexes[a]}}var zo="void main() {fragColor=vec4(1.0);}";const Gt={prelude:Ze(`#ifdef GL_ES 3precision mediump float; 4#else 5#if !defined(lowp) 6#define lowp 7#endif 8#if !defined(mediump) 9#define mediump 10#endif 11#if !defined(highp) 12#define highp 13#endif 14#endif 15out highp vec4 fragColor;`,`#ifdef GL_ES 16precision highp float; 17#else 18#if !defined(lowp) 19#define lowp 20#endif 21#if !defined(mediump) 22#define mediump 23#endif 24#if !defined(highp) 25#define highp 26#endif 27#endif 28vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 29);}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);
29return (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 30);} 31#ifdef TERRAIN3D 32uniform 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; 33#endif 34const 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) { 35#ifdef TERRAIN3D 36highp 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)); 37#else 38return 1.0; 39#endif 40}float calculate_visibility(vec4 pos) { 41#ifdef TERRAIN3D 42vec3 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; 43#else 44return 1.0; 45#endif 46}float ele(vec2 pos) { 47#ifdef TERRAIN3D 48vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a; 49#else 50return 0.0; 51#endif 52}float get_elevation(vec2 pos) { 53#ifdef TERRAIN3D 54#ifdef GLOBE 55if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;} 56#endif 57vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration; 58#else 59return 0.0; 60#endif 61}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:Ze("","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:Ze("",`#define GLOBE_RADIUS 6371008.8 62uniform 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;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 63);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY); 64if (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;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len 65);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) {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) {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:Ze(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity; 66#ifdef OVERDRAW_INSPECTOR 67fragColor=vec4(1.0); 68#endif 69}`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:Ze(`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;
69uniform 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; 70#ifdef OVERDRAW_INSPECTOR 71fragColor=vec4(1.0); 72#endif 73}`,"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;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);}"),circle:Ze(`in vec3 v_data;in float v_visibility; 74#pragma mapbox: define highp vec4 color 75#pragma mapbox: define mediump float radius 76#pragma mapbox: define lowp float blur 77#pragma mapbox: define lowp float opacity 78#pragma mapbox: define highp vec4 stroke_color 79#pragma mapbox: define mediump float stroke_width 80#pragma mapbox: define lowp float stroke_opacity 81void main() { 82#pragma mapbox: initialize highp vec4 color 83#pragma mapbox: initialize mediump float radius 84#pragma mapbox: initialize lowp float blur 85#pragma mapbox: initialize lowp float opacity 86#pragma mapbox: initialize highp vec4 stroke_color 87#pragma mapbox: initialize mediump float stroke_width 88#pragma mapbox: initialize lowp float stroke_opacity 89vec2 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;} 90#ifdef OVERDRAW_INSPECTOR 91fragColor=vec4(1.0); 92#endif 93}`,`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;in vec2 a_pos;out vec3 v_data;out float v_visibility; 94#pragma mapbox: define highp vec4 color 95#pragma mapbox: define mediump float radius 96#pragma mapbox: define lowp float blur 97#pragma mapbox: define lowp float opacity 98#pragma mapbox: define highp vec4 stroke_color 99#pragma mapbox: define mediump float stroke_width 100#pragma mapbox: define lowp float stroke_opacity 101void main(void) { 102#pragma mapbox: initialize highp vec4 color 103#pragma mapbox: initialize mediump float radius 104#pragma mapbox: initialize lowp float blur 105#pragma mapbox: initialize lowp float opacity 106#pragma mapbox: initialize highp vec4 stroke_color 107#pragma mapbox: initialize mediump float stroke_width 108#pragma mapbox: initialize lowp float stroke_opacity 109vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) { 110#ifdef GLOBE 111vec3 center_vector=projectToSphere(circle_center); 112#endif 113float 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 { 114#ifdef GLOBE 115vec4 projected_center=interpolateProjection(circle_center,center_vector,ele); 116#else 117vec4 projected_center=projectTileWithElevation(circle_center,ele); 118#endif 119corner_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);} 120#ifdef GLOBE 121vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele); 122#else 123gl_Position=projectTileWithElevation(corner_position,ele); 124#endif 125} 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);}`),clippingMask:Ze(zo,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:Ze(`uniform highp float u_intensity;in vec2 v_extrude; 126#pragma mapbox: define highp float weight 127#define GAUSS_COEF 0.3989422804014327 128void main() { 129#pragma mapbox: initialize highp float weight 130float 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); 131#ifdef OVERDRAW_INSPECTOR 132fragColor=vec4(1.0); 133#endif 134}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude; 135#pragma mapbox: define highp float weight 136#pragma mapbox: define mediump float radius 137const highp float ZERO=1.0/255.0/16.0; 138#define GAUSS_COEF 0.3989422804014327 139void main(void) { 140#pragma mapbox: initialize highp float weight 141#pragma mapbox: initialize mediump float radius 142vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/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=floor(pos_raw/8.0); 143#ifdef GLOBE 144vec2 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); 145#else 146gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center)); 147#endif 148}`),heatmapTexture:Ze(`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; 149#ifdef OVERDRAW_INSPECTOR 150fragColor=vec4(0.0); 151#endif 152}`,"uniform mat4 u_matrix;uniform vec2 u_world;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:Ze("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;}}","in vec2 a_anchor_pos;in vec2 a_placed;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:Ze("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;}","in vec2 a_pos;in float a_radius;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:Ze(`#ifdef GL_ES 153precision highp float; 154#endif 155uniform 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) {float x=(float(stop)+0.5)/float(u_color_ramp_size);vec4 data=texture(u_elevation_stops,vec2(x,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 156{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)); 157#ifdef OVERDRAW_INSPECTOR 158fragColor=vec4(1.0); 159#endif 160}`,"uniform vec2 u_dimension;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:Ze("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);}","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:Ze(zo,`in vec2 a_pos;void main() { 161#ifdef GLOBE 162gl_Position=projectTileFor3D(a_pos,0.0); 163#else 164gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0); 165#endif 166}`),fill:Ze(`#pragma mapbox: define highp vec4 color 167#pragma mapbox: define lowp float opacity 168void main() { 169#pragma mapbox: initialize highp vec4 color 170#pragma mapbox: initialize lowp float opacity 171fragColor=color*opacity; 172#ifdef OVERDRAW_INSPECTOR 173fragColor=vec4(1.0); 174#endif 175}`,`uniform vec2 u_fill_translate;in vec2 a_pos; 176#pragma mapbox: define highp vec4 color 177#pragma mapbox: define lowp float opacity 178void main() { 179#pragma mapbox: initialize highp vec4 color 180#pragma mapbox: initialize lowp float opacity 181gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:Ze(`in vec2 v_pos; 182#ifdef GLOBE 183in float v_depth; 184#endif 185#pragma mapbox: define highp vec4 outline_color 186#pragma mapbox: define lowp float opacity 187void main() { 188#pragma mapbox: initialize highp vec4 outline_color 189#pragma mapbox: initialize lowp float opacity 190float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity); 191#ifdef GLOBE 192if (v_depth > 1.0) {discard;} 193#endif 194#ifdef OVERDRAW_INSPECTOR 195fragColor=vec4(1.0); 196#endif 197}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos; 198#ifdef GLOBE 199out float v_depth; 200#endif 201#pragma mapbox: define highp vec4 outline_color 202#pragma mapbox: define lowp float opacity 203void main() { 204#pragma mapbox: initialize highp vec4 outline_color 205#pragma mapbox: initialize lowp float opacity 206gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 207#ifdef GLOBE 208v_depth=gl_Position.z/gl_Position.w; 209#endif 210}`),fillOutlinePattern:Ze(`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; 211#ifdef GLOBE 212in float v_depth; 213#endif 214#pragma mapbox: define lowp float opacity 215#pragma mapbox: define lowp vec4 pattern_from 216#pragma mapbox: define lowp vec4 pattern_to 217void main() { 218#pragma mapbox: initialize lowp float opacity 219#pragma mapbox: initialize mediump vec4 pattern_from 220#pragma mapbox: initialize mediump vec4 pattern_to 221vec2 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; 222#ifdef GLOBE 223if (v_depth > 1.0) {discard;} 224#endif 225#ifdef OVERDRAW_INSPECTOR 226fragColor=vec4(1.0); 227#endif 228}`,`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;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos; 229#ifdef GLOBE 230out float v_depth; 231#endif 232#pragma mapbox: define lowp float opacity 233#pragma mapbox: define lowp vec4 pattern_from 234#pragma mapbox: define lowp vec4 pattern_to 235#pragma mapbox: define lowp float pixel_ratio_from 236#pragma mapbox: define lowp float pixel_ratio_to 237void main() { 238#pragma mapbox: initialize lowp float opacity 239#pragma mapbox: initialize mediump vec4 pattern_from 240#pragma mapbox: initialize mediump vec4 pattern_to 241#pragma mapbox: initialize lowp float pixel_ratio_from 242#pragma mapbox: initialize lowp float pixel_ratio_to 243vec2 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; 244#ifdef GLOBE 245v_depth=gl_Position.z/gl_Position.w; 246#endif 247}`),fillPattern:Ze(`#ifdef GL_ES 248precision highp float; 249#endif 250uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b; 251#pragma mapbox: define lowp float opacity 252#pragma mapbox: define lowp vec4 pattern_from 253#pragma mapbox: define lowp vec4 pattern_to 254void main() { 255#pragma mapbox: initialize lowp float opacity 256#pragma mapbox: initialize mediump vec4 pattern_from 257#pragma mapbox: initialize mediump vec4 pattern_to 258vec2 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; 259#ifdef OVERDRAW_INSPECTOR 260fragColor=vec4(1.0); 261#endif 262}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b; 263#pragma mapbox: define lowp float opacity 264#pragma mapbox: define lowp vec4 pattern_from 265#pragma mapbox: define lowp vec4 pattern_to 266#pragma mapbox: define lowp float pixel_ratio_from 267#pragma mapbox: define lowp float pixel_ratio_to 268void main() { 269#pragma mapbox: initialize lowp float opacity 270#pragma mapbox: initialize mediump vec4 pattern_from 271#pragma mapbox: initialize mediump vec4 pattern_to 272#pragma mapbox: initialize lowp float pixel_ratio_from 273#pragma mapbox: initialize lowp float pixel_ratio_to 274vec2 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_siz
274e_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:Ze(`in vec4 v_color;void main() {fragColor=v_color; 275#ifdef OVERDRAW_INSPECTOR 276fragColor=vec4(1.0); 277#endif 278}`,`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;in vec2 a_pos;in vec4 a_normal_ed; 279#ifdef TERRAIN3D 280in vec2 a_centroid; 281#endif 282out vec4 v_color; 283#pragma mapbox: define highp float base 284#pragma mapbox: define highp float height 285#pragma mapbox: define highp vec4 color 286void main() { 287#pragma mapbox: initialize highp float base 288#pragma mapbox: initialize highp float height 289#pragma mapbox: initialize highp vec4 color 290vec3 normal=a_normal_ed.xyz; 291#ifdef TERRAIN3D 292float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 293#else 294float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 295#endif 296base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; 297#ifdef GLOBE 298vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 299#else 300gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 301#endif 302float 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); 303#ifdef GLOBE 304mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition); 305#endif 306directional=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:Ze(`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; 307#pragma mapbox: define lowp float base 308#pragma mapbox: define lowp float height 309#pragma mapbox: define lowp vec4 pattern_from 310#pragma mapbox: define lowp vec4 pattern_to 311#pragma mapbox: define lowp float pixel_ratio_from 312#pragma mapbox: define lowp float pixel_ratio_to 313void main() { 314#pragma mapbox: initialize lowp float base 315#pragma mapbox: initialize lowp float height 316#pragma mapbox: initialize mediump vec4 pattern_from 317#pragma mapbox: initialize mediump vec4 pattern_to 318#pragma mapbox: initialize lowp float pixel_ratio_from 319#pragma mapbox: initialize lowp float pixel_ratio_to 320vec2 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; 321#ifdef OVERDRAW_INSPECTOR 322fragColor=vec4(1.0); 323#endif 324}`,`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;in vec2 a_pos;in vec4 a_normal_ed; 325#ifdef TERRAIN3D 326in vec2 a_centroid; 327#endif 328#ifdef GLOBE 329out vec3 v_sphere_pos; 330#endif 331out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting; 332#pragma mapbox: define lowp float base 333#pragma mapbox: define lowp float height 334#pragma mapbox: define lowp vec4 pattern_from 335#pragma mapbox: define lowp vec4 pattern_to 336#pragma mapbox: define lowp float pixel_ratio_from 337#pragma mapbox: define lowp float pixel_ratio_to 338void main() { 339#pragma mapbox: initialize lowp float base 340#pragma mapbox: initialize lowp float height 341#pragma mapbox: initialize mediump vec4 pattern_from 342#pragma mapbox: initialize mediump vec4 pattern_to 343#pragma mapbox: initialize lowp float pixel_ratio_from 344#pragma mapbox: initialize lowp float pixel_ratio_to 345vec2 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=a_normal_ed.xyz;float edgedistance=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; 346#ifdef TERRAIN3D 347float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0); 348#else 349float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0; 350#endif 351base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate; 352#ifdef GLOBE 353vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation); 354#else 355gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0); 356#endif 357vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0 358? a_pos 359: 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:Ze(`#ifdef GL_ES 360precision highp float; 361#endif 362uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);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/p
362ow(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); 363#ifdef OVERDRAW_INSPECTOR 364fragColor=vec4(1.0); 365#endif 366}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Ze(`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]; 367#define PI 3.141592653589793 368#define STANDARD 0 369#define COMBINED 1 370#define IGOR 2 371#define MULTIDIRECTIONAL 3 372#define BASIC 4 373float 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 374{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 375{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);} 376#ifdef OVERDRAW_INSPECTOR 377fragColor=vec4(1.0); 378#endif 379}`,"uniform mat4 u_matrix;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:Ze(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale; 380#ifdef GLOBE 381in float v_depth; 382#endif 383#pragma mapbox: define highp vec4 color 384#pragma mapbox: define lowp float blur 385#pragma mapbox: define lowp float opacity 386void main() { 387#pragma mapbox: initialize highp vec4 color 388#pragma mapbox: initialize lowp float blur 389#pragma mapbox: initialize lowp float opacity 390float 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); 391#ifdef GLOBE 392if (v_depth > 1.0) {discard;} 393#endif 394#ifdef OVERDRAW_INSPECTOR 395fragColor=vec4(1.0); 396#endif 397}`,` 398#define scale 0.015873016 399in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;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; 400#ifdef GLOBE 401out float v_depth; 402#endif 403#pragma mapbox: define highp vec4 color 404#pragma mapbox: define lowp float blur 405#pragma mapbox: define lowp float opacity 406#pragma mapbox: define mediump float gapwidth 407#pragma mapbox: define lowp float offset 408#pragma mapbox: define mediump float width 409void main() { 410#pragma mapbox: initialize highp vec4 color 411#pragma mapbox: initialize lowp float blur 412#pragma mapbox: initialize lowp float opacity 413#pragma mapbox: initialize mediump float gapwidth 414#pragma mapbox: initialize lowp float offset 415#pragma mapbox: initialize mediump float width 416float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=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);
416float 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; 417#ifdef GLOBE 418v_depth=gl_Position.z/gl_Position.w; 419#endif 420#ifdef TERRAIN3D 421v_gamma_scale=1.0; 422#else 423float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 424#endif 425v_width2=vec2(outset,inset);}`),lineGradient:Ze(`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; 426#ifdef GLOBE 427in float v_depth; 428#endif 429#pragma mapbox: define lowp float blur 430#pragma mapbox: define lowp float opacity 431void main() { 432#pragma mapbox: initialize lowp float blur 433#pragma mapbox: initialize lowp float opacity 434float 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); 435#ifdef GLOBE 436if (v_depth > 1.0) {discard;} 437#endif 438#ifdef OVERDRAW_INSPECTOR 439fragColor=vec4(1.0); 440#endif 441}`,` 442#define scale 0.015873016 443in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;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 float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv; 444#ifdef GLOBE 445out float v_depth; 446#endif 447#pragma mapbox: define lowp float blur 448#pragma mapbox: define lowp float opacity 449#pragma mapbox: define mediump float gapwidth 450#pragma mapbox: define lowp float offset 451#pragma mapbox: define mediump float width 452void main() { 453#pragma mapbox: initialize lowp float blur 454#pragma mapbox: initialize lowp float opacity 455#pragma mapbox: initialize mediump float gapwidth 456#pragma mapbox: initialize lowp float offset 457#pragma mapbox: initialize mediump float width 458float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;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=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=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; 459#ifdef GLOBE 460v_depth=gl_Position.z/gl_Position.w; 461#endif 462#ifdef TERRAIN3D 463v_gamma_scale=1.0; 464#else 465float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 466#endif 467v_width2=vec2(outset,inset);}`),linePattern:Ze(`#ifdef GL_ES 468precision highp float; 469#endif 470uniform 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; 471#ifdef GLOBE 472in float v_depth; 473#endif 474#pragma mapbox: define lowp vec4 pattern_from 475#pragma mapbox: define lowp vec4 pattern_to 476#pragma mapbox: define lowp float pixel_ratio_from 477#pragma mapbox: define lowp float pixel_ratio_to 478#pragma mapbox: define lowp float blur 479#pragma mapbox: define lowp float opacity 480void main() { 481#pragma mapbox: initialize mediump vec4 pattern_from 482#pragma mapbox: initialize mediump vec4 pattern_to 483#pragma mapbox: initialize lowp float pixel_ratio_from 484#pragma mapbox: initialize lowp float pixel_ratio_to 485#pragma mapbox: initialize lowp float blur 486#pragma mapbox: initialize lowp float opacity 487vec2 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; 488#ifdef GLOBE 489if (v_depth > 1.0) {discard;} 490#endif 491#ifdef OVERDRAW_INSPECTOR 492fragColor=vec4(1.0); 493#endif 494}`,` 495#define scale 0.015873016 496#define LINE_DISTANCE_SCALE 2.0 497in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;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; 498#ifdef GLOBE 499out float v_depth; 500#endif 501#pragma mapbox: define lowp float blur 502#pragma mapbox: define lowp float opacity 503#pragma mapbox: define lowp float offset 504#pragma mapbox: define mediump float gapwidth 505#pragma mapbox: define mediump float width 506#pragma mapbox: define lowp float floorwidth 507#pragma mapbox: define lowp vec4 pattern_from 508#pragma mapbox: define lowp vec4 pattern_to 509#pragma mapbox: define lowp float pixel_ratio_from 510#pragma mapbox: define lowp float pixel_ratio_to 511void main() { 512#pragma mapbox: initialize lowp float blur 513#pragma mapbox: initialize lowp float opacity 514#pragma mapbox: initialize lowp float offset 515#pragma mapbox: initialize mediump float gapwidth 516#pragma mapbox: initialize mediump float width 517#pragma mapbox: initialize lowp float floorwidth 518#pragma mapbox: initialize mediump vec4 pattern_from 519#pragma mapbox: initialize mediump vec4 pattern_to 520#pragma mapbox: initialize lowp float pixel_ratio_from 521#pragma mapbox: initialize lowp float pixel_ratio_to 522float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=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);
522float 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; 523#ifdef GLOBE 524v_depth=gl_Position.z/gl_Position.w; 525#endif 526#ifdef TERRAIN3D 527v_gamma_scale=1.0; 528#else 529float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 530#endif 531v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:Ze(`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; 532#ifdef GLOBE 533in float v_depth; 534#endif 535#pragma mapbox: define highp vec4 color 536#pragma mapbox: define lowp float blur 537#pragma mapbox: define lowp float opacity 538#pragma mapbox: define mediump float width 539#pragma mapbox: define lowp float floorwidth 540#pragma mapbox: define mediump vec4 dasharray_from 541#pragma mapbox: define mediump vec4 dasharray_to 542void main() { 543#pragma mapbox: initialize highp vec4 color 544#pragma mapbox: initialize lowp float blur 545#pragma mapbox: initialize lowp float opacity 546#pragma mapbox: initialize mediump float width 547#pragma mapbox: initialize lowp float floorwidth 548#pragma mapbox: initialize mediump vec4 dasharray_from 549#pragma mapbox: initialize mediump vec4 dasharray_to 550float 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);
550float 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); 551#ifdef GLOBE 552if (v_depth > 1.0) {discard;} 553#endif 554#ifdef OVERDRAW_INSPECTOR 555fragColor=vec4(1.0); 556#endif 557}`,` 558#define scale 0.015873016 559#define LINE_DISTANCE_SCALE 2.0 560in vec2 a_pos_normal;in vec4 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 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; 561#ifdef GLOBE 562out float v_depth; 563#endif 564#pragma mapbox: define highp vec4 color 565#pragma mapbox: define lowp float blur 566#pragma mapbox: define lowp float opacity 567#pragma mapbox: define mediump float gapwidth 568#pragma mapbox: define lowp float offset 569#pragma mapbox: define mediump float width 570#pragma mapbox: define lowp float floorwidth 571#pragma mapbox: define mediump vec4 dasharray_from 572#pragma mapbox: define mediump vec4 dasharray_to 573void main() { 574#pragma mapbox: initialize highp vec4 color 575#pragma mapbox: initialize lowp float blur 576#pragma mapbox: initialize lowp float opacity 577#pragma mapbox: initialize mediump float gapwidth 578#pragma mapbox: initialize lowp float offset 579#pragma mapbox: initialize mediump float width 580#pragma mapbox: initialize lowp float floorwidth 581#pragma mapbox: initialize mediump vec4 dasharray_from 582#pragma mapbox: initialize mediump vec4 dasharray_to 583float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=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; 584#ifdef GLOBE 585v_depth=gl_Position.z/gl_Position.w; 586#endif 587#ifdef TERRAIN3D 588v_gamma_scale=1.0; 589#else 590float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 591#endif 592float 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:Ze(`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; 593#ifdef GLOBE 594in float v_depth; 595#endif 596#pragma mapbox: define lowp float blur 597#pragma mapbox: define lowp float opacity 598#pragma mapbox: define mediump float width 599#pragma mapbox: define lowp float floorwidth 600#pragma mapbox: define mediump vec4 dasharray_from 601#pragma mapbox: define mediump vec4 dasharray_to 602void main() { 603#pragma mapbox: initialize lowp float blur 604#pragma mapbox: initialize lowp float opacity 605#pragma mapbox: initialize mediump float width 606#pragma mapbox: initialize lowp float floorwidth 607#pragma mapbox: initialize mediump vec4 dasharray_from 608#pragma mapbox: initialize mediump vec4 dasharray_to 609float 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);
609float 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); 610#ifdef GLOBE 611if (v_depth > 1.0) {discard;} 612#endif 613#ifdef OVERDRAW_INSPECTOR 614fragColor=vec4(1.0); 615#endif 616}`,` 617#define scale 0.015873016 618#define LINE_DISTANCE_SCALE 2.0 619in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;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 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; 620#ifdef GLOBE 621out float v_depth; 622#endif 623#pragma mapbox: define lowp float blur 624#pragma mapbox: define lowp float opacity 625#pragma mapbox: define mediump float gapwidth 626#pragma mapbox: define lowp float offset 627#pragma mapbox: define mediump float width 628#pragma mapbox: define lowp float floorwidth 629#pragma mapbox: define mediump vec4 dasharray_from 630#pragma mapbox: define mediump vec4 dasharray_to 631void main() { 632#pragma mapbox: initialize lowp float blur 633#pragma mapbox: initialize lowp float opacity 634#pragma mapbox: initialize mediump float gapwidth 635#pragma mapbox: initialize lowp float offset 636#pragma mapbox: initialize mediump float width 637#pragma mapbox: initialize lowp float floorwidth 638#pragma mapbox: initialize mediump vec4 dasharray_from 639#pragma mapbox: initialize mediump vec4 dasharray_to 640float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*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=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=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; 641#ifdef GLOBE 642v_depth=gl_Position.z/gl_Position.w; 643#endif 644#ifdef TERRAIN3D 645v_gamma_scale=1.0; 646#else 647float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective; 648#endif 649float 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);}`),raster:Ze(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 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;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.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); 650#ifdef OVERDRAW_INSPECTOR 651fragColor=vec4(1.0); 652#endif 653}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5; 654#ifdef GLOBE 655if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;} 656#endif 657v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:Ze(`uniform sampler2D u_texture;in vec2 v_tex;in float v_total_opacity;void main() {fragColor=texture(u_texture,v_tex)*v_total_opacity; 658#ifdef OVERDRAW_INSPECTOR 659fragColor=vec4(1.0); 660#endif 661}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;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;out vec2 v_tex;out float v_total_opacity; 662#pragma mapbox: define lowp float opacity 663void main() { 664#pragma mapbox: initialize lowp float opacity 665vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);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 ? 666camera_to_anchor_distance/u_camera_to_center_distance : 667u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);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; 668#ifdef GLOBE 669if(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);} 670#endif 671vec4 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:Ze(`#define SDF_PX 8.0 672uniform bool u_is_halo;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; 673#pragma mapbox: define highp vec4 fill_color 674#pragma mapbox: define highp vec4 halo_color 675#pragma mapbox: define lowp float halo_width 676#pragma mapbox: define lowp float halo_blur 677void main() { 678#pragma mapbox: initialize highp vec4 fill_color 679#pragma mapbox: initialize highp vec4 halo_color 680#pragma mapbox: initialize lowp float halo_width 681#pragma mapbox: initialize lowp float halo_blur 682float 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;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*total_opacity); 683#ifdef OVERDRAW_INSPECTOR 684fragColor=vec4(1.0); 685#endif 686}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;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;out vec2 v_data0;out vec3 v_data1; 687#pragma mapbox: define highp vec4 fill_color 688#pragma mapbox: define highp vec4 halo_color 689#pragma mapbox: define lowp float opacity 690#pragma mapbox: define lowp float halo_width 691#pragma mapbox: define lowp float halo_blur 692void main() { 693#pragma mapbox: initialize highp vec4 fill_color 694#pragma mapbox: initialize highp vec4 halo_color 695#pragma mapbox: initialize lowp float opacity 696#pragma mapbox: initialize lowp float halo_width 697#pragma mapbox: initialize lowp float halo_blur 698vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy/16.0;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);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 ? 699camera_to_anchor_distance/u_camera_to_center_distance : 700u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);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; 701#ifdef GLOBE 702if(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);} 703#endif 704vec4 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:Ze(`#define SDF_PX 8.0 705#define SDF 1.0 706#define ICON 0.0 707uniform bool u_is_halo;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 vec4 v_data1; 708#pragma mapbox: define highp vec4 fill_color 709#pragma mapbox: define highp vec4 halo_color 710#pragma mapbox: define lowp float halo_width 711#pragma mapbox: define lowp float halo_blur 712void main() { 713#pragma mapbox: initialize highp vec4 fill_color 714#pragma mapbox: initialize highp vec4 halo_color 715#pragma mapbox: initialize lowp float halo_width 716#pragma mapbox: initialize lowp float halo_blur 717float total_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;
717fragColor=texture(u_texture_icon,tex_icon)*total_opacity; 718#ifdef OVERDRAW_INSPECTOR 719fragColor=vec4(1.0); 720#endif 721return;}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;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*total_opacity); 722#ifdef OVERDRAW_INSPECTOR 723fragColor=vec4(1.0); 724#endif 725}`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;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;out vec4 v_data0;out vec4 v_data1; 726#pragma mapbox: define highp vec4 fill_color 727#pragma mapbox: define highp vec4 halo_color 728#pragma mapbox: define lowp float opacity 729#pragma mapbox: define lowp float halo_width 730#pragma mapbox: define lowp float halo_blur 731void main() { 732#pragma mapbox: initialize highp vec4 fill_color 733#pragma mapbox: initialize highp vec4 halo_color 734#pragma mapbox: initialize lowp float opacity 735#pragma mapbox: initialize lowp float halo_width 736#pragma mapbox: initialize lowp float halo_blur 737vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);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 ? 738camera_to_anchor_distance/u_camera_to_center_distance : 739u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);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; 740#ifdef GLOBE 741if(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);} 742#endif 743vec4 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=vec4(gamma_scale,size,total_opacity,is_sdf);}`),terrain:Ze("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 && 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);
743float 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;}}","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,get_elevation(a_pos3d.xy)-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:Ze("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);}","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;}"),terrainCoords:Ze("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;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);}"),projectionErrorMeasurement:Ze("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:Ze(`#ifdef GL_ES 744precision highp float; 745#endif 746in 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 747);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;}`,"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:Ze("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);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};
vendor: 79,583 bytes, lines 747-796
747function Ze(p,t){const n=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=t.match(/in ([\w]+) ([\w]+)/g),u=p.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),y=f?f.concat(u):u,b={};return{fragmentSource:p=p.replace(n,((w,S,P,C,A)=>(b[A]=!0,S==="define"?` 748#ifndef HAS_UNIFORM_u_${A} 749in ${P} ${C} ${A}; 750#else 751uniform ${P} ${C} u_${A}; 752#endif 753`:` 754#ifdef HAS_UNIFORM_u_${A} 755 ${P} ${C} ${A} = u_${A}; 756#endif 757`))),vertexSource:t=t.replace(n,((w,S,P,C,A)=>{const F=C==="float"?"vec2":"vec4",V=A.match(/color/)?"color":F;return b[A]?S==="define"?` 758#ifndef HAS_UNIFORM_u_${A} 759uniform lowp float u_${A}_t; 760in ${P} ${F} a_${A}; 761out ${P} ${C} ${A}; 762#else 763uniform ${P} ${C} u_${A}; 764#endif 765`:V==="vec4"?` 766#ifndef HAS_UNIFORM_u_${A} 767 ${A} = a_${A}; 768#else 769 ${P} ${C} ${A} = u_${A}; 770#endif 771`:` 772#ifndef HAS_UNIFORM_u_${A} 773 ${A} = unpack_mix_${V}(a_${A}, u_${A}_t); 774#else 775 ${P} ${C} ${A} = u_${A}; 776#endif 777`:S==="define"?` 778#ifndef HAS_UNIFORM_u_${A} 779uniform lowp float u_${A}_t; 780in ${P} ${F} a_${A}; 781#else 782uniform ${P} ${C} u_${A}; 783#endif 784`:V==="vec4"?` 785#ifndef HAS_UNIFORM_u_${A} 786 ${P} ${C} ${A} = a_${A}; 787#else 788 ${P} ${C} ${A} = u_${A}; 789#endif 790`:` 791#ifndef HAS_UNIFORM_u_${A} 792 ${P} ${C} ${A} = unpack_mix_${V}(a_${A}, u_${A}_t); 793#else 794 ${P} ${C} ${A} = u_${A}; 795#endif 796`})),staticAttributes:a,staticUniforms:y}}class Jt{constructor(t,n,a){this.vertexBuffer=t,this.indexBuffer=n,this.segments=a}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var Lt=c.aS([{name:"a_pos",type:"Int16",components:2}]);const Ft="#define PROJECTION_MERCATOR",Tc="mercator";class _i{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Tc}get shaderDefine(){return Ft}get shaderPreludeCode(){return Gt.projectionMercator}get vertexShaderPreludeCode(){return Gt.projectionMercator.vertexSource}get subdivisionGranularity(){return c.aT.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(t){}getMeshFromTileID(t,n,a,u,f){if(this._cachedMesh)return this._cachedMesh;const y=new c.aU;y.emplaceBack(0,0),y.emplaceBack(c.a5,0),y.emplaceBack(0,c.a5),y.emplaceBack(c.a5,c.a5);const b=t.createVertexBuffer(y,Lt.members),w=c.aV.simpleSegment(0,0,4,2),S=new c.aW;return S.emplaceBack(1,0,2),S.emplaceBack(1,2,3),this._cachedMesh=new Jt(b,t.createIndexBuffer(S),w),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(t){}}class yi{constructor(t=0,n=0,a=0,u=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(a)||a<0||isNaN(u)||u<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=a,this.right=u}interpolate(t,n,a){return n.top!=null&&t.top!=null&&(this.top=c.G.number(t.top,n.top,a)),n.bottom!=null&&t.bottom!=null&&(this.bottom=c.G.number(t.bottom,n.bottom,a)),n.left!=null&&t.left!=null&&(this.left=c.G.number(t.left,n.left,a)),n.right!=null&&t.right!=null&&(this.right=c.G.number(t.right,n.right,a)),this}getCenter(t,n){const a=c.ak((this.left+t-this.right)/2,0,t),u=c.ak((this.top+n-this.bottom)/2,0,n);return new c.P(a,u)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new yi(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function vi(p,t){if(!p.renderWorldCopies||p.lngRange)return;const n=t.lng-p.center.lng;t.lng+=n>180?-360:n<-180?360:0}function nl(p){return Math.max(0,Math.floor(p))}class fn{constructor(t,n){var a;this.applyConstrain=(u,f)=>this._constrainOverride!==null?this._constrainOverride(u,f):this._callbacks.defaultConstrain(u,f),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=n?.renderWorldCopies===void 0||!!n?.renderWorldCopies,this._minZoom=n?.minZoom||0,this._maxZoom=n?.maxZoom||22,this._minPitch=n?.minPitch==null?0:n?.minPitch,this._maxPitch=n?.maxPitch==null?60:n?.maxPitch,this._constrainOverride=(a=n?.constrainOverride)!==null&&a!==void 0?a:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new c.V(0,0),this._elevation=0,this._zoom=0,this._tileZoom=nl(this._zoom),this._scale=c.an(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new yi,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,n,a){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=nl(this._zoom),this._scale=c.an(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new yi(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!a&&t.autoCalculateNearFarZ,n&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}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(t){this._minZoom!==t&&(this._minZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.setZoom(this.applyConstrain(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(t){this._minPitch!==t&&(this._minPitch=t,this.setPitch(Math.max(this.pitch,t)))}get maxPitch(){return this._maxPitch}setMaxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.setPitch(Math.min(this.pitch,t)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){t===void 0&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,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.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){const n=c.W(t,-180,180)*Math.PI/180;var a,u,f,y,b,w,S,P,C;this._bearingInRadians!==n&&(this._unmodified=!1,this._bearingInRadians=n,this._calcMatrices(),this._rotationMatrix=he(),a=this._rotationMatrix,f=-this._bearingInRadians,y=(u=this._rotationMatrix)[0],b=u[1],w=u[2],S=u[3],P=Math.sin(f),C=Math.cos(f),a[0]=y*C+w*P,a[1]=b*C+S*P,a[2]=y*-P+w*C,a[3]=b*-P+S*C)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){const n=c.ak(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==n&&(this._unmodified=!1,this._pitchInRadians=n,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){const n=t/180*Math.PI;this._rollInRadians!==n&&(this._unmodified=!1,this._rollInRadians=n,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return c.aX(this._fovInRadians)}setFov(t){t=c.ak(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=c.am(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){const n=this.applyConstrain(this._center,t).zoom;this._zoom!==n&&(this._unmodified=!1,this._zoom=n,this._tileZoom=Math.max(0,Math.floor(n)),this._scale=c.an(n),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,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(t,n){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=n,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,a){this._unmodified=!1,this._edgeInsets.interpolate(t,n,a),this.constrainInternal(),this._calcMatrices()}resize(t,n,a=!0){this._width=t,this._height=n,a&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new mt([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-c.al,c.al])}getCameraQueryGeometry(t,n){if(n.length===1)return[n[0],t];{const{minX:a,minY:u,maxX:f,maxY:y}=c.a7.fromPoints(n).extend(t);return[new c.P(a,u),new c.P(f,u),new c.P(f,y),new c.P(a,y),new c.P(a,u)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const t=this._unmodified,{center:n,zoom:a}=this.applyConstrain(this.center,this.zoom);this.setCenter(n),this.setZoom(a),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=c.ao(new Float64Array(16));c.Q(t,t,[this._width/2,-this._height/2,1]),c.O(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,t=c.ao(new Float64Array(16)),c.Q(t,t,[1,-1,1]),c.O(t,t,[-1,-1,0]),c.Q(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,n,a,u){const f=a!==void 0?a:this.bearing,y=u=u!==void 0?u:this.pitch,{distanceToCenter:b,clampedElevation:w}=this._distanceToCenterFromAltElevationPitch(n,this.elevation,y),{x:S,y:P}=Mo(y,f),C=c.a6.fromLngLat(t,n);let A,F,V=c.aY(1,C.y),U=0;do{if(U+=1,U>10)break;F=b/V,A=new c.a6(C.x+S*F,C.y+P*F),V=1/A.meterInMercatorCoordinateUnits()}while(Math.abs(b-F*V)>1e-12);return{center:A.toLngLat(),elevation:w,zoom:c.aq(this.height/2/Math.tan(this.fovInRadians/2)/F/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;const n=1/this.worldSize,a=c.ap(1,this.center.lat)*this.worldSize,u=c.a6.fromLngLat(this.center,this.elevation),f=u.x/n,y=u.y/n,b=u.z/n,w=this.pitch,S=this.bearing,{x:P,y:C,z:A}=Mo(w,S),F=this.cameraToCenterDistance,V=f+F*-P,U=y+F*-C,q=b+F*A,{distanceToCenter:G,clampedElevation:Y}=this._distanceToCenterFromAltElevationPitch(q/a,t,w),ee=G*a,X=new c.a6((V+P*ee)*n,(U+C*ee)*n,0).toLngLat(),Q=c.ap(1,X.lat),te=c.aq(this.height/2/Math.tan(this.fovInRadians/2)/G/Q/this.tileSize);this._elevation=Y,this._center=X,this.setZoom(te)}_distanceToCenterFromAltElevationPitch(t,n,a){const u=-Math.cos(c.am(a)),f=t-n;let y,b=n;return u*f>=0||Math.abs(u)<.1?(y=1e4,b=t+y*u):y=-f/u,{distanceToCenter:y,clampedElevation:b}}getCameraPoint(){const t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const t=c.ap(1,this.center.lat)*this.worldSize;return Hn(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/t).toLngLat()}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];const n=t.canonical.z>=0?1<<t.canonical.z:Math.pow(2,t.canonical.z);return[t.canonical.x/n,t.canonical.y/n,1/n/c.a5,1/n/c.a5]}}class Rt{constructor(t,n){this.min=t,this.max=n,this.center=c.aZ([],c.a_([],this.min,this.max),.5)}quadrant(t){const n=[t%2==0,t<2],a=c.a$(this.min),u=c.a$(this.max);for(let f=0;f<n.length;f++)a[f]=n[f]?this.min[f]:this.center[f],u[f]=n[f]?this.center[f]:this.max[f];return u[2]=this.max[2],new Rt(a,u)}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 n=!0;for(let a=0;a<t.planes.length;a++){const u=this.intersectsPlane(t.planes[a]);if(u===0)return 0;u===1&&(n=!1)}return n?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 n=t[3],a=t[3];for(let u=0;u<3;u++)t[u]>0?(n+=t[u]*this.min[u],a+=t[u]*this.max[u]):(a+=t[u]*this.min[u],n+=t[u]*this.max[u]);return n>=0?2:a<0?0:1}}class Ls{distanceToTile2d(t,n,a,u){const f=u.distanceX([t,n]),y=u.distanceY([t,n]);return Math.hypot(f,y)}getWrap(t,n,a){return a}getTileBoundingVolume(t,n,a,u){var f,y;let b=0,w=0;if(u?.terrain){const P=new c.a2(t.z,n,t.z,t.x,t.y),C=u.terrain.getMinMaxElevation(P);b=(f=C.minElevation)!==null&&f!==void 0?f:Math.min(0,a),w=(y=C.maxElevation)!==null&&y!==void 0?y:Math.max(0,a)}const S=1<<t.z;return new Rt([n+t.x/S,t.y/S,b],[n+(t.x+1)/S,(t.y+1)/S,w])}allowVariableZoom(t,n){const a=t.fov*(Math.abs(Math.cos(t.rollInRadians))*t.height+Math.abs(Math.sin(t.rollInRadians))*t.width)/t.height,u=c.ak(78.5-a/2,0,60);return!!n.terrain||t.pitch>u}allowWorldCopies(){return!0}prepareNextFrame(){}}class xr{constructor(t,n,a){this.points=t,this.planes=n,this.aabb=a}static fromInvProjectionMatrix(t,n=1,a=0,u,f){const y=f?[[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]],b=Math.pow(2,a),w=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map((A=>(function(F,V,U,q){const G=c.aE([],F,V),Y=1/G[3]/U*q;return c.b4(G,G,[Y,Y,1/G[3],Y])})(A,t,n,b)));u&&(function(A,F,V,U){const q=U?4:0,G=U?0:4;let Y=0;const ee=[],X=[];for(let K=0;K<4;K++){const se=c.b0([],A[K+G],A[K+q]),me=c.b5(se);c.aZ(se,se,1/me),ee.push(me),X.push(se)}for(let K=0;K<4;K++){const se=c.b6(A[K+q],X[K],V);Y=se!==null&&se>=0?Math.max(Y,se):Math.max(Y,ee[K])}const Q=(function(K,se){const me=c.b0([],K[se[0]],K[se[1]]),pe=c.b0([],K[se[2]],K[se[1]]),ce=[0,0,0,0];return c.b1(ce,c.b2([],me,pe)),ce[3]=-c.b3(ce,K[se[0]]),ce})(A,F),te=(function(K,se){const me=c.b7(K),pe=c.b8([],K,1/me),ce=c.b0([],se,c.aZ([],pe,c.b3(se,pe))),fe=c.b7(ce);if(fe>0){const Te=Math.sqrt(1-pe[3]*pe[3]),Se=c.aZ([],pe,-pe[3]),we=c.a_([],Se,c.aZ([],ce,Te/fe));return c.b9(se,we)}return null})(V,Q);if(te!==null){const K=te/c.b3(X[0],Q);Y=Math.min(Y,K)}for(let K=0;K<4;K++){const se=Math.min(Y,ee[K]);A[K+G]=[A[K+q][0]+X[K][0]*se,A[K+q][1]+X[K][1]*se,A[K+q][2]+X[K][2]*se,1]}})(w,y[0],u,f);const S=y.map((A=>{const F=c.b0([],w[A[0]],w[A[1]]),V=c.b0([],w[A[2]],w[A[1]]),U=c.b1([],c.b2([],F,V)),q=-c.b3(U,w[A[1]]);return U.concat(q)})),P=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],C=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const A of w)for(let F=0;F<3;F++)P[F]=Math.min(P[F],A[F]),C[F]=Math.max(C[F],A[F]);return new xr(w,S,new Rt(P,C))}}class Cr{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,n,a){return this._helper.interpolatePadding(t,n,a)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,a=!0){this._helper.resize(t,n,a)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}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,n){}constructor(t){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this.defaultConstrain=(n,a)=>{a=c.ak(+a,this.minZoom,this.maxZoom);const u={center:new c.V(n.lng,n.lat),zoom:a};let f=this._helper._lngRange;if(!this._helper._renderWorldCopies&&f===null){const X=179.9999999999;f=[-X,X]}const y=this.tileSize*c.an(u.zoom);let b=0,w=y,S=0,P=y,C=0,A=0;const{x:F,y:V}=this.size;if(this._helper._latRange){const X=this._helper._latRange;b=c.X(X[1])*y,w=c.X(X[0])*y,w-b<V&&(C=V/(w-b))}f&&(S=c.W(c.Y(f[0])*y,0,y),P=c.W(c.Y(f[1])*y,0,y),P<S&&(P+=y),P-S<F&&(A=F/(P-S)));const{x:U,y:q}=ar(y,n);let G,Y;const ee=Math.max(A||0,C||0);if(ee)return u.center=Wn(y,new c.P(A?(P+S)/2:U,C?(w+b)/2:q)).wrap(),u.zoom+=c.aq(ee),u;if(this._helper._latRange){const X=V/2;q-X<b&&(Y=b+X),q+X>w&&(Y=w-X)}if(f){const X=(S+P)/2;let Q=U;this._helper._renderWorldCopies&&(Q=c.W(U,X-y/2,X+y/2));const te=F/2;Q-te<S&&(G=S+te),Q+te>P&&(G=P-te)}return(G!==void 0||Y!==void 0)&&(u.center=Wn(y,new c.P(G??U,Y??q)).wrap()),u},this.applyConstrain=(n,a)=>this._helper.applyConstrain(n,a),this._helper=new fn({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,a)=>this.defaultConstrain(n,a)},t),this._coveringTilesDetailsProvider=new Ls}clone(){const t=new Cr;return t.apply(this,!1),t}apply(t,n,a){this._helper.apply(t,n,a)}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){const n=[new c.ba(0,t)];if(this._helper._renderWorldCopies){const a=this.screenPointToMercatorCoordinate(new c.P(0,0)),u=this.screenPointToMercatorCoordinate(new c.P(this._helper._width,0)),f=this.screenPointToMercatorCoordinate(new c.P(this._helper._width,this._helper._height)),y=this.screenPointToMercatorCoordinate(new c.P(0,this._helper._height)),b=Math.floor(Math.min(a.x,u.x,f.x,y.x)),w=Math.floor(Math.max(a.x,u.x,f.x,y.x)),S=1;for(let P=b-S;P<=w+S;P++)P!==0&&n.push(new c.ba(P,t))}return n}getCameraFrustum(){return xr.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){const n=this.screenPointToLocation(this.centerPoint,t),a=t?t.getElevationForLngLatZoom(n,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(a)}setLocationAtPoint(t,n){const a=c.ap(this.elevation,this.center.lat),u=this.screenPointToMercatorCoordinateAtZ(n,a),f=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,a),y=c.a6.fromLngLat(t),b=new c.a6(y.x-(u.x-f.x),y.y-(u.y-f.y));this.setCenter(b?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,n){return n?this.coordinatePoint(c.a6.fromLngLat(t),n.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(c.a6.fromLngLat(t))}screenPointToLocation(t,n){var a;return(a=this.screenPointToMercatorCoordinate(t,n))===null||a===void 0?void 0:a.toLngLat()}screenPointToMercatorCoordinate(t,n){if(n){const a=n.pointCoordinate(t);if(a!=null)return a}return this.screenPointToMercatorCoordinateAtZ(t)}screenPointToMercatorCoordinateAtZ(t,n){const a=n||0,u=[t.x,t.y,0,1],f=[t.x,t.y,1,1];c.aE(u,u,this._pixelMatrixInverse),c.aE(f,f,this._pixelMatrixInverse);const y=u[3],b=f[3],w=u[1]/y,S=f[1]/b,P=u[2]/y,C=f[2]/b,A=P===C?0:(a-P)/(C-P);return new c.a6(c.G.number(u[0]/y,f[0]/b,A)/this.worldSize,c.G.number(w,S,A)/this.worldSize,a)}coordinatePoint(t,n=0,a=this._pixelMatrix){const u=[t.x*this.worldSize,t.y*this.worldSize,n,1];return c.aE(u,u,a),new c.P(u[0]/u[3],u[1]/u[3])}getBounds(){const t=Math.max(0,this._helper._height/2-ln(this));return new mt().extend(this.screenPointToLocation(new c.P(0,t))).extend(this.screenPointToLocation(new c.P(this._helper._width,t))).extend(this.screenPointToLocation(new c.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new c.P(0,this._helper._height)))}isPointOnMapSurface(t,n){return n?n.pointCoordinate(t)!=null:t.y>this.height/2-ln(this)}calculatePosMatrix(t,n=!1,a){var u;const f=(u=t.key)!==null&&u!==void 0?u:c.bb(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),y=n?this._alignedPosMatrixCache:this._posMatrixCache;if(y.has(f)){const S=y.get(f);return a?S.f32:S.f64}const b=Cs(t,this.worldSize);c.S(b,n?this._alignedProjMatrix:this._viewProjMatrix,b);const w={f64:b,f32:new Float32Array(b)};return y.set(f,w),a?w.f32:w.f64}calculateFogMatrix(t){const n=t.key,a=this._fogMatrixCacheF32;if(a.has(n))return a.get(n);const u=Cs(t,this.worldSize);return c.S(u,this._fogMatrix,u),a.set(n,new Float32Array(u)),a.get(n)}calculateCenterFromCameraLngLatAlt(t,n,a,u){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,a,u)}_calculateNearFarZIfNeeded(t,n,a){if(!this._helper.autoCalculateNearFarZ)return;const u=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),f=t-u*this._helper._pixelPerMeter/Math.cos(n),y=u<0?f:t,b=Math.PI/2+this.pitchInRadians,w=c.am(this.fov)*(Math.abs(Math.cos(c.am(this.roll)))*this.height+Math.abs(Math.sin(c.am(this.roll)))*this.width)/this.height*(.5+a.y/this.height),S=Math.sin(w)*y/Math.sin(c.ak(Math.PI-b-w,.01,Math.PI-.01)),P=ln(this),C=Math.atan(P/this._helper.cameraToCenterDistance),A=c.am(.75),F=C>A?2*C*(.5+a.y/(2*P)):A,V=Math.sin(F)*y/Math.sin(c.ak(Math.PI-b-F,.01,Math.PI-.01)),U=Math.min(S,V);this._helper._farZ=1.01*(Math.cos(Math.PI/2-n)*U+y),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const t=this.centerOffset,n=ar(this.worldSize,this.center),a=n.x,u=n.y;this._helper._pixelPerMeter=c.ap(1,this.center.lat)*this.worldSize;const f=c.am(Math.min(this.pitch,an)),y=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(f));let b;this._calculateNearFarZIfNeeded(y,f,t),b=new Float64Array(16),c.bc(b,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),c.ay(this._invProjMatrix,b),b[8]=2*-t.x/this._helper._width,b[9]=2*t.y/this._helper._height,this._projectionMatrix=c.bd(b),c.Q(b,b,[1,-1,1]),c.O(b,b,[0,0,-this._helper.cameraToCenterDistance]),c.be(b,b,-this.rollInRadians),c.bf(b,b,this.pitchInRadians),c.be(b,b,-this.bearingInRadians),c.O(b,b,[-a,-u,0]),this._mercatorMatrix=c.Q([],b,[this.worldSize,this.worldSize,this.worldSize]),c.Q(b,b,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=c.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,b),c.O(b,b,[0,0,-this.elevation]),this._viewProjMatrix=b,this._invViewProjMatrix=c.ay([],b);const w=[0,0,-1,1];c.aE(w,w,this._invViewProjMatrix),this._cameraPosition=[w[0]/w[3],w[1]/w[3],w[2]/w[3]],this._fogMatrix=new Float64Array(16),c.bc(this._fogMatrix,this.fovInRadians,this.width/this.height,y,this._helper._farZ),this._fogMatrix[8]=2*-t.x/this.width,this._fogMatrix[9]=2*t.y/this.height,c.Q(this._fogMatrix,this._fogMatrix,[1,-1,1]),c.O(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),c.be(this._fogMatrix,this._fogMatrix,-this.rollInRadians),c.bf(this._fogMatrix,this._fogMatrix,this.pitchInRadians),c.be(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),c.O(this._fogMatrix,this._fogMatrix,[-a,-u,0]),c.Q(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),c.O(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=c.S(new Float64Array(16),this.clipSpaceToPixelsMatrix,b);const S=this._helper._width%2/2,P=this._helper._height%2/2,C=Math.cos(this.bearingInRadians),A=Math.sin(-this.bearingInRadians),F=a-Math.round(a)+C*S+A*P,V=u-Math.round(u)+C*P+A*S,U=new Float64Array(b);if(c.O(U,U,[F>.5?F-1:F,V>.5?V-1:V,0]),this._alignedProjMatrix=U,b=c.ay(new Float64Array(16),this._pixelMatrix),!b)throw new Error("failed to invert matrix");this._pixelMatrixInverse=b,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const t=this.screenPointToMercatorCoordinate(new c.P(0,0)),n=[t.x*this.worldSize,t.y*this.worldSize,0,1];return c.aE(n,n,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const t=c.ap(1,this.center.lat)*this.worldSize;return Hn(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/t).toLngLat()}lngLatToCameraDepth(t,n){const a=c.a6.fromLngLat(t),u=[a.x*this.worldSize,a.y*this.worldSize,n,1];return c.aE(u,u,this._viewProjMatrix),u[2]/u[3]}getProjectionData(t){const{overscaledTileID:n,aligned:a,applyTerrainMatrix:u}=t,f=this._helper.getMercatorTileCoordinates(n),y=n?this.calculatePosMatrix(n,a,!0):null;let b;return b=n&&n.terrainRttPosMatrix32f&&u?n.terrainRttPosMatrix32f:y||c.bg(),{mainMatrix:b,tileMercatorCoords:f,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:b}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,n,a){return 1}transformLightDirection(t){return c.a$(t)}getRayDirectionFromPixel(t){throw new Error("Not implemented.")}projectTileCoordinates(t,n,a,u){const f=this.calculatePosMatrix(a);let y;u?(y=[t,n,u(t,n),1],c.aE(y,y,f)):(y=[t,n,0,1],Ao(y,y,f));const b=y[3];return{point:new c.P(y[0]/b,y[1]/b),signedDistanceFromCamera:b,isOccluded:!1}}populateCache(t){for(const n of t)this.calculatePosMatrix(n)}getMatrixForModel(t,n){const a=c.a6.fromLngLat(t,n),u=a.meterInMercatorCoordinateUnits(),f=c.bh();return c.O(f,f,[a.x,a.y,a.z]),c.be(f,f,Math.PI),c.bf(f,f,Math.PI/2),c.Q(f,f,[-u,u,u]),f}getProjectionDataForCustomLayer(t=!0){const n=new c.a2(0,0,0,0,0),a=this.getProjectionData({overscaledTileID:n,applyGlobeMatrix:t}),u=Cs(n,this.worldSize);c.S(u,this._viewProjMatrix,u),a.tileMercatorCoords=[0,0,1,1];const f=[c.a5,c.a5,this.worldSize/this._helper.pixelsPerMeter],y=c.bi();return c.Q(y,u,f),a.fallbackMatrix=y,a.mainMatrix=y,a}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}}function Ji(){c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function sl(p){if(p.useSlerp)if(p.k<1){const t=c.bj(p.startEulerAngles.roll,p.startEulerAngles.pitch,p.startEulerAngles.bearing),n=c.bj(p.endEulerAngles.roll,p.endEulerAngles.pitch,p.endEulerAngles.bearing),a=new Float64Array(4);c.bk(a,t,n,p.k);const u=c.bl(a);p.tr.setRoll(u.roll),p.tr.setPitch(u.pitch),p.tr.setBearing(u.bearing)}else p.tr.setRoll(p.endEulerAngles.roll),p.tr.setPitch(p.endEulerAngles.pitch),p.tr.setBearing(p.endEulerAngles.bearing);else p.tr.setRoll(c.G.number(p.startEulerAngles.roll,p.endEulerAngles.roll,p.k)),p.tr.setPitch(c.G.number(p.startEulerAngles.pitch,p.endEulerAngles.pitch,p.k)),p.tr.setBearing(c.G.number(p.startEulerAngles.bearing,p.endEulerAngles.bearing,p.k))}function Ar(p,t,n,a,u){const f=u.padding,y=ar(u.worldSize,n.getNorthWest()),b=ar(u.worldSize,n.getNorthEast()),w=ar(u.worldSize,n.getSouthEast()),S=ar(u.worldSize,n.getSouthWest()),P=c.am(-a),C=y.rotate(P),A=b.rotate(P),F=w.rotate(P),V=S.rotate(P),U=new c.P(Math.max(C.x,A.x,V.x,F.x),Math.max(C.y,A.y,V.y,F.y)),q=new c.P(Math.min(C.x,A.x,V.x,F.x),Math.min(C.y,A.y,V.y,F.y)),G=U.sub(q),Y=(u.width-(f.left+f.right+t.left+t.right))/G.x,ee=(u.height-(f.top+f.bottom+t.top+t.bottom))/G.y;if(ee<0||Y<0)return void Ji();const X=Math.min(c.aq(u.scale*Math.min(Y,ee)),p.maxZoom),Q=c.P.convert(p.offset),te=new c.P((t.left-t.right)/2,(t.top-t.bottom)/2).rotate(c.am(a)),K=Q.add(te).mult(u.scale/c.an(X));return{center:Wn(u.worldSize,y.add(w).div(2).sub(K)),zoom:X,bearing:a}}class Lo{get useGlobeControls(){return!1}handlePanInertia(t,n){const a=t.mag(),u=Math.abs(ln(n));return{easingOffset:t.mult(Math.min(.75*u/a,1)),easingCenter:n.center}}handleMapControlsRollPitchBearingZoom(t,n){t.bearingDelta&&n.setBearing(n.bearing+t.bearingDelta),t.pitchDelta&&n.setPitch(n.pitch+t.pitchDelta),t.rollDelta&&n.setRoll(n.roll+t.rollDelta),t.zoomDelta&&n.setZoom(n.zoom+t.zoomDelta)}handleMapControlsPan(t,n,a){t.around.distSqr(n.centerPoint)<.01||n.setLocationAtPoint(a,t.around)}cameraForBoxAndBearing(t,n,a,u,f){return Ar(t,n,a,u,f)}handleJumpToCenterZoom(t,n){t.zoom!==(n.zoom!==void 0?+n.zoom:t.zoom)&&t.setZoom(+n.zoom),n.center!==void 0&&t.setCenter(c.V.convert(n.center))}handleEaseTo(t,n){const a=t.zoom,u=t.padding,f={roll:t.roll,pitch:t.pitch,bearing:t.bearing},y={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},b=n.zoom!==void 0,w=!t.isPaddingEqual(n.padding);let S=!1;const P=b?+n.zoom:t.zoom;let C=t.centerPoint.add(n.offsetAsPoint);const A=t.screenPointToLocation(C),{center:F,zoom:V}=t.applyConstrain(c.V.convert(n.center||A),P??a);vi(t,F);const U=ar(t.worldSize,A),q=ar(t.worldSize,F).sub(U),G=c.an(V-a);return S=V!==a,{easeFunc:Y=>{if(S&&t.setZoom(c.G.number(a,V,Y)),c.bm(f,y)||sl({startEulerAngles:f,endEulerAngles:y,tr:t,k:Y,useSlerp:f.roll!=y.roll}),w&&(t.interpolatePadding(u,n.padding,Y),C=t.centerPoint.add(n.offsetAsPoint)),n.around)t.setLocationAtPoint(n.around,n.aroundPoint);else{const ee=c.an(t.zoom-a),X=Math.pow(V>a?Math.min(2,G):Math.max(.5,G),1-Y),Q=Wn(t.worldSize,U.add(q.mult(Y*X)).mult(ee));t.setLocationAtPoint(t.renderWorldCopies?Q.wrap():Q,C)}},isZooming:S,elevationCenter:F}}handleFlyTo(t,n){const a=n.zoom!==void 0,u=t.zoom,f=t.applyConstrain(c.V.convert(n.center||n.locationAtOffset),a?+n.zoom:u),y=f.center,b=f.zoom;vi(t,y);const w=ar(t.worldSize,n.locationAtOffset),S=ar(t.worldSize,y).sub(w),P=S.mag(),C=c.an(b-u);let A;if(n.minZoom!==void 0){const F=Math.min(+n.minZoom,u,b),V=t.applyConstrain(y,F).zoom;A=c.an(V-u)}return{easeFunc:(F,V,U,q)=>{t.setZoom(F===1?b:u+c.aq(V));const G=F===1?y:Wn(t.worldSize,w.add(S.mult(U)).mult(V));t.setLocationAtPoint(t.renderWorldCopies?G.wrap():G,q)},scaleOfZoom:C,targetCenter:y,scaleOfMinZoom:A,pixelPathLength:P}}}class It{constructor(t,n,a){this.blendFunction=t,this.blendColor=n,this.mask=a}}It.Replace=[1,0],It.disabled=new It(It.Replace,c.bn.transparent,[!1,!1,!1,!1]),It.unblended=new It(It.Replace,c.bn.transparent,[!0,!0,!0,!0]),It.alphaBlended=new It([1,771],c.bn.transparent,[!0,!0,!0,!0]);const ts=2305;class st{constructor(t,n,a){this.enable=t,this.mode=n,this.frontFace=a}}st.disabled=new st(!1,1029,ts),st.backCCW=new st(!0,1029,ts),st.frontCCW=new st(!0,1028,ts);class Xe{constructor(t,n,a){this.func=t,this.mask=n,this.range=a}}Xe.ReadOnly=!1,Xe.ReadWrite=!0,Xe.disabled=new Xe(519,Xe.ReadOnly,[0,1]);const Fs=7680;class at{constructor(t,n,a,u,f,y){this.test=t,this.ref=n,this.mask=a,this.fail=u,this.depthFail=f,this.pass=y}}at.disabled=new at({func:519,mask:0},0,0,Fs,Fs,Fs);const is=new WeakMap;function lr(p){var t;if(is.has(p))return is.get(p);{const n=(t=p.getParameter(p.VERSION))===null||t===void 0?void 0:t.startsWith("WebGL 2.0");return is.set(p,n),n}}class Rs{get awaitingQuery(){return!!this._readbackQueue}constructor(t){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=t;const n=t.context,a=n.gl;this._texFormat=a.RGBA,this._texType=a.UNSIGNED_BYTE;const u=new c.aU;u.emplaceBack(-1,-1),u.emplaceBack(2,-1),u.emplaceBack(-1,2);const f=new c.aW;f.emplaceBack(0,1,2),this._fullscreenTriangle=new Jt(n.createVertexBuffer(u,Lt.members),n.createIndexBuffer(f),c.aV.simpleSegment(0,0,u.length,f.length)),this._resultBuffer=new Uint8Array(4),n.activeTexture.set(a.TEXTURE1);const y=a.createTexture();a.bindTexture(a.TEXTURE_2D,y),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.NEAREST),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.NEAREST),a.texImage2D(a.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=n.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(y),lr(a)&&(this._pbo=a.createBuffer(),a.bindBuffer(a.PIXEL_PACK_BUFFER,this._pbo),a.bufferData(a.PIXEL_PACK_BUFFER,4,a.STREAM_READ),a.bindBuffer(a.PIXEL_PACK_BUFFER,null))}destroy(){const t=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),t.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(t,n){const a=this._updateCount;return this._readbackQueue?a>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():a>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(t,n),this._updateCount++,this._measuredError}_bindFramebuffer(){const t=this._cachedRenderContext.context,n=t.gl;t.activeTexture.set(n.TEXTURE1),n.bindTexture(n.TEXTURE_2D,this._fbo.colorAttachment.get()),t.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(t,n){const a=this._cachedRenderContext.context,u=a.gl;if(this._bindFramebuffer(),a.viewport.set([0,0,this._texWidth,this._texHeight]),a.clear({color:c.bn.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(a,u.TRIANGLES,Xe.disabled,at.disabled,It.unblended,st.disabled,((f,y)=>({u_input:f,u_output_expected:y}))(t,n),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&lr(u)){u.bindBuffer(u.PIXEL_PACK_BUFFER,this._pbo),u.readBuffer(u.COLOR_ATTACHMENT0),u.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),u.bindBuffer(u.PIXEL_PACK_BUFFER,null);const f=u.fenceSync(u.SYNC_GPU_COMMANDS_COMPLETE,0);u.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:f}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const t=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&lr(t)){const n=t.clientWaitSync(this._readbackQueue.sync,0,0);if(n===t.WAIT_FAILED)return c.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(n===t.TIMEOUT_EXPIRED)return;t.bindBuffer(t.PIXEL_PACK_BUFFER,this._pbo),t.getBufferSubData(t.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),t.bindBuffer(t.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),t.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Rs._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(t){let n=0;return n+=t[0]/256,n+=t[1]/65536,n+=t[2]/16777216,t[3]<127&&(n=-n),n/128}}const mn=c.a5/128;function Bs(p,t){const n=p.granularity!==void 0?Math.max(p.granularity,1):1,a=n+(p.generateBorders?2:0),u=n+(p.extendToNorthPole||p.generateBorders?1:0)+(p.extendToSouthPole||p.generateBorders?1:0),f=a+1,y=u+1,b=p.generateBorders?-1:0,w=p.generateBorders||p.extendToNorthPole?-1:0,S=n+(p.generateBorders?1:0),P=n+(p.generateBorders||p.extendToSouthPole?1:0),C=f*y,A=a*u*6,F=f*y>65536;if(F&&t==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const V=F||t==="32bit",U=new Int16Array(2*C);let q=0;for(let ee=w;ee<=P;ee++)for(let X=b;X<=S;X++){let Q=X/n*c.a5;X===-1&&(Q=-mn),X===n+1&&(Q=c.a5+mn);let te=ee/n*c.a5;ee===-1&&(te=p.extendToNorthPole?c.bp:-mn),ee===n+1&&(te=p.extendToSouthPole?c.bq:c.a5+mn),U[q++]=Q,U[q++]=te}const G=V?new Uint32Array(A):new Uint16Array(A);let Y=0;for(let ee=0;ee<u;ee++)for(let X=0;X<a;X++){const Q=X+1+ee*f,te=X+(ee+1)*f,K=X+1+(ee+1)*f;G[Y++]=X+ee*f,G[Y++]=te,G[Y++]=Q,G[Y++]=Q,G[Y++]=te,G[Y++]=K}return{vertices:U.buffer.slice(0),indices:G.buffer.slice(0),uses32bitIndices:V}}const gn=new c.aT({fill:new c.br(128,2),line:new c.br(512,0),tile:new c.br(128,32),stencil:new c.br(128,1),circle:3});class Sc{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}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 Gt.projectionGlobe}get vertexShaderPreludeCode(){return Gt.projectionMercator.vertexSource}get subdivisionGranularity(){return gn}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(t){this._errorMeasurement||(this._errorMeasurement=new Rs(t));const n=c.X(this._errorQueryLatitudeDegrees),a=2*Math.atan(Math.exp(Math.PI-n*Math.PI*2))-.5*Math.PI,u=this._errorMeasurement.updateErrorLoop(n,a),f=be();u!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=u,this._errorMeasurementLastChangeTime=f);const y=Math.min(Math.max((f-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=c.bs(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,c.bt(y))}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,n,a,u,f){const y=(f==="stencil"?gn.stencil:gn.tile).getGranularityForZoomLevel(n.z);return this._getMesh(t,{granularity:y,generateBorders:a,extendToNorthPole:n.y===0&&u,extendToSouthPole:n.y===(1<<n.z)-1&&u})}_getMesh(t,n){const a=this._getMeshKey(n);if(a in this._tileMeshCache)return this._tileMeshCache[a];const u=(function(f,y){const b=Bs(y,"16bit"),w=c.aU.deserialize({arrayBuffer:b.vertices,length:b.vertices.byteLength/2/2}),S=c.aW.deserialize({arrayBuffer:b.indices,length:b.indices.byteLength/2/3});return new Jt(f.createVertexBuffer(w,Lt.members),f.createIndexBuffer(S),c.aV.simpleSegment(0,0,w.length,S.length))})(t,n);return this._tileMeshCache[a]=u,u}recalculate(t){}hasTransition(){const t=be();let n=!1;return n=n||(t-this._errorMeasurementLastChangeTime)/1e3<.7,n=n||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,n}setErrorQueryLatitudeDegrees(t){this._errorQueryLatitudeDegrees=t}}const ol=new c.t({type:new c.D(c.u.projection.type)});class al extends c.E{constructor(t){super(),this._transitionable=new c.x(ol,void 0),this.setProjection(t),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new c.H(0)),this._mercatorProjection=new _i,this._verticalPerspectiveProjection=new Sc}get transitionState(){const t=this.properties.get("type");if(typeof t=="string"&&t==="mercator")return 0;if(typeof t=="string"&&t==="vertical-perspective")return 1;if(t instanceof c.bu){if(t.from==="vertical-perspective"&&t.to==="mercator")return 1-t.transition;if(t.from==="mercator"&&t.to==="vertical-perspective")return t.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}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()}updateGPUdependent(t){this._mercatorProjection.updateGPUdependent(t),this._verticalPerspectiveProjection.updateGPUdependent(t)}getMeshFromTileID(t,n,a,u,f){return this.currentProjection.getMeshFromTileID(t,n,a,u,f)}setProjection(t){this._transitionable.setValue("type",t?.type||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}setErrorQueryLatitudeDegrees(t){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(t),this._mercatorProjection.setErrorQueryLatitudeDegrees(t)}}function Pc(p){const t=Ni(p.worldSize,p.center.lat);return 2*Math.PI*t}function Xt(p,t,n,a,u){const f=1/(1<<u),y=t/c.a5*f+a*f,b=c.bx((p/c.a5*f+n*f)*Math.PI*2+Math.PI,2*Math.PI),w=2*Math.atan(Math.exp(Math.PI-y*Math.PI*2))-.5*Math.PI,S=Math.cos(w),P=new Float64Array(3);return P[0]=Math.sin(b)*S,P[1]=Math.sin(w),P[2]=Math.cos(b)*S,P}function oi(p){return(function(t,n){const a=Math.cos(n),u=new Float64Array(3);return u[0]=Math.sin(t)*a,u[1]=Math.sin(n),u[2]=Math.cos(t)*a,u})(p.lng*Math.PI/180,p.lat*Math.PI/180)}function Ni(p,t){return p/(2*Math.PI)/Math.cos(t*Math.PI/180)}function Os(p){const t=Math.asin(p[1])/Math.PI*180,n=Math.sqrt(p[0]*p[0]+p[2]*p[2]);if(n>1e-6){const a=p[0]/n,u=Math.acos(p[2]/n),f=(a>0?u:-u)/Math.PI*180;return new c.V(c.W(f,-180,180),t)}return new c.V(0,t)}function Vs(p){return Math.cos(p*Math.PI/180)}function ii(p,t){const n=Vs(p),a=Vs(t);return c.aq(a/n)}function _n(p,t){const n=p.rotate(t.bearingInRadians),a=t.zoom+ii(t.center.lat,0),u=c.bs(1/Vs(t.center.lat),1/Vs(Math.min(Math.abs(t.center.lat),60)),c.bv(a,7,3,0,1)),f=360/Pc({worldSize:t.worldSize,center:{lat:t.center.lat}});return new c.V(t.center.lng-n.x*f*u,c.ak(t.center.lat+n.y*f,-c.al,c.al))}function ll(p){const t=.5*p,n=Math.sin(t),a=Math.cos(t);return Math.log(n+a)-Math.log(a-n)}function Ic(p,t,n,a){const u=p.lat+n*a;if(Math.abs(n)>1){const f=(Math.sign(p.lat+n)!==Math.sign(p.lat)?-Math.abs(p.lat):Math.abs(p.lat))*Math.PI/180,y=Math.abs(p.lat+n)*Math.PI/180,b=ll(f+a*(y-f)),w=ll(f),S=ll(y);return new c.V(p.lng+t*((b-w)/(S-w)),u)}return new c.V(p.lng+t*a,u)}class ih{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;const t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,n,a,u){const f=`${t.z}_${t.x}_${t.y}_${u?.terrain?"t":""}`,y=this._cache.get(f);if(y)return y;const b=this._cachePrevious.get(f);if(b)return this._cache.set(f,b),b;const w=this._boundingVolumeFactory(t,n,a,u);return this._cache.set(f,w),this._hadAnyChanges=!0,w}}class rs{constructor(t,n,a,u){this.min=a,this.max=u,this.points=t,this.planes=n}static fromAabb(t,n){const a=[];for(let u=0;u<8;u++)a.push([1&~u?t[0]:n[0],(u>>1&1)==1?n[1]:t[1],(u>>2&1)==1?n[2]:t[2]]);return new rs(a,[[-1,0,0,n[0]],[1,0,0,-t[0]],[0,-1,0,n[1]],[0,1,0,-t[1]],[0,0,-1,n[2]],[0,0,1,-t[2]]],t,n)}static fromCenterSizeAngles(t,n,a){const u=c.bz([],a[0],a[1],a[2]),f=c.bA([],[n[0],0,0],u),y=c.bA([],[0,n[1],0],u),b=c.bA([],[0,0,n[2]],u),w=[...t],S=[...t];for(let C=0;C<8;C++)for(let A=0;A<3;A++){const F=t[A]+f[A]*(1&~C?-1:1)+y[A]*((C>>1&1)==1?1:-1)+b[A]*((C>>2&1)==1?1:-1);w[A]=Math.min(w[A],F),S[A]=Math.max(S[A],F)}const P=[];for(let C=0;C<8;C++){const A=[...t];c.a_(A,A,c.aZ([],f,1&~C?-1:1)),c.a_(A,A,c.aZ([],y,(C>>1&1)==1?1:-1)),c.a_(A,A,c.aZ([],b,(C>>2&1)==1?1:-1)),P.push(A)}return new rs(P,[[...f,-c.b3(f,P[0])],[...y,-c.b3(y,P[0])],[...b,-c.b3(b,P[0])],[-f[0],-f[1],-f[2],-c.b3(f,P[7])],[-y[0],-y[1],-y[2],-c.b3(y,P[7])],[-b[0],-b[1],-b[2],-c.b3(b,P[7])]],w,S)}intersectsFrustum(t){let n=!0;const a=this.points.length,u=this.planes.length,f=t.planes.length,y=t.points.length;for(let b=0;b<f;b++){const w=t.planes[b];let S=0;for(let P=0;P<a;P++){const C=this.points[P];w[0]*C[0]+w[1]*C[1]+w[2]*C[2]+w[3]>=0&&S++}if(S===0)return 0;S<a&&(n=!1)}if(n)return 2;for(let b=0;b<u;b++){const w=this.planes[b];let S=0;for(let P=0;P<y;P++){const C=t.points[P];w[0]*C[0]+w[1]*C[1]+w[2]*C[2]+w[3]>=0&&S++}if(S===0)return 0}return 1}intersectsPlane(t){const n=this.points.length;let a=0;for(let u=0;u<n;u++){const f=this.points[u];t[0]*f[0]+t[1]*f[1]+t[2]*f[2]+t[3]>=0&&a++}return a===n?2:a===0?0:1}}function Fo(p,t,n){const a=p-t;return a<0?-a:Math.max(0,a-n)}function cl(p,t,n,a,u){const f=p-n;let y;return y=f<0?Math.min(-f,1+f-u):f>u?Math.min(Math.max(f-u,0),1-f):0,Math.max(y,Fo(t,a,u))}class Ro{constructor(){this._boundingVolumeCache=new ih(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,n,a,u){const f=1<<a.z,y=1/f,b=a.x/f,w=a.y/f;let S=2;return S=Math.min(S,cl(t,n,b,w,y)),S=Math.min(S,cl(t,n,b+.5,-w-y,y)),S=Math.min(S,cl(t,n,b+.5,2-w-y,y)),S}getWrap(t,n,a){const u=1<<n.z,f=1/u,y=n.x/u,b=Fo(t.x,y,f),w=Fo(t.x,y-1,f),S=Fo(t.x,y+1,f),P=Math.min(b,w,S);return P===S?1:P===w?-1:0}allowVariableZoom(t,n){return Di(t,n)>4}allowWorldCopies(){return!1}getTileBoundingVolume(t,n,a,u){return this._boundingVolumeCache.getTileBoundingVolume(t,n,a,u)}_computeTileBoundingVolume(t,n,a,u){var f,y;let b=0,w=0;if(u?.terrain){const S=new c.a2(t.z,n,t.z,t.x,t.y),P=u.terrain.getMinMaxElevation(S);b=(f=P.minElevation)!==null&&f!==void 0?f:Math.min(0,a),w=(y=P.maxElevation)!==null&&y!==void 0?y:Math.max(0,a)}if(b/=c.bC,w/=c.bC,b+=1,w+=1,t.z<=0)return rs.fromAabb([-w,-w,-w],[w,w,w]);if(t.z===1)return rs.fromAabb([t.x===0?-w:0,t.y===0?0:-w,-w],[t.x===0?0:w,t.y===0?w:0,w]);{const S=[Xt(0,0,t.x,t.y,t.z),Xt(c.a5,0,t.x,t.y,t.z),Xt(c.a5,c.a5,t.x,t.y,t.z),Xt(0,c.a5,t.x,t.y,t.z)],P=[];for(const ce of S)P.push(c.aZ([],ce,w));if(w!==b)for(const ce of S)P.push(c.aZ([],ce,b));t.y===0&&P.push([0,1,0]),t.y===(1<<t.z)-1&&P.push([0,-1,0]);const C=[1,1,1],A=[-1,-1,-1];for(const ce of P)for(let fe=0;fe<3;fe++)C[fe]=Math.min(C[fe],ce[fe]),A[fe]=Math.max(A[fe],ce[fe]);const F=Xt(c.a5/2,c.a5/2,t.x,t.y,t.z),V=c.b2([],[0,1,0],F);c.b1(V,V);const U=c.b2([],F,V);c.b1(U,U);const q=c.b2([],S[2],S[1]);c.b1(q,q);const G=c.b2([],S[0],S[3]);c.b1(G,G),P.push(c.aZ([],F,w)),t.y>=(1<<t.z)/2&&P.push(c.aZ([],Xt(c.a5/2,0,t.x,t.y,t.z),w)),t.y<(1<<t.z)/2&&P.push(c.aZ([],Xt(c.a5/2,c.a5,t.x,t.y,t.z),w));const Y=Bo(F,P),ee=Bo(U,P),X=[-F[0],-F[1],-F[2],Y.max],Q=[F[0],F[1],F[2],-Y.min],te=[-U[0],-U[1],-U[2],ee.max],K=[U[0],U[1],U[2],-ee.min],se=[...q,0],me=[...G,0],pe=[];return t.y===0?pe.push(c.bB(me,se,X),c.bB(me,se,Q)):pe.push(c.bB(te,se,X),c.bB(te,se,Q),c.bB(te,me,X),c.bB(te,me,Q)),t.y===(1<<t.z)-1?pe.push(c.bB(me,se,X),c.bB(me,se,Q)):pe.push(c.bB(K,se,X),c.bB(K,se,Q),c.bB(K,me,X),c.bB(K,me,Q)),new rs(pe,[X,Q,te,K,se,me],C,A)}}}function Bo(p,t){let n=1/0,a=-1/0;for(const u of t){const f=c.b3(p,u);n=Math.min(n,f),a=Math.max(a,f)}return{min:n,max:a}}class yn{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,n,a){return this._helper.interpolatePadding(t,n,a)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n){this._helper.resize(t,n)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}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}setTransitionState(t){}constructor(t){this._cachedClippingPlane=c.bD(),this._projectionMatrix=c.bh(),this._globeViewProjMatrix32f=c.bg(),this._globeViewProjMatrixNoCorrection=c.bh(),this._globeViewProjMatrixNoCorrectionInverted=c.bh(),this._globeProjMatrixInverted=c.bh(),this._cameraPosition=c.by(),this._globeLatitudeErrorCorrectionRadians=0,this.defaultConstrain=(n,a)=>{const u=c.ak(n.lat,-c.al,c.al),f=c.ak(+a,this.minZoom+ii(0,u),this.maxZoom);return{center:new c.V(n.lng,u),zoom:f}},this.applyConstrain=(n,a)=>this._helper.applyConstrain(n,a),this._helper=new fn({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,a)=>this.defaultConstrain(n,a)},t),this._coveringTilesDetailsProvider=new Ro}clone(){const t=new yn;return t.apply(this,!1),t}apply(t,n,a){this._globeLatitudeErrorCorrectionRadians=a||0,this._helper.apply(t,n)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const t=c.by();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){const{overscaledTileID:n,applyGlobeMatrix:a}=t,u=this._helper.getMercatorTileCoordinates(n);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:u,clippingPlane:this._cachedClippingPlane,projectionTransition:a?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(t){const n=this.pitchInRadians,a=this.cameraToCenterDistance/t,u=Math.sin(n)*a,f=Math.cos(n)*a+1,y=1/Math.sqrt(u*u+f*f)*1;let b=-u,w=f;const S=Math.sqrt(b*b+w*w);b/=S,w/=S;const P=[0,b,w];c.bE(P,P,[0,0,0],-this.bearingInRadians),c.bF(P,P,[0,0,0],-1*this.center.lat*Math.PI/180),c.bG(P,P,[0,0,0],this.center.lng*Math.PI/180);const C=1/c.b5(P);return c.aZ(P,P,C),[...P,-y*C]}isLocationOccluded(t){return!this.isSurfacePointVisible(oi(t))}transformLightDirection(t){const n=this._helper._center.lng*Math.PI/180,a=this._helper._center.lat*Math.PI/180,u=Math.cos(a),f=[Math.sin(n)*u,Math.sin(a),Math.cos(n)*u],y=[f[2],0,-f[0]],b=[0,0,0];c.b2(b,y,f),c.b1(y,y),c.b1(b,b);const w=[0,0,0];return c.b1(w,[y[0]*t[0]+b[0]*t[1]+f[0]*t[2],y[1]*t[0]+b[1]*t[1]+f[1]*t[2],y[2]*t[0]+b[2]*t[1]+f[2]*t[2]]),w}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,n,a){const u=(function(b,w,S){const P=1/(1<<S.z);return new c.a6(b/c.a5*P+S.x*P,w/c.a5*P+S.y*P)})(t,n,a.canonical),f=(y=u.y,[c.bx(u.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-y*Math.PI*2))-.5*Math.PI]);var y;return this.getCircleRadiusCorrection()/Math.cos(f[1])}projectTileCoordinates(t,n,a,u){const f=a.canonical,y=Xt(t,n,f.x,f.y,f.z),b=1+(u?u(t,n):0)/c.bC,w=[y[0]*b,y[1]*b,y[2]*b,1];c.aE(w,w,this._globeViewProjMatrixNoCorrection);const S=this._cachedClippingPlane,P=S[0]*y[0]+S[1]*y[1]+S[2]*y[2]+S[3]<0;return{point:new c.P(w[0]/w[3],w[1]/w[3]),signedDistanceFromCamera:w[3],isOccluded:P}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const t=Ni(this.worldSize,this.center.lat),n=c.bi(),a=c.bi();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),c.bc(n,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const u=this.centerOffset;n[8]=2*-u.x/this._helper._width,n[9]=2*u.y/this._helper._height,this._projectionMatrix=c.bd(n),this._globeProjMatrixInverted=c.bi(),c.ay(this._globeProjMatrixInverted,n),c.O(n,n,[0,0,-this.cameraToCenterDistance]),c.be(n,n,this.rollInRadians),c.bf(n,n,-this.pitchInRadians),c.be(n,n,this.bearingInRadians),c.O(n,n,[0,0,-t]);const f=c.by();f[0]=t,f[1]=t,f[2]=t,c.bf(a,n,this.center.lat*Math.PI/180),c.bH(a,a,-this.center.lng*Math.PI/180),c.Q(a,a,f),this._globeViewProjMatrixNoCorrection=a,c.bf(n,n,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),c.bH(n,n,-this.center.lng*Math.PI/180),c.Q(n,n,f),this._globeViewProjMatrix32f=new Float32Array(n),this._globeViewProjMatrixNoCorrectionInverted=c.bi(),c.ay(this._globeViewProjMatrixNoCorrectionInverted,a);const y=c.by();this._cameraPosition=c.by(),this._cameraPosition[2]=this.cameraToCenterDistance/t,c.bE(this._cameraPosition,this._cameraPosition,y,-this.rollInRadians),c.bF(this._cameraPosition,this._cameraPosition,y,this.pitchInRadians),c.bE(this._cameraPosition,this._cameraPosition,y,-this.bearingInRadians),c.a_(this._cameraPosition,this._cameraPosition,[0,0,1]),c.bF(this._cameraPosition,this._cameraPosition,y,-this.center.lat*Math.PI/180),c.bG(this._cameraPosition,this._cameraPosition,y,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);const b=c.bd(this._globeViewProjMatrixNoCorrectionInverted);c.Q(b,b,[1,1,-1]),this._cachedFrustum=xr.fromInvProjectionMatrix(b,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){c.w("calculateFogMatrix is not supported on globe projection.");const n=c.bi();return c.ao(n),n}getVisibleUnwrappedCoordinates(t){return[new c.ba(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t&&c.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,n){if(!this._globeViewProjMatrixNoCorrection)return 1;const a=oi(t);c.aZ(a,a,1+n/c.bC);const u=c.bD();return c.aE(u,[a[0],a[1],a[2],1],this._globeViewProjMatrixNoCorrection),u[2]/u[3]}populateCache(t){}getBounds(){const t=.5*this.width,n=.5*this.height,a=[new c.P(0,0),new c.P(t,0),new c.P(this.width,0),new c.P(this.width,n),new c.P(this.width,this.height),new c.P(t,this.height),new c.P(0,this.height),new c.P(0,n)],u=[];for(const C of a)u.push(this.unprojectScreenPoint(C));let f=0,y=0,b=0,w=0;const S=this.center;for(const C of u){const A=c.bI(S.lng,C.lng),F=c.bI(S.lat,C.lat);A<y&&(y=A),A>f&&(f=A),F<w&&(w=F),F>b&&(b=F)}const P=[S.lng+y,S.lat+w,S.lng+f,S.lat+b];return this.isSurfacePointOnScreen([0,1,0])&&(P[3]=90,P[0]=-180,P[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(P[1]=-90,P[0]=-180,P[2]=180),new mt(P)}calculateCenterFromCameraLngLatAlt(t,n,a,u){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,a,u)}setLocationAtPoint(t,n){const a=oi(this.unprojectScreenPoint(n)),u=oi(t),f=c.by();c.bJ(f);const y=c.by();c.bG(y,a,f,-this.center.lng*Math.PI/180),c.bF(y,y,f,this.center.lat*Math.PI/180);const b=u[0]*u[0]+u[2]*u[2],w=y[0]*y[0];if(b<w)return;const S=Math.sqrt(b-w),P=-S,C=c.bK(u[0],u[2],y[0],S),A=c.bK(u[0],u[2],y[0],P),F=c.by();c.bG(F,u,f,-C);const V=c.bK(F[1],F[2],y[1],y[2]),U=c.by();c.bG(U,u,f,-A);const q=c.bK(U[1],U[2],y[1],y[2]),G=.5*Math.PI,Y=V>=-G&&V<=G,ee=q>=-G&&q<=G;let X,Q;if(Y&&ee){const me=this.center.lng*Math.PI/180,pe=this.center.lat*Math.PI/180;c.bL(C,me)+c.bL(V,pe)<c.bL(A,me)+c.bL(q,pe)?(X=C,Q=V):(X=A,Q=q)}else if(Y)X=C,Q=V;else{if(!ee)return;X=A,Q=q}const te=X/Math.PI*180,K=Q/Math.PI*180,se=this.center.lat;this.setCenter(new c.V(te,c.ak(K,-90,90))),this.setZoom(this.zoom+ii(se,this.center.lat))}locationToScreenPoint(t,n){const a=oi(t);if(n){const u=n.getElevationForLngLatZoom(t,this._helper._tileZoom);c.aZ(a,a,1+u/c.bC)}return this._projectSurfacePointToScreen(a)}_projectSurfacePointToScreen(t){const n=c.bD();return c.aE(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],new c.P((.5*n[0]+.5)*this.width,(.5*-n[1]+.5)*this.height)}screenPointToMercatorCoordinate(t,n){if(n){const a=n.pointCoordinate(t);if(a)return a}return c.a6.fromLngLat(this.unprojectScreenPoint(t))}screenPointToLocation(t,n){var a;return(a=this.screenPointToMercatorCoordinate(t,n))===null||a===void 0?void 0:a.toLngLat()}isPointOnMapSurface(t,n){const a=this._cameraPosition,u=this.getRayDirectionFromPixel(t);return!!this.rayPlanetIntersection(a,u)}getRayDirectionFromPixel(t){const n=c.bD();n[0]=t.x/this.width*2-1,n[1]=-1*(t.y/this.height*2-1),n[2]=1,n[3]=1,c.aE(n,n,this._globeViewProjMatrixNoCorrectionInverted),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3];const a=c.by();a[0]=n[0]-this._cameraPosition[0],a[1]=n[1]-this._cameraPosition[1],a[2]=n[2]-this._cameraPosition[2];const u=c.by();return c.b1(u,a),u}isSurfacePointVisible(t){const n=this._cachedClippingPlane;return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]>=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;const n=c.bD();return c.aE(n,[...t,1],this._globeViewProjMatrixNoCorrection),n[0]/=n[3],n[1]/=n[3],n[2]/=n[3],n[0]>-1&&n[0]<1&&n[1]>-1&&n[1]<1&&n[2]>-1&&n[2]<1}rayPlanetIntersection(t,n){const a=c.b3(t,n),u=c.by(),f=c.by();c.aZ(f,n,a),c.b0(u,t,f);const y=1-c.b3(u,u);if(y<0)return null;const b=c.b3(t,t)-1,w=-a+(a<0?1:-1)*Math.sqrt(y),S=b/w,P=w;return{tMin:Math.min(S,P),tMax:Math.max(S,P)}}unprojectScreenPoint(t){const n=this._cameraPosition,a=this.getRayDirectionFromPixel(t),u=this.rayPlanetIntersection(n,a);if(u){const P=c.by();c.a_(P,n,[a[0]*u.tMin,a[1]*u.tMin,a[2]*u.tMin]);const C=c.by();return c.b1(C,P),Os(C)}const f=this._cachedClippingPlane,y=f[0]*a[0]+f[1]*a[1]+f[2]*a[2],b=-c.b9(f,n)/y,w=c.by();if(b>0)c.a_(w,n,[a[0]*b,a[1]*b,a[2]*b]);else{const P=c.by();c.a_(P,n,[2*a[0],2*a[1],2*a[2]]);const C=c.b9(this._cachedClippingPlane,P);c.b0(w,P,[this._cachedClippingPlane[0]*C,this._cachedClippingPlane[1]*C,this._cachedClippingPlane[2]*C])}const S=(function(P){const C=c.by();return C[0]=P[0]*-P[3],C[1]=P[1]*-P[3],C[2]=P[2]*-P[3],{center:C,radius:Math.sqrt(1-P[3]*P[3])}})(f);return Os((function(P,C,A){const F=c.by();c.b0(F,A,P);const V=c.by();return c.bw(V,P,F,C/c.b7(F)),V})(S.center,S.radius,w))}getMatrixForModel(t,n){const a=c.V.convert(t),u=1/c.bC,f=c.bh();return c.bH(f,f,a.lng/180*Math.PI),c.bf(f,f,-a.lat/180*Math.PI),c.O(f,f,[0,0,1+n/c.bC]),c.bf(f,f,.5*Math.PI),c.Q(f,f,[u,u,u]),f}getProjectionDataForCustomLayer(t=!0){const n=this.getProjectionData({overscaledTileID:new c.a2(0,0,0,0,0),applyGlobeMatrix:t});return n.tileMercatorCoords=[0,0,1,1],n}getFastPathSimpleProjectionMatrix(t){}}class ns{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,n,a){return this._helper.interpolatePadding(t,n,a)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,n,a=!0){this._helper.resize(t,n,a)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,n){this._helper.overrideNearFarZ(t,n)}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}setTransitionState(t,n){this._globeness=t,this._globeLatitudeErrorCorrectionRadians=n,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this.defaultConstrain=(n,a)=>this.currentTransform.defaultConstrain(n,a),this.applyConstrain=(n,a)=>this._helper.applyConstrain(n,a),this._helper=new fn({calcMatrices:()=>{this._calcMatrices()},defaultConstrain:(n,a)=>this.defaultConstrain(n,a)},t),this._globeness=1,this._mercatorTransform=new Cr,this._verticalPerspectiveTransform=new yn}clone(){const t=new ns;return t._globeness=this._globeness,t._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,t.apply(this,!1),t}apply(t,n){this._helper.apply(t,n),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians)}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){const n=this._mercatorTransform.getProjectionData(t),a=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?a.mainMatrix:n.mainMatrix,clippingPlane:a.clippingPlane,tileMercatorCoords:a.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:n.fallbackMatrix}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){return c.bs(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return c.bs(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(t,n,a){const u=this._mercatorTransform.getPitchedTextCorrection(t,n,a),f=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,n,a);return c.bs(u,f,this._globeness)}projectTileCoordinates(t,n,a,u){return this.currentTransform.projectTileCoordinates(t,n,a,u)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1,this._globeLatitudeErrorCorrectionRadians),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._mercatorTransform.recalculateZoomAndCenter(t),this._verticalPerspectiveTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(t,n){return this.currentTransform.lngLatToCameraDepth(t,n)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,n,a,u){return this._helper.calculateCenterFromCameraLngLatAlt(t,n,a,u)}setLocationAtPoint(t,n){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(t,n),void this.apply(this._mercatorTransform,!1);this._verticalPerspectiveTransform.setLocationAtPoint(t,n),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,n){return this.currentTransform.locationToScreenPoint(t,n)}screenPointToMercatorCoordinate(t,n){return this.currentTransform.screenPointToMercatorCoordinate(t,n)}screenPointToLocation(t,n){return this.currentTransform.screenPointToLocation(t,n)}isPointOnMapSurface(t,n){return this.currentTransform.isPointOnMapSurface(t,n)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getMatrixForModel(t,n){return this.currentTransform.getMatrixForModel(t,n)}getProjectionDataForCustomLayer(t=!0){const n=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return n;const a=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return a.fallbackMatrix=n.mainMatrix,a}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}}class Ui{get useGlobeControls(){return!0}handlePanInertia(t,n){const a=_n(t,n);return Math.abs(a.lng-n.center.lng)>180&&(a.lng=n.center.lng+179.5*Math.sign(a.lng-n.center.lng)),{easingCenter:a,easingOffset:new c.P(0,0)}}handleMapControlsRollPitchBearingZoom(t,n){const a=t.around,u=n.screenPointToLocation(a);t.bearingDelta&&n.setBearing(n.bearing+t.bearingDelta),t.pitchDelta&&n.setPitch(n.pitch+t.pitchDelta),t.rollDelta&&n.setRoll(n.roll+t.rollDelta);const f=n.zoom;t.zoomDelta&&n.setZoom(n.zoom+t.zoomDelta);const y=n.zoom-f;if(y===0)return;const b=c.bI(n.center.lng,u.lng),w=b/(Math.abs(b/180)+1),S=c.bI(n.center.lat,u.lat),P=n.getRayDirectionFromPixel(a),C=n.cameraPosition,A=-1*c.b3(C,P),F=c.by();c.a_(F,C,[P[0]*A,P[1]*A,P[2]*A]);const V=c.b5(F)-1,U=Math.exp(.5*-Math.max(V-.3,0)),q=Ni(n.worldSize,n.center.lat)/Math.min(n.width,n.height),G=c.bv(q,.9,.5,1,.25),Y=(1-c.an(-y))*Math.min(U,G),ee=n.center.lat,X=n.zoom,Q=new c.V(n.center.lng+w*Y,c.ak(n.center.lat+S*Y,-c.al,c.al));n.setLocationAtPoint(u,a);const te=n.center,K=c.bv(Math.abs(b),45,85,0,1),se=c.bv(q,.75,.35,0,1),me=Math.pow(Math.max(K,se),.25),pe=c.bI(te.lng,Q.lng),ce=c.bI(te.lat,Q.lat);n.setCenter(new c.V(te.lng+pe*me,te.lat+ce*me).wrap()),n.setZoom(X+ii(ee,n.center.lat))}handleMapControlsPan(t,n,a){if(!t.panDelta)return;const u=n.center.lat,f=n.zoom;n.setCenter(_n(t.panDelta,n).wrap()),n.setZoom(f+ii(u,n.center.lat))}cameraForBoxAndBearing(t,n,a,u,f){const y=Ar(t,n,a,u,f),b=n.left/f.width*2-1,w=(f.width-n.right)/f.width*2-1,S=n.top/f.height*-2+1,P=(f.height-n.bottom)/f.height*-2+1,C=c.bI(a.getWest(),a.getEast())<0,A=C?a.getEast():a.getWest(),F=C?a.getWest():a.getEast(),V=Math.max(a.getNorth(),a.getSouth()),U=Math.min(a.getNorth(),a.getSouth()),q=A+.5*c.bI(A,F),G=V+.5*c.bI(V,U),Y=f.clone();Y.setCenter(y.center),Y.setBearing(y.bearing),Y.setPitch(0),Y.setRoll(0),Y.setZoom(y.zoom);const ee=Y.modelViewProjectionMatrix,X=[oi(a.getNorthWest()),oi(a.getNorthEast()),oi(a.getSouthWest()),oi(a.getSouthEast()),oi(new c.V(F,G)),oi(new c.V(A,G)),oi(new c.V(q,V)),oi(new c.V(q,U))],Q=oi(y.center);let te=Number.POSITIVE_INFINITY;for(const K of X)b<0&&(te=Ui.getLesserNonNegativeNonNull(te,Ui.solveVectorScale(K,Q,ee,"x",b))),w>0&&(te=Ui.getLesserNonNegativeNonNull(te,Ui.solveVectorScale(K,Q,ee,"x",w))),S>0&&(te=Ui.getLesserNonNegativeNonNull(te,Ui.solveVectorScale(K,Q,ee,"y",S))),P<0&&(te=Ui.getLesserNonNegativeNonNull(te,Ui.solveVectorScale(K,Q,ee,"y",P)));if(Number.isFinite(te)&&te!==0)return y.zoom=Math.min(Y.zoom+c.aq(te),t.maxZoom),y;Ji()}handleJumpToCenterZoom(t,n){const a=t.center.lat,u=t.applyConstrain(n.center?c.V.convert(n.center):t.center,t.zoom).center;t.setCenter(u.wrap());const f=n.zoom!==void 0?+n.zoom:t.zoom+ii(a,u.lat);t.zoom!==f&&t.setZoom(f)}handleEaseTo(t,n){const a=t.zoom,u=t.center,f=t.padding,y={roll:t.roll,pitch:t.pitch,bearing:t.bearing},b={roll:n.roll===void 0?t.roll:n.roll,pitch:n.pitch===void 0?t.pitch:n.pitch,bearing:n.bearing===void 0?t.bearing:n.bearing},w=n.zoom!==void 0,S=!t.isPaddingEqual(n.padding);let P=!1;const C=n.center?c.V.convert(n.center):u,A=t.applyConstrain(C,a).center;vi(t,A);const F=t.clone();F.setCenter(A),F.setZoom(w?+n.zoom:a+ii(u.lat,C.lat)),F.setBearing(n.bearing);const V=new c.P(c.ak(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),c.ak(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));F.setLocationAtPoint(A,V);const U=(n.offset&&n.offsetAsPoint.mag())>0?F.center:A,q=w?+n.zoom:a+ii(u.lat,U.lat),G=a+ii(u.lat,0),Y=q+ii(U.lat,0),ee=c.bI(u.lng,U.lng),X=c.bI(u.lat,U.lat),Q=c.an(Y-G);return P=q!==a,{easeFunc:te=>{if(c.bm(y,b)||sl({startEulerAngles:y,endEulerAngles:b,tr:t,k:te,useSlerp:y.roll!=b.roll}),S&&t.interpolatePadding(f,n.padding,te),n.around)c.w("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(n.around,n.aroundPoint);else{const K=Ic(u,ee,X,te*Math.pow(Y>G?Math.min(2,Q):Math.max(.5,Q),1-te));t.setCenter(K.wrap())}if(P){const K=c.G.number(G,Y,te)+ii(0,t.center.lat);t.setZoom(K)}},isZooming:P,elevationCenter:U}}handleFlyTo(t,n){const a=n.zoom!==void 0,u=t.center,f=t.zoom,y=t.padding,b=!t.isPaddingEqual(n.padding),w=t.applyConstrain(c.V.convert(n.center||n.locationAtOffset),f).center,S=a?+n.zoom:t.zoom+ii(t.center.lat,w.lat),P=t.clone();P.setCenter(w),P.setZoom(S),P.setBearing(n.bearing);const C=new c.P(c.ak(t.centerPoint.x+n.offsetAsPoint.x,0,t.width),c.ak(t.centerPoint.y+n.offsetAsPoint.y,0,t.height));P.setLocationAtPoint(w,C);const A=P.center;vi(t,A);const F=(function(X,Q,te){const K=oi(Q),se=oi(te),me=c.b3(K,se),pe=Math.acos(me),ce=Pc(X);return pe/(2*Math.PI)*ce})(t,u,A),V=f+ii(u.lat,0),U=S+ii(A.lat,0),q=c.an(U-V);let G;if(typeof n.minZoom=="number"){const X=+n.minZoom+ii(A.lat,0),Q=Math.min(X,V,U)+ii(0,A.lat),te=t.applyConstrain(A,Q).zoom+ii(A.lat,0);G=c.an(te-V)}const Y=c.bI(u.lng,A.lng),ee=c.bI(u.lat,A.lat);return{easeFunc:(X,Q,te,K)=>{const se=Ic(u,Y,ee,te);b&&t.interpolatePadding(y,n.padding,X);const me=X===1?A:se;t.setCenter(me.wrap());const pe=V+c.aq(Q);t.setZoom(X===1?S:pe+ii(0,me.lat))},scaleOfZoom:q,targetCenter:A,scaleOfMinZoom:G,pixelPathLength:F}}static solveVectorScale(t,n,a,u,f){const y=u==="x"?[a[0],a[4],a[8],a[12]]:[a[1],a[5],a[9],a[13]],b=[a[3],a[7],a[11],a[15]],w=t[0]*y[0]+t[1]*y[1]+t[2]*y[2],S=t[0]*b[0]+t[1]*b[1]+t[2]*b[2],P=n[0]*y[0]+n[1]*y[1]+n[2]*y[2],C=n[0]*b[0]+n[1]*b[1]+n[2]*b[2];return P+f*S===w+f*C||b[3]*(w-P)+y[3]*(C-S)+w*C==P*S?null:(P+y[3]-f*C-f*b[3])/(P-w-f*C+f*S)}static getLesserNonNegativeNonNull(t,n){return n!==null&&n>=0&&n<t?n:t}}class cr{constructor(t){this._globe=t,this._mercatorCameraHelper=new Lo,this._verticalPerspectiveCameraHelper=new Ui}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(t,n){return this.currentHelper.handlePanInertia(t,n)}handleMapControlsRollPitchBearingZoom(t,n){return this.currentHelper.handleMapControlsRollPitchBearingZoom(t,n)}handleMapControlsPan(t,n,a){this.currentHelper.handleMapControlsPan(t,n,a)}cameraForBoxAndBearing(t,n,a,u,f){return this.currentHelper.cameraForBoxAndBearing(t,n,a,u,f)}handleJumpToCenterZoom(t,n){this.currentHelper.handleJumpToCenterZoom(t,n)}handleEaseTo(t,n){return this.currentHelper.handleEaseTo(t,n)}handleFlyTo(t,n){return this.currentHelper.handleFlyTo(t,n)}}const Oo=(p,t)=>c.B(p,t&&t.filter((n=>n.identifier!=="source.canvas"))),ul=c.bM();class vn extends c.E{constructor(t,n={}){var a,u;super(),this._rtlPluginLoaded=()=>{for(const y in this.tileManagers){const b=this.tileManagers[y].getSource().type;b!=="vector"&&b!=="geojson"||this.tileManagers[y].reload()}},this.map=t,this.dispatcher=new Is(rn(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",((y,b)=>this.getGlyphs(y,b))),this.dispatcher.registerMessageHandler("GI",((y,b)=>this.getImages(y,b))),this.dispatcher.registerMessageHandler("GDA",((y,b)=>
796this.getDashes(y,b))),this.imageManager=new Ut,this.imageManager.setEventedParent(this);const f=((a=t._container)===null||a===void 0?void 0:a.lang)||typeof document<"u"&&((u=document.documentElement)===null||u===void 0?void 0:u.lang)||void 0;this.glyphManager=new oe(t._requestManager,n.localIdeographFontFamily,f),this.lineAtlas=new Ye(256,512),this.crossTileSymbolIndex=new wc,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",c.bN()),qr().on(Es,this._rtlPluginLoaded),this.on("data",(y=>{if(y.dataType!=="source"||y.sourceDataType!=="metadata")return;const b=this.tileManagers[y.sourceId];if(!b)return;const w=b.getSource();if(w&&w.vectorLayerIds)for(const S in this._layers){const P=this._layers[S];P.source===w.id&&this._validateLayer(P)}}))}_setInitialValues(){var t;this._spritesImagesIds={},this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new c.bO,this._availableImages=[],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(((t=this.crossTileSymbolIndex)===null||t===void 0?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,n){var a,u,f;this._checkLoaded();const y=n===null?(f=(u=(a=this.stylesheet.state)===null||a===void 0?void 0:a[t])===null||u===void 0?void 0:u.default)!==null&&f!==void 0?f:null:n;if(c.bP(y,this._globalState[t]))return this;this._globalState[t]=y,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();const n=[];for(const a in t)!c.bP(this._globalState[a],t[a].default)&&(n.push(a),this._globalState[a]=t[a].default);this._applyGlobalStateChanges(n)}_applyGlobalStateChanges(t){if(t.length===0)return;const n=new Set,a={};for(const u of t){a[u]=this._globalState[u];for(const f in this._layers){const y=this._layers[f],b=y.getLayoutAffectingGlobalStateRefs(),w=y.getPaintAffectingGlobalStateRefs(),S=y.getVisibilityAffectingGlobalStateRefs();if(b.has(u)&&n.add(y.source),w.has(u))for(const{name:P,value:C}of w.get(u))this._updatePaintProperty(y,P,C);S!=null&&S.has(u)&&(y.recalculateVisibility(),this._updateLayer(y))}}this.dispatcher.broadcast("UGS",a);for(const u in this.tileManagers)n.has(u)&&(this._reloadSource(u),this._changed=!0)}loadURL(t){return c._(this,arguments,void 0,(function*(n,a={},u){this.fire(new c.l("dataloading",{dataType:"style"})),a.validate=typeof a.validate!="boolean"||a.validate,this._loadStyleRequest=new AbortController;const f=this._loadStyleRequest;try{const y=yield this.map._requestManager.transformRequest(n,"Style");c.bQ(f.signal);const b=yield c.j(y,f);this._loadStyleRequest===f&&(this._loadStyleRequest=null),this._load(b.data,a,u)}catch(y){this._loadStyleRequest===f&&(this._loadStyleRequest=null),y&&!f.signal.aborted&&this.fire(new c.k(y))}}))}loadJSON(t,n={},a){this.fire(new c.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,Ee.frameAsync(this._frameRequest,this.map._ownerWindow).then((()=>{this._frameRequest=null,n.validate=n.validate!==!1,this._load(t,n,a)})).catch((()=>{}))}loadEmpty(){this.fire(new c.l("dataloading",{dataType:"style"})),this._load(ul,{validate:!1})}_load(t,n,a){var u,f;let y=n.transformStyle?n.transformStyle(a,t):t;if(!n.validate||!Oo(this,c.C(y))){y=Object.assign({},y),this._loaded=!0,this.stylesheet=y;for(const b in y.sources)this.addSource(b,y.sources[b],{validate:!1});y.sprite?this._loadSprite(y.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(y.glyphs),this._createLayers(),this.light=new ct(this.stylesheet.light),this._setProjectionInternal(((u=this.stylesheet.projection)===null||u===void 0?void 0:u.type)||"mercator"),this.sky=new ot(this.stylesheet.sky),this.map.setTerrain((f=this.stylesheet.terrain)!==null&&f!==void 0?f:null),this.fire(new c.l("data",{dataType:"style"})),this.fire(new c.l("style.load"))}}_createLayers(){var t,n,a;
vendor: 78,035 bytes, lines 796-798
796const u=c.bR(this.stylesheet.layers);this.setGlobalState((t=this.stylesheet.state)!==null&&t!==void 0?t:null),this.dispatcher.broadcast("SL",u),this._order=u.map((f=>f.id)),this._layers={},this._serializedLayers=null;for(const f of u){const y=c.bS(f,this._globalState);if(y.setEventedParent(this,{layer:{id:f.id}}),this._layers[f.id]=y,c.bT(y)&&this.tileManagers[y.source]){const b=(a=(n=f.paint)===null||n===void 0?void 0:n["raster-fade-duration"])!==null&&a!==void 0?a:y.paint.get("raster-fade-duration");this.tileManagers[y.source].setRasterFadeDuration(b)}}}_loadSprite(t,n=!1,a=void 0){this.imageManager.setLoaded(!1);const u=new AbortController;let f;this._spriteRequest=u,(function(y,b,w,S){return c._(this,void 0,void 0,(function*(){const P=ht(y),C=w>1?"@2x":"",A={},F={};for(const{id:V,url:U}of P){const q=yield b.transformRequest(dt(U,C,".json"),"SpriteJSON");A[V]=c.j(q,S);const G=yield b.transformRequest(dt(U,C,".png"),"SpriteImage");F[V]=Be.getImage(G,S)}return yield Promise.all([...Object.values(A),...Object.values(F)]),(function(V,U){return c._(this,void 0,void 0,(function*(){const q={};for(const G in V){q[G]={};const Y=Ee.getImageCanvasContext((yield U[G]).data),ee=(yield V[G]).data;for(const X in ee){const{width:Q,height:te,x:K,y:se,sdf:me,pixelRatio:pe,stretchX:ce,stretchY:fe,content:Te,textFitWidth:Se,textFitHeight:we}=ee[X];q[G][X]={data:null,pixelRatio:pe,sdf:me,stretchX:ce,stretchY:fe,content:Te,textFitWidth:Se,textFitHeight:we,spriteData:{width:Q,height:te,x:K,y:se,context:Y}}}}return q}))})(A,F)}))})(t,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then((y=>{if(this._spriteRequest=null,y)for(const b in y){this._spritesImagesIds[b]=[];const w=this._spritesImagesIds[b]?this._spritesImagesIds[b].filter((S=>!(S in y))):[];for(const S of w)this.imageManager.removeImage(S),this._changedImages[S]=!0;for(const S in y[b]){const P=b==="default"?S:`${b}:${S}`;this._spritesImagesIds[b].push(P),P in this.imageManager.images?this.imageManager.updateImage(P,y[b][S],!1):this.imageManager.addImage(P,y[b][S]),n&&(this._changedImages[P]=!0)}}})).catch((y=>{this._spriteRequest=null,f=y,u.signal.aborted||this.fire(new c.k(f))})).finally((()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),n&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"})),a&&a(f)}))}_unloadSprite(){for(const t of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(t),this._changedImages[t]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"}))}_validateLayer(t){const n=this.tileManagers[t.source];if(!n)return;const a=t.sourceLayer;if(!a)return;const u=n.getSource();(u.type==="geojson"||u.vectorLayerIds&&u.vectorLayerIds.indexOf(a)===-1)&&this.fire(new c.k(new Error(`Source layer "${a}" does not exist on source "${u.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(t,n=!1){const a=this._serializedAllLayers();if(!t||t.length===0)return Object.values(n?c.bU(a):a);const u=[];for(const f of t)if(a[f]){const y=n?c.bU(a[f]):a[f];u.push(y)}return u}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;t=this._serializedLayers={};const n=Object.keys(this._layers);for(const a of n){const u=this._layers[a];u.type!=="custom"&&(t[a]=u.serialize())}return t}hasTransitions(){var t,n,a;if(!((t=this.light)===null||t===void 0)&&t.hasTransition()||!((n=this.sky)===null||n===void 0)&&n.hasTransition()||!((a=this.projection)===null||a===void 0)&&a.hasTransition())return!0;for(const u in this.tileManagers)if(this.tileManagers[u].hasTransition())return!0;for(const u in this._layers)if(this._layers[u].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const n=this._changed;if(n){const u=Object.keys(this._updatedLayers),f=Object.keys(this._removedLayers);(u.length||f.length)&&this._updateWorkerLayers(u,f);for(const y in this._updatedSources){const b=this._updatedSources[y];if(b==="reload")this._reloadSource(y);else{if(b!=="clear")throw new Error(`Invalid action ${b}`);this._clearSource(y)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const y in this._updatedPaintProps)this._layers[y].updateTransitions(t);this.light.updateTransitions(t),this.sky.updateTransitions(t),this._resetUpdates()}const a={};for(const u in this.tileManagers){const f=this.tileManagers[u];a[u]=f.used,f.used=!1}for(const u of this._order){const f=this._layers[u];f.recalculate(t,this._availableImages),!f.isHidden(t.zoom)&&f.source&&(this.tileManagers[f.source].used=!0)}for(const u in a){const f=this.tileManagers[u];!!a[u]!=!!f.used&&f.fire(new c.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:u}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,n&&this.fire(new c.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const n in this.tileManagers)this.tileManagers[n].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,n){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:n})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,n={}){var a;this._checkLoaded();const u=this.serialize();if(t=n.transformStyle?n.transformStyle(u,t):t,((a=n.validate)===null||a===void 0||a)&&Oo(this,c.C(t)))return!1;(t=c.bU(t)).layers=c.bR(t.layers);const f=c.bV(u,t),y=this._getOperationsToPerform(f);if(y.unimplemented.length>0)throw new Error(`Unimplemented: ${y.unimplemented.join(", ")}.`);if(y.operations.length===0)return!1;for(const b of y.operations)b();return this.stylesheet=t,this._serializedLayers=null,this.fire(new c.l("style.load",{style:this})),!0}_getOperationsToPerform(t){const n=[],a=[];for(const u of t)switch(u.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":n.push((()=>this.addLayer.apply(this,u.args)));break;case"removeLayer":n.push((()=>this.removeLayer.apply(this,u.args)));break;case"setPaintProperty":n.push((()=>this.setPaintProperty.apply(this,u.args)));break;case"setLayoutProperty":n.push((()=>this.setLayoutProperty.apply(this,u.args)));break;case"setFilter":n.push((()=>this.setFilter.apply(this,u.args)));break;case"addSource":n.push((()=>this.addSource.apply(this,u.args)));break;case"removeSource":n.push((()=>this.removeSource.apply(this,u.args)));break;case"setLayerZoomRange":n.push((()=>this.setLayerZoomRange.apply(this,u.args)));break;case"setLight":n.push((()=>this.setLight.apply(this,u.args)));break;case"setGeoJSONSourceData":n.push((()=>this.setGeoJSONSourceData.apply(this,u.args)));break;case"setGlyphs":n.push((()=>this.setGlyphs.apply(this,u.args)));break;case"setSprite":n.push((()=>this.setSprite.apply(this,u.args)));break;case"setTerrain":n.push((()=>this.map.setTerrain.apply(this,u.args)));break;case"setSky":n.push((()=>this.setSky.apply(this,u.args)));break;case"setProjection":this.setProjection.apply(this,u.args);break;case"setGlobalState":n.push((()=>this.setGlobalState.apply(this,u.args)));break;case"setTransition":n.push((()=>{}));break;default:a.push(u.command)}return{operations:n,unimplemented:a}}addImage(t,n){if(this.getImage(t))return this.fire(new c.k(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,n),this._afterImageUpdated(t)}updateImage(t,n){this.imageManager.updateImage(t,n)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new c.k(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,n,a={}){if(this._checkLoaded(),this.tileManagers[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(c.C.source,`sources.${t}`,n,null,a))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const u=this.tileManagers[t]=new pi(t,n,this.dispatcher);u.style=this,u.setEventedParent(this,(()=>({isSourceLoaded:u.loaded(),source:u.serialize(),sourceId:t}))),u.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);for(const a in this._layers)if(this._layers[a].source===t)return this.fire(new c.k(new Error(`Source "${t}" cannot be removed while layer "${a}" is using it.`)));const n=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],n.fire(new c.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),n.setEventedParent(null),n.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,n){if(this._checkLoaded(),this.tileManagers[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const a=this.tileManagers[t].getSource();if(a.type!=="geojson")throw new Error(`geojsonSource.type is ${a.type}, which is !== 'geojson`);a.setData(n),this._changed=!0}getSource(t){return this.tileManagers[t]&&this.tileManagers[t].getSource()}addLayer(t,n,a={}){this._checkLoaded();const u=t.id;if(this.getLayer(u))return void this.fire(new c.k(new Error(`Layer "${u}" already exists on this map.`)));let f;if(t.type==="custom"){if(Oo(this,c.bW(t)))return;f=c.bS(t,this._globalState)}else{if("source"in t&&typeof t.source=="object"&&(this.addSource(u,t.source),t=c.bU(t),t=c.e(t,{source:u})),this._validate(c.C.layer,`layers.${u}`,t,{arrayIndex:-1},a))return;f=c.bS(t,this._globalState),this._validateLayer(f),f.setEventedParent(this,{layer:{id:u}})}const y=n?this._order.indexOf(n):this._order.length;if(n&&y===-1)this.fire(new c.k(new Error(`Cannot add layer "${u}" before non-existing layer "${n}".`)));else{if(this._order.splice(y,0,u),this._layerOrderChanged=!0,this._layers[u]=f,this._removedLayers[u]&&f.source&&f.type!=="custom"){const b=this._removedLayers[u];delete this._removedLayers[u],b.type!==f.type?this._updatedSources[f.source]="clear":(this._updatedSources[f.source]="reload",this.tileManagers[f.source].pause())}this._updateLayer(f),f.onAdd&&f.onAdd(this.map)}}moveLayer(t,n){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new c.k(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===n)return;const a=this._order.indexOf(t);this._order.splice(a,1);const u=n?this._order.indexOf(n):this._order.length;n&&u===-1?this.fire(new c.k(new Error(`Cannot move layer "${t}" before non-existing layer "${n}".`))):(this._order.splice(u,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const n=this._layers[t];if(!n)return void this.fire(new c.k(new Error(`Cannot remove non-existing layer "${t}".`)));n.setEventedParent(null);const a=this._order.indexOf(t);this._order.splice(a,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=n,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],n.onRemove&&n.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,n,a){this._checkLoaded();const u=this.getLayer(t);u?u.minzoom===n&&u.maxzoom===a||(n!=null&&(u.minzoom=n),a!=null&&(u.maxzoom=a),this._updateLayer(u)):this.fire(new c.k(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,n,a={}){this._checkLoaded();const u=this.getLayer(t);if(u){if(!c.bP(u.filter,n))return n==null?(u.setFilter(void 0),void this._updateLayer(u)):void(this._validate(c.C.filter,`layers.${u.id}.filter`,n,null,a)||(u.setFilter(c.bU(n)),this._updateLayer(u)))}else this.fire(new c.k(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return c.bU(this.getLayer(t).filter)}setLayoutProperty(t,n,a,u={}){this._checkLoaded();const f=this.getLayer(t);f?c.bP(f.getLayoutProperty(n),a)||(f.setLayoutProperty(n,a,u),this._updateLayer(f)):this.fire(new c.k(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,n){const a=this.getLayer(t);if(a)return a.getLayoutProperty(n);this.fire(new c.k(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,n,a,u={}){this._checkLoaded();const f=this.getLayer(t);f?c.bP(f.getPaintProperty(n),a)||this._updatePaintProperty(f,n,a,u):this.fire(new c.k(new Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,n,a,u={}){t.setPaintProperty(n,a,u)&&this._updateLayer(t),c.bT(t)&&n==="raster-fade-duration"&&this.tileManagers[t.source].setRasterFadeDuration(a),this._changed=!0,this._updatedPaintProps[t.id]=!0,this._serializedLayers=null}getPaintProperty(t,n){return this.getLayer(t).getPaintProperty(n)}setFeatureState(t,n){this._checkLoaded();const a=t.source,u=t.sourceLayer,f=this.tileManagers[a];if(f===void 0)return void this.fire(new c.k(new Error(`The source '${a}' does not exist in the map's style.`)));const y=f.getSource().type;y==="geojson"&&u?this.fire(new c.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):y!=="vector"||u?(t.id===void 0&&this.fire(new c.k(new Error("The feature id parameter must be provided."))),f.setFeatureState(u,t.id,n)):this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,n){this._checkLoaded();const a=t.source,u=this.tileManagers[a];if(u===void 0)return void this.fire(new c.k(new Error(`The source '${a}' does not exist in the map's style.`)));const f=u.getSource().type,y=f==="vector"?t.sourceLayer:void 0;f!=="vector"||y?n&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new c.k(new Error("A feature id is required to remove its specific state property."))):u.removeFeatureState(y,t.id,n):this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const n=t.source,a=t.sourceLayer,u=this.tileManagers[n];if(u!==void 0)return u.getSource().type!=="vector"||a?(t.id===void 0&&this.fire(new c.k(new Error("The feature id parameter must be provided."))),u.getFeatureState(a,t.id)):void this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.k(new Error(`The source '${n}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const t=c.bX(this.tileManagers,(f=>f.serialize())),n=this._serializeByIds(this._order,!0),a=this.map.getTerrain()||void 0,u=this.stylesheet;return c.bY({version:u.version,name:u.name,metadata:u.metadata,light:u.light,sky:u.sky,center:u.center,zoom:u.zoom,bearing:u.bearing,pitch:u.pitch,sprite:u.sprite,glyphs:u.glyphs,transition:u.transition,projection:u.projection,sources:t,layers:n,terrain:a},(f=>f!==void 0))}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.tileManagers[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){const n=y=>this._layers[y].type==="fill-extrusion",a={},u=[];for(let y=this._order.length-1;y>=0;y--){const b=this._order[y];if(n(b)){a[b]=y;for(const w of t){const S=w[b];if(S)for(const P of S)u.push(P)}}}u.sort(((y,b)=>b.intersectionZ-y.intersectionZ));const f=[];for(let y=this._order.length-1;y>=0;y--){const b=this._order[y];if(n(b))for(let w=u.length-1;w>=0;w--){const S=u[w].feature;if(a[S.layer.id]<y)break;f.push(S),u.pop()}else for(const w of t){const S=w[b];if(S)for(const P of S)f.push(P.feature)}}return f}queryRenderedFeatures(t,n,a){n&&n.filter&&this._validate(c.C.filter,"queryRenderedFeatures.filter",n.filter,null,n);const u={};if(n&&n.layers){if(!(Array.isArray(n.layers)||n.layers instanceof Set))return this.fire(new c.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const S of n.layers){const P=this._layers[S];if(!P)return this.fire(new c.k(new Error(`The layer '${S}' does not exist in the map's style and cannot be queried for features.`))),[];u[P.source]=!0}}const f=[];n.availableImages=this._availableImages;const y=this._serializedAllLayers(),b=n.layers instanceof Set?n.layers:Array.isArray(n.layers)?new Set(n.layers):null,w=Object.assign(Object.assign({},n),{layers:b,globalState:this._globalState});for(const S in this.tileManagers)n.layers&&!u[S]||f.push(Bi(this.tileManagers[S],this._layers,y,t,w,a,this.map.terrain?(P,C,A)=>this.map.terrain.getElevation(P,C,A):void 0));return this.placement&&f.push((function(S,P,C,A,F,V,U){const q={},G=V.queryRenderedSymbols(A),Y=[];for(const ee of Object.keys(G).map(Number))Y.push(U[ee]);Y.sort(Un);for(const ee of Y){const X=ee.featureIndex.lookupSymbolFeatures(G[ee.bucketInstanceId],P,ee.bucketIndex,ee.sourceLayerIndex,{filterSpec:F.filter,globalState:F.globalState},F.layers,F.availableImages,S);for(const Q in X){const te=q[Q]=q[Q]||[],K=X[Q];K.sort(((se,me)=>{const pe=ee.featureSortOrder;if(pe){const ce=pe.indexOf(se.featureIndex);return pe.indexOf(me.featureIndex)-ce}return me.featureIndex-se.featureIndex}));for(const se of K)te.push(se)}}return(function(ee,X,Q){for(const te in ee)for(const K of ee[te])$n(K,Q[X[te].source]);return ee})(q,S,C)})(this._layers,y,this.tileManagers,t,w,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(f)}querySourceFeatures(t,n){n!=null&&n.filter&&this._validate(c.C.filter,"querySourceFeatures.filter",n.filter,null,n);const a=this.tileManagers[t];return a?(function(u,f){const y=u.getRenderableIds().map((S=>u.getTileByID(S))),b=[],w={};for(let S=0;S<y.length;S++){const P=y[S],C=P.tileID.canonical.key;w[C]||(w[C]=!0,P.querySourceFeatures(b,f))}return b})(a,n?Object.assign(Object.assign({},n),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,n={}){this._checkLoaded();const a=this.light.getLight();let u=!1;for(const y in t)if(!c.bP(t[y],a[y])){u=!0;break}if(!u)return;const f={now:be(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,n),this.light.updateTransitions(f)}getProjection(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.projection}setProjection(t){this._checkLoaded();const n=t??{type:"mercator"};if(this.stylesheet.projection=t,this.projection){if(this.projection.name===n.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(n.type)}getSky(){var t;return(t=this.stylesheet)===null||t===void 0?void 0:t.sky}setSky(t,n={}){this._checkLoaded();const a=this.getSky();let u=!1;if(!t&&!a)return;if(t&&!a)u=!0;else if(!t&&a)u=!0;else for(const y in t)if(!c.bP(t[y],a[y])){u=!0;break}if(!u)return;const f={now:be(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,n),this.sky.updateTransitions(f)}_setProjectionInternal(t){const n=(function(a,u){const f={constrainOverride:u};if(Array.isArray(a)){const y=new al({type:a});return{projection:y,transform:new ns(f),cameraHelper:new cr(y)}}switch(a){case"mercator":return{projection:new _i,transform:new Cr(f),cameraHelper:new Lo};case"globe":{const y=new al({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:y,transform:new ns(f),cameraHelper:new cr(y)}}case"vertical-perspective":return{projection:new Sc,transform:new yn(f),cameraHelper:new Ui};default:return c.w(`Unknown projection name: ${a}. Falling back to mercator projection.`),{projection:new _i,transform:new Cr(f),cameraHelper:new Lo}}})(t,this.map.transformConstrain);this.projection=n.projection,this.map.migrateProjection(n.transform,n.cameraHelper);for(const a in this.tileManagers)this.tileManagers[a].reload()}_validate(t,n,a,u,f={}){return(!f||f.validate!==!1)&&Oo(this,t.call(c.C,c.e({key:n,style:this.serialize(),value:a,styleSpec:c.u},u)))}_remove(t=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),qr().off(Es,this._rtlPluginLoaded);for(const n in this._layers)this._layers[n].setEventedParent(null);for(const n in this.tileManagers){const a=this.tileManagers[n];a.setEventedParent(null),a.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(const n in this.tileManagers)this.tileManagers[n].update(t,this.map.terrain)}_generateCollisionBoxes(){for(const t in this.tileManagers)this._reloadSource(t)}_updatePlacement(t,n,a,u,f=!1){let y=!1,b=!1;const w={};for(const S of this._order){const P=this._layers[S];if(P.type!=="symbol")continue;if(!w[P.source]){const A=this.tileManagers[P.source];w[P.source]=A.getRenderableIds(!0).map((F=>A.getTileByID(F))).sort(((F,V)=>V.tileID.overscaledZ-F.tileID.overscaledZ||(F.tileID.isLessThan(V.tileID)?-1:1)))}const C=this.crossTileSymbolIndex.addLayer(P,w[P.source],t.center.lng);y=y||C}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((f=f||this._layerOrderChanged||a===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(be(),t.zoom))&&(this.pauseablePlacement=new th(t,this.map.terrain,this._order,f,n,a,u,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,w),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(be()),b=!0),y&&this.pauseablePlacement.placement.setStale()),b||y)for(const S of this._order){const P=this._layers[S];P.type==="symbol"&&this.placement.updateLayerOpacities(P,w[P.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(be())}_releaseSymbolFadeTiles(){for(const t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,n){return c._(this,void 0,void 0,(function*(){const a=yield this.imageManager.getImages(n.icons);this._updateTilesForChangedImages();const u=this.tileManagers[n.source];return u&&u.setDependencies(n.tileID.key,n.type,n.icons),a}))}getGlyphs(t,n){return c._(this,void 0,void 0,(function*(){const a=yield this.glyphManager.getGlyphs(n.stacks),u=this.tileManagers[n.source];return u&&u.setDependencies(n.tileID.key,n.type,[""]),a}))}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,n={}){this._checkLoaded(),t&&this._validate(c.C.glyphs,"glyphs",t,null,n)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getDashes(t,n){return c._(this,void 0,void 0,(function*(){const a={};for(const[u,f]of Object.entries(n.dashes))a[u]=this.lineAtlas.getDash(f.dasharray,f.round);return a}))}addSprite(t,n,a={},u){this._checkLoaded();const f=[{id:t,url:n}],y=[...ht(this.stylesheet.sprite),...f];this._validate(c.C.sprite,"sprite",y,null,a)||(this.stylesheet.sprite=y,this._loadSprite(f,!0,u))}removeSprite(t){this._checkLoaded();const n=ht(this.stylesheet.sprite);if(n.find((a=>a.id===t))){if(this._spritesImagesIds[t])for(const a of this._spritesImagesIds[t])this.imageManager.removeImage(a),this._changedImages[a]=!0;n.splice(n.findIndex((a=>a.id===t)),1),this.stylesheet.sprite=n.length>0?n:void 0,delete this._spritesImagesIds[t],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"}))}else this.fire(new c.k(new Error(`Sprite "${t}" doesn't exists on this map.`)))}getSprite(){return ht(this.stylesheet.sprite)}setSprite(t,n={},a){this._checkLoaded(),t&&this._validate(c.C.sprite,"sprite",t,null,n)||(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,a):(this._unloadSprite(),a&&a(null)))}destroy(){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null);for(const t in this.tileManagers){const n=this.tileManagers[t];n.setEventedParent(null),n.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this._availableImages=[],this._spritesImagesIds={}),this.glyphManager&&this.glyphManager.destroy();for(const t in this._layers){const n=this._layers[t];n.setEventedParent(null),n.onRemove&&n.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={}}}var js=c.aS([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class rh{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,n,a,u,f,y,b,w,S){this.context=t;let P=this.boundPaintVertexBuffers.length!==u.length;for(let C=0;!P&&C<u.length;C++)this.boundPaintVertexBuffers[C]!==u[C]&&(P=!0);!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==a||P||this.boundIndexBuffer!==f||this.boundVertexOffset!==y||this.boundDynamicVertexBuffer!==b||this.boundDynamicVertexBuffer2!==w||this.boundDynamicVertexBuffer3!==S?this.freshBind(n,a,u,f,y,b,w,S):(t.bindVertexArray.set(this.vao),b&&b.bind(),f&&f.dynamicDraw&&f.bind(),w&&w.bind(),S&&S.bind())}freshBind(t,n,a,u,f,y,b,w){const S=t.numAttributes,P=this.context,C=P.gl;this.vao&&this.destroy(),this.vao=P.createVertexArray(),P.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=u,this.boundVertexOffset=f,this.boundDynamicVertexBuffer=y,this.boundDynamicVertexBuffer2=b,this.boundDynamicVertexBuffer3=w,n.enableAttributes(C,t);for(const A of a)A.enableAttributes(C,t);y&&y.enableAttributes(C,t),b&&b.enableAttributes(C,t),w&&w.enableAttributes(C,t),n.bind(),n.setVertexAttribPointers(C,t,f);for(const A of a)A.bind(),A.setVertexAttribPointers(C,t,f);y&&(y.bind(),y.setVertexAttribPointers(C,t,f)),u&&u.bind(),b&&(b.bind(),b.setVertexAttribPointers(C,t,f)),w&&(w.bind(),w.setVertexAttribPointers(C,t,f)),P.currentNumAttributes=S}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const Vo=(p,t,n,a,u)=>({u_texture:0,u_ele_delta:p,u_fog_matrix:t,u_fog_color:n?n.properties.get("fog-color"):c.bn.white,u_fog_ground_blend:n?n.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:u?0:n?n.calculateFogBlendOpacity(a):0,u_horizon_color:n?n.properties.get("horizon-color"):c.bn.white,u_horizon_fog_blend:n?n.properties.get("horizon-fog-blend"):1,u_is_globe_mode:u?1:0}),nh={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Dr(p){const t=[];for(let n=0;n<p.length;n++){if(p[n]===null)continue;const a=p[n].split(" ");t.push(a.pop())}return t}class sh{constructor(t,n,a,u,f,y,b,w,S=[]){const P=t.gl;this.program=P.createProgram();const C=Dr(n.staticAttributes),A=a?a.getBinderAttributes():[],F=C.concat(A),V=Gt.prelude.staticUniforms?Dr(Gt.prelude.staticUniforms):[],U=b.staticUniforms?Dr(b.staticUniforms):[],q=n.staticUniforms?Dr(n.staticUniforms):[],G=a?a.getBinderUniforms():[],Y=V.concat(U).concat(q).concat(G),ee=[];for(const pe of Y)ee.indexOf(pe)<0&&ee.push(pe);const X=a?a.defines():[];lr(P)&&X.unshift("#version 300 es"),f&&X.push("#define OVERDRAW_INSPECTOR;"),y&&X.push("#define TERRAIN3D;"),w&&X.push(w),S&&X.push(...S);let Q=X.concat(Gt.prelude.fragmentSource,b.fragmentSource,n.fragmentSource).join(` 797`),te=X.concat(Gt.prelude.vertexSource,b.vertexSource,n.vertexSource).join(` 798`);lr(P)||(Q=(function(pe){return pe.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")})(Q),te=(function(pe){return pe.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")})(te));const K=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(K,Q),P.compileShader(K),!P.getShaderParameter(K,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(K)}`);P.attachShader(this.program,K);const se=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(se,te),P.compileShader(se),!P.getShaderParameter(se,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(se)}`);P.attachShader(this.program,se),this.attributes={};const me={};this.numAttributes=F.length;for(let pe=0;pe<this.numAttributes;pe++)F[pe]&&(P.bindAttribLocation(this.program,pe,F[pe]),this.attributes[F[pe]]=pe);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(se),P.deleteShader(K);for(let pe=0;pe<ee.length;pe++){const ce=ee[pe];if(ce&&!me[ce]){const fe=P.getUniformLocation(this.program,ce);fe&&(me[ce]=fe)}}this.fixedUniforms=u(t,me),this.terrainUniforms=((pe,ce)=>({u_depth:new c.bZ(pe,ce.u_depth),u_terrain:new c.bZ(pe,ce.u_terrain),u_terrain_dim:new c.bo(pe,ce.u_terrain_dim),u_terrain_matrix:new c.b$(pe,ce.u_terrain_matrix),u_terrain_unpack:new c.c0(pe,ce.u_terrain_unpack),u_terrain_exaggeration:new c.bo(pe,ce.u_terrain_exaggeration)}))(t,me),this.projectionUniforms=((pe,ce)=>({u_projection_matrix:new c.b$(pe,ce.u_projection_matrix),u_projection_tile_mercator_coords:new c.c0(pe,ce.u_projection_tile_mercator_coords),u_projection_clipping_plane:new c.c0(pe,ce.u_projection_clipping_plane),u_projection_transition:new c.bo(pe,ce.u_projection_transition),u_projection_fallback_matrix:new c.b$(pe,ce.u_projection_fallback_matrix)}))(t,me),this.binderUniforms=a?a.getUniforms(t,me):[]}draw(t,n,a,u,f,y,b,w,S,P,C,A,F,V,U,q,G,Y,ee){const X=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(a),t.setStencilMode(u),t.setColorMode(f),t.setCullFace(y),w){t.activeTexture.set(X.TEXTURE2),X.bindTexture(X.TEXTURE_2D,w.depthTexture),t.activeTexture.set(X.TEXTURE3),X.bindTexture(X.TEXTURE_2D,w.texture);for(const te in this.terrainUniforms)this.terrainUniforms[te].set(w[te])}if(S)for(const te in S)this.projectionUniforms[nh[te]].set(S[te]);if(b)for(const te in this.fixedUniforms)this.fixedUniforms[te].set(b[te]);q&&q.setUniforms(t,this.binderUniforms,V,{zoom:U});let Q=0;switch(n){case X.LINES:Q=2;break;case X.TRIANGLES:Q=3;break;case X.LINE_STRIP:Q=1}for(const te of F.get()){const K=te.vaos||(te.vaos={});(K[P]||(K[P]=new rh)).bind(t,this,C,q?q.getPaintVertexBuffers():[],A,te.vertexOffset,G,Y,ee),X.drawElements(n,te.primitiveLength*Q,X.UNSIGNED_SHORT,te.primitiveOffset*Q*2)}}}function hl(p,t,n){const a=1/c.aK(n,1,t.transform.tileZoom),u=Math.pow(2,n.tileID.overscaledZ),f=n.tileSize*Math.pow(2,t.transform.tileZoom)/u,y=f*(n.tileID.canonical.x+n.tileID.wrap*u),b=f*n.tileID.canonical.y;return{u_image:0,u_texsize:n.imageAtlasTexture.size,u_scale:[a,p.fromScale,p.toScale],u_fade:p.t,u_pixel_coord_upper:[y>>16,b>>16],u_pixel_coord_lower:[65535&y,65535&b]}}const Mc=(p,t,n,a)=>{const u=p.style.light,f=u.properties.get("position"),y=[f.x,f.y,f.z],b=c.c3();u.properties.get("anchor")==="viewport"&&c.c4(b,p.transform.bearingInRadians),c.c5(y,y,b);const w=p.transform.transformLightDirection(y),S=u.properties.get("color");return{u_lightpos:y,u_lightpos_globe:w,u_lightintensity:u.properties.get("intensity"),u_lightcolor:[S.r,S.g,S.b],u_vertical_gradient:+t,u_opacity:n,u_fill_translate:a}},Ec=(p,t,n,a,u,f,y)=>c.e(Mc(p,t,n,a),hl(f,p,y),{u_height_factor:-Math.pow(2,u.overscaledZ)/y.tileSize/8}),jo=(p,t,n,a)=>c.e(hl(t,p,n),{u_fill_translate:a}),Cc=(p,t)=>({u_world:p,u_fill_translate:t}),Ac=(p,t,n,a,u)=>c.e(jo(p,t,n,u),{u_world:a}),Dc=(p,t,n,a,u)=>{const f=p.transform;let y,b,w=0;if(n.paint.get("circle-pitch-alignment")==="map"){const S=c.aK(t,1,f.zoom);y=!0,b=[S,S],w=S/(c.a5*Math.pow(2,t.tileID.overscaledZ))*2*Math.PI*u}else y=!1,b=f.pixelsToGLUnits;return{u_camera_to_center_distance:f.cameraToCenterDistance,u_scale_with_map:+(n.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+y,u_device_pixel_ratio:p.pixelRatio,u_extrude_scale:b,u_globe_extrude_scale:w,u_translate:a}},kc=p=>({u_pixel_extrude_scale:[1/p.width,1/p.height]}),xn=p=>({u_viewport_size:[p.width,p.height]}),dl=(p,t=1)=>({u_color:p,u_overlay:0,u_overlay_scale:t}),pl=(p,t,n,a)=>{const u=c.aK(p,1,t)/(c.a5*Math.pow(2,p.tileID.overscaledZ))*2*Math.PI*a;return{u_extrude_scale:c.aK(p,1,t),u_intensity:n,u_globe_extrude_scale:u}},ss=(p,t,n,a)=>{const u=c.N();c.c6(u,0,p.width,p.height,0,0,1);const f=p.context.gl;return{u_matrix:u,u_world:[f.drawingBufferWidth,f.drawingBufferHeight],u_image:n,u_color_ramp:a,u_opacity:t.paint.get("heatmap-opacity")}},oh=(p,t,n)=>{const a=n.paint.get("hillshade-accent-color");let u;switch(n.paint.get("hillshade-method")){case"basic":u=4;break;case"combined":u=1;break;case"igor":u=2;break;case"multidirectional":u=3;break;default:u=0}const f=n.getIlluminationProperties();for(let y=0;y<f.directionRadians.length;y++)n.paint.get("hillshade-illumination-anchor")==="viewport"&&(f.directionRadians[y]+=p.transform.bearingInRadians);return{u_image:0,u_latrange:ah(0,t.tileID),u_exaggeration:n.paint.get("hillshade-exaggeration"),u_altitudes:f.altitudeRadians,u_azimuths:f.directionRadians,u_accent:a,u_method:u,u_highlights:f.highlightColor,u_shadows:f.shadowColor}},No=(p,t)=>{const n=t.stride,a=c.N();return c.c6(a,0,c.a5,-c.a5,0,0,1),c.O(a,a,[0,-c.a5,0]),{u_matrix:a,u_image:1,u_dimension:[n,n],u_zoom:p.overscaledZ,u_unpack:t.getUnpackVector()}};function ah(p,t){const n=Math.pow(2,t.canonical.z),a=t.canonical.y;return[new c.a6(0,a/n).toLngLat().lat,new c.a6(0,(a+1)/n).toLngLat().lat]}const lh=(p,t,n=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:n,u_opacity:p.paint.get("color-relief-opacity")}),Ns=(p,t,n,a)=>{const u=p.transform;return{u_translation:br(p,t,n),u_ratio:a/c.aK(t,1,u.zoom),u_device_pixel_ratio:p.pixelRatio,u_units_to_pixels:[1/u.pixelsToGLUnits[0],1/u.pixelsToGLUnits[1]]}},zc=(p,t,n,a,u)=>c.e(Ns(p,t,n,a),{u_image:0,u_image_height:u}),Lc=(p,t,n,a,u)=>{const f=p.transform,y=os(t,f);return{u_translation:br(p,t,n),u_texsize:t.imageAtlasTexture.size,u_ratio:a/c.aK(t,1,f.zoom),u_device_pixel_ratio:p.pixelRatio,u_image:0,u_scale:[y,u.fromScale,u.toScale],u_fade:u.t,u_units_to_pixels:[1/f.pixelsToGLUnits[0],1/f.pixelsToGLUnits[1]]}},fl=(p,t,n,a,u)=>{const f=os(t,p.transform);return c.e(Ns(p,t,n,a),{u_tileratio:f,u_crossfade_from:u.fromScale,u_crossfade_to:u.toScale,u_image:0,u_mix:u.t,u_lineatlas_width:p.lineAtlas.width,u_lineatlas_height:p.lineAtlas.height})},Fc=(p,t,n,a,u,f)=>{const y=os(t,p.transform);return c.e(Ns(p,t,n,a),{u_image:0,u_image_height:f,u_tileratio:y,u_crossfade_from:u.fromScale,u_crossfade_to:u.toScale,u_image_dash:1,u_mix:u.t,u_lineatlas_width:p.lineAtlas.width,u_lineatlas_height:p.lineAtlas.height})};function os(p,t){return 1/c.aK(p,1,t.tileZoom)}function br(p,t,n){return c.aL(p.transform,t,n.paint.get("line-translate"),n.paint.get("line-translate-anchor"))}const ml=(p,t,n,a,u)=>{return{u_tl_parent:p,u_scale_parent:t,u_buffer_scale:1,u_fade_t:n.mix,u_opacity:n.opacity*a.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:a.paint.get("raster-brightness-min"),u_brightness_high:a.paint.get("raster-brightness-max"),u_saturation_factor:(y=a.paint.get("raster-saturation"),y>0?1-1/(1.001-y):-y),u_contrast_factor:(f=a.paint.get("raster-contrast"),f>0?1/(1-f):1+f),u_spin_weights:gl(a.paint.get("raster-hue-rotate")),u_coords_top:[u[0].x,u[0].y,u[1].x,u[1].y],u_coords_bottom:[u[3].x,u[3].y,u[2].x,u[2].y]};var f,y};function gl(p){p*=Math.PI/180;const t=Math.sin(p),n=Math.cos(p);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const Uo=(p,t,n,a,u,f,y,b,w,S,P,C,A)=>{const F=y.transform;return{u_is_size_zoom_constant:+(p==="constant"||p==="source"),u_is_size_feature_constant:+(p==="constant"||p==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:F.cameraToCenterDistance,u_pitch:F.pitch/360*2*Math.PI,u_rotate_symbol:+n,u_aspect_ratio:F.width/F.height,u_fade_change:y.options.fadeDuration?y.symbolFadeChange:1,u_label_plane_matrix:b,u_coord_matrix:w,u_is_text:+P,u_pitch_with_map:+a,u_is_along_line:u,u_is_variable_anchor:f,u_texsize:C,u_texture:0,u_translation:S,u_pitched_scale:A}},_l=(p,t,n,a,u,f,y,b,w,S,P,C,A,F)=>{const V=y.transform;return c.e(Uo(p,t,n,a,u,f,y,b,w,S,P,C,F),{u_gamma_scale:a?Math.cos(V.pitch*Math.PI/180)*V.cameraToCenterDistance:1,u_device_pixel_ratio:y.pixelRatio,u_is_halo:1})},yl=(p,t,n,a,u,f,y,b,w,S,P,C,A)=>c.e(_l(p,t,n,a,u,f,y,b,w,S,!0,P,0,A),{u_texsize_icon:C,u_texture_icon:1}),bn=(p,t)=>({u_opacity:p,u_color:t}),vl=(p,t,n,a,u)=>c.e((function(f,y,b,w){const S=b.imageManager.getPattern(f.from.toString()),P=b.imageManager.getPattern(f.to.toString()),{width:C,height:A}=b.imageManager.getPixelSize(),F=Math.pow(2,w.tileID.overscaledZ),V=w.tileSize*Math.pow(2,b.transform.tileZoom)/F,U=V*(w.tileID.canonical.x+w.tileID.wrap*F),q=V*w.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:S.tl,u_pattern_br_a:S.br,u_pattern_tl_b:P.tl,u_pattern_br_b:P.br,u_texsize:[C,A],u_mix:y.t,u_pattern_size_a:S.displaySize,u_pattern_size_b:P.displaySize,u_scale_a:y.fromScale,u_scale_b:y.toScale,u_tile_units_to_pixels:1/c.aK(w,1,b.transform.tileZoom),u_pixel_coord_upper:[U>>16,q>>16],u_pixel_coord_lower:[65535&U,65535&q]}})(n,u,t,a),{u_opacity:p}),Rc=(p,t)=>{},ch={fillExtrusion:(p,t)=>({u_lightpos:new c.c1(p,t.u_lightpos),u_lightpos_globe:new c.c1(p,t.u_lightpos_globe),u_lightintensity:new c.bo(p,t.u_lightintensity),u_lightcolor:new c.c1(p,t.u_lightcolor),u_vertical_gradient:new c.bo(p,t.u_vertical_gradient),u_opacity:new c.bo(p,t.u_opacity),u_fill_translate:new c.c2(p,t.u_fill_translate)}),fillExtrusionPattern:(p,t)=>({u_lightpos:new c.c1(p,t.u_lightpos),u_lightpos_globe:new c.c1(p,t.u_lightpos_globe),u_lightintensity:new c.bo(p,t.u_lightintensity),u_lightcolor:new c.c1(p,t.u_lightcolor),u_vertical_gradient:new c.bo(p,t.u_vertical_gradient),u_height_factor:new c.bo(p,t.u_height_factor),u_opacity:new c.bo(p,t.u_opacity),u_fill_translate:new c.c2(p,t.u_fill_translate),u_image:new c.bZ(p,t.u_image),u_texsize:new c.c2(p,t.u_texsize),u_pixel_coord_upper:new c.c2(p,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.c2(p,t.u_pixel_coord_lower),u_scale:new c.c1(p,t.u_scale),u_fade:new c.bo(p,t.u_fade)}),fill:(p,t)=>({u_fill_translate:new c.c2(p,t.u_fill_translate)}),fillPattern:(p,t)=>({u_image:new c.bZ(p,t.u_image),u_texsize:new c.c2(p,t.u_texsize),u_pixel_coord_upper:new c.c2(p,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.c2(p,t.u_pixel_coord_lower),u_scale:new c.c1(p,t.u_scale),u_fade:new c.bo(p,t.u_fade),u_fill_translate:new c.c2(p,t.u_fill_translate)}),fillOutline:(p,t)=>({u_world:new c.c2(p,t.u_world),u_fill_translate:new c.c2(p,t.u_fill_translate)}),fillOutlinePattern:(p,t)=>({u_world:new c.c2(p,t.u_world),u_image:new c.bZ(p,t.u_image),u_texsize:new c.c2(p,t.u_texsize),u_pixel_coord_upper:new c.c2(p,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.c2(p,t.u_pixel_coord_lower),u_scale:new c.c1(p,t.u_scale),u_fade:new c.bo(p,t.u_fade),u_fill_translate:new c.c2(p,t.u_fill_translate)}),circle:(p,t)=>({u_camera_to_center_distance:new c.bo(p,t.u_camera_to_center_distance),u_scale_with_map:new c.bZ(p,t.u_scale_with_map),u_pitch_with_map:new c.bZ(p,t.u_pitch_with_map),u_extrude_scale:new c.c2(p,t.u_extrude_scale),u_device_pixel_ratio:new c.bo(p,t.u_device_pixel_ratio),u_globe_extrude_scale:new c.bo(p,t.u_globe_extrude_scale),u_translate:new c.c2(p,t.u_translate)}),collisionBox:(p,t)=>({u_pixel_extrude_scale:new c.c2(p,t.u_pixel_extrude_scale)}),collisionCircle:(p,t)=>({u_viewport_size:new c.c2(p,t.u_viewport_size)}),debug:(p,t)=>({u_color:new c.b_(p,t.u_color),u_overlay:new c.bZ(p,t.u_overlay),u_overlay_scale:new c.bo(p,t.u_overlay_scale)}),depth:Rc,clippingMask:Rc,heatmap:(p,t)=>({u_extrude_scale:new c.bo(p,t.u_extrude_scale),u_intensity:new c.bo(p,t.u_intensity),u_globe_extrude_scale:new c.bo(p,t.u_globe_extrude_scale)}),heatmapTexture:(p,t)=>({u_matrix:new c.b$(p,t.u_matrix),u_world:new c.c2(p,t.u_world),u_image:new c.bZ(p,t.u_image),u_color_ramp:new c.bZ(p,t.u_color_ramp),u_opacity:new c.bo(p,t.u_opacity)}),hillshade:(p,t)=>({u_image:new c.bZ(p,t.u_image),u_latrange:new c.c2(p,t.u_latrange),u_exaggeration:new c.bo(p,t.u_exaggeration),u_altitudes:new c.c8(p,t.u_altitudes),u_azimuths:new c.c8(p,t.u_azimuths),u_accent:new c.b_(p,t.u_accent),u_method:new c.bZ(p,t.u_method),u_shadows:new c.c7(p,t.u_shadows),u_highlights:new c.c7(p,t.u_highlights)}),hillshadePrepare:(p,t)=>({u_matrix:new c.b$(p,t.u_matrix),u_image:new c.bZ(p,t.u_image),u_dimension:new c.c2(p,t.u_dimension),u_zoom:new c.bo(p,t.u_zoom),u_unpack:new c.c0(p,t.u_unpack)}),colorRelief:(p,t)=>({u_image:new c.bZ(p,t.u_image),u_unpack:new c.c0(p,t.u_unpack),u_dimension:new c.c2(p,t.u_dimension),u_elevation_stops:new c.bZ(p,t.u_elevation_stops),u_color_stops:new c.bZ(p,t.u_color_stops),u_color_ramp_size:new c.bZ(p,t.u_color_ramp_size),u_opacity:new c.bo(p,t.u_opacity)}),line:(p,t)=>({u_translation:new c.c2(p,t.u_translation),u_ratio:new c.bo(p,t.u_ratio),u_device_pixel_ratio:new c.bo(p,t.u_device_pixel_ratio),u_units_to_pixels:new c.c2(p,t.u_units_to_pixels)}),lineGradient:(p,t)=>({u_translation:new c.c2(p,t.u_translation),u_ratio:new c.bo(p,t.u_ratio),u_device_pixel_ratio:new c.bo(p,t.u_device_pixel_ratio),u_units_to_pixels:new c.c2(p,t.u_units_to_pixels),u_image:new c.bZ(p,t.u_image),u_image_height:new c.bo(p,t.u_image_height)}),linePattern:(p,t)=>({u_translation:new c.c2(p,t.u_translation),u_texsize:new c.c2(p,t.u_texsize),u_ratio:new c.bo(p,t.u_ratio),u_device_pixel_ratio:new c.bo(p,t.u_device_pixel_ratio),u_image:new c.bZ(p,t.u_image),u_units_to_pixels:new c.c2(p,t.u_units_to_pixels),u_scale:new c.c1(p,t.u_scale),u_fade:new c.bo(p,t.u_fade)}),lineSDF:(p,t)=>({u_translation:new c.c2(p,t.u_translation),u_ratio:new c.bo(p,t.u_ratio),u_device_pixel_ratio:new c.bo(p,t.u_device_pixel_ratio),u_units_to_pixels:new c.c2(p,t.u_units_to_pixels),u_image:new c.bZ(p,t.u_image),u_mix:new c.bo(p,t.u_mix),u_tileratio:new c.bo(p,t.u_tileratio),u_crossfade_from:new c.bo(p,t.u_crossfade_from),u_crossfade_to:new c.bo(p,t.u_crossfade_to),u_lineatlas_width:new c.bo(p,t.u_lineatlas_width),u_lineatlas_height:new c.bo(p,t.u_lineatlas_height)}),lineGradientSDF:(p,t)=>({u_translation:new c.c2(p,t.u_translation),u_ratio:new c.bo(p,t.u_ratio),u_device_pixel_ratio:new c.bo(p,t.u_device_pixel_ratio),u_units_to_pixels:new c.c2(p,t.u_units_to_pixels),u_image:new c.bZ(p,t.u_image),u_image_height:new c.bo(p,t.u_image_height),u_tileratio:new c.bo(p,t.u_tileratio),u_crossfade_from:new c.bo(p,t.u_crossfade_from),u_crossfade_to:new c.bo(p,t.u_crossfade_to),u_image_dash:new c.bZ(p,t.u_image_dash),u_mix:new c.bo(p,t.u_mix),u_lineatlas_width:new c.bo(p,t.u_lineatlas_width),u_lineatlas_height:new c.bo(p,t.u_lineatlas_height)}),raster:(p,t)=>({u_tl_parent:new c.c2(p,t.u_tl_parent),u_scale_parent:new c.bo(p,t.u_scale_parent),u_buffer_scale:new c.bo(p,t.u_buffer_scale),u_fade_t:new c.bo(p,t.u_fade_t),u_opacity:new c.bo(p,t.u_opacity),u_image0:new c.bZ(p,t.u_image0),u_image1:new c.bZ(p,t.u_image1),u_brightness_low:new c.bo(p,t.u_brightness_low),u_brightness_high:new c.bo(p,t.u_brightness_high),u_saturation_factor:new c.bo(p,t.u_saturation_factor),u_contrast_factor:new c.bo(p,t.u_contrast_factor),u_spin_weights:new c.c1(p,t.u_spin_weights),u_coords_top:new c.c0(p,t.u_coords_top),u_coords_bottom:new c.c0(p,t.u_coords_bottom)}),symbolIcon:(p,t)=>({u_is_size_zoom_constant:new c.bZ(p,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bZ(p,t.u_is_size_feature_constant),u_size_t:new c.bo(p,t.u_size_t),u_size:new c.bo(p,t.u_size),u_camera_to_center_distance:new c.bo(p,t.u_camera_to_center_distance),u_pitch:new c.bo(p,t.u_pitch),u_rotate_symbol:new c.bZ(p,t.u_rotate_symbol),u_aspect_ratio:new c.bo(p,t.u_aspect_ratio),u_fade_change:new c.bo(p,t.u_fade_change),u_label_plane_matrix:new c.b$(p,t.u_label_plane_matrix),u_coord_matrix:new c.b$(p,t.u_coord_matrix),u_is_text:new c.bZ(p,t.u_is_text),u_pitch_with_map:new c.bZ(p,t.u_pitch_with_map),u_is_along_line:new c.bZ(p,t.u_is_along_line),u_is_variable_anchor:new c.bZ(p,t.u_is_variable_anchor),u_texsize:new c.c2(p,t.u_texsize),u_texture:new c.bZ(p,t.u_texture),u_translation:new c.c2(p,t.u_translation),u_pitched_scale:new c.bo(p,t.u_pitched_scale)}),symbolSDF:(p,t)=>({u_is_size_zoom_constant:new c.bZ(p,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bZ(p,t.u_is_size_feature_constant),u_size_t:new c.bo(p,t.u_size_t),u_size:new c.bo(p,t.u_size),u_camera_to_center_distance:new c.bo(p,t.u_camera_to_center_distance),u_pitch:new c.bo(p,t.u_pitch),u_rotate_symbol:new c.bZ(p,t.u_rotate_symbol),u_aspect_ratio:new c.bo(p,t.u_aspect_ratio),u_fade_change:new c.bo(p,t.u_fade_change),u_label_plane_matrix:new c.b$(p,t.u_label_plane_matrix),u_coord_matrix:new c.b$(p,t.u_coord_matrix),u_is_text:new c.bZ(p,t.u_is_text),u_pitch_with_map:new c.bZ(p,t.u_pitch_with_map),u_is_along_line:new c.bZ(p,t.u_is_along_line),u_is_variable_anchor:new c.bZ(p,t.u_is_variable_anchor),u_texsize:new c.c2(p,t.u_texsize),u_texture:new c.bZ(p,t.u_texture),u_gamma_scale:new c.bo(p,t.u_gamma_scale),u_device_pixel_ratio:new c.bo(p,t.u_device_pixel_ratio),u_is_halo:new c.bZ(p,t.u_is_halo),u_translation:new c.c2(p,t.u_translation),u_pitched_scale:new c.bo(p,t.u_pitched_scale)}),symbolTextAndIcon:(p,t)=>({u_is_size_zoom_constant:new c.bZ(p,t.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bZ(p,t.u_is_size_feature_constant),u_size_t:new c.bo(p,t.u_size_t),u_size:new c.bo(p,t.u_size),u_camera_to_center_distance:new c.bo(p,t.u_camera_to_center_distance),u_pitch:new c.bo(p,t.u_pitch),u_rotate_symbol:new c.bZ(p,t.u_rotate_symbol),u_aspect_ratio:new c.bo(p,t.u_aspect_ratio),u_fade_change:new c.bo(p,t.u_fade_change),u_label_plane_matrix:new c.b$(p,t.u_label_plane_matrix),u_coord_matrix:new c.b$(p,t.u_coord_matrix),u_is_text:new c.bZ(p,t.u_is_text),u_pitch_with_map:new c.bZ(p,t.u_pitch_with_map),u_is_along_line:new c.bZ(p,t.u_is_along_line),u_is_variable_anchor:new c.bZ(p,t.u_is_variable_anchor),u_texsize:new c.c2(p,t.u_texsize),u_texsize_icon:new c.c2(p,t.u_texsize_icon),u_texture:new c.bZ(p,t.u_texture),u_texture_icon:new c.bZ(p,t.u_texture_icon),u_gamma_scale:new c.bo(p,t.u_gamma_scale),u_device_pixel_ratio:new c.bo(p,t.u_device_pixel_ratio),u_is_halo:new c.bZ(p,t.u_is_halo),u_translation:new c.c2(p,t.u_translation),u_pitched_scale:new c.bo(p,t.u_pitched_scale)}),background:(p,t)=>({u_opacity:new c.bo(p,t.u_opacity),u_color:new c.b_(p,t.u_color)}),backgroundPattern:(p,t)=>({u_opacity:new c.bo(p,t.u_opacity),u_image:new c.bZ(p,t.u_image),u_pattern_tl_a:new c.c2(p,t.u_pattern_tl_a),u_pattern_br_a:new c.c2(p,t.u_pattern_br_a),u_pattern_tl_b:new c.c2(p,t.u_pattern_tl_b),u_pattern_br_b:new c.c2(p,t.u_pattern_br_b),u_texsize:new c.c2(p,t.u_texsize),u_mix:new c.bo(p,t.u_mix),u_pattern_size_a:new c.c2(p,t.u_pattern_size_a),u_pattern_size_b:new c.c2(p,t.u_pattern_size_b),u_scale_a:new c.bo(p,t.u_scale_a),u_scale_b:new c.bo(p,t.u_scale_b),u_pixel_coord_upper:new c.c2(p,t.u_pixel_coord_upper),u_pixel_coord_lower:new c.c2(p,t.u_pixel_coord_lower),u_tile_units_to_pixels:new c.bo(p,t.u_tile_units_to_pixels)}),terrain:(p,t)=>({u_texture:new c.bZ(p,t.u_texture),u_ele_delta:new c.bo(p,t.u_ele_delta),u_fog_matrix:new c.b$(p,t.u_fog_matrix),u_fog_color:new c.b_(p,t.u_fog_color),u_fog_ground_blend:new c.bo(p,t.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.bo(p,t.u_fog_ground_blend_opacity),u_horizon_color:new c.b_(p,t.u_horizon_color),u_horizon_fog_blend:new c.bo(p,t.u_horizon_fog_blend),u_is_globe_mode:new c.bo(p,t.u_is_globe_mode)}),terrainDepth:(p,t)=>({u_ele_delta:new c.bo(p,t.u_ele_delta)}),terrainCoords:(p,t)=>({u_texture:new c.bZ(p,t.u_texture),u_terrain_coords_id:new c.bo(p,t.u_terrain_coords_id),u_ele_delta:new c.bo(p,t.u_ele_delta)}),projectionErrorMeasurement:(p,t)=>({u_input:new c.bo(p,t.u_input),u_output_expected:new c.bo(p,t.u_output_expected)}),atmosphere:(p,t)=>({u_sun_pos:new c.c1(p,t.u_sun_pos),u_atmosphere_blend:new c.bo(p,t.u_atmosphere_blend),u_globe_position:new c.c1(p,t.u_globe_position),u_globe_radius:new c.bo(p,t.u_globe_radius),u_inv_proj_matrix:new c.b$(p,t.u_inv_proj_matrix)}),sky:(p,t)=>({u_sky_color:new c.b_(p,t.u_sky_color),u_horizon_color:new c.b_(p,t.u_horizon_color),u_horizon:new c.c2(p,t.u_horizon),u_horizon_normal:new c.c2(p,t.u_horizon_normal),u_sky_horizon_blend:new c.bo(p,t.u_sky_horizon_blend),u_sky_blend:new c.bo(p,t.u_sky_blend)})};class uh{constructor(t,n,a){this.context=t;const u=t.gl;this.buffer=u.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),u.bufferData(u.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?u.DYNAMIC_DRAW:u.STATIC_DRAW),this.dynamicDraw||n.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const hh={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Bc{constructor(t,n,a,u){this.length=n.length,this.attributes=a,this.itemSize=n.bytesPerElement,this.dynamicDraw=u,this.context=t;const f=t.gl;this.buffer=f.createBuffer(),t.bindVertexBuffer.set(this.buffer),f.bufferData(f.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||n.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let a=0;a<this.attributes.length;a++){const u=n.attributes[this.attributes[a].name];u!==void 0&&t.enableVertexAttribArray(u)}}setVertexAttribPointers(t,n,a){for(let u=0;u<this.attributes.length;u++){const f=this.attributes[u],y=n.attributes[f.name];y!==void 0&&t.vertexAttribPointer(y,f.components,t[hh[f.type]],!1,this.itemSize,f.offset+this.itemSize*(a||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class pt{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Oc extends pt{getDefault(){return c.bn.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class $o extends pt{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Go extends pt{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class qo extends pt{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class xl extends pt{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class wn extends pt{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Us extends pt{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class as extends pt{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Qi extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class Vc extends pt{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class jc extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class bl extends pt{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Tn extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class Zo extends pt{getDefault(){const t=this.gl;return[t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}}class Wo extends pt{getDefault(){return c.bn.transparent}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class $s extends pt{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}}class Ho extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class Nc extends pt{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class ls extends pt{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}class cs extends pt{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}}class Uc extends pt{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class wl extends pt{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Qe extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Xo extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class dh extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class $c extends pt{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Gs extends pt{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class ph extends pt{getDefault(){return null}set(t){var n;if(t===this.current&&!this.dirty)return;const a=this.gl;lr(a)?a.bindVertexArray(t):(n=a.getExtension("OES_vertex_array_object"))===null||n===void 0||n.bindVertexArrayOES(t),this.current=t,this.dirty=!1}}class fh extends pt{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Gc extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class mh extends pt{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class qs extends pt{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Yo extends qs{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Zs extends qs{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ko extends qs{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}const Jo="Framebuffer is not complete";class qc{constructor(t,n,a,u,f){this.context=t,this.width=n,this.height=a;const y=t.gl,b=this.framebuffer=y.createFramebuffer();if(this.colorAttachment=new Yo(t,b),u)this.depthAttachment=f?new Ko(t,b):new Zs(t,b);else if(f)throw new Error("Stencil cannot be set without depth");if(y.checkFramebufferStatus(y.FRAMEBUFFER)!==y.FRAMEBUFFER_COMPLETE)throw new Error(Jo)}destroy(){const t=this.context.gl,n=this.colorAttachment.get();if(n&&t.deleteTexture(n),this.depthAttachment){const a=this.depthAttachment.get();a&&t.deleteRenderbuffer(a)}t.deleteFramebuffer(this.framebuffer)}}class Qo{constructor(t){var n,a;if(this.gl=t,this.clearColor=new Oc(this),this.clearDepth=new $o(this),this.clearStencil=new Go(this),this.colorMask=new qo(this),this.depthMask=new xl(this),this.stencilMask=new wn(this),this.stencilFunc=new Us(this),this.stencilOp=new as(this),this.stencilTest=new Qi(this),this.depthRange=new Vc(this),this.depthTest=new jc(this),this.depthFunc=new bl(this),this.blend=new Tn(this),this.blendFunc=new Zo(this),this.blendColor=new Wo(this),this.blendEquation=new $s(this),this.cullFace=new Ho(this),this.cullFaceSide=new Nc(this),this.frontFace=new ls(this),this.program=new cs(this),this.activeTexture=new Uc(this),this.viewport=new wl(this),this.bindFramebuffer=new Qe(this),this.bindRenderbuffer=new Xo(this),this.bindTexture=new dh(this),this.bindVertexBuffer=new $c(this),this.bindElementBuffer=new Gs(this),this.bindVertexArray=new ph(this),this.pixelStoreUnpack=new fh(this),this.pixelStoreUnpackPremultiplyAlpha=new Gc(this),this.pixelStoreUnpackFlipY=new mh(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),lr(t)){this.HALF_FLOAT=t.HALF_FLOAT;const u=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(n=t.RGBA16F)!==null&&n!==void 0?n:u?.RGBA16F_EXT,this.RGB16F=(a=t.RGB16F)!==null&&a!==void 0?a:u?.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");const u=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=u?.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n){return new uh(this,t,n)}createVertexBuffer(t,n,a){return new Bc(this,t,n,a)}createRenderbuffer(t,n,a){const u=this.gl,f=u.createRenderbuffer();return this.bindRenderbuffer.set(f),u.renderbufferStorage(u.RENDERBUFFER,t,n,a),this.bindRenderbuffer.set(null),f}createFramebuffer(t,n,a,u){return new qc(this,t,n,a,u)}clear({color:t,depth:n,stencil:a}){const u=this.gl;let f=0;t&&(f|=u.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),n!==void 0&&(f|=u.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),a!==void 0&&(f|=u.STENCIL_BUFFER_BIT,this.clearStencil.set(a),this.stencilMask.set(255)),u.clear(f)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){c.bP(t.blendFunction,It.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return lr(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))===null||t===void 0?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var n;return lr(this.gl)?this.gl.deleteVertexArray(t):(n=this.gl.getExtension("OES_vertex_array_object"))===null||n===void 0?void 0:n.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}}let Sn;function us(p,t,n,a,u){const f=p.context,y=p.transform,b=f.gl,w=p.useProgram("collisionBox"),S=[];let P=0,C=0;for(let G=0;G<a.length;G++){const Y=a[G],ee=t.getTile(Y).getBucket(n);if(!ee)continue;const X=u?ee.textCollisionBox:ee.iconCollisionBox,Q=ee.collisionCircleArray;Q.length>0&&(S.push({circleArray:Q,circleOffset:C,coord:Y}),P+=Q.length/4,C=P),X&&w.draw(f,b.LINES,Xe.disabled,at.disabled,p.colorModeForRenderPass(),st.disabled,kc(p.transform),p.style.map.terrain&&p.style.map.terrain.getTerrainData(Y),y.getProjectionData({overscaledTileID:Y,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),n.id,X.layoutVertexBuffer,X.indexBuffer,X.segments,null,p.transform.zoom,null,null,X.collisionVertexBuffer)}if(!u||!S.length)return;const A=p.useProgram("collisionCircle"),F=new c.c9;F.resize(4*P),F._trim();let V=0;for(const G of S)for(let Y=0;Y<G.circleArray.length/4;Y++){const ee=4*Y,X=G.circleArray[ee+0],Q=G.circleArray[ee+1],te=G.circleArray[ee+2],K=G.circleArray[ee+3];F.emplace(V++,X,Q,te,K,0),F.emplace(V++,X,Q,te,K,1),F.emplace(V++,X,Q,te,K,2),F.emplace(V++,X,Q,te,K,3)}(!Sn||Sn.length<2*P)&&(Sn=(function(G){const Y=2*G,ee=new c.cb;ee.resize(Y),ee._trim();for(let X=0;X<Y;X++){const Q=6*X;ee.uint16[Q+0]=4*X+0,ee.uint16[Q+1]=4*X+1,ee.uint16[Q+2]=4*X+2,ee.uint16[Q+3]=4*X+2,ee.uint16[Q+4]=4*X+3,ee.uint16[Q+5]=4*X+0}return ee})(P));const U=f.createIndexBuffer(Sn,!0),q=f.createVertexBuffer(F,c.ca.members,!0);for(const G of S){const Y=xn(p.transform);A.draw(f,b.TRIANGLES,Xe.disabled,at.disabled,p.colorModeForRenderPass(),st.disabled,Y,p.style.map.terrain&&p.style.map.terrain.getTerrainData(G.coord),null,n.id,q,U,c.aV.simpleSegment(0,2*G.circleOffset,G.circleArray.length,G.circleArray.length/2),null,p.transform.zoom,null,null,null)}q.destroy(),U.destroy()}const hs=c.ao(new Float32Array(16));function Tl(p,t,n,a,u,f){const{horizontalAlign:y,verticalAlign:b}=c.aP(p);return new c.P((-(y-.5)*t/u+a[0])*f,(-(b-.5)*n/u+a[1])*f)}function gh(p,t,n,a,u,f){const y=t.tileAnchorPoint.add(new c.P(t.translation[0],t.translation[1]));if(t.pitchWithMap){let b=a.mult(f);n||(b=b.rotate(-u));const w=y.add(b);return Xn(w.x,w.y,t.pitchedLabelPlaneMatrix,t.getElevation).point}if(n){const b=yr(t.tileAnchorPoint.x+1,t.tileAnchorPoint.y,t).point.sub(p),w=Math.atan(b.y/b.x)+(b.x<0?Math.PI:0);return p.add(a.rotate(w))}return p.add(a)}function Ws(p,t,n,a,u,f,y,b,w,S,P,C){const A=p.text.placedSymbolArray,F=p.text.dynamicLayoutVertexArray,V=p.icon.dynamicLayoutVertexArray,U={};F.clear();for(let q=0;q<A.length;q++){const G=A.get(q),Y=G.hidden||!G.crossTileID||p.allowVerticalPlacement&&!G.placedOrientation?null:a[G.crossTileID];if(Y){const ee=new c.P(G.anchorX,G.anchorY),X={getElevation:C,width:u.width,height:u.height,pitchedLabelPlaneMatrix:f,pitchWithMap:n,transform:u,tileAnchorPoint:ee,translation:S,unwrappedTileID:P},Q=n?Ct(ee.x,ee.y,X):yr(ee.x,ee.y,X),te=Wr(u.cameraToCenterDistance,Q.signedDistanceFromCamera);let K=c.ax(p.textSizeData,b,G)*te/c.aJ;n&&(K*=p.tilePixelRatio/y);const{width:se,height:me,anchor:pe,textOffset:ce,textBoxScale:fe}=Y,Te=Tl(pe,se,me,ce,fe,K),Se=u.getPitchedTextCorrection(ee.x+S[0],ee.y+S[1],P),we=gh(Q.point,X,t,Te,-u.bearingInRadians,Se),Oe=p.allowVerticalPlacement&&G.placedOrientation===c.aw.vertical?Math.PI/2:0;for(let je=0;je<G.numGlyphs;je++)c.aD(F,we,Oe);w&&G.associatedIconIndex>=0&&(U[G.associatedIconIndex]={shiftedAnchor:we,angle:Oe})}else ji(G.numGlyphs,F)}if(w){V.clear();const q=p.icon.placedSymbolArray;for(let G=0;G<q.length;G++){const Y=q.get(G);if(Y.hidden)ji(Y.numGlyphs,V);else{const ee=U[G];if(ee)for(let X=0;X<Y.numGlyphs;X++)c.aD(V,ee.shiftedAnchor,ee.angle);else ji(Y.numGlyphs,V)}}p.icon.dynamicLayoutVertexBuffer.updateData(V)}p.text.dynamicLayoutVertexBuffer.updateData(F)}function _h(p,t,n){return n.iconsInText&&t?"symbolTextAndIcon":p?"symbolSDF":"symbolIcon"}function Sl(p,t,n,a,u,f,y,b,w,S,P,C,A){const F=p.context,V=F.gl,U=p.transform,q=b==="map",G=w==="map",Y=b!=="viewport"&&n.layout.get("symbol-placement")!=="point",ee=q&&!G&&!Y,X=!n.layout.get("symbol-sort-key").isConstant();let Q=!1;const te=p.getDepthModeForSublayer(0,Xe.ReadOnly),K=n._unevaluatedLayout.hasValue("text-variable-anchor")||n._unevaluatedLayout.hasValue("text-variable-anchor-offset"),se=[],me=U.getCircleRadiusCorrection();for(const pe of a){const ce=t.getTile(pe),fe=ce.getBucket(n);if(!fe)continue;const Te=u?fe.text:fe.icon;if(!Te||!Te.segments.get().length||!Te.hasVisibleVertices)continue;const Se=Te.programConfigurations.get(n.id),we=u||fe.sdfIcons,Oe=u?fe.textSizeData:fe.iconSizeData,je=G||U.pitch!==0,ft=p.useProgram(_h(we,u,fe),Se),Mt=c.av(Oe,U.zoom),St=p.style.map.terrain&&p.style.map.terrain.getTerrainData(pe);let At,xt,Qt,bt,ai=[0,0],Wt=null;if(u)xt=ce.glyphAtlasTexture,Qt=V.LINEAR,At=ce.glyphAtlasTexture.size,fe.iconsInText&&(ai=ce.imageAtlasTexture.size,Wt=ce.imageAtlasTexture,bt=je||p.options.rotating||p.options.zooming||Oe.kind==="composite"||Oe.kind==="camera"?V.LINEAR:V.NEAREST);else{const Pt=n.layout.get("icon-size").constantOr(0)!==1||fe.iconsNeedLinear;xt=ce.imageAtlasTexture,Qt=we||p.options.rotating||p.options.zooming||Pt||je?V.LINEAR:V.NEAREST,At=ce.imageAtlasTexture.size}const Ht=c.aK(ce,1,p.transform.zoom),fi=He(q,p.transform,Ht),Yr=c.N();c.ay(Yr,fi);const Rr=Je(G,q,p.transform,Ht),Sr=c.aL(U,ce,f,y),zi=U.getProjectionData({overscaledTileID:pe,applyGlobeMatrix:!A,applyTerrainMatrix:!0}),kn=K&&fe.hasTextData(),ho=n.layout.get("icon-text-fit")!=="none"&&kn&&fe.hasIconData();if(Y){const Pt=p.style.map.terrain?(wt,ri)=>p.style.map.terrain.getElevation(pe,wt,ri):null;Co(fe,p,u,fi,Yr,G,S,n.layout.get("text-rotation-alignment")==="map",pe.toUnwrapped(),U.width,U.height,Sr,Pt)}const zn=u&&K||ho,tr=Y||zn?hs:G?fi:p.transform.clipSpaceToPixelsMatrix,Pr=we&&n.paint.get(u?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let fr;fr=we?fe.iconsInText?yl(Oe.kind,Mt,ee,G,Y,zn,p,tr,Rr,Sr,At,ai,me):_l(Oe.kind,Mt,ee,G,Y,zn,p,tr,Rr,Sr,u,At,0,me):Uo(Oe.kind,Mt,ee,G,Y,zn,p,tr,Rr,Sr,u,At,me);const mr={program:ft,buffers:Te,uniformValues:fr,projectionData:zi,atlasTexture:xt,atlasTextureIcon:Wt,atlasInterpolation:Qt,atlasInterpolationIcon:bt,isSDF:we,hasHalo:Pr};if(X&&fe.canOverlap){Q=!0;const Pt=Te.segments.get();for(const wt of Pt)se.push({segments:new c.aV([wt]),sortKey:wt.sortKey,state:mr,terrainData:St})}else se.push({segments:Te.segments,sortKey:0,state:mr,terrainData:St})}Q&&se.sort(((pe,ce)=>pe.sortKey-ce.sortKey));for(const pe of se){const ce=pe.state;if(F.activeTexture.set(V.TEXTURE0),ce.atlasTexture.bind(ce.atlasInterpolation,V.CLAMP_TO_EDGE),ce.atlasTextureIcon&&(F.activeTexture.set(V.TEXTURE1),ce.atlasTextureIcon&&ce.atlasTextureIcon.bind(ce.atlasInterpolationIcon,V.CLAMP_TO_EDGE)),ce.isSDF){const fe=ce.uniformValues;ce.hasHalo&&(fe.u_is_halo=1,Hs(ce.buffers,pe.segments,n,p,ce.program,te,P,C,fe,ce.projectionData,pe.terrainData)),fe.u_is_halo=0}Hs(ce.buffers,pe.segments,n,p,ce.program,te,P,C,ce.uniformValues,ce.projectionData,pe.terrainData)}}function Hs(p,t,n,a,u,f,y,b,w,S,P){const C=a.context;u.draw(C,C.gl.TRIANGLES,f,y,b,st.backCCW,w,P,S,n.id,p.layoutVertexBuffer,p.indexBuffer,t,n.paint,a.transform.zoom,p.programConfigurations.get(n.id),p.dynamicLayoutVertexBuffer,p.opacityVertexBuffer)}function Pl(p,t,n,a,u){const f=p.context,y=f.gl,b=at.disabled,w=new It([y.ONE,y.ONE],c.bn.transparent,[!0,!0,!0,!0]),S=t.getBucket(n);if(!S)return;const P=a.key;let C=n.heatmapFbos.get(P);C||(C=Il(f,t.tileSize,t.tileSize),n.heatmapFbos.set(P,C)),f.bindFramebuffer.set(C.framebuffer),f.viewport.set([0,0,t.tileSize,t.tileSize]),f.clear({color:c.bn.transparent});const A=S.programConfigurations.get(n.id),F=p.useProgram("heatmap",A,!u),V=p.transform.getProjectionData({overscaledTileID:t.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),U=p.style.map.terrain.getTerrainData(a);F.draw(f,y.TRIANGLES,Xe.disabled,b,w,st.disabled,pl(t,p.transform.zoom,n.paint.get("heatmap-intensity"),1),U,V,n.id,S.layoutVertexBuffer,S.indexBuffer,S.segments,n.paint,p.transform.zoom,A)}function Zc(p,t,n,a,u){const f=p.context,y=f.gl,b=p.transform;f.setColorMode(p.colorModeForRenderPass());const w=Xs(f,t),S=n.key,P=t.heatmapFbos.get(S);if(!P)return;f.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,P.colorAttachment.get()),f.activeTexture.set(y.TEXTURE1),w.bind(y.LINEAR,y.CLAMP_TO_EDGE);const C=b.getProjectionData({overscaledTileID:n,applyTerrainMatrix:u,applyGlobeMatrix:!a});p.useProgram("heatmapTexture").draw(f,y.TRIANGLES,Xe.disabled,at.disabled,p.colorModeForRenderPass(),st.disabled,ss(p,t,0,1),null,C,t.id,p.rasterBoundsBuffer,p.quadTriangleIndexBuffer,p.rasterBoundsSegments,t.paint,b.zoom),P.destroy(),t.heatmapFbos.delete(S)}function Il(p,t,n){var a,u;const f=p.gl,y=f.createTexture();f.bindTexture(f.TEXTURE_2D,y),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,f.LINEAR),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,f.LINEAR);const b=(a=p.HALF_FLOAT)!==null&&a!==void 0?a:f.UNSIGNED_BYTE,w=(u=p.RGBA16F)!==null&&u!==void 0?u:f.RGBA;f.texImage2D(f.TEXTURE_2D,0,w,t,n,0,f.RGBA,b,null);const S=p.createFramebuffer(t,n,!1,!1);return S.colorAttachment.set(y),S}function Xs(p,t){return t.colorRampTexture||(t.colorRampTexture=new c.T(p,t.colorRamp,p.gl.RGBA)),t.colorRampTexture}function ea(p,t,n,a,u,f,y,b){let w=256;if(u.stepInterpolant){const S=t.getSource().maxzoom,P=y.canonical.z===S?Math.ceil(1<<p.transform.maxZoom-y.canonical.z):1;w=c.ak(c.cd(f.maxLineLength/c.a5*1024*P),256,n.maxTextureSize)}return b.gradient=c.ce({expression:u.gradientExpression(),evaluationKey:"lineProgress",resolution:w,image:b.gradient||void 0,clips:f.lineClipsArray}),b.texture?b.texture.update(b.gradient):b.texture=new c.T(n,b.gradient,a.RGBA),b.version=u.gradientVersion,b.texture}function yh(p,t,n,a,u){p.activeTexture.set(t.TEXTURE0),n.imageAtlasTexture.bind(t.LINEAR,t.CLAMP_TO_EDGE),a.updatePaintBuffers(u)}function Wc(p,t,n,a,u,f){(u||p.lineAtlas.dirty)&&(t.activeTexture.set(n.TEXTURE0),p.lineAtlas.bind(t)),a.updatePaintBuffers(f)}function qt(p,t,n,a,u,f,y){const b=f.gradients[u.id];let w=b.texture;u.gradientVersion!==b.version&&(w=ea(p,t,n,a,u,f,y,b)),n.activeTexture.set(a.TEXTURE0),w.bind(u.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE)}function Pn(p,t,n,a,u,f,y,b,w){const S=f.gradients[u.id];let P=S.texture;u.gradientVersion!==S.version&&(P=ea(p,t,n,a,u,f,y,S)),n.activeTexture.set(a.TEXTURE0),P.bind(u.stepInterpolant?a.NEAREST:a.LINEAR,a.CLAMP_TO_EDGE),n.activeTexture.set(a.TEXTURE1),p.lineAtlas.bind(n),b.updatePaintBuffers(w)}function ki(p,t,n,a,u){if(!n||!a||!a.imageAtlas)return;const f=a.imageAtlas.patternPositions;let y=f[n.to.toString()],b=f[n.from.toString()];if(!y&&b&&(y=b),!b&&y&&(b=y),!y||!b){const w=u.getPaintProperty(t);y=f[w],b=f[w]}y&&b&&p.setConstantPatternPositions(y,b)}function ta(p,t,n,a,u,f,y,b){const w=p.context.gl,S="fill-pattern",P=n.paint.get(S),C=P&&P.constantOr(1),A=n.getCrossfadeParameters();let F,V,U,q,G;const Y=p.transform,ee=n.paint.get("fill-translate"),X=n.paint.get("fill-translate-anchor");y?(V=C&&!n.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",F=w.LINES):(V=C?"fillPattern":"fill",F=w.TRIANGLES);const Q=P.constantOr(null);for(const te of a){const K=t.getTile(te);if(C&&!K.patternsLoaded())continue;const se=K.getBucket(n);if(!se)continue;const me=se.programConfigurations.get(n.id),pe=p.useProgram(V,me),ce=p.style.map.terrain&&p.style.map.terrain.getTerrainData(te);C&&(p.context.activeTexture.set(w.TEXTURE0),K.imageAtlasTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),me.updatePaintBuffers(A)),ki(me,S,Q,K,n);const fe=Y.getProjectionData({overscaledTileID:te,applyGlobeMatrix:!b,applyTerrainMatrix:!0}),Te=c.aL(Y,K,ee,X);if(y){q=se.indexBuffer2,G=se.segments2;const we=[w.drawingBufferWidth,w.drawingBufferHeight];U=V==="fillOutlinePattern"&&C?Ac(p,A,K,we,Te):Cc(we,Te)}else q=se.indexBuffer,G=se.segments,U=C?jo(p,A,K,Te):{u_fill_translate:Te};const Se=p.stencilModeForClipping(te);pe.draw(p.context,F,u,Se,f,st.backCCW,U,ce,fe,n.id,se.layoutVertexBuffer,q,G,n.paint,p.transform.zoom,me)}}function ds(p,t,n,a,u,f,y,b){const w=p.context,S=w.gl,P="fill-extrusion-pattern",C=n.paint.get(P),A=C.constantOr(1),F=n.getCrossfadeParameters(),V=n.paint.get("fill-extrusion-opacity"),U=C.constantOr(null),q=p.transform;for(const G of a){const Y=t.getTile(G),ee=Y.getBucket(n);if(!ee)continue;const X=p.style.map.terrain&&p.style.map.terrain.getTerrainData(G),Q=ee.programConfigurations.get(n.id),te=p.useProgram(A?"fillExtrusionPattern":"fillExtrusion",Q);A&&(p.context.activeTexture.set(S.TEXTURE0),Y.imageAtlasTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),Q.updatePaintBuffers(F));const K=q.getProjectionData({overscaledTileID:G,applyGlobeMatrix:!b,applyTerrainMatrix:!0});ki(Q,P,U,Y,n);const se=c.aL(q,Y,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),me=n.paint.get("fill-extrusion-vertical-gradient"),pe=A?Ec(p,me,V,se,G,F,Y):Mc(p,me,V,se);te.draw(w,w.gl.TRIANGLES,u,f,y,st.backCCW,pe,X,K,n.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,n.paint,p.transform.zoom,Q,p.style.map.terrain&&ee.centroidVertexBuffer)}}
798function ia(p,t,n,a,u,f,y,b,w){var S;const P=p.style.projection,C=p.context,A=p.transform,F=C.gl,V=[`#define NUM_ILLUMINATION_SOURCES ${n.paint.get("hillshade-highlight-color").values.length}`],U=p.useProgram("hillshade",null,!1,V),q=!p.options.moving;for(const G of a){const Y=t.getTile(G),ee=Y.fbo;if(!ee)continue;const X=P.getMeshFromTileID(C,G.canonical,b,!0,"raster"),Q=(S=p.style.map.terrain)===null||S===void 0?void 0:S.getTerrainData(G);C.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_2D,ee.colorAttachment.get());const te=A.getProjectionData({overscaledTileID:G,aligned:q,applyGlobeMatrix:!w,applyTerrainMatrix:!0});U.draw(C,F.TRIANGLES,f,u[G.overscaledZ],y,st.backCCW,oh(p,Y,n),Q,te,n.id,X.vertexBuffer,X.indexBuffer,X.segments)}}function Hr(p,t,n,a,u,f,y,b,w){var S;const P=p.style.projection,C=p.context,A=p.transform,F=C.gl,V=p.useProgram("colorRelief"),U=!p.options.moving,q=n.paint.get("resampling")==="nearest"?F.NEAREST:F.LINEAR;let G=!0,Y=0;for(const ee of a){const X=t.getTile(ee),Q=X.dem;if(G){const ce=F.getParameter(F.MAX_TEXTURE_SIZE),{elevationTexture:fe,colorTexture:Te}=n.getColorRampTextures(C,ce,Q.getUnpackVector());C.activeTexture.set(F.TEXTURE1),fe.bind(F.NEAREST,F.CLAMP_TO_EDGE),C.activeTexture.set(F.TEXTURE4),Te.bind(F.LINEAR,F.CLAMP_TO_EDGE),G=!1,Y=fe.size[0]}if(!Q||!Q.data)continue;const te=Q.stride,K=Q.getPixels();if(C.activeTexture.set(F.TEXTURE0),C.pixelStoreUnpackPremultiplyAlpha.set(!1),X.demTexture=X.demTexture||p.getTileTexture(te),X.demTexture){const ce=X.demTexture;ce.update(K,{premultiply:!1}),ce.bind(q,F.CLAMP_TO_EDGE)}else X.demTexture=new c.T(C,K,F.RGBA,{premultiply:!1}),X.demTexture.bind(q,F.CLAMP_TO_EDGE);const se=P.getMeshFromTileID(C,ee.canonical,b,!0,"raster"),me=(S=p.style.map.terrain)===null||S===void 0?void 0:S.getTerrainData(ee),pe=A.getProjectionData({overscaledTileID:ee,aligned:U,applyGlobeMatrix:!w,applyTerrainMatrix:!0});V.draw(C,F.TRIANGLES,f,u[ee.overscaledZ],y,st.backCCW,lh(n,X.dem,Y),me,pe,n.id,se.vertexBuffer,se.indexBuffer,se.segments)}}const Ys=[new c.P(0,0),new c.P(c.a5,0),new c.P(c.a5,c.a5),new c.P(0,c.a5)];function Xr(p,t,n,a,u,f,y,b,w=!1,S=!1){const P=a[a.length-1].overscaledZ,C=p.context,A=C.gl,F=p.useProgram("raster"),V=p.transform,U=p.style.projection,q=p.colorModeForRenderPass(),G=!p.options.moving,Y=n.paint.get("raster-opacity"),ee=n.paint.get("resampling")==="nearest"||n.paint.get("raster-resampling")==="nearest"?A.NEAREST:A.LINEAR,X=n.paint.get("raster-fade-duration"),Q=!!p.style.map.terrain;for(const te of a){const K=p.getDepthModeForSublayer(te.overscaledZ-P,Y===1?Xe.ReadWrite:Xe.ReadOnly,A.LESS),se=t.getTile(te);C.activeTexture.set(A.TEXTURE0),se.texture.bind(ee,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST),C.activeTexture.set(A.TEXTURE1);const{parentTile:me,parentScaleBy:pe,parentTopLeft:ce,fadeValues:fe}=Ml(se,t,X,Q);se.fadeOpacity=fe.tileOpacity,me?(me.fadeOpacity=fe.parentTileOpacity,me.texture.bind(ee,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST)):se.texture.bind(ee,A.CLAMP_TO_EDGE,A.LINEAR_MIPMAP_NEAREST),se.texture.useMipmap&&C.extTextureFilterAnisotropic&&p.transform.pitch>p.options.anisotropicFilterPitch&&A.texParameterf(A.TEXTURE_2D,C.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,C.extTextureFilterAnisotropicMax);const Te=p.style.map.terrain&&p.style.map.terrain.getTerrainData(te),Se=V.getProjectionData({overscaledTileID:te,aligned:G,applyGlobeMatrix:!S,applyTerrainMatrix:!0}),we=ml(ce,pe,fe.fadeMix,n,b),Oe=U.getMeshFromTileID(C,te.canonical,f,y,"raster");F.draw(C,A.TRIANGLES,K,u?u[te.overscaledZ]:at.disabled,q,w?st.frontCCW:st.backCCW,we,Te,Se,n.id,Oe.vertexBuffer,Oe.indexBuffer,Oe.segments)}}function Ml(p,t,n,a){const u={parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:{tileOpacity:1,parentTileOpacity:1,fadeMix:{opacity:1,mix:0}}};if(n===0||a)return u;if(p.fadingParentID){const f=t.getLoadedTile(p.fadingParentID);if(!f)return u;const y=Math.pow(2,f.tileID.overscaledZ-p.tileID.overscaledZ);return{parentTile:f,parentScaleBy:y,parentTopLeft:[p.tileID.canonical.x*y%1,p.tileID.canonical.y*y%1],fadeValues:(function(b,w,S){const P=be(),C=(P-w.timeAdded)/S,A=b.fadingDirection===Yi.Incoming,F=c.ak((P-b.timeAdded)/S,0,1),V=c.ak(1-C,0,1),U=A?F:V;return{tileOpacity:U,parentTileOpacity:A?V:F,fadeMix:{opacity:1,mix:1-U}}})(p,f,n)}}return p.selfFading?{parentTile:null,parentScaleBy:1,parentTopLeft:[0,0],fadeValues:(function(f,y){const b=(be()-f.timeAdded)/y,w=c.ak(b,0,1);return{tileOpacity:w,fadeMix:{opacity:w,mix:0}}})(p,n)}:u}const Hc=new c.bn(1,0,0,1),Xc=new c.bn(0,1,0,1),Yc=new c.bn(0,0,1,1),Kc=new c.bn(1,0,1,1),Jc=new c.bn(0,1,1,1);function kr(p,t,n,a){Ks(p,0,t+n/2,p.transform.width,n,a)}
vendor: 62,906 bytes, lines 798-800
798function El(p,t,n,a){Ks(p,t-n/2,0,n,p.transform.height,a)}function Ks(p,t,n,a,u,f){const y=p.context,b=y.gl;b.enable(b.SCISSOR_TEST),b.scissor(t*p.pixelRatio,n*p.pixelRatio,a*p.pixelRatio,u*p.pixelRatio),y.clear({color:f}),b.disable(b.SCISSOR_TEST)}function Qc(p,t,n){const a=p.context,u=a.gl,f=p.useProgram("debug"),y=Xe.disabled,b=at.disabled,w=p.colorModeForRenderPass(),S="$debug",P=p.style.map.terrain&&p.style.map.terrain.getTerrainData(n);a.activeTexture.set(u.TEXTURE0);const C=t.getTileByID(n.key).latestRawTileData,A=Math.floor((C&&C.byteLength||0)/1024),F=t.getTile(n).tileSize,V=512/Math.min(F,512)*(n.overscaledZ/p.transform.zoom)*.5;let U=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(U+=` => ${n.overscaledZ}`),(function(G,Y){G.initDebugOverlayCanvas();const ee=G.debugOverlayCanvas,X=G.context.gl,Q=G.debugOverlayCanvas.getContext("2d");Q.clearRect(0,0,ee.width,ee.height),Q.shadowColor="white",Q.shadowBlur=2,Q.lineWidth=1.5,Q.strokeStyle="white",Q.textBaseline="top",Q.font="bold 36px Open Sans, sans-serif",Q.fillText(Y,5,5),Q.strokeText(Y,5,5),G.debugOverlayTexture.update(ee),G.debugOverlayTexture.bind(X.LINEAR,X.CLAMP_TO_EDGE)})(p,`${U} ${A}kB`);const q=p.transform.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});f.draw(a,u.TRIANGLES,y,b,It.alphaBlended,st.disabled,dl(c.bn.transparent,V),null,q,S,p.debugBuffer,p.quadTriangleIndexBuffer,p.debugSegments),f.draw(a,u.LINE_STRIP,y,b,w,st.disabled,dl(c.bn.red),P,q,S,p.debugBuffer,p.tileBorderIndexBuffer,p.debugSegments)}function Cl(p,t,n,a){const{isRenderingGlobe:u}=a,f=p.context,y=f.gl,b=p.transform,w=p.colorModeForRenderPass(),S=p.getDepthModeFor3D(),P=p.useProgram("terrain");f.bindFramebuffer.set(null),f.viewport.set([0,0,p.width,p.height]);for(const C of n){const A=t.getTerrainMesh(C.tileID),F=p.renderToTexture.getTexture(C),V=t.getTerrainData(C.tileID);f.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,F.texture);const U=Vo(t.getMeshFrameDelta(b.zoom),b.calculateFogMatrix(C.tileID.toUnwrapped()),p.style.sky,b.pitch,u),q=b.getProjectionData({overscaledTileID:C.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});P.draw(f,y.TRIANGLES,S,at.disabled,w,st.backCCW,U,V,q,"terrain",A.vertexBuffer,A.indexBuffer,A.segments)}}function Al(p,t){if(!t.mesh){const n=new c.aU;n.emplaceBack(-1,-1),n.emplaceBack(1,-1),n.emplaceBack(1,1),n.emplaceBack(-1,1);const a=new c.aW;a.emplaceBack(0,1,2),a.emplaceBack(0,2,3),t.mesh=new Jt(p.createVertexBuffer(n,Lt.members),p.createIndexBuffer(a),c.aV.simpleSegment(0,0,n.length,a.length))}return t.mesh}class Js{constructor(t,n){this.context=new Qo(t),this.transform=n,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.ao(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=pi.maxOverzooming+pi.maxUnderzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new wc}resize(t,n,a){if(this.width=Math.floor(t*a),this.height=Math.floor(n*a),this.pixelRatio=a,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style._order)this.style._layers[u].resize()}setup(){const t=this.context,n=new c.aU;n.emplaceBack(0,0),n.emplaceBack(c.a5,0),n.emplaceBack(0,c.a5),n.emplaceBack(c.a5,c.a5),this.tileExtentBuffer=t.createVertexBuffer(n,Lt.members),this.tileExtentSegments=c.aV.simpleSegment(0,0,4,2);const a=new c.aU;a.emplaceBack(0,0),a.emplaceBack(c.a5,0),a.emplaceBack(0,c.a5),a.emplaceBack(c.a5,c.a5),this.debugBuffer=t.createVertexBuffer(a,Lt.members),this.debugSegments=c.aV.simpleSegment(0,0,4,5);const u=new c.cg;u.emplaceBack(0,0,0,0),u.emplaceBack(c.a5,0,c.a5,0),u.emplaceBack(0,c.a5,0,c.a5),u.emplaceBack(c.a5,c.a5,c.a5,c.a5),this.rasterBoundsBuffer=t.createVertexBuffer(u,js.members),this.rasterBoundsSegments=c.aV.simpleSegment(0,0,4,2);const f=new c.aU;f.emplaceBack(0,0),f.emplaceBack(c.a5,0),f.emplaceBack(0,c.a5),f.emplaceBack(c.a5,c.a5),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(f,Lt.members),this.rasterBoundsSegmentsPosOnly=c.aV.simpleSegment(0,0,4,5);const y=new c.aU;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(y,Lt.members),this.viewportSegments=c.aV.simpleSegment(0,0,4,2);const b=new c.ch;b.emplaceBack(0),b.emplaceBack(1),b.emplaceBack(3),b.emplaceBack(2),b.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(b);const w=new c.aW;w.emplaceBack(1,0,2),w.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(w);const S=this.context.gl;this.stencilClearMode=new at({func:S.ALWAYS,mask:0},0,255,S.ZERO,S.ZERO,S.ZERO),this.tileExtentMesh=new Jt(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const t=this.context,n=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const a=c.N();c.c6(a,0,this.width,this.height,0,0,1),c.Q(a,a,[n.drawingBufferWidth,n.drawingBufferHeight,0]);const u={mainMatrix:a,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:a};this.useProgram("clippingMask",null,!0).draw(t,n.TRIANGLES,Xe.disabled,this.stencilClearMode,It.disabled,st.disabled,null,null,u,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,n,a){if(this.currentStencilSource===t.source||!t.isTileClipped()||!n||!n.length)return;this.currentStencilSource=t.source,this.nextStencilID+n.length>256&&this.clearStencil();const u=this.context;u.setColorMode(It.disabled),u.setDepthMode(Xe.disabled);const f={};for(const y of n)f[y.key]=this.nextStencilID++;this._renderTileMasks(f,n,a,!0),this._renderTileMasks(f,n,a,!1),this._tileClippingMaskIDs=f}_renderTileMasks(t,n,a,u){const f=this.context,y=f.gl,b=this.style.projection,w=this.transform,S=this.useProgram("clippingMask");for(const P of n){const C=t[P.key],A=this.style.map.terrain&&this.style.map.terrain.getTerrainData(P),F=b.getMeshFromTileID(this.context,P.canonical,u,!0,"stencil"),V=w.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!a,applyTerrainMatrix:!0});S.draw(f,y.TRIANGLES,Xe.disabled,new at({func:y.ALWAYS,mask:0},C,255,y.KEEP,y.KEEP,y.REPLACE),It.disabled,a?st.disabled:st.backCCW,null,A,V,"$clipping",F.vertexBuffer,F.indexBuffer,F.segments)}}_renderTilesDepthBuffer(){const t=this.context,n=t.gl,a=this.style.projection,u=this.transform,f=this.useProgram("depth"),y=this.getDepthModeFor3D(),b=cn(u,{tileSize:u.tileSize});for(const w of b){const S=this.style.map.terrain&&this.style.map.terrain.getTerrainData(w),P=a.getMeshFromTileID(this.context,w.canonical,!0,!0,"raster"),C=u.getProjectionData({overscaledTileID:w,applyGlobeMatrix:!0,applyTerrainMatrix:!0});f.draw(t,n.TRIANGLES,y,at.disabled,It.disabled,st.backCCW,null,S,C,"$clipping",P.vertexBuffer,P.indexBuffer,P.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new at({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){const n=this.context.gl;return new at({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){const n=this.context.gl,a=t.sort(((y,b)=>b.overscaledZ-y.overscaledZ)),u=a[a.length-1].overscaledZ,f=a[0].overscaledZ-u+1;if(f>1){this.currentStencilSource=void 0,this.nextStencilID+f>256&&this.clearStencil();const y={};for(let b=0;b<f;b++)y[b+u]=new at({func:n.GEQUAL,mask:255},b+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=f,[y,a]}return[{[u]:at.disabled},a]}stencilConfigForOverlapTwoPass(t){const n=this.context.gl,a=t.sort(((y,b)=>b.overscaledZ-y.overscaledZ)),u=a[a.length-1].overscaledZ,f=a[0].overscaledZ-u+1;if(this.clearStencil(),f>1){const y={},b={};for(let w=0;w<f;w++)y[w+u]=new at({func:n.GREATER,mask:255},f+1+w,255,n.KEEP,n.KEEP,n.REPLACE),b[w+u]=new at({func:n.GREATER,mask:255},1+w,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID=2*f+1,[y,b,a]}return this.nextStencilID=3,[{[u]:new at({func:n.GREATER,mask:255},2,255,n.KEEP,n.KEEP,n.REPLACE)},{[u]:new at({func:n.GREATER,mask:255},1,255,n.KEEP,n.KEEP,n.REPLACE)},a]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new It([t.CONSTANT_COLOR,t.ONE],new c.bn(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?It.unblended:It.alphaBlended}getDepthModeForSublayer(t,n,a){if(!this.opaquePassEnabledForLayer())return Xe.disabled;const u=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new Xe(a||this.context.gl.LEQUAL,n,[u,u])}getDepthModeFor3D(){return new Xe(this.context.gl.LEQUAL,Xe.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,n){var a,u;this.style=t,this.options=n,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(be()),this.imageManager.beginFrame();const f=this.style._order,y=this.style.tileManagers,b={},w={},S={},P={isRenderingToTexture:!1,isRenderingGlobe:((a=t.projection)===null||a===void 0?void 0:a.transitionState)>0};for(const A in y){const F=y[A];F.used&&F.prepare(this.context),b[A]=F.getVisibleCoordinates(!1),w[A]=b[A].slice().reverse(),S[A]=F.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let A=0;A<f.length;A++)if(this.style._layers[f[A]].is3D()){this.opaquePassCutoff=A;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const A of f){const F=this.style._layers[A];if(!F.hasOffscreenPass()||F.isHidden(this.transform.zoom))continue;const V=w[F.source];(F.type==="custom"||V.length)&&this.renderLayer(this,y[F.source],F,V,P)}if((u=this.style.projection)===null||u===void 0||u.updateGPUdependent({context:this.context,useProgram:A=>this.useProgram(A)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:n.showOverdrawInspector?c.bn.black:c.bn.transparent,depth:1}),this.clearStencil(),this.style.sky&&(function(A,F){const V=A.context,U=V.gl,q=((te,K,se)=>{const me=Math.cos(K.rollInRadians),pe=Math.sin(K.rollInRadians),ce=ln(K),fe=K.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:te.properties.get("sky-color"),u_horizon_color:te.properties.get("horizon-color"),u_horizon:[(K.width/2-ce*pe)*se,(K.height/2+ce*me)*se],u_horizon_normal:[-pe,me],u_sky_horizon_blend:te.properties.get("sky-horizon-blend")*K.height/2*se,u_sky_blend:fe}})(F,A.style.map.transform,A.pixelRatio),G=new Xe(U.LEQUAL,Xe.ReadWrite,[0,1]),Y=at.disabled,ee=A.colorModeForRenderPass(),X=A.useProgram("sky"),Q=Al(V,F);X.draw(V,U.TRIANGLES,G,Y,ee,st.disabled,q,null,void 0,"sky",Q.vertexBuffer,Q.indexBuffer,Q.segments)})(this,this.style.sky),this._showOverdrawInspector=n.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=f.length-1;this.currentLayer>=0;this.currentLayer--){const A=this.style._layers[f[this.currentLayer]],F=y[A.source],V=b[A.source];this._renderTileClippingMasks(A,V,!1),this.renderLayer(this,F,A,V,P)}this.renderPass="translucent";let C=!1;for(this.currentLayer=0;this.currentLayer<f.length;this.currentLayer++){const A=this.style._layers[f[this.currentLayer]],F=y[A.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(A,P))continue;this.opaquePassEnabledForLayer()||C||(C=!0,P.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const V=(A.type==="symbol"?S:w)[A.source];this._renderTileClippingMasks(A,b[A.source],!!this.renderToTexture),this.renderLayer(this,F,A,V,P)}if(P.isRenderingGlobe&&(function(A,F,V){const U=A.context,q=U.gl,G=A.useProgram("atmosphere"),Y=new Xe(q.LEQUAL,Xe.ReadOnly,[0,1]),ee=A.transform,X=(function(fe,Te){const Se=fe.properties.get("position"),we=[-Se.x,-Se.y,-Se.z],Oe=c.ao(new Float64Array(16));return fe.properties.get("anchor")==="map"&&(c.be(Oe,Oe,Te.rollInRadians),c.bf(Oe,Oe,-Te.pitchInRadians),c.be(Oe,Oe,Te.bearingInRadians),c.bf(Oe,Oe,Te.center.lat*Math.PI/180),c.bH(Oe,Oe,-Te.center.lng*Math.PI/180)),c.cf(we,we,Oe),we})(V,A.transform),Q=ee.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),te=F.properties.get("atmosphere-blend")*Q.projectionTransition;if(te===0)return;const K=Ni(ee.worldSize,ee.center.lat),se=ee.inverseProjectionMatrix,me=new Float64Array(4);me[3]=1,c.aE(me,me,ee.modelViewProjectionMatrix),me[0]/=me[3],me[1]/=me[3],me[2]/=me[3],me[3]=1,c.aE(me,me,se),me[0]/=me[3],me[1]/=me[3],me[2]/=me[3],me[3]=1;const pe=((fe,Te,Se,we,Oe)=>({u_sun_pos:fe,u_atmosphere_blend:Te,u_globe_position:Se,u_globe_radius:we,u_inv_proj_matrix:Oe}))(X,te,[me[0],me[1],me[2]],K,se),ce=Al(U,F);G.draw(U,q.TRIANGLES,Y,at.disabled,It.alphaBlended,st.disabled,pe,null,null,"atmosphere",ce.vertexBuffer,ce.indexBuffer,ce.segments)})(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const A=(function(F,V){let U=null;const q=Object.values(F._layers).flatMap((X=>X.source&&!X.isHidden(V)?[F.tileManagers[X.source]]:[])),G=q.filter((X=>X.getSource().type==="vector")),Y=q.filter((X=>X.getSource().type!=="vector")),ee=X=>{(!U||U.getSource().maxzoom<X.getSource().maxzoom)&&(U=X)};return G.forEach((X=>ee(X))),U||Y.forEach((X=>ee(X))),U})(this.style,this.transform.zoom);A&&(function(F,V,U){for(let q=0;q<U.length;q++)Qc(F,V,U[q])})(this,A,A.getVisibleCoordinates())}this.options.showPadding&&(function(A){const F=A.transform.padding;kr(A,A.transform.height-(F.top||0),3,Hc),kr(A,F.bottom||0,3,Xc),El(A,F.left||0,3,Yc),El(A,A.transform.width-(F.right||0),3,Kc);const V=A.transform.centerPoint;(function(U,q,G,Y){Ks(U,q-1,G-10,2,20,Y),Ks(U,q-10,G-1,20,2,Y)})(A,V.x,A.transform.height-V.y,Jc)})(this),this.context.setDefault()}maybeDrawDepthAndCoords(t){if(!this.style||!this.style.map||!this.style.map.terrain)return;const n=this.terrainFacilitator.matrix,a=this.transform.modelViewProjectionMatrix;let u=this.terrainFacilitator.dirty;u||(u=t?!c.ci(n,a):!c.cj(n,a)),u||(u=this.style.map.terrain.tileManager.anyTilesAfterTime(this.terrainFacilitator.renderTime)),u&&(c.ck(n,a),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,(function(f,y){const b=f.context,w=b.gl,S=f.transform,P=It.unblended,C=new Xe(w.LEQUAL,Xe.ReadWrite,[0,1]),A=y.tileManager.getRenderableTiles(),F=f.useProgram("terrainDepth");b.bindFramebuffer.set(y.getFramebuffer("depth").framebuffer),b.viewport.set([0,0,f.width/devicePixelRatio,f.height/devicePixelRatio]),b.clear({color:c.bn.transparent,depth:1});for(const V of A){const U=y.getTerrainMesh(V.tileID),q=y.getTerrainData(V.tileID),G=S.getProjectionData({overscaledTileID:V.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),Y={u_ele_delta:y.getMeshFrameDelta(S.zoom)};F.draw(b,w.TRIANGLES,C,at.disabled,P,st.backCCW,Y,q,G,"terrain",U.vertexBuffer,U.indexBuffer,U.segments)}b.bindFramebuffer.set(null),b.viewport.set([0,0,f.width,f.height])})(this,this.style.map.terrain),(function(f,y){const b=f.context,w=b.gl,S=f.transform,P=It.unblended,C=new Xe(w.LEQUAL,Xe.ReadWrite,[0,1]),A=y.getCoordsTexture(),F=y.tileManager.getRenderableTiles(),V=f.useProgram("terrainCoords");b.bindFramebuffer.set(y.getFramebuffer("coords").framebuffer),b.viewport.set([0,0,f.width/devicePixelRatio,f.height/devicePixelRatio]),b.clear({color:c.bn.transparent,depth:1}),y.coordsIndex=[];for(const U of F){const q=y.getTerrainMesh(U.tileID),G=y.getTerrainData(U.tileID);b.activeTexture.set(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,A.texture);const Y={u_terrain_coords_id:(255-y.coordsIndex.length)/255,u_texture:0,u_ele_delta:y.getMeshFrameDelta(S.zoom)},ee=S.getProjectionData({overscaledTileID:U.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});V.draw(b,w.TRIANGLES,C,at.disabled,P,st.backCCW,Y,G,ee,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),y.coordsIndex.push(U.tileID.key)}b.bindFramebuffer.set(null),b.viewport.set([0,0,f.width,f.height])})(this,this.style.map.terrain))}renderLayer(t,n,a,u,f){a.isHidden(this.transform.zoom)||(a.type==="background"||a.type==="custom"||(u||[]).length)&&(this.id=a.id,c.aQ(a)?(function(y,b,w,S,P,C){if(y.renderPass!=="translucent")return;const{isRenderingToTexture:A}=C,F=at.disabled,V=y.colorModeForRenderPass();(w._unevaluatedLayout.hasValue("text-variable-anchor")||w._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&(function(U,q,G,Y,ee,X,Q,te,K){const se=q.transform,me=q.style.map.terrain,pe=ee==="map",ce=X==="map";for(const fe of U){const Te=Y.getTile(fe),Se=Te.getBucket(G);if(!Se||!Se.text||!Se.text.segments.get().length)continue;const we=c.av(Se.textSizeData,se.zoom),Oe=c.aK(Te,1,q.transform.zoom),je=He(pe,q.transform,Oe),ft=G.layout.get("icon-text-fit")!=="none"&&Se.hasIconData();if(we){const Mt=Math.pow(2,se.zoom-Te.tileID.overscaledZ),St=me?(At,xt)=>me.getElevation(fe,At,xt):null;Ws(Se,pe,ce,K,se,je,Mt,we,ft,c.aL(se,Te,Q,te),fe.toUnwrapped(),St)}}})(S,y,w,b,w.layout.get("text-rotation-alignment"),w.layout.get("text-pitch-alignment"),w.paint.get("text-translate"),w.paint.get("text-translate-anchor"),P),w.paint.get("icon-opacity").constantOr(1)!==0&&Sl(y,b,w,S,!1,w.paint.get("icon-translate"),w.paint.get("icon-translate-anchor"),w.layout.get("icon-rotation-alignment"),w.layout.get("icon-pitch-alignment"),w.layout.get("icon-keep-upright"),F,V,A),w.paint.get("text-opacity").constantOr(1)!==0&&Sl(y,b,w,S,!0,w.paint.get("text-translate"),w.paint.get("text-translate-anchor"),w.layout.get("text-rotation-alignment"),w.layout.get("text-pitch-alignment"),w.layout.get("text-keep-upright"),F,V,A),b.map.showCollisionBoxes&&(us(y,b,w,S,!0),us(y,b,w,S,!1))})(t,n,a,u,this.style.placement.variableOffsets,f):c.cl(a)?(function(y,b,w,S,P){if(y.renderPass!=="translucent")return;const{isRenderingToTexture:C}=P,A=w.paint.get("circle-opacity"),F=w.paint.get("circle-stroke-width"),V=w.paint.get("circle-stroke-opacity"),U=!w.layout.get("circle-sort-key").isConstant();if(A.constantOr(1)===0&&(F.constantOr(1)===0||V.constantOr(1)===0))return;const q=y.context,G=q.gl,Y=y.transform,ee=y.getDepthModeForSublayer(0,Xe.ReadOnly),X=at.disabled,Q=y.colorModeForRenderPass(),te=[],K=Y.getCircleRadiusCorrection();for(let se=0;se<S.length;se++){const me=S[se],pe=b.getTile(me),ce=pe.getBucket(w);if(!ce)continue;const fe=w.paint.get("circle-translate"),Te=w.paint.get("circle-translate-anchor"),Se=c.aL(Y,pe,fe,Te),we=ce.programConfigurations.get(w.id),Oe=y.useProgram("circle",we),je=ce.layoutVertexBuffer,ft=ce.indexBuffer,Mt=y.style.map.terrain&&y.style.map.terrain.getTerrainData(me),St={programConfiguration:we,program:Oe,layoutVertexBuffer:je,indexBuffer:ft,uniformValues:Dc(y,pe,w,Se,K),terrainData:Mt,projectionData:Y.getProjectionData({overscaledTileID:me,applyGlobeMatrix:!C,applyTerrainMatrix:!0})};if(U){const At=ce.segments.get();for(const xt of At)te.push({segments:new c.aV([xt]),sortKey:xt.sortKey,state:St})}else te.push({segments:ce.segments,sortKey:0,state:St})}U&&te.sort(((se,me)=>se.sortKey-me.sortKey));for(const se of te){const{programConfiguration:me,program:pe,layoutVertexBuffer:ce,indexBuffer:fe,uniformValues:Te,terrainData:Se,projectionData:we}=se.state;pe.draw(q,G.TRIANGLES,ee,X,Q,st.backCCW,Te,Se,we,w.id,ce,fe,se.segments,w.paint,y.transform.zoom,me)}})(t,n,a,u,f):c.cm(a)?(function(y,b,w,S,P){if(w.paint.get("heatmap-opacity")===0)return;const C=y.context,{isRenderingToTexture:A,isRenderingGlobe:F}=P;if(y.style.map.terrain){for(const V of S){const U=b.getTile(V);b.hasRenderableParent(V)||(y.renderPass==="offscreen"?Pl(y,U,w,V,F):y.renderPass==="translucent"&&Zc(y,w,V,A,F))}C.viewport.set([0,0,y.width,y.height])}else y.renderPass==="offscreen"?(function(V,U,q,G){const Y=V.context,ee=Y.gl,X=V.transform,Q=at.disabled,te=new It([ee.ONE,ee.ONE],c.bn.transparent,[!0,!0,!0,!0]);(function(K,se,me){const pe=K.gl;K.activeTexture.set(pe.TEXTURE1),K.viewport.set([0,0,se.width/4,se.height/4]);let ce=me.heatmapFbos.get(c.cc);ce?(pe.bindTexture(pe.TEXTURE_2D,ce.colorAttachment.get()),K.bindFramebuffer.set(ce.framebuffer)):(ce=Il(K,se.width/4,se.height/4),me.heatmapFbos.set(c.cc,ce))})(Y,V,q),Y.clear({color:c.bn.transparent});for(let K=0;K<G.length;K++){const se=G[K];if(U.hasRenderableParent(se))continue;const me=U.getTile(se),pe=me.getBucket(q);if(!pe)continue;const ce=pe.programConfigurations.get(q.id),fe=V.useProgram("heatmap",ce),Te=X.getProjectionData({overscaledTileID:se,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Se=X.getCircleRadiusCorrection();fe.draw(Y,ee.TRIANGLES,Xe.disabled,Q,te,st.backCCW,pl(me,X.zoom,q.paint.get("heatmap-intensity"),Se),null,Te,q.id,pe.layoutVertexBuffer,pe.indexBuffer,pe.segments,q.paint,X.zoom,ce)}Y.viewport.set([0,0,V.width,V.height])})(y,b,w,S):y.renderPass==="translucent"&&(function(V,U){const q=V.context,G=q.gl;q.setColorMode(V.colorModeForRenderPass());const Y=U.heatmapFbos.get(c.cc);Y&&(q.activeTexture.set(G.TEXTURE0),G.bindTexture(G.TEXTURE_2D,Y.colorAttachment.get()),q.activeTexture.set(G.TEXTURE1),Xs(q,U).bind(G.LINEAR,G.CLAMP_TO_EDGE),V.useProgram("heatmapTexture").draw(q,G.TRIANGLES,Xe.disabled,at.disabled,V.colorModeForRenderPass(),st.disabled,ss(V,U,0,1),null,null,U.id,V.viewportBuffer,V.quadTriangleIndexBuffer,V.viewportSegments,U.paint,V.transform.zoom))})(y,w)})(t,n,a,u,f):c.cn(a)?(function(y,b,w,S,P){if(y.renderPass!=="translucent")return;const{isRenderingToTexture:C}=P,A=w.paint.get("line-opacity"),F=w.paint.get("line-width");if(A.constantOr(1)===0||F.constantOr(1)===0)return;const V=y.getDepthModeForSublayer(0,Xe.ReadOnly),U=y.colorModeForRenderPass(),q=w.paint.get("line-dasharray"),G=q.constantOr(1),Y=w.paint.get("line-pattern"),ee=Y.constantOr(1),X=w.paint.get("line-gradient"),Q=w.getCrossfadeParameters();let te;te=ee?"linePattern":G&&X?"lineGradientSDF":G?"lineSDF":X?"lineGradient":"line";const K=y.context,se=K.gl,me=y.transform;let pe=!0;for(const ce of S){const fe=b.getTile(ce);if(ee&&!fe.patternsLoaded())continue;const Te=fe.getBucket(w);if(!Te)continue;const Se=Te.programConfigurations.get(w.id),we=y.context.program.get(),Oe=y.useProgram(te,Se),je=pe||Oe.program!==we,ft=y.style.map.terrain&&y.style.map.terrain.getTerrainData(ce),Mt=Y.constantOr(null),St=q&&q.constantOr(null);if(Mt&&fe.imageAtlas){const ai=fe.imageAtlas,Wt=ai.patternPositions[Mt.to.toString()],Ht=ai.patternPositions[Mt.from.toString()];Wt&&Ht&&Se.setConstantPatternPositions(Wt,Ht)}else if(St){const ai=w.layout.get("line-cap").constantOr(null)==="round",Wt=y.lineAtlas.getDash(St.to,ai),Ht=y.lineAtlas.getDash(St.from,ai);Se.setConstantDashPositions(Wt,Ht)}const At=me.getProjectionData({overscaledTileID:ce,applyGlobeMatrix:!C,applyTerrainMatrix:!0}),xt=me.getPixelScale();let Qt;ee?(Qt=Lc(y,fe,w,xt,Q),yh(K,se,fe,Se,Q)):G&&X?(Qt=Fc(y,fe,w,xt,Q,Te.lineClipsArray.length),Pn(y,b,K,se,w,Te,ce,Se,Q)):G?(Qt=fl(y,fe,w,xt,Q),Wc(y,K,se,Se,je,Q)):X?(Qt=zc(y,fe,w,xt,Te.lineClipsArray.length),qt(y,b,K,se,w,Te,ce)):Qt=Ns(y,fe,w,xt);const bt=y.stencilModeForClipping(ce);Oe.draw(K,se.TRIANGLES,V,bt,U,st.disabled,Qt,ft,At,w.id,Te.layoutVertexBuffer,Te.indexBuffer,Te.segments,w.paint,y.transform.zoom,Se,Te.layoutVertexBuffer2),pe=!1}})(t,n,a,u,f):c.co(a)?(function(y,b,w,S,P){const C=w.paint.get("fill-color"),A=w.paint.get("fill-opacity");if(A.constantOr(1)===0)return;const{isRenderingToTexture:F}=P,V=y.colorModeForRenderPass(),U=w.paint.get("fill-pattern"),q=y.opaquePassEnabledForLayer()&&!U.constantOr(1)&&C.constantOr(c.bn.transparent).a===1&&A.constantOr(0)===1?"opaque":"translucent";y.renderPass===q&&ta(y,b,w,S,y.getDepthModeForSublayer(1,y.renderPass==="opaque"?Xe.ReadWrite:Xe.ReadOnly),V,!1,F),y.renderPass==="translucent"&&w.paint.get("fill-antialias")&&ta(y,b,w,S,y.getDepthModeForSublayer(w.getPaintProperty("fill-outline-color")?2:0,Xe.ReadOnly),V,!0,F)})(t,n,a,u,f):c.cp(a)?(function(y,b,w,S,P){const C=w.paint.get("fill-extrusion-opacity");if(C===0)return;const{isRenderingToTexture:A}=P;if(y.renderPass==="translucent"){const F=new Xe(y.context.gl.LEQUAL,Xe.ReadWrite,y.depthRangeFor3D);if(C!==1||w.paint.get("fill-extrusion-pattern").constantOr(1))ds(y,b,w,S,F,at.disabled,It.disabled,A),ds(y,b,w,S,F,y.stencilModeFor3D(),y.colorModeForRenderPass(),A);else{const V=y.colorModeForRenderPass();ds(y,b,w,S,F,at.disabled,V,A)}}})(t,n,a,u,f):c.cq(a)?(function(y,b,w,S,P){if(y.renderPass!=="offscreen"&&y.renderPass!=="translucent")return;const{isRenderingToTexture:C}=P,A=y.context,F=y.style.projection.useSubdivision,V=y.getDepthModeForSublayer(0,Xe.ReadOnly),U=y.colorModeForRenderPass();if(y.renderPass==="offscreen")(function(q,G,Y,ee,X,Q,te){const K=q.context,se=K.gl,me=ee.paint.get("resampling")==="nearest"?se.NEAREST:se.LINEAR;for(const pe of Y){const ce=G.getTile(pe),fe=ce.dem;if(!fe||!fe.data||!ce.needsHillshadePrepare)continue;const Te=fe.dim,Se=fe.stride,we=fe.getPixels();if(K.activeTexture.set(se.TEXTURE1),K.pixelStoreUnpackPremultiplyAlpha.set(!1),ce.demTexture=ce.demTexture||q.getTileTexture(Se),ce.demTexture){const je=ce.demTexture;je.update(we,{premultiply:!1}),je.bind(se.NEAREST,se.CLAMP_TO_EDGE)}else ce.demTexture=new c.T(K,we,se.RGBA,{premultiply:!1}),ce.demTexture.bind(se.NEAREST,se.CLAMP_TO_EDGE);K.activeTexture.set(se.TEXTURE0);let Oe=ce.fbo;if(!Oe){const je=new c.T(K,{width:Te,height:Te,data:null},se.RGBA);je.bind(me,se.CLAMP_TO_EDGE),Oe=ce.fbo=K.createFramebuffer(Te,Te,!0,!1),Oe.colorAttachment.set(je.texture)}K.bindFramebuffer.set(Oe.framebuffer),K.viewport.set([0,0,Te,Te]),q.useProgram("hillshadePrepare").draw(K,se.TRIANGLES,X,Q,te,st.disabled,No(ce.tileID,fe),null,null,ee.id,q.rasterBoundsBuffer,q.quadTriangleIndexBuffer,q.rasterBoundsSegments),ce.needsHillshadePrepare=!1}})(y,b,S,w,V,at.disabled,U),A.viewport.set([0,0,y.width,y.height]);else if(y.renderPass==="translucent")if(F){const[q,G,Y]=y.stencilConfigForOverlapTwoPass(S);ia(y,b,w,Y,q,V,U,!1,C),ia(y,b,w,Y,G,V,U,!0,C)}else{const[q,G]=y.getStencilConfigForOverlapAndUpdateStencilID(S);ia(y,b,w,G,q,V,U,!1,C)}})(t,n,a,u,f):c.cr(a)?(function(y,b,w,S,P){if(y.renderPass!=="translucent"||!S.length)return;const{isRenderingToTexture:C}=P,A=y.style.projection.useSubdivision,F=y.getDepthModeForSublayer(0,Xe.ReadOnly),V=y.colorModeForRenderPass();if(A){const[U,q,G]=y.stencilConfigForOverlapTwoPass(S);Hr(y,b,w,G,U,F,V,!1,C),Hr(y,b,w,G,q,F,V,!0,C)}else{const[U,q]=y.getStencilConfigForOverlapAndUpdateStencilID(S);Hr(y,b,w,q,U,F,V,!1,C)}})(t,n,a,u,f):c.bT(a)?(function(y,b,w,S,P){if(y.renderPass!=="translucent"||w.paint.get("raster-opacity")===0||!S.length)return;const{isRenderingToTexture:C}=P,A=b.getSource(),F=y.style.projection.useSubdivision;if(A instanceof Gr)Xr(y,b,w,S,null,!1,!1,A.tileCoords,A.flippedWindingOrder,C);else if(F){const[V,U,q]=y.stencilConfigForOverlapTwoPass(S);Xr(y,b,w,q,V,!1,!0,Ys,!1,C),Xr(y,b,w,q,U,!0,!0,Ys,!1,C)}else{const[V,U]=y.getStencilConfigForOverlapAndUpdateStencilID(S);Xr(y,b,w,U,V,!1,!0,Ys,!1,C)}})(t,n,a,u,f):c.cs(a)?(function(y,b,w,S,P){const C=w.paint.get("background-color"),A=w.paint.get("background-opacity");if(A===0)return;const{isRenderingToTexture:F}=P,V=y.context,U=V.gl,q=y.style.projection,G=y.transform,Y=G.tileSize,ee=w.paint.get("background-pattern");if(y.isPatternMissing(ee))return;const X=!ee&&C.a===1&&A===1&&y.opaquePassEnabledForLayer()?"opaque":"translucent";if(y.renderPass!==X)return;const Q=at.disabled,te=y.getDepthModeForSublayer(0,X==="opaque"?Xe.ReadWrite:Xe.ReadOnly),K=y.colorModeForRenderPass(),se=y.useProgram(ee?"backgroundPattern":"background"),me=S||cn(G,{tileSize:Y,terrain:y.style.map.terrain});ee&&(V.activeTexture.set(U.TEXTURE0),y.imageManager.bind(y.context));const pe=w.getCrossfadeParameters();for(const ce of me){const fe=G.getProjectionData({overscaledTileID:ce,applyGlobeMatrix:!F,applyTerrainMatrix:!0}),Te=ee?vl(A,y,ee,{tileID:ce,tileSize:Y},pe):bn(A,C),Se=y.style.map.terrain&&y.style.map.terrain.getTerrainData(ce),we=q.getMeshFromTileID(V,ce.canonical,!1,!0,"raster");se.draw(V,U.TRIANGLES,te,Q,K,st.backCCW,Te,Se,fe,w.id,we.vertexBuffer,we.indexBuffer,we.segments)}})(t,0,a,u,f):c.ct(a)&&(function(y,b,w,S){const{isRenderingGlobe:P}=S,C=y.context,A=w.implementation,F=y.style.projection,V=y.transform,U=V.getProjectionDataForCustomLayer(P),q={farZ:V.farZ,nearZ:V.nearZ,fov:V.fov*Math.PI/180,modelViewProjectionMatrix:V.modelViewProjectionMatrix,projectionMatrix:V.projectionMatrix,shaderData:{variantName:F.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793; 799uniform mat4 u_projection_matrix; 800${F.shaderPreludeCode.vertexSource}`,define:F.shaderDefine},defaultProjectionData:U},G=A.renderingMode?A.renderingMode:"2d";if(y.renderPass==="offscreen"){const Y=A.prerender;Y&&(y.setCustomLayerDefaults(),C.setColorMode(y.colorModeForRenderPass()),Y.call(A,C.gl,q),C.setDirty(),y.setBaseState())}else if(y.renderPass==="translucent"){y.setCustomLayerDefaults(),C.setColorMode(y.colorModeForRenderPass()),C.setStencilMode(at.disabled);const Y=G==="3d"?y.getDepthModeFor3D():y.getDepthModeForSublayer(0,Xe.ReadOnly);C.setDepthMode(Y),A.render(C.gl,q),C.setDirty(),y.setBaseState(),C.bindFramebuffer.set(null)}})(t,0,a,f))}saveTileTexture(t){const n=this._tileTextures[t.size[0]];n?n.length<Js.MAX_TEXTURE_POOL_SIZE_PER_BUCKET?n.push(t):t.destroy():this._tileTextures[t.size[0]]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const n=this.imageManager.getPattern(t.from.toString()),a=this.imageManager.getPattern(t.to.toString());return!n||!a}useProgram(t,n,a=!1,u=[]){this.cache=this.cache||{};const f=!!this.style.map.terrain,y=this.style.projection,b=a?Gt.projectionMercator:y.shaderPreludeCode,w=a?Ft:y.shaderDefine,S=t+(n?n.cacheKey:"")+`/${a?Tc:y.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(f?"/terrain":"")+(u?`/${u.join("/")}`:"");return this.cache[S]||(this.cache[S]=new sh(this.context,Gt[t],n,ch[t],this._showOverdrawInspector,f,b,w,u)),this.cache[S]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas??(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new c.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){var t,n;if(this._tileTextures){for(const a in this._tileTextures){const u=this._tileTextures[a];if(u)for(const f of u)f.destroy()}this._tileTextures={}}if(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&&((t=this.tileExtentMesh.vertexBuffer)===null||t===void 0||t.destroy()),this.tileExtentMesh&&((n=this.tileExtentMesh.indexBuffer)===null||n===void 0||n.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.cache){for(const a in this.cache){const u=this.cache[a];u&&u.program&&this.context.gl.deleteProgram(u.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){const{drawingBufferWidth:t,drawingBufferHeight:n}=this.context.gl;return this.width!==t||this.height!==n}}function Dl(p,t){let n,a=!1,u=null,f=null;const y=()=>{u=null,a&&(p.apply(f,n),u=setTimeout(y,t),a=!1)};return(...b)=>(a=!0,f=this,n=b,u||y(),u)}Js.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50;class kl{constructor(t){this._getCurrentHash=()=>{const n=window.location.hash.replace("#","");if(this._hashName){let a;return n.split("&").map((u=>u.split("="))).forEach((u=>{u[0]===this._hashName&&(a=u)})),(a&&a[1]||"").split("/")}return n.split("/")},this._onHashChange=()=>{const n=this._getCurrentHash();if(!this._isValidHash(n))return!1;const a=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(n[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:a,pitch:+(n[4]||0)}),!0},this._updateHashUnthrottled=()=>{const n=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,n)},this._removeHash=()=>{const n=this._getCurrentHash();if(n.length===0)return;const a=n.join("/");let u=a;u.split("&").length>0&&(u=u.split("&")[0]),this._hashName&&(u=`${this._hashName}=${a}`);let f=window.location.hash.replace(u,"");f.startsWith("#&")?f=f.slice(0,1)+f.slice(2):f==="#"&&(f="");let y=window.location.href.replace(/(#.+)?$/,f);y=y.replace("&&","&"),window.history.replaceState(window.history.state,null,y)},this._updateHash=Dl(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,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(t){const n=this._map.getCenter(),a=Math.round(100*this._map.getZoom())/100,u=Math.ceil((a*Math.LN2+Math.log(512/360/.5))/Math.LN10),f=Math.pow(10,u),y=Math.round(n.lng*f)/f,b=Math.round(n.lat*f)/f,w=this._map.getBearing(),S=this._map.getPitch();let P="";if(P+=t?`/${y}/${b}/${a}`:`${a}/${b}/${y}`,(w||S)&&(P+="/"+Math.round(10*w)/10),S&&(P+=`/${Math.round(S)}`),this._hashName){const C=this._hashName;let A=!1;const F=window.location.hash.slice(1).split("&").map((V=>{const U=V.split("=")[0];return U===C?(A=!0,`${U}=${P}`):V})).filter((V=>V));return A||F.push(`${C}=${P}`),`#${F.join("&")}`}return`#${P}`}_isValidHash(t){if(t.length<3||t.some(isNaN))return!1;try{new c.V(+t[2],+t[1])}catch{return!1}const n=+t[0],a=+(t[3]||0),u=+(t[4]||0);return n>=this._map.getMinZoom()&&n<=this._map.getMaxZoom()&&a>=-180&&a<=180&&u>=this._map.getMinPitch()&&u<=this._map.getMaxPitch()}}const ps={linearity:.3,easing:c.cu(0,0,.3,1)},ra=c.e({deceleration:2500,maxSpeed:1400},ps),eu=c.e({deceleration:20,maxSpeed:1400},ps),er=c.e({deceleration:1e3,maxSpeed:360},ps),ur=c.e({deceleration:1e3,maxSpeed:90},ps),tu=c.e({deceleration:1e3,maxSpeed:360},ps);class hr{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:be(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=be();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const n={zoom:0,bearing:0,pitch:0,roll:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:f}of this._inertiaBuffer)n.zoom+=f.zoomDelta||0,n.bearing+=f.bearingDelta||0,n.pitch+=f.pitchDelta||0,n.roll+=f.rollDelta||0,f.panDelta&&n.pan._add(f.panDelta),f.around&&(n.around=f.around),f.pinchAround&&(n.pinchAround=f.pinchAround);const a=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,u={};if(n.pan.mag()){const f=eo(n.pan.mag(),a,c.e({},ra,t||{})),y=n.pan.mult(f.amount/n.pan.mag()),b=this._map.cameraHelper.handlePanInertia(y,this._map.transform);u.center=b.easingCenter,u.offset=b.easingOffset,Qs(u,f)}if(n.zoom){const f=eo(n.zoom,a,eu);u.zoom=c.cv(this._map.transform.zoom+f.amount,this._map.getZoomSnap(),f.amount),Qs(u,f)}if(n.bearing){const f=eo(n.bearing,a,er);u.bearing=this._map.transform.bearing+c.ak(f.amount,-179,179),Qs(u,f)}if(n.pitch){const f=eo(n.pitch,a,ur);u.pitch=this._map.transform.pitch+f.amount,Qs(u,f)}if(n.roll){const f=eo(n.roll,a,tu);u.roll=this._map.transform.roll+c.ak(f.amount,-179,179),Qs(u,f)}if(u.zoom||u.bearing){const f=n.pinchAround===void 0?n.around:n.pinchAround;u.around=f?this._map.unproject(f):this._map.getCenter()}return this.clear(),c.e(u,{noMoveStart:!0})}}function Qs(p,t){(!p.duration||p.duration<t.duration)&&(p.duration=t.duration,p.easing=t.easing)}function eo(p,t,n){const{maxSpeed:a,linearity:u,deceleration:f}=n,y=c.ak(p*u/(t/1e3),-a,a),b=Math.abs(y)/(f*u);return{easing:n.easing,duration:1e3*b,amount:y*(b/2)}}class $i extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a,u={}){a=a instanceof MouseEvent?a:new MouseEvent(t,a);const f=le.mousePos(n.getCanvas(),a),y=n.unproject(f);super(t,c.e({point:f,lngLat:y,originalEvent:a},u)),this._defaultPrevented=!1,this.target=n}}class wr extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){const u=t==="touchend"?a.changedTouches:a.touches,f=le.touchPos(n.getCanvasContainer(),u),y=f.map((w=>n.unproject(w))),b=f.reduce(((w,S,P,C)=>w.add(S.div(C.length))),new c.P(0,0));super(t,{points:f,point:b,lngLats:y,lngLat:n.unproject(b),originalEvent:a}),this._defaultPrevented=!1}}class iu extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,a){super(t,{originalEvent:a}),this._defaultPrevented=!1}}class vh{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new iu(t.type,this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new $i(t.type,this._map,t))}mouseup(t){this._map.fire(new $i(t.type,this._map,t))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||this._map.fire(new $i(t.type,this._map,t))}dblclick(t){return this._firePreventable(new $i(t.type,this._map,t))}mouseover(t){this._map.fire(new $i(t.type,this._map,t))}mouseout(t){this._map.fire(new $i(t.type,this._map,t))}touchstart(t){return this._firePreventable(new wr(t.type,this._map,t))}touchmove(t){this._map.fire(new wr(t.type,this._map,t))}touchend(t){this._map.fire(new wr(t.type,this._map,t))}touchcancel(t){this._map.fire(new wr(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class xh{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new $i(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new $i("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new $i(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class to{constructor(t){this._map=t}get transform(){return this._map._requestedCameraState||this._map.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(t){return this.transform.screenPointToLocation(c.P.convert(t),this._map.terrain)}}class zl{constructor(t,n){this._map=t,this._tr=new to(t),this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1,n.boxZoom&&typeof n.boxZoom=="object"&&(this._boxZoomEnd=n.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(le.disableDrag(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const a=n;if(this._lastPos.equals(a)||!this._box&&a.dist(this._startPos)<this._clickTolerance)return;const u=this._startPos;this._lastPos=a,this._box||(this._box=le.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",t));const f=Math.min(u.x,a.x),y=Math.max(u.x,a.x),b=Math.min(u.y,a.y),w=Math.max(u.y,a.y);this._box.style.transform=`translate(${f}px,${b}px)`,this._box.style.width=y-f+"px",this._box.style.height=w-b+"px"}mouseupWindow(t,n){if(!this._active||t.button!==0)return;const a=this._startPos,u=n;if(this.reset(),le.suppressClick(),a.x!==u.x||a.y!==u.y)return this._map.fire(new c.l("boxzoomend",{originalEvent:t})),this._boxZoomEnd?void this._boxZoomEnd(this._map,a,u,t):{cameraAnimation:f=>f.fitScreenCoordinates(a,u,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box.remove(),this._box=null),le.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new c.l(t,{originalEvent:n}))}}function In(p,t){if(p.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${p.length}, points ${t.length}`);const n={};for(let a=0;a<p.length;a++)n[p[a].identifier]=t[a];return n}class zr{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,n,a){(this.centroid||a.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),a.length===this.numTouches&&(this.centroid=(function(u){const f=new c.P(0,0);for(const y of u)f._add(y);return f.div(u.length)})(n),this.touches=In(a,n)))}touchmove(t,n,a){if(this.aborted||!this.centroid)return;const u=In(a,n);for(const f in this.touches){const y=u[f];(!y||y.dist(this.touches[f])>30)&&(this.aborted=!0)}}touchend(t,n,a){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),a.length===0){const u=!this.aborted&&this.centroid;if(this.reset(),u)return u}}}class Re{constructor(t){this.singleTap=new zr(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,n,a){this.singleTap.touchstart(t,n,a)}touchmove(t,n,a){this.singleTap.touchmove(t,n,a)}touchend(t,n,a){const u=this.singleTap.touchend(t,n,a);if(u){const f=t.timeStamp-this.lastTime<500,y=!this.lastTap||this.lastTap.dist(u)<30;if(f&&y||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=u,this.count===this.numTaps)return this.reset(),u}}}class ru{constructor(t){this._tr=new to(t),this._zoomIn=new Re({numTouches:1,numTaps:2}),this._zoomOut=new Re({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,a){this._zoomIn.touchstart(t,n,a),this._zoomOut.touchstart(t,n,a)}touchmove(t,n,a){this._zoomIn.touchmove(t,n,a),this._zoomOut.touchmove(t,n,a)}touchend(t,n,a){const u=this._zoomIn.touchend(t,n,a),f=this._zoomOut.touchend(t,n,a),y=this._tr;return u?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:c.cv(y.zoom+1,b.getZoomSnap()),around:y.unproject(u)},{originalEvent:t})}):f?(this._active=!0,t.preventDefault(),setTimeout((()=>this.reset()),0),{cameraAnimation:b=>b.easeTo({duration:300,zoom:c.cv(y.zoom-1,b.getZoomSnap()),around:y.unproject(f)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Mn{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){const n=this._moveFunction(...t);if(n.bearingDelta||n.pitchDelta||n.rollDelta||n.around||n.panDelta)return this._active=!0,n}dragStart(t,n){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(n)?n[0]:n,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,n){if(!this.isEnabled())return;const a=this._lastPoint;if(!a)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);const u=Array.isArray(n)?n[0]:n;return!this._moved&&u.dist(a)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=u,this._move(a,u))}dragEnd(t){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(t)&&(this._moved&&le.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const nu=0,io=2,ro={[nu]:1,[io]:2};class En{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){this._eventButton=t.button}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!(function(n,a){const u=ro[a];return n.buttons===void 0||(n.buttons&u)!==u})(t,this._eventButton)}isValidEndEvent(t){return t.button===this._eventButton}}class bh{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){this._firstTouch=t.targetTouches[0].identifier}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}}class Ll{constructor(t=new En({checkCorrectEvent:()=>!0}),n=new bh){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=n}_executeRelevantHandler(t,n,a){return t instanceof MouseEvent?n(t):typeof TouchEvent<"u"&&t instanceof TouchEvent?a(t):void 0}startMove(t){this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.startMove(n)),(n=>this.oneFingerTouchMoveStateManager.startMove(n)))}endMove(t){this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.endMove(n)),(n=>this.oneFingerTouchMoveStateManager.endMove(n)))}isValidStartEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidStartEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidStartEvent(n)))}isValidMoveEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidMoveEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(n)))}isValidEndEvent(t){return this._executeRelevantHandler(t,(n=>this.mouseMoveStateManager.isValidEndEvent(n)),(n=>this.oneFingerTouchMoveStateManager.isValidEndEvent(n)))}}const no=p=>{p.mousedown=p.dragStart,p.mousemoveWindow=p.dragMove,p.mouseup=p.dragEnd,p.contextmenu=t=>{t.preventDefault()}};class Fl{constructor(t,n){this._clickTolerance=t.clickTolerance||1,this._map=n,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,n,a){return this._calculateTransform(t,n,a)}touchmove(t,n,a){if(this._active){if(!this._shouldBePrevented(a.length))return t.preventDefault(),this._calculateTransform(t,n,a);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t)}}touchend(t,n,a){this._calculateTransform(t,n,a),this._active&&this._shouldBePrevented(a.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,a){a.length>0&&(this._active=!0);const u=In(a,n),f=new c.P(0,0),y=new c.P(0,0);let b=0;for(const S in u){const P=u[S],C=this._touches[S];C&&(f._add(P),y._add(P.sub(C)),b++,u[S]=P)}if(this._touches=u,this._shouldBePrevented(b)||!y.mag())return;const w=y.div(b);return this._sum._add(w),this._sum.mag()<this._clickTolerance?void 0:{around:f.div(b),panDelta:w}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Rl{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(t,n,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,a){if(!this._firstTwoTouches)return;t.preventDefault();const[u,f]=this._firstTwoTouches,y=so(a,n,u),b=so(a,n,f);if(!y||!b)return;const w=this._aroundCenter?null:y.add(b).div(2);return this._move([y,b],w,t)}touchend(t,n,a){if(!this._firstTwoTouches)return;const[u,f]=this._firstTwoTouches,y=so(a,n,u),b=so(a,n,f);y&&b||(this._active&&le.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function so(p,t,n){for(let a=0;a<p.length;a++)if(p[a].identifier===n)return t[a]}function su(p,t){return Math.log(p/t)/Math.LN2}class ou extends Rl{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const a=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(su(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:su(this._distance,a),pinchAround:n}}}function Bl(p,t){return 180*p.angleWith(t)/Math.PI}class au extends Rl{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n,a){const u=this._vector;if(this._vector=t[0].sub(t[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Bl(this._vector,u),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,a=Bl(t,this._startVector);return Math.abs(a)<n}}function na(p){return Math.abs(p.y)>Math.abs(p.x)}class lu extends Rl{constructor(t){super(),this._currentTouchCount=0,this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,n,a){super.touchstart(t,n,a),this._currentTouchCount=a.length}_start(t){this._lastPoints=t,na(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,a){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const u=t[0].sub(this._lastPoints[0]),f=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(u,f,a.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(u.y+f.y)/2*-.5}):void 0}gestureBeginsVertically(t,n,a){if(this._valid!==void 0)return this._valid;const u=t.mag()>=2,f=n.mag()>=2;if(!u&&!f)return;if(!u||!f)return this._firstMove===void 0&&(this._firstMove=a),a-this._firstMove<100&&void 0;const y=t.y>0==n.y>0;return na(t)&&na(n)&&y}}const wh={panStep:100,bearingStep:15,pitchStep:10};class Lr{constructor(t){this._tr=new to(t);const n=wh;this._panStep=n.panStep,this._bearingStep=n.bearingStep,this._pitchStep=n.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,a=0,u=0,f=0,y=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?a=-1:(t.preventDefault(),f=-1);break;case 39:t.shiftKey?a=1:(t.preventDefault(),f=1);break;case 38:t.shiftKey?u=1:(t.preventDefault(),y=-1);break;case 40:t.shiftKey?u=-1:(t.preventDefault(),y=1);break;default:return}return this._rotationDisabled&&(a=0,u=0),{cameraAnimation:b=>{const w=this._tr;b.easeTo({duration:300,easeId:"keyboardHandler",easing:vt,zoom:n?c.cv(w.zoom+n*(t.shiftKey?2:1),b.getZoomSnap()):w.zoom,bearing:w.bearing+a*this._bearingStep,pitch:w.pitch+u*this._pitchStep,offset:[-f*this._panStep,-y*this._panStep],center:w.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function vt(p){return p*(2-p)}const cu=4.000244140625,sa=1/450;class oo{constructor(t,n){this._onTimeout=a=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(a)},this._map=t,this._tr=new to(t),this._triggerRenderFrame=n,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=sa}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const a=be(),u=a-(this._lastWheelEventTime||0);this._lastWheelEventTime=a,n!==0&&n%cu==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":u>400?(this._type=null,this._lastValue=n,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(u*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=le.mousePos(this._map.getCanvas(),t),a=this._tr;this._aroundPoint=this._aroundCenter?a.transform.locationToScreenPoint(c.V.convert(a.center)):n,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const b=t.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=b),typeof this._targetZoom=="number"&&(this._targetZoom+=b)}if(this._delta!==0){const b=this._type==="wheel"&&Math.abs(this._delta)>cu?this._wheelZoomRate:this._defaultZoomRate;let w=2/(1+Math.exp(-Math.abs(this._delta*b)));this._delta<0&&w!==0&&(w=1/w);const S=typeof this._targetZoom!="number"?t.scale:c.an(this._targetZoom),P=t.applyConstrain(t.getCameraLngLat(),c.aq(S*w)).zoom,C=this._map.getZoomSnap();if(this._type==="wheel"&&C>0){const A=c.cv(t.zoom,C);this._targetZoom=c.cv(P,C,P-A)}else this._targetZoom=P;this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const n=typeof this._targetZoom!="number"?t.zoom:this._targetZoom,a=this._startZoom,u=this._easing;let f,y=!1;if(this._type==="wheel"&&a&&u){const b=be()-this._lastWheelEventTime,w=Math.min((b+5)/200,1),S=u(w);f=c.G.number(a,n,S),w<1?this._frameId||(this._frameId=!0):y=!0}else f=n,y=!0;return this._active=!0,y&&(this._active=!1,this._finishTimeout=setTimeout((()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout}),200)),this._lastExpectedZoom=f,{noInertia:!0,needsRenderFrame:!y,zoomDelta:f-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=c.cx;if(this._prevEase){const a=this._prevEase,u=(be()-a.start)/a.duration,f=a.easing(u+.01)-a.easing(u),y=.27/Math.sqrt(f*f+1e-4)*.01,b=Math.sqrt(.0729-y*y);n=c.cu(y,b,.25,1)}return this._prevEase={start:be(),duration:t,easing:n},n}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class oa{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class uu{constructor(t){this._tr=new to(t),this.reset()}reset(){this._active=!1}dblclick(t,n){return t.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:c.cv(this._tr.zoom+(t.shiftKey?-1:1),a.getZoomSnap()),around:this._tr.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class hu{constructor(){this._tap=new Re({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,n,a){if(!this._swipePoint)if(this._tapTime){const u=n[0],f=t.timeStamp-this._tapTime<500,y=this._tapPoint.dist(u)<30;f&&y?a.length>0&&(this._swipePoint=u,this._swipeTouch=a[0].identifier):this.reset()}else this._tap.touchstart(t,n,a)}touchmove(t,n,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;const u=n[0],f=u.y-this._swipePoint.y;return this._swipePoint=u,t.preventDefault(),this._active=!0,{zoomDelta:f/128}}}else this._tap.touchmove(t,n,a)}touchend(t,n,a){if(this._tapTime)this._swipePoint&&a.length===0&&this.reset();else{const u=this._tap.touchend(t,n,a);u&&(this._tapTime=t.timeStamp,this._tapPoint=u)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ol{constructor(t,n,a){this._el=t,this._mousePan=n,this._touchPan=a}enable(t){this._inertiaOptions=t||{},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()}}class du{constructor(t,n,a,u){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=n,this._mousePitch=a,this._mouseRoll=u}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()}}class dr{constructor(t,n,a,u){this._el=t,this._touchZoom=n,this._touchRotate=a,this._tapDragZoom=u,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("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()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class ao{constructor(t,n){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=t,this._options=n,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=le.create("div","maplibregl-cooperative-gesture-screen",t);let n=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(n=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const a=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),u=document.createElement("div");u.className="maplibregl-desktop-message",u.textContent=n,this._container.appendChild(u);const f=document.createElement("div");f.className="maplibregl-mobile-message",f.textContent=a,this._container.appendChild(f),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(t){return t[this._bypassKey]}notifyGestureBlocked(t,n){this._enabled&&(this._map.fire(new c.l("cooperativegestureprevented",{gestureType:t,originalEvent:n})),this._container.classList.add("maplibregl-show"),setTimeout((()=>{this._container.classList.remove("maplibregl-show")}),100))}}const Ve=p=>p.zoom||p.drag||p.roll||p.pitch||p.rotate;class $e extends c.l{}function Cn(p){return p.panDelta&&p.panDelta.mag()||p.zoomDelta||p.bearingDelta||p.pitchDelta||p.rollDelta}class pu{get _ownerDocument(){var t;return((t=this._el)===null||t===void 0?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,n;return((n=(t=this._el)===null||t===void 0?void 0:t.ownerDocument)===null||n===void 0?void 0:n.defaultView)||window}constructor(t,n){this.handleWindowEvent=u=>{this.handleEvent(u,`${u.type}Window`)},this.handleEvent=(u,f)=>{if(u.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const y=u.type==="renderFrame"?void 0:u,b={needsRenderFrame:!1},w={},S={};for(const{handlerName:A,handler:F,allowed:V}of this._handlers){if(!F.isEnabled())continue;let U;if(this._blockedByActive(S,V,A))F.reset();else if(F[f||u.type]){if(c.cy(u,f||u.type)){const q=le.mousePos(this._map.getCanvas(),u);U=F[f||u.type](u,q)}else if(c.cz(u,f||u.type)){const q=this._getMapTouches(u.touches),G=le.touchPos(this._map.getCanvas(),q);U=F[f||u.type](u,G,q)}else c.cA(f||u.type)||(U=F[f||u.type](u));this.mergeHandlerResult(b,w,U,A,y),U&&U.needsRenderFrame&&this._triggerRe
800nderFrame()}(U||F.isActive())&&(S[A]=F)}const P={};for(const A in this._previousActiveHandlers)S[A]||(P[A]=y);this._previousActiveHandlers=S,(Object.keys(P).length||Cn(b))&&(this._changes.push([b,w,P]),this._triggerRenderFrame()),(Object.keys(S).length||Cn(b))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:C}=b;C&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],C(this._map))},this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new hr(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(n);const a=this._el;this._listeners=[[a,"touchstart",{passive:!0}],[a,"touchmove",{passive:!1}],[a,"touchend",void 0],[a,"touchcancel",void 0],[a,"mousedown",void 0],[a,"mousemove",void 0],[a,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[a,"mouseover",void 0],[a,"mouseout",void 0],[a,"dblclick",void 0],[a,"click",void 0],[a,"keydown",{capture:!1}],[a,"keyup",void 0],[a,"wheel",{passive:!1}],[a,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(const[u,f,y]of this._listeners)u.addEventListener(f,u===this._ownerDocument?this.handleWindowEvent:this.handleEvent,y)}destroy(){for(const[t,n,a]of this._listeners)t.removeEventListener(n,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,a)}_addDefaultHandlers(t){const n=this._map,a=n.getCanvasContainer();this._add("mapEvent",new vh(n,t));const u=n.boxZoom=new zl(n,t);this._add("boxZoom",u),t.interactive&&t.boxZoom&&u.enable();const f=n.cooperativeGestures=new ao(n,t.cooperativeGestures);this._add("cooperativeGestures",f),t.cooperativeGestures&&f.enable();const y=new ru(n),b=new uu(n);n.doubleClickZoom=new oa(b,y),this._add("tapZoom",y),this._add("clickZoom",b),t.interactive&&t.doubleClickZoom&&n.doubleClickZoom.enable();const w=new hu;this._add("tapDragZoom",w);const S=n.touchPitch=new lu(n);this._add("touchPitch",S),t.interactive&&t.touchPitch&&n.touchPitch.enable(t.touchPitch);const P=()=>n.project(n.getCenter()),C=(function({enable:X,clickTolerance:Q,aroundCenter:te=!0,minPixelCenterThreshold:K=100,rotateDegreesPerPixelMoved:se=.8},me){return new Mn({clickTolerance:Q,move:(pe,ce)=>{const fe=me();if(te&&Math.abs(fe.y-pe.y)>K)return{bearingDelta:c.cw(new c.P(pe.x,ce.y),ce,fe)};let Te=(ce.x-pe.x)*se;return te&&ce.y<fe.y&&(Te=-Te),{bearingDelta:Te}},moveStateManager:new En({checkCorrectEvent:pe=>pe.button===0&&pe.ctrlKey||pe.button===2&&!pe.ctrlKey}),enable:X,assignEvents:no})})(t,P),A=(function({enable:X,clickTolerance:Q,pitchDegreesPerPixelMoved:te=-.5}){return new Mn({clickTolerance:Q,move:(K,se)=>({pitchDelta:(se.y-K.y)*te}),moveStateManager:new En({checkCorrectEvent:K=>K.button===0&&K.ctrlKey||K.button===2}),enable:X,assignEvents:no})})(t),F=(function({enable:X,clickTolerance:Q,rollDegreesPerPixelMoved:te=.3},K){return new Mn({clickTolerance:Q,move:(se,me)=>{const pe=K();let ce=(me.x-se.x)*te;return me.y<pe.y&&(ce=-ce),{rollDelta:ce}},moveStateManager:new En({checkCorrectEvent:se=>se.button===2&&se.ctrlKey}),enable:X,assignEvents:no})})(t,P);n.dragRotate=new du(t,C,A,F),this._add("mouseRotate",C,["mousePitch"]),this._add("mousePitch",A,["mouseRotate","mouseRoll"]),this._add("mouseRoll",F,["mousePitch"]),t.interactive&&t.dragRotate&&n.dragRotate.enable();const V=(function({enable:X,clickTolerance:Q}){return new Mn({clickTolerance:Q,move:(te,K)=>({around:K,panDelta:K.sub(te)}),activateOnStart:!0,moveStateManager:new En({checkCorrectEvent:te=>te.button===0&&!te.ctrlKey}),enable:X,assignEvents:no})})(t),U=new Fl(t,n);n.dragPan=new Ol(a,V,U),this._add("mousePan",V),this._add("touchPan",U,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&n.dragPan.enable(t.dragPan);const q=new au,G=new ou;n.touchZoomRotate=new dr(a,G,q,w),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",G,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&n.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new xh(n));const Y=n.scrollZoom=new oo(n,(()=>
vendor: 22,582 bytes, line 800
800this._triggerRenderFrame()));this._add("scrollZoom",Y,["mousePan"]),t.interactive&&t.scrollZoom&&n.scrollZoom.enable(t.scrollZoom);const ee=n.keyboard=new Lr(n);this._add("keyboard",ee),t.interactive&&t.keyboard&&n.keyboard.enable()}_add(t,n,a){this._handlers.push({handlerName:t,handler:n,allowed:a}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ve(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,n,a){for(const u in t)if(u!==a&&(!n||n.indexOf(u)<0))return!0;return!1}_getMapTouches(t){const n=[];for(const a of t)this._el.contains(a.target)&&n.push(a);return n}mergeHandlerResult(t,n,a,u,f){if(!a)return;c.e(t,a);const y={handlerName:u,originalEvent:a.originalEvent||f};a.zoomDelta!==void 0&&(n.zoom=y),a.panDelta!==void 0&&(n.drag=y),a.rollDelta!==void 0&&(n.roll=y),a.pitchDelta!==void 0&&(n.pitch=y),a.bearingDelta!==void 0&&(n.rotate=y)}_applyChanges(){const t={},n={},a={};for(const[u,f,y]of this._changes)u.panDelta&&(t.panDelta=(t.panDelta||new c.P(0,0))._add(u.panDelta)),u.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+u.zoomDelta),u.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+u.bearingDelta),u.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+u.pitchDelta),u.rollDelta&&(t.rollDelta=(t.rollDelta||0)+u.rollDelta),u.around!==void 0&&(t.around=u.around),u.pinchAround!==void 0&&(t.pinchAround=u.pinchAround),u.noInertia&&(t.noInertia=u.noInertia),c.e(n,f),c.e(a,y);this._updateMapTransform(t,n,a),this._changes=[]}_updateMapTransform(t,n,a){const u=this._map,f=u._getTransformForUpdate(),y=u.terrain;if(!(Cn(t)||y&&this._terrainMovement))return this._fireEvents(n,a,!0);u._stop(!0);let{panDelta:b,zoomDelta:w,bearingDelta:S,pitchDelta:P,rollDelta:C,around:A,pinchAround:F}=t;F!==void 0&&(A=F),A=A||u.transform.centerPoint,y&&!f.isPointOnMapSurface(A)&&(A=f.centerPoint);const V={panDelta:b,zoomDelta:w,rollDelta:C,pitchDelta:P,bearingDelta:S,around:A};this._map.cameraHelper.useGlobeControls&&!f.isPointOnMapSurface(A)&&(A=f.centerPoint);const U=A.distSqr(f.centerPoint)<.01?f.center:f.screenPointToLocation(b?A.sub(b):A);this._handleMapControls({terrain:y,tr:f,deltasForHelper:V,preZoomAroundLoc:U,combinedEventsInProgress:n,panDelta:b}),u._applyUpdatedTransform(f),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,a,!0)}_handleMapControls({terrain:t,tr:n,deltasForHelper:a,preZoomAroundLoc:u,combinedEventsInProgress:f,panDelta:y}){const b=this._map.cameraHelper;if(b.handleMapControlsRollPitchBearingZoom(a,n),t)return b.useGlobeControls?(this._terrainMovement||!f.drag&&!f.zoom||(this._terrainMovement=!0,this._map._elevationFreeze=!0),void b.handleMapControlsPan(a,n,u)):this._terrainMovement||!f.drag&&!f.zoom?void(f.drag&&this._terrainMovement&&y?n.setCenter(n.screenPointToLocation(n.centerPoint.sub(y))):b.handleMapControlsPan(a,n,u)):(this._terrainMovement=!0,this._map._elevationFreeze=!0,void b.handleMapControlsPan(a,n,u));b.handleMapControlsPan(a,n,u)}_fireEvents(t,n,a){const u=Ve(this._eventsInProgress),f=Ve(t),y={};for(const C in t){const{originalEvent:A}=t[C];this._eventsInProgress[C]||(y[`${C}start`]=A),this._eventsInProgress[C]=t[C]}!u&&f&&this._fireEvent("movestart",f.originalEvent);for(const C in y)this._fireEvent(C,y[C]);f&&this._fireEvent("move",f.originalEvent);for(const C in t){const{originalEvent:A}=t[C];this._fireEvent(C,A)}const b={};let w;for(const C in this._eventsInProgress){const{handlerName:A,originalEvent:F}=this._eventsInProgress[C];this._handlersById[A].isActive()||(delete this._eventsInProgress[C],w=n[A]||F,b[`${C}end`]=w)}for(const C in b)this._fireEvent(C,b[C]);const S=Ve(this._eventsInProgress),P=(u||f)&&!S;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const C=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&C.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(C)}if(a&&P){this._updatingCamera=!0;const C=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),A=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!C||!C.essential&&Ee.prefersReducedMotion?(this._map.fire(new c.l("moveend",{originalEvent:w})),A(this._map.getBearing())&&this._map.resetNorth()):(A(C.bearing||this._map.getBearing())&&(C.bearing=0),C.freezeElevation=!0,this._map.easeTo(C,{originalEvent:w})),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new c.l(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add((t=>{delete this._frameId,this.handleEvent(new $e("renderFrame",{timeStamp:t})),this._applyChanges()}))}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class aa extends c.E{constructor(t,n,a){super(),this._renderFrameCallback=()=>{const u=Math.min((be()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(u)),u<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=a.bearingSnap,this._zoomSnap=a.zoomSnap,this.cameraHelper=n,this.on("moveend",(()=>{delete this._requestedCameraState}))}migrateProjection(t,n){t.apply(this.transform,!0),this.transform=t,this.cameraHelper=n}getCenter(){return new c.V(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,n){return this.jumpTo({elevation:t},n),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,n,a){return t=c.P.convert(t).mult(-1),this.panTo(this.transform.center,c.e({offset:t},n),a)}panTo(t,n,a){return this.easeTo(c.e({center:t},n),a)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,a){return this.easeTo(c.e({zoom:t},n),a)}zoomIn(t,n){return this.zoomTo(c.cv(this.getZoom()+1,this._zoomSnap),t,n),this}zoomOut(t,n){return this.zoomTo(c.cv(this.getZoom()-1,this._zoomSnap),t,n),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,n){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new c.l("movestart",n)).fire(new c.l("move",n)).fire(new c.l("moveend",n))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,a){return this.easeTo(c.e({bearing:t},n),a)}resetNorth(t,n){return this.rotateTo(0,c.e({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(c.e({bearing:0,pitch:0,roll:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}getRoll(){return this.transform.roll}setRoll(t,n){return this.jumpTo({roll:t},n),this}cameraForBounds(t,n){t=mt.convert(t).adjustAntiMeridian();const a=n&&n.bearing||0;return this._cameraForBoxAndBearing(t.getNorthWest(),t.getSouthEast(),a,n)}_cameraForBoxAndBearing(t,n,a,u){const f={top:0,bottom:0,right:0,left:0};if(typeof(u=c.e({padding:f,offset:[0,0],maxZoom:this.transform.maxZoom},u)).padding=="number"){const P=u.padding;u.padding={top:P,bottom:P,right:P,left:P}}const y=c.e(f,u.padding);u.padding=y;const b=this.transform,w=new mt(t,n),S=this.cameraHelper.cameraForBoxAndBearing(u,y,w,a,b);return S&&this._zoomSnap&&(S.zoom=c.cv(S.zoom,this._zoomSnap,-1)),S}fitBounds(t,n,a){return this._fitInternal(this.cameraForBounds(t,n),n,a)}fitScreenCoordinates(t,n,a,u,f){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(c.P.convert(t)),this.transform.screenPointToLocation(c.P.convert(n)),a,u),u,f)}_fitInternal(t,n,a){return t?(delete(n=c.e(t,n)).padding,n.linear?this.easeTo(n,a):this.flyTo(n,a)):this}jumpTo(t,n){this.stop(),"zoom"in t&&this._zoomSnap&&(t.zoom=c.cv(t.zoom,this._zoomSnap));const a=this._getTransformForUpdate();let u=!1,f=!1,y=!1;const b=a.zoom;this.terrain&&a.setElevation(this.terrain.getElevationForLngLatZoom(t.center?c.V.convert(t.center):a.center,t.zoom||a.tileZoom)),this.cameraHelper.handleJumpToCenterZoom(a,t);const w=a.zoom!==b;return"elevation"in t&&a.elevation!==+t.elevation&&a.setElevation(+t.elevation),"bearing"in t&&a.bearing!==+t.bearing&&(u=!0,a.setBearing(+t.bearing)),"pitch"in t&&a.pitch!==+t.pitch&&(f=!0,a.setPitch(+t.pitch)),"roll"in t&&a.roll!==+t.roll&&(y=!0,a.setRoll(+t.roll)),t.padding==null||a.isPaddingEqual(t.padding)||a.setPadding(t.padding),this._applyUpdatedTransform(a),this.fire(new c.l("movestart",n)).fire(new c.l("move",n)),w&&this.fire(new c.l("zoomstart",n)).fire(new c.l("zoom",n)).fire(new c.l("zoomend",n)),u&&this.fire(new c.l("rotatestart",n)).fire(new c.l("rotate",n)).fire(new c.l("rotateend",n)),f&&this.fire(new c.l("pitchstart",n)).fire(new c.l("pitch",n)).fire(new c.l("pitchend",n)),y&&this.fire(new c.l("rollstart",n)).fire(new c.l("roll",n)).fire(new c.l("rollend",n)),this.fire(new c.l("moveend",n))}calculateCameraOptionsFromTo(t,n,a,u=0){const f=c.a6.fromLngLat(t,n),y=c.a6.fromLngLat(a,u),b=y.x-f.x,w=y.y-f.y,S=y.z-f.z,P=Math.hypot(b,w,S);if(P===0)throw new Error("Can't calculate camera options with same From and To");const C=Math.hypot(b,w),A=c.aq(this.transform.cameraToCenterDistance/P/this.transform.tileSize),F=180*Math.atan2(b,-w)/Math.PI;let V=180*Math.acos(C/P)/Math.PI;return V=S<0?90-V:90+V,{center:y.toLngLat(),elevation:u,zoom:A,pitch:V,bearing:F}}calculateCameraOptionsFromCameraLngLatAltRotation(t,n,a,u,f){const y=this.transform.calculateCenterFromCameraLngLatAlt(t,n,a,u);return{center:y.center,elevation:y.elevation,zoom:y.zoom,bearing:a,pitch:u,roll:f}}easeTo(t,n){this._stop(!1,t.easeId),"zoom"in(t=c.e({offset:[0,0],duration:500,easing:c.cx},t))&&this._zoomSnap&&(t.zoom=c.cv(t.zoom,this._zoomSnap)),(t.animate===!1||!t.essential&&Ee.prefersReducedMotion)&&(t.duration=0);const a=this._getTransformForUpdate(),u=this.getBearing(),f=a.pitch,y=a.roll,b="bearing"in t?this._normalizeBearing(t.bearing,u):u,w="pitch"in t?+t.pitch:f,S="roll"in t?this._normalizeBearing(t.roll,y):y,P="padding"in t?t.padding:a.padding,C=c.P.convert(t.offset);let A,F;t.around&&(A=c.V.convert(t.around),F=a.locationToScreenPoint(A));const V={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},U=this.cameraHelper.handleEaseTo(a,{bearing:b,pitch:w,roll:S,padding:P,around:A,aroundPoint:F,offsetAsPoint:C,offset:t.offset,zoom:t.zoom,center:t.center});return this._rotating=this._rotating||u!==b,this._pitching=this._pitching||w!==f,this._rolling=this._rolling||S!==y,this._padding=!a.isPaddingEqual(P),this._zooming=this._zooming||U.isZooming,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,V),this.terrain&&this._prepareElevation(U.elevationCenter),this._ease((q=>{U.easeFunc(q),this.terrain&&!t.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(a),this._fireMoveEvents(n)}),(q=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n,q)}),t),this}_prepareEase(t,n,a={}){this._moving=!0,n||a.moving||this.fire(new c.l("movestart",t)),this._zooming&&!a.zooming&&this.fire(new c.l("zoomstart",t)),this._rotating&&!a.rotating&&this.fire(new c.l("rotatestart",t)),this._pitching&&!a.pitching&&this.fire(new c.l("pitchstart",t)),this._rolling&&!a.rolling&&this.fire(new c.l("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(t,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(t){this._elevationStart!==void 0&&this._elevationCenter!==void 0||this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const n=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(t<1&&n!==this._elevationTarget){const a=this._elevationTarget-this._elevationStart;this._elevationStart+=t*(a-(n-(a*t+this._elevationStart))/(1-t)),this._elevationTarget=n}this.transform.setElevation(c.G.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};const n=t.getCameraLngLat(),a=t.getCameraAltitude(),u=this.terrain?this.terrain.getElevationForLngLatZoom(n,t.zoom):0;if(a<u){const f=this.calculateCameraOptionsFromTo(n,u,t.center,t.elevation);return{pitch:f.pitch,zoom:f.zoom}}return{}}_applyUpdatedTransform(t){const n=[];if(n.push((u=>this._elevateCameraIfInsideTerrain(u))),this.transformCameraUpdate&&n.push((u=>this.transformCameraUpdate(u))),!n.length)return;const a=t.clone();for(const u of n){const f=a.clone(),{center:y,zoom:b,roll:w,pitch:S,bearing:P,elevation:C}=u(f);y&&f.setCenter(y),C!==void 0&&f.setElevation(C),b!==void 0&&f.setZoom(b),w!==void 0&&f.setRoll(w),S!==void 0&&f.setPitch(S),P!==void 0&&f.setBearing(P),a.apply(f,!1)}this.transform.apply(a,!1)}_fireMoveEvents(t){this.fire(new c.l("move",t)),this._zooming&&this.fire(new c.l("zoom",t)),this._rotating&&this.fire(new c.l("rotate",t)),this._pitching&&this.fire(new c.l("pitch",t)),this._rolling&&this.fire(new c.l("roll",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;delete this._easeId;const a=this._zooming,u=this._rotating,f=this._pitching,y=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,a&&this.fire(new c.l("zoomend",t)),u&&this.fire(new c.l("rotateend",t)),f&&this.fire(new c.l("pitchend",t)),y&&this.fire(new c.l("rollend",t)),this.fire(new c.l("moveend",t))}flyTo(t,n){if(!t.essential&&Ee.prefersReducedMotion){const fe=c.U(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(fe,n)}this.stop(),"zoom"in(t=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.cx},t))&&this._zoomSnap&&(t.zoom=c.cv(t.zoom,this._zoomSnap));const a=this._getTransformForUpdate(),u=a.bearing,f=a.pitch,y=a.roll,b=a.padding,w="bearing"in t?this._normalizeBearing(t.bearing,u):u,S="pitch"in t?+t.pitch:f,P="roll"in t?this._normalizeBearing(t.roll,y):y,C="padding"in t?t.padding:a.padding,A=c.P.convert(t.offset);let F=a.centerPoint.add(A);const V=a.screenPointToLocation(F),U=this.cameraHelper.handleFlyTo(a,{bearing:w,pitch:S,roll:P,padding:C,locationAtOffset:V,offsetAsPoint:A,center:t.center,minZoom:t.minZoom,zoom:t.zoom});let q=t.curve;const G=Math.max(a.width,a.height),Y=G/U.scaleOfZoom,ee=U.pixelPathLength;typeof U.scaleOfMinZoom=="number"&&(q=Math.sqrt(G/U.scaleOfMinZoom/ee*2));const X=q*q;function Q(fe){const Te=(Y*Y-G*G+(fe?-1:1)*X*X*ee*ee)/(2*(fe?Y:G)*X*ee);return Math.log(Math.sqrt(Te*Te+1)-Te)}function te(fe){return(Math.exp(fe)-Math.exp(-fe))/2}function K(fe){return(Math.exp(fe)+Math.exp(-fe))/2}const se=Q(!1);let me=function(fe){return K(se)/K(se+q*fe)},pe=function(fe){return G*((K(se)*(te(Te=se+q*fe)/K(Te))-te(se))/X)/ee;var Te},ce=(Q(!0)-se)/q;if(Math.abs(ee)<2e-6||!isFinite(ce)){if(Math.abs(G-Y)<1e-6)return this.easeTo(t,n);const fe=Y<G?-1:1;ce=Math.abs(Math.log(Y/G))/q,pe=()=>0,me=Te=>Math.exp(fe*q*Te)}return t.duration="duration"in t?+t.duration:1e3*ce/("screenSpeed"in t?+t.screenSpeed/q:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=u!==w,this._pitching=S!==f,this._rolling=P!==y,this._padding=!a.isPaddingEqual(C),this._prepareEase(n,!1),this.terrain&&this._prepareElevation(U.targetCenter),this._ease((fe=>{const Te=fe*ce,Se=1/me(Te),we=pe(Te);this._rotating&&a.setBearing(c.G.number(u,w,fe)),this._pitching&&a.setPitch(c.G.number(f,S,fe)),this._rolling&&a.setRoll(c.G.number(y,P,fe)),this._padding&&(a.interpolatePadding(b,C,fe),F=a.centerPoint.add(A)),U.easeFunc(fe,Se,we,F),this.terrain&&!t.freezeElevation&&this._updateElevation(fe),this._applyUpdatedTransform(a),this._fireMoveEvents(n)}),(()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(n)}),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,n){var a;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const u=this._onEaseEnd;delete this._onEaseEnd,u.call(this,n)}return t||(a=this.handlers)===null||a===void 0||a.stop(!1),this}_ease(t,n,a){a.animate===!1||a.duration===0?(t(1),n()):(this._easeStart=be(),this._easeOptions=a,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,n){t=c.W(t,-180,180);const a=Math.abs(t-n);return Math.abs(t-360-n)<a&&(t-=360),Math.abs(t+360-n)<a&&(t+=360),t}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(c.V.convert(t),this.transform):null}}const xi={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Vl{constructor(t=xi){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=n=>{!n||n.sourceDataType!=="metadata"&&n.sourceDataType!=="visibility"&&n.dataType!=="style"&&n.type!=="terrain"||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=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=le.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=le.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=le.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(t,n){const a=this._map._getUIString(`AttributionControl.${n}`);t.title=a,t.setAttribute("aria-label",a)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map((u=>typeof u!="string"?"":u))):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const u=this._map.style.stylesheet;this.styleOwner=u.owner,this.styleId=u.id}const n=this._map.style.tileManagers;for(const u in n){const f=n[u];if(f.used||f.usedForTerrain){const y=f.getSource();y.attribution&&t.indexOf(y.attribution)<0&&t.push(y.attribution)}}t=t.filter((u=>String(u).trim())),t.sort(((u,f)=>u.length-f.length)),t=t.filter(((u,f)=>{for(let y=f+1;y<t.length;y++)if(t[y].indexOf(u)>=0)return!1;return!0}));const a=t.join(" | ");a!==this._attribHTML&&(this._attribHTML=a,t.length?(this._innerContainer.innerHTML=le.sanitize(a),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class la{constructor(t={}){this._updateCompact=()=>{const n=this._container.children;if(n.length){const a=n[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&a.classList.add("maplibregl-compact"):a.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=le.create("div","maplibregl-ctrl");const n=le.create("a","maplibregl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://maplibre.org/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),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}}class pr{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,a=n?this._queue.concat(n):this._queue;
800for(const u of a)if(u.id===t)return void(u.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const n=this._currentlyRunning=this._queue;this._queue=[];for(const a of n)if(!a.cancelled&&(a.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var fu=c.aS([{name:"a_pos3d",type:"Int16",components:3}]);class Th extends c.E{constructor(t){super(),this._lastTilesetChange=be(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null}getSource(){return this.tileManager._source}update(t,n){this.tileManager.update(t,n),this._renderableTilesKeys=[];const a={};for(const u of cn(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:n,calculateTileZoom:this.tileManager._source.calculateTileZoom}))a[u.key]=!0,this._renderableTilesKeys.push(u.key),this._tiles[u.key]||(u.terrainRttPosMatrix32f=new Float64Array(16),c.c6(u.terrainRttPosMatrix32f,0,c.a5,c.a5,0,0,1),this._tiles[u.key]=new Zn(u,this.tileSize),this._lastTilesetChange=be());for(const u in this._tiles)a[u]||delete this._tiles[u]}freeRtt(t){for(const n in this._tiles){const a=this._tiles[n];(!t||a.tileID.equals(t)||a.tileID.isChildOf(t)||t.isChildOf(a.tileID))&&(a.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map((t=>this.getTileByID(t)))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,n){return n?this._getTerrainCoordsForTileRanges(t,n):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){const n={};for(const a of this._renderableTilesKeys){const u=this._tiles[a].tileID,f=t.clone(),y=c.bi();if(u.canonical.equals(t.canonical))c.c6(y,0,c.a5,c.a5,0,0,1);else if(u.canonical.isChildOf(t.canonical)){const b=u.canonical.z-t.canonical.z,w=u.canonical.x-(u.canonical.x>>b<<b),S=u.canonical.y-(u.canonical.y>>b<<b),P=c.a5>>b;c.c6(y,0,P,P,0,0,1),c.O(y,y,[-w*P,-S*P,0])}else{if(!t.canonical.isChildOf(u.canonical))continue;{const b=t.canonical.z-u.canonical.z,w=t.canonical.x-(t.canonical.x>>b<<b),S=t.canonical.y-(t.canonical.y>>b<<b),P=c.a5>>b;c.c6(y,0,c.a5,c.a5,0,0,1),c.O(y,y,[w*P,S*P,0]),c.Q(y,y,[1/2**b,1/2**b,0])}}f.terrainRttPosMatrix32f=new Float32Array(y),n[a]=f}return n}_getTerrainCoordsForTileRanges(t,n){const a={};for(const u of this._renderableTilesKeys){const f=this._tiles[u].tileID;if(!this._isWithinTileRanges(f,n))continue;const y=t.clone(),b=c.bi();if(f.canonical.z===t.canonical.z){const w=t.canonical.x-f.canonical.x+t.wrap*(1<<t.canonical.z),S=t.canonical.y-f.canonical.y;c.c6(b,0,c.a5,c.a5,0,0,1),c.O(b,b,[w*c.a5,S*c.a5,0])}else if(f.canonical.z>t.canonical.z){const w=f.canonical.z-t.canonical.z,S=f.canonical.x-(f.canonical.x>>w<<w)+t.wrap*(1<<f.canonical.z),P=f.canonical.y-(f.canonical.y>>w<<w),C=t.canonical.x-(f.canonical.x>>w),A=t.canonical.y-(f.canonical.y>>w),F=c.a5>>w;c.c6(b,0,F,F,0,0,1),c.O(b,b,[-S*F+C*c.a5,-P*F+A*c.a5,0])}else{const w=t.canonical.z-f.canonical.z,S=t.canonical.x-(t.canonical.x>>w<<w)+t.wrap*(1<<t.canonical.z),P=t.canonical.y-(t.canonical.y>>w<<w),C=(t.canonical.x>>w)-f.canonical.x,A=(t.canonical.y>>w)-f.canonical.y,F=c.a5<<w;c.c6(b,0,F,F,0,0,1),c.O(b,b,[S*c.a5+C*F,P*c.a5+A*F,0])}y.terrainRttPosMatrix32f=new Float32Array(b),a[u]=y}return a}getSourceTile(t,n){const a=this.tileManager._source;let u=t.overscaledZ-this.deltaZoom;if(u>a.maxzoom&&(u=a.maxzoom),u<a.minzoom)return;this._sourceTileCache[t.key]||(this._sourceTileCache[t.key]=t.scaledTo(u).key);let f=this.findTileInCaches(this._sourceTileCache[t.key]);if(!f?.dem&&n)for(;u>=a.minzoom&&!f?.dem;)f=this.findTileInCaches(t.scaledTo(u--).key);return f}findTileInCaches(t){let n=this.tileManager.getTileByID(t);return n||(n=this.tileManager._outOfViewCache.getByKey(t),n)}anyTilesAfterTime(t=Date.now()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,n){const a=n[t.canonical.z];return!!a&&(t.wrap>a.minWrap||t.wrap<a.maxWrap||t.canonical.x>=a.minTileXWrapped&&t.canonical.x<=a.maxTileXWrapped&&t.canonical.y>=a.minTileY&&t.canonical.y<=a.maxTileY)}}class Sh{constructor(t,n,a){this._meshCache={},this.painter=t,this.tileManager=new Th(n),this.options=a,this.exaggeration=typeof a.exaggeration=="number"?a.exaggeration:1,this.qual
vendor: 14,156 bytes, line 800
800ityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}destroy(){this._fbo&&(this._fbo.destroy(),this._fbo=null),this._fboCoordsTexture&&(this._fboCoordsTexture.destroy(),this._fboCoordsTexture=null),this._fboDepthTexture&&(this._fboDepthTexture.destroy(),this._fboDepthTexture=null),this._emptyDemTexture&&(this._emptyDemTexture.destroy(),this._emptyDemTexture=null),this._emptyDepthTexture&&(this._emptyDepthTexture.destroy(),this._emptyDepthTexture=null),this._coordsTexture&&(this._coordsTexture.destroy(),this._coordsTexture=null);for(const t in this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,n,a,u=c.a5){var f;const y=t.normalizeCoordinates(n,a,u);if(!y)return 0;const b=this.getTerrainData(y.tileID),w=(f=b.tile)===null||f===void 0?void 0:f.dem;if(!w)return 0;const S=c.cB([],[y.x/u*c.a5,y.y/u*c.a5],b.u_terrain_matrix),P=[S[0]*w.dim,S[1]*w.dim],C=Math.floor(P[0]),A=Math.floor(P[1]),F=P[0]-C,V=P[1]-A;return w.get(C,A)*(1-F)*(1-V)+w.get(C+1,A)*F*(1-V)+w.get(C,A+1)*(1-F)*V+w.get(C+1,A+1)*F*V}getElevationForLngLatZoom(t,n){if(!c.cC(n,t.wrap()))return 0;const{tileID:a,mercatorX:u,mercatorY:f}=this._getOverscaledTileIDFromLngLatZoom(t,n);return this.getElevation(a,u%c.a5,f%c.a5,c.a5)}getElevationForLngLat(t,n){const a=cn(n,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this});let u=0;for(const f of a)f.canonical.z>u&&(u=Math.min(f.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,u)}getElevation(t,n,a,u=c.a5){return this.getDEMElevation(t,n,a,u)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){const u=this.painter.context,f=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new c.T(u,f,u.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new c.T(u,new c.R({width:1,height:1}),u.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.ao([])}const n=this.tileManager.getSourceTile(t,!0);if(n&&n.dem&&(!n.demTexture||n.needsTerrainPrepare)){const u=this.painter.context;n.demTexture=this.painter.getTileTexture(n.dem.stride),n.demTexture?n.demTexture.update(n.dem.getPixels(),{premultiply:!1}):n.demTexture=new c.T(u,n.dem.getPixels(),u.gl.RGBA,{premultiply:!1}),n.demTexture.bind(u.gl.NEAREST,u.gl.CLAMP_TO_EDGE),n.needsTerrainPrepare=!1}const a=n&&n.toString()+n.tileID.key+t.key;if(a&&!this._demMatrixCache[a]){const u=this.tileManager.getSource().maxzoom;let f=t.canonical.z-n.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=u?f=t.canonical.z-u:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const y=t.canonical.x-(t.canonical.x>>f<<f),b=t.canonical.y-(t.canonical.y>>f<<f),w=c.cD(new Float64Array(16),[1/(c.a5<<f),1/(c.a5<<f),0]);c.O(w,w,[y*c.a5,b*c.a5,0]),this._demMatrixCache[t.key]={matrix:w,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:n&&n.dem&&n.dem.dim||1,u_terrain_matrix:a?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:n&&n.dem&&n.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(n&&n.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:n}}getFramebuffer(t){const n=this.painter,a=n.width/devicePixelRatio,u=n.height/devicePixelRatio;return!this._fbo||this._fbo.width===a&&this._fbo.height===u||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new c.T(n.context,{width:a,height:u,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new c.T(n.context,{width:a,height:u,data:null},n.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(n.context.gl.NEAREST,n.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=n.context.createFramebuffer(a,u,!0,!1),this._fbo.depthAttachment.set(n.context.createRenderbuffer(n.context.gl.DEPTH_COMPONENT16,a,u))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const n=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let f=0,y=0;f<this._coordsTextureSize;f++)for(let b=0;b<this._coordsTextureSize;b++,y+=4)n[y+0]=255&b,n[y+1]=255&f,n[y+2]=b>>8<<4|f>>8,n[y+3]=0;const a=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(n.buffer)),u=new c.T(t,a,t.gl.RGBA,{premultiply:!1});return u.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=u,u}pointCoordinate(t){this.painter.maybeDrawDepthAndCoords(!0);const n=new Uint8Array(4),a=this.painter.context,u=a.gl,f=Math.round(t.x*this.painter.pixelRatio/devicePixelRatio),y=Math.round(t.y*this.painter.pixelRatio/devicePixelRatio),b=Math.round(this.painter.height/devicePixelRatio);a.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),u.readPixels(f,b-y-1,1,1,u.RGBA,u.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null);const w=n[0]+(n[2]>>4<<8),S=n[1]+((15&n[2])<<8),P=this.coordsIndex[255-n[3]],C=P&&this.tileManager.getTileByID(P);if(!C)return null;const A=this._coordsTextureSize,F=(1<<C.tileID.canonical.z)*A;return new c.a6((C.tileID.canonical.x*A+w)/F+C.tileID.wrap,(C.tileID.canonical.y*A+S)/F,this.getElevation(C.tileID,w,S,A))}depthAtPoint(t){const n=new Uint8Array(4),a=this.painter.context,u=a.gl;return a.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),u.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,u.RGBA,u.UNSIGNED_BYTE,n),a.bindFramebuffer.set(null),(n[0]/16777216+n[1]/65536+n[2]/256+n[3])/256}getTerrainMesh(t){var n;const a=((n=this.painter.style.projection)===null||n===void 0?void 0:n.transitionState)>0,u=a&&t.canonical.y===0,f=a&&t.canonical.y===(1<<t.canonical.z)-1,y=`m_${u?"n":""}_${f?"s":""}`;if(this._meshCache[y])return this._meshCache[y];const b=this.painter.context,w=new c.cE,S=new c.aW,P=this.meshSize,C=c.a5/P,A=P*P;for(let K=0;K<=P;K++)for(let se=0;se<=P;se++)w.emplaceBack(se*C,K*C,0);for(let K=0;K<A;K+=P+1)for(let se=0;se<P;se++)S.emplaceBack(se+K,P+se+K+1,P+se+K+2),S.emplaceBack(se+K,P+se+K+2,se+K+1);const F=w.length,V=F+(P+1),U=(P+1)*P,q=u?c.bp:0,G=u?0:1,Y=f?c.bq:c.a5,ee=f?0:1;for(let K=0;K<=P;K++)w.emplaceBack(K*C,q,G);for(let K=0;K<=P;K++)w.emplaceBack(K*C,Y,ee);for(let K=0;K<P;K++)S.emplaceBack(U+K,V+K,V+K+1),S.emplaceBack(U+K,V+K+1,U+K+1),S.emplaceBack(0+K,F+K+1,F+K),S.emplaceBack(0+K,0+K+1,F+K+1);const X=w.length,Q=X+2*(P+1);for(const K of[0,1])for(let se=0;se<=P;se++)for(const me of[0,1])w.emplaceBack(K*c.a5,se*C,me);for(let K=0;K<2*P;K+=2)S.emplaceBack(X+K,X+K+1,X+K+3),S.emplaceBack(X+K,X+K+3,X+K+2),S.emplaceBack(Q+K,Q+K+3,Q+K+1),S.emplaceBack(Q+K,Q+K+2,Q+K+3);const te=new Jt(b.createVertexBuffer(w,fu.members),b.createIndexBuffer(S),c.aV.simpleSegment(0,0,w.length,S.length));return this._meshCache[y]=te,te}getMeshFrameDelta(t){return 2*Math.PI*c.bC/Math.pow(2,Math.max(t,0))/5}getMinTileElevationForLngLatZoom(t,n){var a;if(!c.cC(n,t.wrap()))return 0;const{tileID:u}=this._getOverscaledTileIDFromLngLatZoom(t,n);return(a=this.getMinMaxElevation(u).minElevation)!==null&&a!==void 0?a:0}getMinMaxElevation(t){const n=this.getTerrainData(t).tile,a={minElevation:null,maxElevation:null};return n&&n.dem&&(a.minElevation=n.dem.min*this.exaggeration,a.maxElevation=n.dem.max*this.exaggeration),a}_getOverscaledTileIDFromLngLatZoom(t,n){const a=c.a6.fromLngLat(t.wrap()),u=(1<<n)*c.a5,f=a.x*u,y=a.y*u,b=Math.floor(f/c.a5),w=Math.floor(y/c.a5);return{tileID:new c.a2(n,0,n,b,w),mercatorX:f,mercatorY:y}}}class Ph{constructor(t,n,a){this._context=t,this._size=n,this._tileSize=a,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){const n=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),a=new c.T(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return a.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),n.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),n.colorAttachment.set(a.texture),{id:t,fbo:n,texture:a,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter((n=>t.id!==n)),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(const n of this._recentlyUsed)if(!this._objects[n].inUse)return this._objects[n];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(const t of this._objects)this.freeObject(t)}isFull(){return!(this._objects.length<this._size)&&this._objects.some((t=>!t.inUse))===!1}}const Tr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class Bt{constructor(t,n){this.painter=t,this.terrain=n,this.pool=new Ph(t.context,30,n.tileManager.tileSize*n.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,n){var a,u;this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter((f=>!t._layers[f].isHidden(n))),this._coordsAscending={};for(const f in t.tileManagers){this._coordsAscending[f]={};const y=t.tileManagers[f].getVisibleCoordinates(),b=t.tileManagers[f].getSource(),w=b instanceof Gr?b.terrainTileRanges:null;for(const S of y){const P=this.terrain.tileManager.getTerrainCoords(S,w);for(const C in P)this._coordsAscending[f][C]||(this._coordsAscending[f][C]=[]),this._coordsAscending[f][C].push(P[C])}}this._rttFingerprints={};for(const f of t._order){const y=t._layers[f],b=y.source;if(Tr[y.type]&&!this._rttFingerprints[b]){this._rttFingerprints[b]={};const w=(u=(a=t.tileManagers[b])===null||a===void 0?void 0:a.getState().revision)!==null&&u!==void 0?u:0;for(const S in this._coordsAscending[b])this._rttFingerprints[b][S]=`${this._coordsAscending[b][S].map((P=>P.key)).sort().join()}#${w}`}}for(const f of this._renderableTiles)for(const y in this._rttFingerprints){const b=this._rttFingerprints[y][f.tileID.key];b&&b!==f.rttFingerprint[y]&&(f.rtt=[])}}renderLayer(t,n){if(t.isHidden(this.painter.transform.zoom))return!1;const a=Object.assign(Object.assign({},n),{isRenderingToTexture:!0}),u=t.type,f=this.painter,y=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(Tr[u]&&(this._prevType&&Tr[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(t.id),!y))return!0;if(Tr[this._prevType]||Tr[u]&&y){this._prevType=u;const b=this._stacks.length-1,w=this._stacks[b]||[];for(const S of this._renderableTiles){if(this.pool.isFull()&&(Cl(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(S),S.rtt[b]){const C=this.pool.getObjectForId(S.rtt[b].id);if(C.stamp===S.rtt[b].stamp){this.pool.useObject(C);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),S.rtt[b]={id:P.id,stamp:P.stamp},f.context.bindFramebuffer.set(P.fbo.framebuffer),f.context.clear({color:c.bn.transparent,stencil:0}),f.currentStencilSource=void 0;for(let C=0;C<w.length;C++){const A=f.style._layers[w[C]],F=A.source?this._coordsAscending[A.source][S.tileID.key]:[S.tileID];f.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),f._renderTileClippingMasks(A,F,!0),f.renderLayer(f,f.style.tileManagers[A.source],A,F,a),A.source&&(S.rttFingerprint[A.source]=this._rttFingerprints[A.source][S.tileID.key])}}return Cl(this.painter,this.terrain,this._rttTiles,a),this._rttTiles=[],this.pool.freeAllObjects(),Tr[u]}return!1}}const Zt={"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 â + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},mu=H,fs={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:xi,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,maxTileC
800acheSize:null,maxTileCacheZoomLevels:c.c.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,experimentalZoomLevelsToOverscale:void 0,anisotropicFilterPitch:20};let lo=class extends aa{get _ownerWindow(){var p,t;return((t=(p=this._container)===null||p===void 0?void 0:p.ownerDocument)===null||t===void 0?void 0:t.defaultView)||window}constructor(p){var t,n;const a=Object.assign(Object.assign(Object.assign({},fs),p),{canvasContextAttributes:Object.assign(Object.assign({},fs.canvasContextAttributes),p.canvasContextAttributes)});if(a.minZoom!=null&&a.maxZoom!=null&&a.minZoom>a.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(a.minPitch!=null&&a.maxPitch!=null&&a.minPitch>a.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(a.minPitch!=null&&a.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(a.maxPitch!=null&&a.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const u=new Cr,f=new Lo;a.minZoom!==void 0&&u.setMinZoom(a.minZoom),a.maxZoom!==void 0&&u.setMaxZoom(a.maxZoom),a.minPitch!==void 0&&u.setMinPitch(a.minPitch),a.maxPitch!==void 0&&u.setMaxPitch(a.maxPitch),a.renderWorldCopies!==void 0&&u.setRenderWorldCopies(a.renderWorldCopies),a.transformConstrain!==null&&u.setConstrainOverride(a.transformConstrain),super(u,f,{bearingSnap:a.bearingSnap,zoomSnap:a.zoomSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new pr,this._controls=[],this._mapId=c.ac(),this._lostContextStyle={style:null,images:null},this._contextLost=b=>
vendor: 12,619 bytes, line 800
800{if(b.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),this.style){for(const w of Object.values(this.style._layers))if(w.type==="custom"&&console.warn(`Custom layer with id '${w.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),w._listeners)for(const[S]of Object.entries(w._listeners))console.warn(`Custom layer with id '${w.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 c.l("webglcontextlost",{originalEvent:b}))}else this.fire(new c.l("webglcontextlost",{originalEvent:b}))},this._contextRestored=b=>{this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&(this.style.imageManager.images=this._lostContextStyle.images),this._lostContextStyle={style:null,images:null},this._setupPainter(),this.resize(),this._update(),this._resizeInternal(),this.fire(new c.l("webglcontextrestored",{originalEvent:b}))},this._onMapScroll=b=>{if(b.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=a.interactive,this._maxTileCacheSize=a.maxTileCacheSize,this._maxTileCacheZoomLevels=a.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},a.canvasContextAttributes),this._trackResize=a.trackResize===!0,this._bearingSnap=a.bearingSnap,this._zoomSnap=a.zoomSnap,this._centerClampedToGround=a.centerClampedToGround,this._refreshExpiredTiles=a.refreshExpiredTiles===!0,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=a.crossSourceCollisions===!0,this._collectResourceTiming=a.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Zt),a.locale),this._clickTolerance=a.clickTolerance,this._overridePixelRatio=a.pixelRatio,this._maxCanvasSize=a.maxCanvasSize,this._zoomLevelsToOverscale=a.experimentalZoomLevelsToOverscale,this.transformCameraUpdate=a.transformCameraUpdate,this.transformConstrain=a.transformConstrain,this.cancelPendingTileRequestsWhileZooming=a.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(a.anisotropicFilterPitch),a.reduceMotion!==void 0&&(Ee.prefersReducedMotion=a.reduceMotion),this._imageQueueHandle=Be.addThrottleControl((()=>this.isMoving())),this._requestManager=new Ne(a.transformRequest),this._container=this._resolveContainer(a.container),a.maxBounds&&this.setMaxBounds(a.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",(()=>this._update(!1))),this.on("moveend",(()=>this._update(!1))),this.on("zoom",(()=>this._update(!0))),this.on("terrain",(()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)})),this.once("idle",(()=>{this._idleTriggered=!0})),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver()),this.handlers=new pu(this,a),this._hash=a.hash&&new kl(typeof a.hash=="string"&&a.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,roll:a.roll}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,c.e({},a.fitBoundsOptions,{duration:0}))));const y=typeof a.style=="string"||((n=(t=a.style)===null||t===void 0?void 0:t.projection)===null||n===void 0?void 0:n.type)!=="globe";this.resize(null,y),this._localIdeographFontFamily=a.localIdeographFontFamily,this._validateStyle=a.validateStyle,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new Vl(typeof a.attributionControl=="boolean"?void 0:a.attributionControl)),a.maplibreLogo&&this.addControl(new la,a.logoPosition),this.on("style.load",(()=>{if(y||this._resizeTransform(),this.transform.unmodified){const b=c.U(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(b)}})),this.on("data",(b=>{this._update(b.dataType==="style"),this.fire(new c.l(`${b.dataType}data`,b))})),this.on("dataloading",(b=>{this.fire(new c.l(`${b.dataType}dataloading`,b))})),this.on("dataabort",(b=>{this.fire(new c.l("sourcedataabort",b))}))}_getMapId(){return this._mapId}setGlobalStateProperty(p,t){return this.style.setGlobalStateProperty(p,t),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(p,t){if(t===void 0&&(t=p.getDefaultPosition?p.getDefaultPosition():"top-right"),!p||!p.onAdd)return this.fire(new c.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=p.onAdd(this);this._controls.push(p);const a=this._controlPositions[t];return t.indexOf("bottom")!==-1?a.insertBefore(n,a.firstChild):a.appendChild(n),this}removeControl(p){if(!p||!p.onRemove)return this.fire(new c.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(p);return t>-1&&this._controls.splice(t,1),p.onRemove(this),this}hasControl(p){return this._controls.indexOf(p)>-1}coveringTiles(p){return cn(this.transform,p)}calculateCameraOptionsFromTo(p,t,n,a){return a==null&&this.terrain&&(a=this.terrain.getElevationForLngLat(n,this.transform)),super.calculateCameraOptionsFromTo(p,t,n,a)}resize(p,t=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(t);const n=!this._moving;return n&&(this.stop(),this.fire(new c.l("movestart",p)).fire(new c.l("move",p))),this.fire(new c.l("resize",p)),n&&this.fire(new c.l("moveend",p)),this}_resizeInternal(p=!0){const[t,n]=this._containerDimensions(),a=this._getClampedPixelRatio(t,n);if(this._resizeCanvas(t,n,a),this.painter.resize(t,n,a),this.painter.overLimit()){const u=this.painter.context.gl;this._maxCanvasSize=[u.drawingBufferWidth,u.drawingBufferHeight];const f=this._getClampedPixelRatio(t,n);this._resizeCanvas(t,n,f),this.painter.resize(t,n,f)}this._resizeTransform(p)}_resizeTransform(p=!0){var t;const[n,a]=this._containerDimensions();this.transform.resize(n,a,p),(t=this._requestedCameraState)===null||t===void 0||t.resize(n,a,p)}_getClampedPixelRatio(p,t){const{0:n,1:a}=this._maxCanvasSize,u=this.getPixelRatio(),f=p*u,y=t*u;return Math.min(f>n?n/f:1,y>a?a/y:1)*u}getPixelRatio(){var p;return(p=this._overridePixelRatio)!==null&&p!==void 0?p:devicePixelRatio}setPixelRatio(p){this._overridePixelRatio=p,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(p){return this.transform.setMaxBounds(mt.convert(p)),this._update()}setMinZoom(p){if((p=p??-2)>=-2&&p<=this.transform.maxZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMinZoom(p),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new c.l("zoomstart")).fire(new c.l("zoom")).fire(new c.l("zoomend")).fire(new c.l("movestart")).fire(new c.l("move")).fire(new c.l("moveend")),this}throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(p){if((p=p??22)>=this.transform.minZoom){const t=this.transform.zoom,n=this._getTransformForUpdate();return n.setMaxZoom(p),this._applyUpdatedTransform(n),this._update(),t!==this.transform.zoom&&this.fire(new c.l("zoomstart")).fire(new c.l("zoom")).fire(new c.l("zoomend")).fire(new c.l("movestart")).fire(new c.l("move")).fire(new c.l("moveend")),this}throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(p){if((p=p??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(p>=0&&p<=this.transform.maxPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();return n.setMinPitch(p),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new c.l("pitchstart")).fire(new c.l("pitch")).fire(new c.l("pitchend")).fire(new c.l("movestart")).fire(new c.l("move")).fire(new c.l("moveend")),this}throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(p){if((p=p??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(p>=this.transform.minPitch){const t=this.transform.pitch,n=this._getTransformForUpdate();return n.setMaxPitch(p),this._applyUpdatedTransform(n),this._update(),t!==this.transform.pitch&&this.fire(new c.l("pitchstart")).fire(new c.l("pitch")).fire(new c.l("pitchend")).fire(new c.l("movestart")).fire(new c.l("move")).fire(new c.l("moveend")),this}throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(p){if((p=p??20)>180)throw new Error("anisotropicFilterPitch must be less than or equal to 180");if(p<0)throw new Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=p,this._update()}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(p){return this.transform.setRenderWorldCopies(p),this._update()}setTransformConstrain(p){return this.transform.setConstrainOverride(p),this._update()}project(p){return this.transform.locationToScreenPoint(c.V.convert(p),this.style&&this.terrain)}unproject(p){return this.transform.screenPointToLocation(c.P.convert(p),this.terrain)}isMoving(){var p;return this._moving||((p=this.handlers)===null||p===void 0?void 0:p.isMoving())}isZooming(){var p;return this._zooming||((p=this.handlers)===null||p===void 0?void 0:p.isZooming())}isRotating(){var p;return this._rotating||((p=this.handlers)===null||p===void 0?void 0:p.isRotating())}_createDelegatedListener(p,t,n){if(p==="mouseenter"||p==="mouseover"){let a=!1;return{layers:t,listener:n,delegates:{mousemove:f=>{const y=t.filter((w=>this.getLayer(w))),b=y.length!==0?this.queryRenderedFeatures(f.point,{layers:y}):[];b.length?a||(a=!0,n.call(this,new $i(p,this,f.originalEvent,{features:b}))):a=!1},mouseout:()=>{a=!1}}}}if(p==="mouseleave"||p==="mouseout"){let a=!1;return{layers:t,listener:n,delegates:{mousemove:y=>{const b=t.filter((w=>this.getLayer(w)));(b.length!==0?this.queryRenderedFeatures(y.point,{layers:b}):[]).length?a=!0:a&&(a=!1,n.call(this,new $i(p,this,y.originalEvent)))},mouseout:y=>{a&&(a=!1,n.call(this,new $i(p,this,y.originalEvent)))}}}}{const a=u=>{const f=t.filter((b=>this.getLayer(b))),y=f.length!==0?this.queryRenderedFeatures(u.point,{layers:f}):[];y.length&&(u.features=y,n.call(this,u),delete u.features)};return{layers:t,listener:n,delegates:{[p]:a}}}}_saveDelegatedListener(p,t){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[p]=this._delegatedListeners[p]||[],this._delegatedListeners[p].push(t)}_removeDelegatedListener(p,t,n){if(!this._delegatedListeners||!this._delegatedListeners[p])return;const a=this._delegatedListeners[p];for(let u=0;u<a.length;u++){const f=a[u];if(f.listener===n&&f.layers.length===t.length&&f.layers.every((y=>t.includes(y)))){for(const y in f.delegates)this.off(y,f.delegates[y]);a.splice(u,1);return}}}on(p,t,n){if(n===void 0)return super.on(p,t);const a=typeof t=="string"?[t]:t,u=this._createDelegatedListener(p,a,n);this._saveDelegatedListener(p,u);for(const f in u.delegates)this.on(f,u.delegates[f]);return{unsubscribe:()=>{this._removeDelegatedListener(p,a,n)}}}once(p,t,n){if(n===void 0)return super.once(p,t);const a=typeof t=="string"?[t]:t,u=this._createDelegatedListener(p,a,n);for(const f in u.delegates){const y=u.delegates[f];u.delegates[f]=(...b)=>{this._removeDelegatedListener(p,a,n),y(...b)}}this._saveDelegatedListener(p,u);for(const f in u.delegates)this.once(f,u.delegates[f]);return this}off(p,t,n){return n===void 0?super.off(p,t):(this._removeDelegatedListener(p,typeof t=="string"?[t]:t,n),this)}queryRenderedFeatures(p,t){if(!this.style)return[];let n;const a=p instanceof c.P||Array.isArray(p),u=a?p:[[0,0],[this.transform.width,this.transform.height]];if(t=t||(a?{}:p)||{},u instanceof c.P||typeof u[0]=="number")n=[c.P.convert(u)];else{const f=c.P.convert(u[0]),y=c.P.convert(u[1]);n=[f,new c.P(y.x,f.y),y,new c.P(f.x,y.y),f]}return this.style.queryRenderedFeatures(n,t,this.transform)}querySourceFeatures(p,t){return this.style.querySourceFeatures(p,t)}setStyle(p,t){return(t=c.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._val
800idateStyle},t)).diff!==!1&&t.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&p?(this._diffStyle(p,t),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._updateStyle(p,t))}setTransformRequest(p){return this._requestManager.setTransformRequest(p),this}_getUIString(p){const t=this._locale[p];if(t==null)throw new Error(`Missing UI string '${p}'`);return t}_updateStyle(p,t){var n,a,u;if((n=this._diffStyleRequest)===null||n===void 0||n.abort(),this._diffStyleRequest=null,t.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",(()=>this._updateStyle(p,t)));const f=this.style&&t.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!p)),p?(this.style=new vn(this,t||{}),this.style.setEventedParent(this,{style:this.style}),typeof p=="string"?this.style.loadURL(p,t,f):this.style.loadJSON(p,t,f),this):(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),(u=(a=this.style)===null||a===void 0?void 0:a.projection)===null||u===void 0||u.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new vn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(p,t){return c._(this,void 0,void 0,(function*(){var n;if((n=this._diffStyleRequest)===null||n===void 0||n.abort(),typeof p=="string"){const a=p;this._diffStyleRequest=new AbortController;const u=this._diffStyleRequest;try{const f=yield this._requestManager.transformRequest(a,"Style");if(u.signal.aborted)return void(this._diffStyleRequest=null);const y=yield c.j(f,u);this._diffStyleRequest=null,this._updateDiff(y.data,t)}catch(f){this._diffStyleRequest=null,c.Z(f)||this.fire(new c.k(f))}}else typeof p=="object"&&(this._diffStyleRequest=null,this._updateDiff(p,t))}))}_updateDiff(p,t){try{this.style.setState(p,t)&&this._update(!0)}catch(n){c.w(`Unable to perform style diff: ${n.message||n.error||n}. Rebuilding the style from scratch.`),this._updateStyle(p,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(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(p,t){return this._lazyInitEmptyStyle(),this.style.addSource(p,t),this._update(!0)}isSourceLoaded(p){const t=this.style&&this.style.tileManagers[p];if(t!==void 0)return t.loaded();this.fire(new c.k(new Error(`There is no tile manager with ID '${p}'`)))}setTerrain(p){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),p){const t=this.style.tileManagers[p.source];if(!t)throw new Error(`cannot load terrain, because there exists no source with ID: ${p.source}`);this.terrain===null&&t.reload();for(const n in this.style._layers){const a=this.style._layers[n];a.type==="hillshade"&&a.source===p.source&&c.w("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===p.source&&c.w("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=new Sh(this.painter,t,p),this.painter.renderToTexture=new Bt(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=n=>{var a;n.dataType==="style"?this.terrain.tileManager.freeRtt():n.dataType==="source"&&n.tile&&(n.sourceId!==p.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((a=n.source)===null||a===void 0?void 0:a.type)==="image"?this.terrain.tileManager.freeRtt():this.terrain.tileManager.freeRtt(n.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGroun
800d&&this.transform.setElevation(0);return this.fire(new c.l("terrain",{terrain:p})),this}getTerrain(){var p,t;return(t=(p=this.terrain)===null||p===void 0?void 0:p.options)!==null&&t!==void 0?t:null}areTilesLoaded(){const p=this.style&&this.style.tileManagers;for(const t of Object.values(p))if(!t.areTilesLoaded())return!1;return!0}removeSource(p){return this.style.removeSource(p),this._update(!0)}getSource(p){return this.style.getSource(p)}setSourceTileLodParams(p,t,n){if(n){const a=this.getSource(n);if(!a)throw new Error(`There is no source with ID "${n}", cannot set LOD parameters`);a.calculateTileZoom=Ha(Math.max(1,p),Math.max(1,t))}else for(const a in this.style.tileManagers)this.style.tileManagers[a].getSource().calculateTileZoom=Ha(Math.max(1,p),Math.max(1,t));return this._update(!0),this}refreshTiles(p,t){const n=this.style.tileManagers[p];if(!n)throw new Error(`There is no tile manager with ID "${p}", cannot refresh tile`);t===void 0?n.reload(!0):n.refreshTiles(t.map((a=>new c.a9(a.z,a.x,a.y))))}addImage(p,t,n={}){const{pixelRatio:a=1,sdf:u=!1,stretchX:f,stretchY:y,content:b,textFitWidth:w,textFitHeight:S}=n;if(this._lazyInitEmptyStyle(),!(t instanceof HTMLImageElement||c.b(t))){if(t.width===void 0||t.height===void 0)return this.fire(new c.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:P,height:C,data:A}=t,F=t;return this.style.addImage(p,{data:new c.R({width:P,height:C},new Uint8Array(A)),pixelRatio:a,stretchX:f,stretchY:y,content:b,textFitWidth:w,textFitHeight:S,sdf:u,version:0,userImage:F}),F.onAdd&&F.onAdd(this,p),this}}{const{width:P,height:C,data:A}=Ee.getImageData(t);this.style.addImage(p,{data:new c.R({width:P,height:C},A),pixelRatio:a,stretchX:f,stretchY:y,content:b,textFitWidth:w,textFitHeight:S,sdf:u,version:0})}}updateImage(p,t){const n=this.style.getImage(p);if(!n)return this.fire(new c.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const{width:a,height:u,data:f}=t instanceof HTMLImageElement||c.b(t)?Ee.getImageData(t):t;if(a===void 0||u===void 0)return this.fire(new c.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(a!==n.data.width||u!==n.data.height)return this.fire(new c.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const y=!(t instanceof HTMLImageElement||c.b(t));return n.data.replace(f,y),this.style.updateImage(p,n),this}getImage(p){return this.style.getImage(p)}hasImage(p){return p?!!this.style.getImage(p):(this.fire(new c.k(new Error("Missing required image id"))),!1)}removeImage(p){this.style.removeImage(p)}loadImage(p){return c._(this,void 0,void 0,(function*(){return Be.getImage(yield this._requestManager.transformRequest(p,"Image"),new AbortController)}))}listImages(){return this.style.listImages()}addLayer(p,t){return this._lazyInitEmptyStyle(),this.style.addLayer(p,t),this._update(!0)}moveLayer(p,t){return this.style.moveLayer(p,t),this._update(!0)}removeLayer(p){return this.style.removeLayer(p),this._update(!0)}getLayer(p){return this.style.getLayer(p)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(p,t,n){return this.style.setLayerZoomRange(p,t,n),this._update(!0)}setFilter(p,t,n={}){return this.style.setFilter(p,t,n),this._update(!0)}getFilter(p){return this.style.getFilter(p)}setPaintProperty(p,t,n,a={}){return this.style.setPaintProperty(p,t,n,a),this._update(!0)}getPaintProperty(p,t){return this.style.getPaintProperty(p,t)}setLayoutProperty(p,t,n,a={}){return this.style.setLayoutProperty(p,t,n,a),this._update(!0)}getLayoutProperty(p,t){return this.style.getLayoutProperty(p,t)}setGlyphs(p,t={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(p,t),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(p,t,n={}){return this._lazyInitEmptyStyle(),this.style.addSprite(p,t,n,(a=>{a||this._update(!0)})),this}removeSprite(p){return this._lazyInitEmptyStyle(),this.style.removeSprite(p),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(p,t={}){return this._lazyInitEmptyStyle(),this.style.setSprite(p,t,(n=>{n||this._update(!0)})),this}setLight(p,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(p,t),this._update(!0)}getLight(){return this.style.getLight()}setSky(p,t={}){return this._lazyInitEmptyStyle(),this.style.setSky(p,t),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(p,t){return this.style.setFeatureState(p,t),this._update()}removeFeatureState(p,t){return this.style.removeFeatureState(p,t),this._update()}getFeatureState(p){return this.style.getFeatureState(p)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let p=0,t=0;return this._container&&(p=this._container.clientWidth||400,t=this._container.clientHeight||300),[p,t]}_setupResizeObserver(){var p;let t=!1;const n=Dl((a=>{this._trackResize&&!this._removed&&(this.resize(a),this.redraw())}),50);this._resizeObserver=new((p=this._ownerWindow.ResizeObserver)!==null&&p!==void 0?p:ResizeObserver)((a=>{t?n(a):t=!0})),this._resizeObserver.observe(this._container)}
vendor: 28,998 bytes, line 800
800_resolveContainer(p){if(typeof p=="string"){const t=document.getElementById(p);if(!t)throw new Error(`Container '${p}' not found.`);return t}if(p instanceof HTMLElement||p&&typeof p=="object"&&p.nodeType===1)return p;throw new Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){const p=this._container;p.classList.add("maplibregl-map");const t=this._canvasContainer=le.create("div","maplibregl-canvas-container",p);this._interactive&&t.classList.add("maplibregl-interactive"),this._canvas=le.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");const n=this._containerDimensions(),a=this._getClampedPixelRatio(n[0],n[1]);this._resizeCanvas(n[0],n[1],a);const u=this._controlContainer=le.create("div","maplibregl-control-container",p),f=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach((y=>{f[y]=le.create("div",`maplibregl-ctrl-${y} `,u)})),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(p,t,n){this._canvas.width=Math.floor(n*p),this._canvas.height=Math.floor(n*t),this._canvas.style.width=`${p}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const p=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let t=null;this._canvas.addEventListener("webglcontextcreationerror",(a=>{t={requestedAttributes:p},a&&(t.statusMessage=a.statusMessage,t.type=a.type)}),{once:!0});let n=null;if(n=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,p):this._canvas.getContext("webgl2",p)||this._canvas.getContext("webgl",p),!n){const a="Failed to initialize WebGL";throw t?(t.message=a,new Error(JSON.stringify(t))):new Error(a)}this.painter=new Js(n,this.transform)}migrateProjection(p,t){super.migrateProjection(p,t),this.painter.transform=p,this.fire(new c.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(p){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||p,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(p){return this._update(),this._renderTaskQueue.add(p)}_cancelRenderFrame(p){this._renderTaskQueue.remove(p)}_render(p){var t,n,a,u,f;const y=this._idleTriggered?this._fadeDuration:0,b=((t=this.style.projection)===null||t===void 0?void 0:t.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(p),this._removed)return;let w=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const C=this.transform.zoom,A=be();this.style.zoomHistory.update(C,A);const F=new c.H(C,{now:A,fadeDuration:y,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),V=F.crossFadingFactor();V===1&&V===this._crossFadingFactor||(w=!0,this._crossFadingFactor=V),this.style.update(F)}const S=((n=this.style.projection)===null||n===void 0?void 0:n.transitionState)>0!==b;(a=this.style.projection)===null||a===void 0||a.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((u=this.style.projection)===null||u===void 0?void 0:u.transitionState,(f=this.style.projection)===null||f===void 0?void 0:f.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||S)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.tileManager.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,y,this._crossSourceCollisions,S),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:y,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new c.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new c.l("load"))),this.style&&(this.style.hasTransitions()||w)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var p,t;this._hash&&this._hash.remove();for(const a of this._controls)a.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),(p=this._diffStyleRequest)===null||p===void 0||p.abort(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),Be.removeThrottleControl(this._imageQueueHandle),(t=this._resizeObserver)===null||t===void 0||t.disconnect();const n=this.painter.context.gl.getExtension("WEBGL_lose_context");n!=null&&n.loseContext&&n.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 c.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ee.frame(this._frameRequest,(p=>{this._frameRequest=null;try{this._render(p)}catch(t){if(!c.Z(t)&&!(function(n){return n.message===Jo})(t))throw t}}),(()=>{}),this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(p){this._showTileBoundaries!==p&&(this._showTileBoundaries=p,this._update())}get showPadding(){return!!this._showPadding}set showPadding(p){this._showPadding!==p&&(this._showPadding=p,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(p){this._showCollisionBoxes!==p&&(this._showCollisionBoxes=p,p?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(p){this._showOverdrawInspector!==p&&(this._showOverdrawInspector=p,this._update())}get repaint(){return!!this._repaint}set repaint(p){this._repaint!==p&&(this._repaint=p,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(p){this._vertices=p,this._update()}get version(){return mu}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(p){return this._lazyInitEmptyStyle(),this.style.setProjection(p),this._update(!0)}};const jl={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Nl{constructor(t,n,a=!1){this.mousedown=u=>{this.startMove(u,le.mousePos(this.element,u)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=u=>{this.move(u,le.mousePos(this.element,u))},this.mouseup=u=>{this._rotatePitchHandler.dragEnd(u),this.offTemp()},this.touchstart=u=>{u.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=le.touchPos(this.element,u.targetTouches)[0],this.startMove(u,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend))},this.touchmove=u=>{u.targetTouches.length!==1?this.reset():(this._lastPos=le.touchPos(this.element,u.targetTouches)[0],this.move(u,this._lastPos))},this.touchend=u=>{u.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=n,this._rotatePitchHandler=new Mn({clickTolerance:3,move:(u,f)=>{const y=n.getBoundingClientRect(),b=new c.P((y.bottom-y.top)/2,(y.right-y.left)/2);return{bearingDelta:c.cw(new c.P(u.x,f.y),f,b),pitchDelta:a?-.5*(f.y-u.y):void 0}},moveStateManager:new Ll,enable:!0,assignEvents:()=>{}}),this.map=t,n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchcancel",this.reset)}startMove(t,n){this._rotatePitchHandler.dragStart(t,n),le.disableDrag()}move(t,n){const a=this.map,{bearingDelta:u,pitchDelta:f}=this._rotatePitchHandler.dragMove(t,n)||{};u&&a.setBearing(a.getBearing()+u),f&&a.setPitch(a.getPitch()+f)}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){le.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}}let Fr;function ms(p,t,n,a=!1){if(a||!n.getCoveringTilesDetailsProvider().allowWorldCopies())return p?.wrap();const u=new c.V(p.lng,p.lat);if(p=new c.V(p.lng,p.lat),t){const f=new c.V(p.lng-360,p.lat),y=new c.V(p.lng+360,p.lat),b=n.locationToScreenPoint(p).distSqr(t);n.locationToScreenPoint(f).distSqr(t)<b?p=f:n.locationToScreenPoint(y).distSqr(t)<b&&(p=y)}for(;Math.abs(p.lng-n.center.lng)>180;){const f=n.locationToScreenPoint(p);if(f.x>=0&&f.y>=0&&f.x<=n.width&&f.y<=n.height)break;p.lng>n.center.lng?p.lng-=360:p.lng+=360}return p.lng!==u.lng&&n.isPointOnMapSurface(n.locationToScreenPoint(p))?p:u}const co={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function ca(p,t,n){const a=p.classList;for(const u in co)a.remove(`maplibregl-${n}-anchor-${u}`);a.add(`maplibregl-${n}-anchor-${t}`)}class uo extends c.E{constructor(t){if(super(),this._onClick=n=>{this.fire(new c.l("click",{originalEvent:n}))},this._onKeyPress=n=>{n.code!=="Space"&&n.code!=="Enter"||this.togglePopup()},this._onMapClick=n=>{const a=n.originalEvent.target,u=this._element;this._popup&&(a===u||u.contains(a))&&this.togglePopup()},this._update=n=>{if(!this._map)return;const a=this._map.loaded()&&!this._map.isMoving();(n?.type==="terrain"||n?.type==="render"&&!a)&&this._map.once("render",this._update),this._lngLat=ms(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let u="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?u=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(u=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let f="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?f="rotateX(0deg)":this._pitchAlignment==="map"&&(f=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||n&&n.type!=="moveend"||(this._pos=this._pos.round()),this._element.style.transform=`${co[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${f} ${u}`,Ee.frameAsync(new AbortController,this._map._ownerWindow).then((()=>{this._updateOpacity(n&&n.type==="moveend")})).catch((()=>{}))},this._onMove=n=>{if(!this._isDragging){const a=this._clickTolerance||this._map._clickTolerance;this._isDragging=n.point.dist(this._pointerdownPos)>=a}this._isDragging&&(this._pos=n.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.l("dragstart"))),this.fire(new c.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.l("dragend")),this._state="inactive"},this._addDragHandler=n=>{this._element.contains(n.originalEvent.target)&&(n.preventDefault(),this._positionDelta=n.point.sub(this._pos).add(this._offset),this._pointerdownPos=n.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._subpixelPositioning=t&&t.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),t&&t.element)this._element=t.element,this._offset=c.P.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=le.create("div");const n=le.createNS("http://www.w3.org/2000/svg","svg"),a=41,u=27;n.setAttributeNS(null,"display","block"),n.setAttributeNS(null,"height",`${a}px`),n.setAttributeNS(null,"width",`${u}px`),n.setAttributeNS(null,"viewBox",`0 0 ${u} ${a}`);const f=le.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"stroke","none"),f.setAttributeNS(null,"stroke-width","1"),f.setAttributeNS(null,"fill","none"),f.setAttributeNS(null,"fill-rule","evenodd");const y=le.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"fill-rule","nonzero");const b=le.createNS("http://www.w3.org/2000/svg","g");b.setAttributeNS(null,"transform","translate(3.0, 29.0)"),b.setAttributeNS(null,"fill","#000000");for(const q of[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}]){const G=le.createNS("http://www.w3.org/2000/svg","ellipse");G.setAttributeNS(null,"opacity","0.04"),G.setAttributeNS(null,"cx","10.5"),G.setAttributeNS(null,"cy","5.80029008"),G.setAttributeNS(null,"rx",q.rx),G.setAttributeNS(null,"ry",q.ry),b.appendChild(G)}const w=le.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill",this._color);const S=le.createNS("http://www.w3.org/2000/svg","path");S.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),w.appendChild(S);const P=le.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"opacity","0.25"),P.setAttributeNS(null,"fill","#000000");const C=le.createNS("http://www.w3.org/2000/svg","path");C.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),P.appendChild(C);const A=le.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"transform","translate(6.0, 7.0)"),A.setAttributeNS(null,"fill","#FFFFFF");const F=le.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(8.0, 8.0)");const V=le.createNS("http://www.w3.org/2000/svg","circle");V.setAttributeNS(null,"fill","#000000"),V.setAttributeNS(null,"opacity","0.25"),V.setAttributeNS(null,"cx","5.5"),V.setAttributeNS(null,"cy","5.5"),V.setAttributeNS(null,"r","5.4999962");const U=le.createNS("http://www.w3.org/2000/svg","circle");U.setAttributeNS(null,"fill","#FFFFFF"),U.setAttributeNS(null,"cx","5.5"),U.setAttributeNS(null,"cy","5.5"),U.setAttributeNS(null,"r","5.4999962"),F.appendChild(V),F.appendChild(U),y.appendChild(b),y.appendChild(w),y.appendChild(P),y.appendChild(A),y.appendChild(F),n.appendChild(y),n.setAttributeNS(null,"height",a*this._scale+"px"),n.setAttributeNS(null,"width",u*this._scale+"px"),this._element.appendChild(n),this._offset=c.P.convert(t&&t.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",(n=>{n.preventDefault()})),this._element.addEventListener("mousedown",(n=>{n.preventDefault()})),ca(this._element,this._anchor,"marker"),t&&t.className)for(const n of t.className.split(" "))this._element.classList.add(n);this._popup=null}addTo(t){return this.remove(),this._map=t,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._element.hasAttribute("role")||this._element.setAttribute("role","button"),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=c.V.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const u=Math.abs(13.5)/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[u,-1*(38.1-13.5+u)],"bottom-right":[-u,-1*(38.1-13.5+u)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}getPopup(){return this._popup}togglePopup(){const t=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:t?(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map)),this):this}_updateOpacity(t=!1){var n,a;const u=(n=this._map)===null||n===void 0?void 0:n.terrain,f=this._map.transform.isLocationOccluded(this._lngLat);if(!u||f){const F=f?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==F&&(this._element.style.opacity=F);return}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout((()=>{this._opacityTimeout=null}),100)}const y=this._map,b=y.terrain.depthAtPoint(this._pos),w=y.terrain.getElevationForLngLat(this._lngLat,y.transform);if(y.transform.lngLatToCameraDepth(this._lngLat,w)-b<.006)return void(this._element.style.opacity=this._opacity);const S=-this._offset.y/y.transform.pixelsPerMeter,P=Math.sin(y.getPitch()*Math.PI/180)*S,C=y.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),A=y.transform.lngLatToCameraDepth(this._lngLat,w+P)-C>.006;!((a=this._popup)===null||a===void 0)&&a.isOpen()&&A&&this._popup.remove(),this._element.style.opacity=A?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(t){return this._offset=c.P.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,n){return(this._opacity===void 0||t===void 0&&n===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),t!==void 0&&(this._opacity=t),n!==void 0&&(this._opacityWhenCovered=n),this._map&&this._updateOpacity(!0),this}}const Ul={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let gs=0,An=!1;const $l={maxWidth:100,unit:"metric"};function ua(p,t,n){const a=n&&n.maxWidth||100,u=p._container.clientHeight/2,f=p._container.clientWidth/2,y=p.unproject([f-a/2,u]),b=p.unproject([f+a/2,u]),w=Math.round(p.project(b).x-p.project(y).x),S=Math.min(a,w,p._container.clientWidth),P=y.distanceTo(b);if(n&&n.unit==="imperial"){const C=3.2808*P;C>5280?Dn(t,S,C/5280,p._getUIString("ScaleControl.Miles")):Dn(t,S,C,p._getUIString("ScaleControl.Feet"))}else n&&n.unit==="nautical"?Dn(t,S,P/1852,p._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Dn(t,S,P/1e3,p._getUIString("ScaleControl.Kilometers")):Dn(t,S,P,p._getUIString("ScaleControl.Meters"))}function Dn(p,t,n,a){const u=(function(f){const y=Math.pow(10,`${Math.floor(f)}`.length-1);let b=f/y;return b=b>=10?10:b>=5?5:b>=3?3:b>=2?2:b>=1?1:(function(w){const S=Math.pow(10,Math.ceil(-Math.log(w)/Math.LN10));return Math.round(w*S)/S})(b),y*b})(n);p.style.width=t*(u/n)+"px",p.innerHTML=`${u} ${a}`}const ha={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},Gl=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function da(p){if(p){if(typeof p=="number"){const t=Math.round(Math.abs(p)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,p),"top-left":new c.P(t,t),"top-right":new c.P(-t,t),bottom:new c.P(0,-p),"bottom-left":new c.P(t,-t),"bottom-right":new c.P(-t,-t),left:new c.P(p,0),right:new c.P(-p,0)}}if(p instanceof c.P||Array.isArray(p)){const t=c.P.convert(p);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:c.P.convert(p.center||[0,0]),top:c.P.convert(p.top||[0,0]),"top-left":c.P.convert(p["top-left"]||[0,0]),"top-right":c.P.convert(p["top-right"]||[0,0]),bottom:c.P.convert(p.bottom||[0,0]),"bottom-left":c.P.convert(p["bottom-left"]||[0,0]),"bottom-right":c.P.convert(p["bottom-right"]||[0,0]),left:c.P.convert(p.left||[0,0]),right:c.P.convert(p.right||[0,0])}}return da(new c.P(0,0))}const pa=H;E.AJAXError=c.cF,E.EXTENT=c.a5,E.Event=c.l,E.Evented=c.E,E.LngLat=c.V,E.MercatorCoordinate=c.a6,E.Point=c.P,E.addProtocol=c.cG,E.config=c.c,E.removeProtocol=c.cH,E.AttributionControl=Vl,E.BoxZoomHandler=zl,E.CanvasSource=Ga,E.CooperativeGesturesHandler=ao,E.DoubleClickZoomHandler=oa,E.DragPanHandler=Ol,E.DragRotateHandler=du,E.EdgeInsets=yi,E.FullscreenControl=class extends c.E{constructor(p={}){var t;super(),this._onFullscreenChange=()=>{var n;let a=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;!((n=a?.shadowRoot)===null||n===void 0)&&n.fullscreenElement;)a=a.shadowRoot.fullscreenElement;a===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(t=p.pseudo)!==null&&t!==void 0&&t,p&&p.container&&(p.container instanceof HTMLElement?this._container=p.container:c.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(p){return this._map=p,this._container||(this._container=this._map.getContainer()),this._controlContainer=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const p=this._fullscreenButton=le.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);le.create("span","maplibregl-ctrl-icon",p).setAttribute("aria-hidden","true"),p.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const p=this._getTitle();this._fullscreenButton.setAttribute("aria-label",p),this._fullscreenButton.title=p}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},E.GeoJSONSource=So,E.GeolocateControl=class extends c.E{constructor(p){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t))return this._setErrorState(),this.fire(new c.l("outofmaxbounds",t)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
800RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(t),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.l("geolocate",t)),this._finish()}},this._updateCamera=t=>{const n=new c.V(t.coords.longitude,t.coords.latitude),a=t.coords.accuracy,u=this._map.getBearing(),f=c.e({bearing:u},this.options.fitBoundsOptions),y=mt.fromLngLat(n,a);this._map.fitBounds(y,f,{geolocateSource:!0})},this._updateMarker=t=>{if(t){const n=new c.V(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(n).addTo(this._map),this._userLocationDotMarker.setLngLat(n).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(t.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(t.code===3&&An)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.l("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t=>{if(!this._map)return;const n=t?.[0]instanceof ResizeObserverEntry;t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||n||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.l("trackuserlocationend")),this.fire(new c.l("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this._geolocateButton=le.create("button","maplibregl-ctrl-geolocate",this._container),le.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(t===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const n=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}else{const n=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=n,this._geolocateButton.setAttribute("aria-label",n)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=le.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new uo({element:this._dotElement}),this._circleElement=le.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new uo({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",(()=>this.trigger())),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=c.e({},Ul,p)}onAdd(p){return this._map=p,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(){return c._(this,arguments,void 0,(function*(t=!1){if(Fr!==void 0&&!t)return Fr;if(window.navigator.permissions===void 0)return Fr=!!window.navigator.geolocation,Fr;try{Fr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Fr=!!window.navigator.geolocation}return Fr}))})().then((t=>this._finishSetupUI(t))),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,gs=0,An=!1}_isOutOfMapMaxBounds(p){const t=this._map.getMaxBounds(),n=p.coords;return t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_E
800RROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){const p=this._userLocationDotMarker.getLngLat();if(!(this.options.showUserLocation&&this.options.showAccuracyCircle&&this._accuracy&&p))return;const t=this._map.project(p),n=this._map.unproject([t.x+100,t.y]),a=p.distanceTo(n)/100,u=2*this._accuracy/a;this._circleElement.style.width=`${u.toFixed(2)}px`,this._circleElement.style.height=`${u.toFixed(2)}px`}trigger(){if(!this._setup)return c.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":gs--,An=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.l("trackuserlocationstart")),this.fire(new c.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let p;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),gs++,gs>1?(p={maximumAge:6e5,timeout:0},An=!0):(p=this.options.positionOptions,An=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,p)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},E.GlobeControl=class{constructor(){this._toggleProjection=()=>{var p;const t=(p=this._map.getProjection())===null||p===void 0?void 0:p.type;this._map.setProjection(t!=="mercator"&&t?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var p;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((p=this._map.getProjection())===null||p===void 0?void 0:p.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(p){return this._map=p,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=le.create("button","maplibregl-ctrl-globe",this._container),le.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},E.Hash=kl,E.ImageSource=Gr,E.KeyboardHandler=Lr,E.LngLatBounds=mt,E.LogoControl
vendor: 9,554 bytes, line 800
800=la,E.Map=lo,E.MapLibreMap=lo,E.MapMouseEvent=$i,E.MapTouchEvent=wr,E.MapWheelEvent=iu,E.Marker=uo,E.NavigationControl=class{constructor(p){this._updateZoomButtons=()=>{const t=this._map.getZoom(),n=t===this._map.getMaxZoom(),a=t===this._map.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=a,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",a.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(t,n)=>{const a=this._map._getUIString(`NavigationControl.${n}`);t.title=a,t.setAttribute("aria-label",a)},this.options=c.e({},jl,p),this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",(t=>t.preventDefault())),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",(t=>this._map.zoomIn({},{originalEvent:t}))),le.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",(t=>this._map.zoomOut({},{originalEvent:t}))),le.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",(t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})})),this._compassIcon=le.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(p){return this._map=p,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Nl(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(p,t){const n=le.create("button",p,this._container);return n.type="button",n.addEventListener("click",t),n}},E.Popup=class extends c.E{constructor(p){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:"")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new c.l("close"))),this),this._update=t=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=le.create("div","maplibregl-popup",this._map.getContainer()),this._tip=le.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const b of this.options.className.split(" "))this._container.classList.add(b);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}let n;if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=ms(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),t&&"point"in t&&t.point&&(n=t.point),this._trackPointer&&!n)return;const a=this._flatPos=this._pos=this._trackPointer&&n?n:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&n?n:this._map.transform.locationToScreenPoint(this._lngLat));let u=this.options.anchor;const f=da(this.options.offset);if(!u){const b=this._container.offsetWidth,w=this._container.offsetHeight,S=(function(C){var A,F,V,U;return C?{top:(A=C.top)!==null&&A!==void 0?A:0,right:(F=C.right)!==null&&F!==void 0?F:0,bottom:(V=C.bottom)!==null&&V!==void 0?V:0,left:(U=C.left)!==null&&U!==void 0?U:0}:{top:0,right:0,bottom:0,left:0}})(this.options.padding);let P;P=a.y+f.bottom.y<w+S.top?["top"]:a.y>this._map.transform.height-w-S.bottom?["bottom"]:[],a.x<b/2+S.left?P.push("left"):a.x>this._map.transform.width-b/2-S.right&&P.push("right"),u=P.length===0?"bottom":P.join("-")}let y=a.add(f[u]);this.options.subpixelPositioning||(y=y.round()),this._container.style.transform=`${co[u]} translate(${y.x}px,${y.y}px)`,ca(this._container,u,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(ha),p)}addTo(p){return this._map&&this.remove(),this._map=p,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(p){return this._lngLat=c.V.convert(p),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(p){return this.setDOMContent(document.createTextNode(p))}setHTML(p){const t=document.createDocumentFragment(),n=document.createElement("body");let a;for(n.innerHTML=p;a=n.firstChild,a;)t.appendChild(a);return this.setDOMContent(t)}getMaxWidth(){var p;return(p=this._container)===null||p===void 0?void 0:p.style.maxWidth}setMaxWidth(p){return this.options.maxWidth=p,this._update(),this}setDOMContent(p){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=le.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(p),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(p){return this._container&&this._container.classList.add(p),this}removeClassName(p){return this._container&&this._container.classList.remove(p),this}setOffset(p){return this.options.offset=p,this._update(),this}toggleClassName(p){if(this._container)return this._container.classList.toggle(p)}setSubpixelPositioning(p){this.options.subpixelPositioning=p}setPadding(p){this.options.padding=p,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=le.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const p=this._container.querySelector(Gl);p&&p.focus()}},E.RasterDEMTileSource=_r,E.RasterTileSource=Et,E.ScaleControl=class{constructor(p){this._onMove=()=>{ua(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,ua(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},$l),p)}getDefaultPosition(){return"bottom-left"}onAdd(p){return this._map=p,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-scale",p.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}}
800,E.ScrollZoomHandler=oo,E.Style=vn,E.TerrainControl=class{constructor(p){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=p}onAdd(p){return this._map=p,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=le.create("button","maplibregl-ctrl-terrain",this._container),le.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},E.TwoFingersTouchPitchHandler=lu,E.TwoFingersTouchRotateHandler=au,E.TwoFingersTouchZoomHandler=ou,E.TwoFingersTouchZoomRotateHandler=dr,E.VectorTileSource=et,E.VideoSource=on,E.addSourceType=(p,t)=>c._(void 0,void 0,void 0,(function*(){if(Po(p))throw new Error(`A source type called "${p}" already exists.`);((n,a)=>{qa[n]=a})(p,t)})),E.clearPrewarmedResources=function(){const p=Kt;p&&(p.isPreloaded()&&p.numActive()===1?(p.release(Ge),Kt=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},E.createTileMesh=Bs,E.getMaxParallelImageRequests=function(){return c.c.MAX_PARALLEL_IMAGE_REQUESTS},E.getRTLTextPluginStatus=function(){return qr().getRTLTextPluginStatus()},E.getVersion=function(){return pa},E.getWorkerCount=function(){return it.workerCount},E.getWorkerUrl=function(){return c.c.WORKER_URL},E.importScriptInWorkers=function(p){return Ri().broadcast("IS",p)},E.isTimeFrozen=function(){return ze.isFrozen()},E.now=be,E.prewarm=function(){rn().acquire(Ge)},E.restoreNow=function(){ze.restoreNow()},E.setMaxParallelImageRequests=function(p){c.c.MAX_PARALLEL_IMAGE_REQUESTS=p},E.setNow=function(p){ze.setNow(p)},E.setRTLTextPlugin=function(p,t){return qr().setRTLTextPlugin(p,t)},E.setWorkerCount=function(p){it.workerCount=p},E.setWorkerUrl=function(p){c.c.WORKER_URL=p}})),L}))})),Nn=Od(jm()),zt=["all",!1],Nm=[{id:"itineraire-connexe-line-border",type:"line",source:"fvt","source-layer":"etape",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#FFFFFF","line-width":6},filter:zt},{id:"itineraire-connexe",type:"line",source:"fvt","source-layer":"etape",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#787A74","line-width":4,"line-dasharray":[2,2]},filter:zt},{id:"itineraire-line-border",type:"line",source:"fvt","source-layer":"etape",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#FFFFFF","line-width":6},filter:zt},{id:"itineraire",type:"line",source:"fvt","source-layer":"etape",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#ff0000","line-opacity":1,"line-width":4},filter:zt},{id:"itineraire-calculateur",type:"line",source:"fvt","source-layer":"etape",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#787A74","line-dasharray":[2,2],"line-opacity":1,"line-width":4},filter:zt},{id:"itineraire-etape",source:"fvt","source-layer":"etape-point",type:"circle",minzoom:7,paint:{"circle-radius":6,"circle-color":"#787A74","circle-stroke-width":2,"circle-stroke-color":" #ffffff","circle-stroke-opacity":1},filter:zt},{id:"segment-line-border",type:"line",source:"fvt","source-layer":"segment",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#FFFFFF","line-width":9},filter:zt},{id:"etape-line-border",type:"line",source:"fvt","source-layer":"etape",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#FFFFFF","line-width":10},filter:zt},{id:"etape",type:"line",source:"fvt","source-layer":"etape",layout:{"line-cap":"round","line-join":"round"},paint:{"line-opacity":1,"line-width":6,"line-color":"#FF0000"},filter:zt},{id:"segment",type:"line",source:"fvt","source-layer":"segment",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["match",["get","statut"],["VV","PCY","ASP","CHR"],"#25A214",["RTE","BCY","ICA"],"#E68701","#C3C6BD"],"line-opacity":1,"line-width":6},filter:zt},{id:"etape-marker",source:"fvt","source-layer":"etape-point",type:"circle",paint:{"circle-radius":3,"circle-color":"#ffffff","circle-stroke-width":3,"circle-stroke-color":" #FF0000","circle-stroke-opacity":1},filter:zt}
800,{id:"etape-marker-fin",type:"circle",source:"fvt","source-layer":"etape-point",paint:{"circle-radius":6,"circle-color":"#ffffff","circle-stroke-width":3,"circle-stroke-color":"#74A518","circle-stroke-opacity":1},filter:zt},{id:"etape-marker-debut",type:"circle",source:"fvt","source-layer":"etape-point",paint:{"circle-radius":6,"circle-color":"#FFFFFF","circle-stroke-width":3,"circle-stroke-color":"#E68701","circle-stroke-opacity":1},filter:zt},{id:"planifier-marker-depart",type:"symbol",source:"fvt","source-layer":"etape-point",layout:{"icon-image":"depart","icon-size":1,"icon-allow-overlap":!0},filter:zt},{id:"planifier-marker-arrivee",type:"symbol",source:"fvt","source-layer":"etape-point",layout:{"icon-image":"arrivee","icon-size":1,"icon-allow-overlap":!0},filter:zt},{id:"planifier-marker-etape",type:"circle",source:"fvt","source-layer":"etape-point",paint:{"circle-radius":6,"circle-color":"#C77400","circle-stroke-width":2,"circle-stroke-color":"#ffffff","circle-stroke-opacity":1},filter:zt},{id:"liaison",type:"line",source:"fvt","source-layer":"liaison",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#000000","line-width":4,"line-dasharray":[2,2]},filter:zt},{id:"provisoire",type:"line",source:"fvt","source-layer":"provisoire",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#ffffff","line-width":4,"line-dasharray":[2,2]},filter:zt},{id:"alternative",type:"line",source:"fvt","source-layer":"alternative",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#231f20","line-width":4,"line-dasharray":[2,2]},filter:zt},{id:"itineraire-line-border-hover",type:"line",source:"fvt","source-layer":"etape",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#FFFFFF","line-width":10},filter:zt},{id:"itineraire-hover",type:"line",source:"fvt","source-layer":"etape",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#ff0000","line-width":6},filter:zt},{id:"etape-hover",type:"line",source:"fvt","source-layer":"etape",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#0096cf","line-width":8},filter:zt},{id:"itineraire-connexe-hover",type:"line",source:"fvt","source-layer":"etape",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#0096cf","line-width":4,"line-dasharray":[2,2]},filter:zt},{id:"boucle",type:"line",source:"fvt","source-layer":"boucle",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#800080","line-opacity":1,"line-width":6},filter:zt},{id:"poi-boucle",type:"symbol",source:"fvt","source-layer":"boucle-point",layout:{"icon-size":1,"icon-allow-overlap":!0,"icon-anchor":"bottom"},filter:zt},{id:"cluster-boucle",type:"symbol",source:"boucle-cluster",layout:{"icon-image":"boucle","icon-size":1,"icon-allow-overlap":!0,"icon-anchor":"bottom"},filter:zt},{id:"clusters-marker-boucle",type:"circle",source:"boucle-cluster",filter:["has","point_count"],paint:{"circle-color":"#800080","circle-radius":12,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}},{id:"cluster-count-boucle",type:"symbol",source:"boucle-cluster",filter:["has","point_count"],paint:{"text-color":"#ffffff"},layout:{"text-field":"{point_count_abbreviated}","text-size":12,"text-allow-overlap":!0}},{id:"poi-ideeparcours",type:"symbol",source:"ideeparcours",layout:{"icon-image":["get","icon"],"icon-size":1,"icon-allow-overlap":!0,"icon-anchor":"bottom"},filter:["all"]},{id:"direction-route-line-border",type:"line",source:"directions",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#FFFFFF","line-width":9},filter:["all",["in","$type","LineString"],["!=","route","dashed"]]},{id:"direction-route-line",type:"line",source:"directions",layout:{"line-cap":"round","line-join":"round","line-sort-key":["case",["==",["get","selected"],!0],1,0]},paint:{"line-color":["case",["==",["get","mode"],"pied"],"#578CF6",["has","color"],["get","color"],["==",["get","selected"],!1],"#D2BC9E","#E68701"],"line-width":5},filter:["all",["in","$type","LineString"],["==","dashed",!1]]},{id:"direction-route-line-dashed",type:"line",source:"directions",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","mode"],"pied"],"#578CF6",["has","color"],["get","color"],"#E68701"],"line-width":6,"line-dasharray":[2,2]},filter:["all",["in","$type","LineString"],["==","dashed",!0]]},{id:"direction-marker-depart",type:"symbol",source:"directions",layout:{"icon-image":"depart","icon-size":1,"icon-allow-overlap":!0}
800,filter:["all",["in","$type","Point"],["==","state","depart"]]},{id:"direction-marker-arrivee",type:"symbol",source:"directions",layout:{"icon-image":"arrivee","icon-size":1,"icon-allow-overlap":!0},filter:["all",["in","$type","Point"],["==","state","arrivee"]]},{id:"direction-marker-etape",type:"circle",source:"directions",paint:{"circle-radius":12,"circle-color":"#C77400","circle-stroke-opacity":1},filter:["all",["in","$type","Point"],["==","state","etape"]]},{id:"direction-marker-num-etape",type:"symbol",source:"directions",paint:{"text-color":"#ffffff"},layout:{"text-field":["get","etape"],"text-size":14,"text-allow-overlap":!0},filter:["all",["in","$type","Point"],["==","state","etape"]]},{id:"direction-poi-marker",type:"symbol",source:"directions",layout:{"icon-image":["get","icon"],"icon-size":1,"icon-allow-overlap":!0,"icon-anchor":"bottom"},filter:["all",["in","$type","Point"],["any",["==","type","sit"],["==","type","aire-de-service"]]]},{id:"direction-marker-point",source:"directions",type:"circle",paint:{"circle-radius":6,"circle-color":"#C77400","circle-stroke-width":2,"circle-stroke-color":"#ffffff","circle-stroke-opacity":1},filter:["all",["in","$type","Point"],["==","state","point"]]},{id:"transport-route-line-border",type:"line",source:"transport",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#FFFFFF","line-width":9},filter:["all",["in","$type","LineString"],["!=","route","dashed"]]},{id:"transport-route-line",type:"line",source:"transport",layout:{"line-cap":"round","line-join":"round","line-sort-key":["case",["==",["get","selected"],!0],1,0]},paint:{"line-color":["case",["==",["get","mode"],"pied"],"#578CF6",["==",["get","mode"],"velo"],"#E68701",["has","color"],["get","color"],["==",["get","selected"],!1],"#D2BC9E","#74A518"],"line-width":5},filter:["all",["in","$type","LineString"],["==","dashed",!1]]},{id:"transport-route-line-dashed",type:"line",source:"transport",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["case",["==",["get","mode"],"pied"],"#578CF6",["has","color"],["get","color"],"#E68701"],"line-width":6,"line-dasharray":[2,2]},filter:["all",["in","$type","LineString"],["==","dashed",!0]]},{id:"transport-marker-depart",type:"symbol",source:"transport",layout:{"icon-image":"depart","icon-size":1,"icon-allow-overlap":!0},filter:["all",["in","$type","Point"],["==","state","depart"]]},{id:"transport-marker-arrivee",type:"symbol",source:"transport",layout:{"icon-image":"arrivee","icon-size":1,"icon-allow-overlap":!0},filter:["all",["in","$type","Point"],["==","state","arrivee"]]},{id:"transport-marker-etape",type:"circle",source:"transport",paint:{"circle-radius":12,"circle-color":"#74A518","circle-stroke-opacity":1},filter:["all",["in","$type","Point"],["==","state","etape"]]},{id:"transport-marker-num-etape",type:"symbol",source:"transport",paint:{"text-color":"#ffffff"},layout:{"text-field":["get","etape"],"text-size":14,"text-allow-overlap":!0},filter:["all",["in","$type","Point"],["==","state","etape"]]},{id:"clusters-gare",type:"circle",source:"gares",filter:["has","point_count"],paint:{"circle-color":"#1A171B","circle-radius":12,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}},{id:"cluster-count-gare",type:"symbol",source:"gares",filter:["has","point_count"],paint:{"text-color":"#ffffff"},layout:{"text-field":"{point_count_abbreviated}","text-size":12,"text-allow-overlap":!0}},{id:"gare-marker",type:"symbol",source:"gares",layout:{"icon-image":["get","icon"],"icon-size":1,"icon-allow-overlap":!0,"icon-anchor":"bottom"},filter:["all"]},{id:"clusters-poi",type:"circle",source:"poi",filter:["has","point_count"],paint:{"circle-color":"#1A171B","circle-radius":12,"circle-stroke-width":2,"circle-stroke-color":"#ffffff"}},{id:"cluster-count-poi",type:"symbol",source:"poi",filter:["has","point_count"],paint:{"text-color":"#ffffff"},layout:{"text-field":"{point_count_abbreviated}","text-size":12,"text-allow-overlap":!0}},{id:"poi-marker",type:"symbol",source:"poi",layout:{"icon-image":["get","icon"],"icon-size":1,"icon-allow-overlap":!0,"icon-anchor":"bottom"},filter:["all"]},{id:"poi-signalements-cours",type:"symbol",source:"signalements",layout:{"icon-image":"signalement-en-cours","icon-size":1,"icon-allow-overlap":!0,"icon-anchor":"center"},filter:["all",["in","$type","Point"],["any",["==","statut",2],["==","
800statut",3]]]},{id:"poi-signalements-resolu",type:"symbol",source:"signalements",layout:{"icon-image":"signalement-resolu","icon-size":1,"icon-allow-overlap":!0,"icon-anchor":"center"},filter:["all",["in","$type","Point"],["==","statut",4]]},{id:"poi-signalements-signale",type:"symbol",source:"signalements",layout:{"icon-image":"signalement-signale","icon-size":1,"icon-allow-overlap":!0,"icon-anchor":"center"},filter:["all",["in","$type","Point"],["==","statut",1]]},{id:"marker",type:"symbol",source:"markers",layout:{"icon-image":"poi","icon-size":1,"icon-allow-overlap":!0,"icon-anchor":"bottom"},filter:["all",["in","$type","Point"]]},{id:"incontournable-marker",type:"symbol",source:"incontournables",layout:{"icon-image":["get","image"],"icon-size":1,"icon-allow-overlap":!0,"icon-anchor":"bottom"},paint:{"icon-opacity":["step",["zoom"],0,1,["case",[">=",["get","poids"],20],1,0],9,["case",[">=",["get","poids"],10],1,0],13,["case",[">=",["get","poids"],0],1,0]]},filter:["all"]},{id:"hover-point-profil",type:"circle",source:"hover-point-profil",paint:{"circle-radius":8,"circle-color":"#3F590D","circle-opacity":1}}],Um=Bd(((R,z)=>{var L={};function j(c){return Math.floor(Math.abs(c)+.5)*(c>=0?1:-1)}function Z(c,H,he){c=j(c*he),H=j(H*he);var xe=(c-H)*2;xe<0&&(xe=-xe-1);for(var Ae="";xe>=32;)Ae+=String.fromCharCode((32|xe&31)+63),xe/=32;return Ae+=String.fromCharCode((xe|0)+63),Ae}L.decode=function(c,H){for(var he=0,xe=0,Ae=0,Le=[],Ee=0,ze=0,be=null,le,Be,Ne=Math.pow(10,Number.isInteger(H)?H:5);he<c.length;){be=null,Ee=1,ze=0;do be=c.charCodeAt(he++)-63,ze+=(be&31)*Ee,Ee*=32;while(be>=32);le=ze&1?(-ze-1)/2:ze/2,Ee=1,ze=0;do be=c.charCodeAt(he++)-63,ze+=(be&31)*Ee,Ee*=32;while(be>=32);Be=ze&1?(-ze-1)/2:ze/2,xe+=le,Ae+=Be,Le.push([xe/Ne,Ae/Ne])}return Le},L.encode=function(c,H){if(!c.length)return"";for(var he=Math.pow(10,Number.isInteger(H)?H:5),xe=Z(c[0][0],0,he)+Z(c[0][1],0,he),Ae=1;Ae<c.length;Ae++){var Le=c[Ae],Ee=c[Ae-1];xe+=Z(Le[0],Ee[0],he),xe+=Z(Le[1],Ee[1],he)}return xe};function E(c){for(var H=[],he=0;he<c.length;he++){var xe=c[he].slice();H.push([xe[1],xe[0]])}return H}L.fromGeoJSON=function(c,H){if(c&&c.type==="Feature"&&(c=c.geometry),!c||c.type!=="LineString")throw new Error("Input must be a GeoJSON LineString");return L.encode(E(c.coordinates),H)},L.toGeoJSON=function(c,H){return{type:"LineString",coordinates:E(L.decode(c,H))}},typeof z=="object"&&z.exports&&(z.exports=L)})),Vd=Od(Um()),Wi=63710088e-1,jd={centimeters:Wi*100,centimetres:Wi*100,degrees:360/(2*Math.PI),feet:Wi*3.28084,inches:Wi*39.37,kilometers:Wi/1e3,kilometres:Wi/1e3,meters:Wi,metres:Wi,miles:Wi/1609.344,millimeters:Wi*1e3,millimetres:Wi*1e3,nauticalmiles:Wi/1852,radians:1,yards:Wi*1.0936};function bo(R,z,L={}){const j={type:"Feature"};return(L.id===0||L.id)&&(j.id=L.id),L.bbox&&(j.bbox=L.bbox),j.properties=z||{},j.geometry=R,j}function tn(R,z,L={}){if(!R)throw new Error("coordinates is required");if(!Array.isArray(R))throw new Error("coordinates must be an Array");if(R.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Gd(R[0])||!Gd(R[1]))throw new Error("coordinates must contain numbers");return bo({type:"Point",coordinates:R},z,L)}function Mr(R,z,L={}){if(R.length<2)throw new Error("coordinates must be an array of two or more positions");return bo({type:"LineString",coordinates:R},z,L)}function Nd(R,z="kilometers"){const L=jd[z];
800if(!L)throw new Error(z+" units is invalid");return R*L}function Ud(R,z="kilometers"){const L=jd[z];if(!L)throw new Error(z+" units is invalid");return R/L}function Na(R){return R%(2*Math.PI)*180/Math.PI}function sr(R){return R%360*Math.PI/180}function $d(R,z="kilometers",L="kilometers"){if(!(R>=0))throw new Error("length must be a positive number");return Nd(Ud(R,z),L)}function Gd(R){return!isNaN(R)&&R!==null&&!Array.isArray(R)}function $m(R){return R!==null&&typeof R=="object"&&!Array.isArray(R)}function Nr(R){if(!R)throw new Error("coord is required");if(!Array.isArray(R)){if(R.type==="Feature"&&R.geometry!==null&&R.geometry.type==="Point")return[...R.geometry.coordinates];if(R.type==="Point")return[...R.coordinates]}if(Array.isArray(R)&&R.length>=2&&!Array.isArray(R[0])&&!Array.isArray(R[1]))return[...R];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Gm(R){if(Array.isArray(R))return R;if(R.type==="Feature"){if(R.geometry!==null)return R.geometry.coordinates}else if(R.coordinates)return R.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function qd(R,z,L){if(!R)throw new Error("No feature passed");if(!L)throw new Error(".featureOf() requires a name");if(!R||R.type!=="Feature"||!R.geometry)throw new Error("Invalid input to "+L+", Feature with geometry required");if(!R.geometry||R.geometry.type!==z)throw new Error("Invalid input to "+L+": must be a "+z+", given "+R.geometry.type)}function Gu(R,z,L={}){if(L.final===!0)return qm(R,z);const j=Nr(R),Z=Nr(z),E=sr(j[0]),c=sr(Z[0]),H=sr(j[1]),he=sr(Z[1]),xe=Math.sin(c-E)*Math.cos(he),Ae=Math.cos(H)*Math.sin(he)-Math.sin(H)*Math.cos(he)*Math.cos(c-E);return Na(Math.atan2(xe,Ae))}function qm(R,z){let L=Gu(z,R);return L=(L+180)%360,L}function Ua(R,z,L={}){var j=Nr(R),Z=Nr(z),E=sr(Z[1]-j[1]),c=sr(Z[0]-j[0]),H=sr(j[1]),he=sr(Z[1]),xe=Math.pow(Math.sin(E/2),2)+Math.pow(Math.sin(c/2),2)*Math.cos(H)*Math.cos(he);return Nd(2*Math.atan2(Math.sqrt(xe),Math.sqrt(1-xe)),L.units)}function Zd(R,z,L,j={}){const Z=Nr(R),E=sr(Z[0]),c=sr(Z[1]),H=sr(L),he=Ud(z,j.units),xe=Math.asin(Math.sin(c)*Math.cos(he)+Math.cos(c)*Math.sin(he)*Math.cos(H)),Ae=Na(E+Math.atan2(Math.sin(H)*Math.sin(he)*Math.cos(c),Math.cos(he)-Math.sin(c)*Math.sin(xe))),Le=Na(xe);return Z[2]!==void 0?tn([Ae,Le,Z[2]],j.properties):tn([Ae,Le],j.properties)}function Zm(R,z,L,j={}){if(!$m(j))throw new Error("options is invalid");const{units:Z="kilometers"}=j;var E,c=[];if(R.type==="Feature")E=R.geometry.coordinates;else if(R.type==="LineString")E=R.coordinates;else throw new Error("input must be a LineString Feature or Geometry");const H=E.length;let he=0,xe,Ae,Le;for(let ze=0;ze<E.length&&!(z>=he&&ze===E.length-1);ze++){if(he>z&&c.length===0){let be=z-he;if(!be)return c.push(E[ze]),Mr(c);Ae=Gu(E[ze],E[ze-1])-180,Le=Zd(E[ze],be,Ae,{units:Z}),c.push(Le.geometry.coordinates)}if(he>=L)return xe=L-he,xe?(Ae=Gu(E[ze],E[ze-1])-180,Le=Zd(E[ze],xe,Ae,{units:Z}),c.push(Le.geometry.coordinates),Mr(c)):(c.push(E[ze]),Mr(c));if(he>=z&&c.push(E[ze]),ze===E.length-1)return Mr(c);he+=Ua(E[ze],E[ze+1],{units:Z})}if(he<z&&E.length===H)throw new Error("Start position is beyond line");var Ee=E[E.length-1];return Mr([Ee,Ee])}function Wd(R,z,L){if(R!==null)for(var j,Z,E,c,H,he,xe,Ae=0,Le=0,Ee,ze=R.type,be=ze==="FeatureCollection",le=ze==="Feature",Be=be?R.features.length:1,Ne=0;Ne<Be;Ne++){xe=be?R.features[Ne].geometry:le?R.geometry:R,Ee=xe?xe.type==="GeometryCollection":!1,H=Ee?xe.geometries.length:1;for(var ht=0;ht<H;ht++){var dt=0,Vt=0;if(c=Ee?xe.geometries[ht]:xe,c!==null){he=c.coordinates;var Ut=c.type;switch(Ae=L&&(Ut==="Polygon"||Ut==="MultiPolygon")?1:0,Ut){case null:break;case"Point":if(z(he,Le,Ne,dt,Vt)===!1)return!1;Le++,dt++;break;case"LineString":case"MultiPoint":for(j=0;j<he.length;j++){if(z(he[j],Le,Ne,dt,Vt)===!1)return!1;Le++,Ut==="MultiPoint"&&dt++}Ut==="LineString"&&dt++;break;case"Polygon":case"MultiLineString":for(j=0;j<he.length;j++){for(Z=0;Z<he[j].length-Ae;Z++){if(z(he[j][Z],Le,Ne,dt,Vt)===!1)return!1;Le++}Ut==="MultiLineString"&&dt++,Ut==="Polygon"&&Vt++}Ut==="Polygon"&&dt++;break;case"MultiPolygon":for(j=0;j<he.length;j++){for(Vt=0,Z=0;Z<he[j].length;Z++){for(E=0;E<he[j][Z].length-Ae;E++){if(z(he[j][Z][E],Le,Ne,dt,Vt)===!1)return!1;Le++}Vt++}dt++}break;case"GeometryCollection":for(j=0;j<c.geometries.length;j++)if(Wd(c.geometries[j],z,L)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Wm(R,z){var L,j,Z,E,c,H,he,xe,Ae,Le,Ee=0,ze=R.type==="FeatureCollection",be=R.type==="Feature",le=ze?R.features.length:1;for(L=0;L<le;L++){for(H=ze?R.features[L].geometry:be?R.geometry:R,xe=ze?R.features[L].properties:be?R.properties:{},Ae=ze?R.features[L].bbox:be?R.bbox:void 0,Le=ze?R.features[L].id:be?R.id:void 0,he=H?H.type==="GeometryCollection":!1,c=he?H.geometries.length:1,Z=0;Z<c;Z++){if(E=he?H.geometries[Z]:H,E===null){if(z(null,Ee,xe,Ae,Le)===!1)return!1;continue}switch(E.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(z(E,Ee,xe,Ae,Le)===!1)return!1;break;case"GeometryCollection":for(j=0;j<E.geometries.length;j++)if(z(E.geometries[j],Ee,xe,Ae,Le)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}Ee++}}function Hd(R,z){Wm(R,function(L,j,Z,E,c){var H=L===null?null:L.type;
800switch(H){case null:case"Point":case"LineString":case"Polygon":return z(bo(L,Z,{bbox:E,id:c}),j,0)===!1?!1:void 0}var he;switch(H){case"MultiPoint":he="Point";break;case"MultiLineString":he="LineString";break;case"MultiPolygon":he="Polygon";break}for(var xe=0;xe<L.coordinates.length;xe++){var Ae=L.coordinates[xe];if(z(bo({type:he,coordinates:Ae},Z),j,xe)===!1)return!1}})}function Xd(R,z){Hd(R,function(L,j,Z){var E=0;if(L.geometry){var c=L.geometry.type;if(!(c==="Point"||c==="MultiPoint")){var H,he=0,xe=0,Ae=0;if(Wd(L,function(Le,Ee,ze,be,le){if(H===void 0||j>he||be>xe||le>Ae){H=Le,he=j,xe=be,Ae=le,E=0;return}if(z(Mr([H,Le],L.properties),j,Z,le,E)===!1)return!1;E++,H=Le})===!1)return!1}}})}function Hm(R,z,L){var j=L,Z=!1;return Xd(R,function(E,c,H,he,xe){Z===!1&&L===void 0?j=E:j=z(j,E,c,H,he,xe),Z=!0}),j}function Xm(R,z={}){return Hm(R,(L,j)=>{const Z=j.geometry.coordinates;return L+Ua(Z[0],Z[1],z)},0)}function Ym(R,z=100){const L=Math.ceil(R.length/z);return R.length>z?R.reduce((j,Z,E)=>((E===0||E===R.length-1||E%L===0)&&j.push(Z),j),[]):R}function Km(R){let z=[];if(R.type!=="LineString")for(const L of R.coordinates)z=[...z,...L];else z=R.coordinates;return z}function hc(R,z=10){R=R.replace("#","");const L=parseInt(R.slice(0,2),16)/255,j=parseInt(R.slice(2,4),16)/255,Z=parseInt(R.slice(4,6),16)/255,E=Math.max(L,j,Z),c=Math.min(L,j,Z);let H,he,xe=(E+c)/2;if(E===c)H=he=0;else{const le=E-c;switch(he=xe>.5?le/(2-E-c):le/(E+c),E){case L:H=(j-Z)/le+(j<Z?6:0);break;case j:H=(Z-L)/le+2;break;case Z:H=(L-j)/le+4;break}H*=60}xe=Math.max(0,xe-z/100);function Ae(le,Be,Ne){return Ne<0&&(Ne+=1),Ne>1&&(Ne-=1),Ne<1/6?le+(Be-le)*6*Ne:Ne<1/2?Be:Ne<2/3?le+(Be-le)*(2/3-Ne)*6:le}let Le,Ee,ze;if(he===0)Le=Ee=ze=xe;else{const le=xe<.5?xe*(1+he):xe+he-xe*he,Be=2*xe-le;Le=Ae(Be,le,H/360+1/3),Ee=Ae(Be,le,H/360),ze=Ae(Be,le,H/360-1/3)}const be=le=>Math.round(le*255).toString(16).padStart(2,"0");return`#${be(Le)}${be(Ee)}${be(ze)}`}function Jm(R,z=200){let L;return(...j)=>{clearTimeout(L),L=setTimeout(()=>{R(...j)},z)}}function wo(R,z=5){return Vd.decode(R,z).map(L=>L.reverse())}function Qm(R,z=5){return Vd.encode([...R].map(L=>[...L].slice(0,2).reverse()),z)}function Yd(R){return R.reduce(function(z,L){return z.extend(L)},new Nn.LngLatBounds(R[0],R[0]))}function eg(R){let z=null;return R.categorie&&(z=R.categorie.parent.code==="hebergements"||R.categorie.parent.code==="restos-bars"?R.categorie.parent.code:R.categorie.code,R.categorie.parent.parent&&(z=R.categorie.parent.code)),z}function tg(R,z){const L="kilometers",j=[],Z=Mr(wo(R)),E=Xm(Z,{units:L})*1e3,c=Math.ceil(Math.round(E/z*100)/100);for(let H=0;H<c-1;H++){const he=H*(z/1e3),xe=Zm(Z,he,he+z/1e3,{units:L});j.push(xe.geometry.coordinates[xe.geometry.coordinates.length-1])}return j}async function Kd(R){if(crypto.subtle){const L=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(R));return Array.from(new Uint8Array(L)).map(j=>j.toString(16).padStart(2,"0")).join("")}let z=0;for(let L=0;L<R.length;L++)z=Math.imul(31,z)+R.charCodeAt(L)|0;return(z>>>0).toString(16).padStart(8,"0")}var qu=document.currentScript?.src||document.querySelector('script[src*="carte.loopi.js"]')?.src||"",dc={};function Jd(R,z){const L=window[z];return L?Promise.resolve(L):(dc[R]||(dc[R]=new Promise((j,Z)=>{const E=new URL(R,qu||window.location.href);qu&&(E.search=new URL(qu).search);const c=document.createElement("script");c.src=E.toString(),c.async=!0,c.onload=()=>j(window[z]),c.onerror=()=>{delete dc[R],Z(new Error(`Chargement impossible : ${R}`))},document.head.appendChild(c)})),dc[R])}var ig=()=>Jd("chart.umd.min.js","Chart"),rg=()=>Jd("Sortable.min.js","Sortable");async function ng(R,z,L){return await Hi("/api/directions",{points:R,carnet:z},!0,L)}async function sg(R,z,L,j,Z){return await Hi("/api/directions/transport",{points:R,gares:z,date:L,velo:j},!0,Z)}async function og(R){return await Hi(`/api/autocomplete/gares?q=${R}`)}async function ag(R,z){let L=`/api/address/search?q=${R}`;return z&&(L+=`&lat=${z[0]}&lon=${z[1]}`),await Hi(L)}async function To(R){const z=await Hi(`/api/address/reverse/${R[0]}/${R[1]}`);return{label:z?.label||[...R].reverse().join(";"),ville:z.ville??null,geometry:{type:"Point",coordinates:R}}}async function lg(R){return await Hi("/api/profil-altimetrique",{geometry:R})}async function cg(R){return await Hi(R==="anonymous"?"/carnet/profil/anonymous":`/carnet/profil/${R}`)}async function ug(R,z){return await Hi("/api/sit/search",R,!0,z)}async function hg(R,z,L){return Hi(`/api/popup/${R}/${z}/${L}`)}async function dg(R){return await Hi(R?`/api/signalements/${R}`:"/api/signalements")}async function pg(R,z,L){return await Hi(`/itineraire/planifier/${R}/${z}/${L}?ajax=1`)}async function fg(R,z){return await Hi("/api/routetogpx/xml",{geometry:R,points:z},!1)}async function mg(R,z,L,j,Z,E,c,H=[]){const he=structuredClone(z);let xe="";if(he.legs&&he.legs.length>1){delete he.geometry;let Ee="";he.legs=he.legs.map(ze=>{const be=Qm(ze.steps.flatMap(le=>wo(le.geometry)));return Ee+=be,{distance:ze.distance,duration:ze.duration,geometry:be}}),xe=await Kd(Ee)}else delete he.legs,xe=await Kd(he.geometry);let Ae=Z?`/api/carnet/creer/route:${xe}`:`/api/favoris/add/route:${xe}`;E&&Z&&(Ae=`/api/carnet/save/${E}`);const Le={id:xe,route:he,points:L.map(Ee=>(Ee.type||delete Ee.type,Ee.poi||delete Ee.poi,Ee)),boucle:j,profil:c};H.length>
8000&&(Le.pointsEtapes=H),Drupal.ajax({url:Ae,base:!1,element:R,submit:{data:JSON.stringify(Le)}}).execute()}async function gg(){return await Hi("/popup/favoris")}async function Qd(R){return await Hi(`/api/objet/${R}`)}async function Hi(R,z=null,L=!0,j){const Z={method:"GET",headers:{"Content-Type":"application/json"}};z&&(Z.method="POST",Z.body=JSON.stringify(z)),j&&(Z.signal=j);const E=await fetch(R,Z);return L?E.json():E.text()}var _g=Object.defineProperty,yg=Object.defineProperties,vg=Object.getOwnPropertyDescriptors,ep=Object.getOwnPropertySymbols,xg=Object.prototype.hasOwnProperty,bg=Object.prototype.propertyIsEnumerable,tp=(R,z,L)=>z in R?_g(R,z,{enumerable:!0,configurable:!0,writable:!0,value:L}):R[z]=L,wg=(R,z)=>{for(var L in z||(z={}))xg.call(z,L)&&tp(R,L,z[L]);if(ep)for(var L of ep(z))bg.call(z,L)&&tp(R,L,z[L]);return R},Tg=(R,z)=>yg(R,vg(z));function Zu(R,z,L={}){if(!R||!z)throw new Error("lines and inputPoint are required arguments");const j=Nr(z);let Z=tn([1/0,1/0],{lineStringIndex:-1,segmentIndex:-1,totalDistance:-1,lineDistance:-1,segmentDistance:-1,pointDistance:1/0,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),E=0,c=0,H=-1;return Hd(R,function(he,xe,Ae){H!==Ae&&(H=Ae,c=0);const Le=Gm(he);for(let Ee=0;Ee<Le.length-1;Ee++){const ze=tn(Le[Ee]),be=Nr(ze),le=tn(Le[Ee+1]),Be=Nr(le),Ne=Ua(ze,le,L);let ht,dt;Be[0]===j[0]&&Be[1]===j[1]?[ht,dt]=[Be,!0]:be[0]===j[0]&&be[1]===j[1]?[ht,dt]=[be,!1]:[ht,dt]=Ig(be,Be,j);const Vt=Ua(z,ht,L);if(Vt<Z.properties.pointDistance){const Ut=Ua(ze,ht,L);Z=tn(ht,{lineStringIndex:Ae,segmentIndex:dt?Ee+1:Ee,totalDistance:E+Ut,lineDistance:c+Ut,segmentDistance:Ut,pointDistance:Vt,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),Z.properties=Tg(wg({},Z.properties),{multiFeatureIndex:Z.properties.lineStringIndex,index:Z.properties.segmentIndex,location:Z.properties.totalDistance,dist:Z.properties.pointDistance})}E+=Ne,c+=Ne}}),Z}function Ps(R,z){const[L,j,Z]=R,[E,c,H]=z;return L*E+j*c+Z*H}function $a(R,z){const[L,j,Z]=R,[E,c,H]=z;return[j*H-Z*c,Z*E-L*H,L*c-j*E]}function Sg(R){return Math.sqrt(Math.pow(R[0],2)+Math.pow(R[1],2)+Math.pow(R[2],2))}function ip(R){const z=Sg(R);return[R[0]/z,R[1]/z,R[2]/z]}function Wu(R){const z=sr(R[1]),L=sr(R[0]);return[Math.cos(z)*Math.cos(L),Math.cos(z)*Math.sin(L),Math.sin(z)]}function Pg(R){const[z,L,j]=R,Z=Na(Math.asin(Math.min(Math.max(j,-1),1)));return[Na(Math.atan2(L,z)),Z]}function Ig(R,z,L){const j=Wu(R),Z=Wu(z),E=Wu(L),c=$a(j,Z);if(c[0]===0&&c[1]===0&&c[2]===0)return Ps(j,Z)>0?[[...z],!0]:[[...L],!1];const H=$a(c,E);if(H[0]===0&&H[1]===0&&H[2]===0)return[[...z],!0];const he=ip($a(H,c)),xe=[-he[0],-he[1],-he[2]],Ae=Ps(E,he)>Ps(E,xe)?he:xe,Le=ip(c),Ee=Ps($a(j,Ae),Le),ze=Ps($a(Ae,Z),Le);return Ee>=0&&ze>=0?[Pg(Ae),!1]:Ps(j,E)>Ps(Z,E)?[[...R],!1]:[[...z],!0]}var Mg=Zu;function Hu(R,z,L={}){const j=Nr(R),Z=Nr(z);return Z[0]+=Z[0]-j[0]>180?-360:j[0]-Z[0]>180?360:0,$d(Eg(j,Z),"meters",L.units)}function Eg(R,z,L){L=L===void 0?Wi:Number(L);const j=L,Z=R[1]*Math.PI/180,E=z[1]*Math.PI/180,c=E-Z;let H=Math.abs(z[0]-R[0])*Math.PI/180;H>Math.PI&&(H-=2*Math.PI);const he=Math.log(Math.tan(E/2+Math.PI/4)/Math.tan(Z/2+Math.PI/4)),xe=Math.abs(he)>1e-11?c/he:Math.cos(Z);return Math.sqrt(c*c+xe*xe*H*H)*j}function Cg(R,z,L={}){var j,Z;const E=(j=L.method)!=null?j:"geodesic",c=(Z=L.units)!=null?Z:"kilometers";if(!R)throw new Error("pt is required");if(Array.isArray(R)?R=tn(R):R.type==="Point"?R=bo(R):qd(R,"Point","point"),!z)throw new Error("line is required");Array.isArray(z)?z=Mr(z):z.type==="LineString"?z=bo(z):qd(z,"LineString","line");let H=1/0;const he=R.geometry.coordinates;return Xd(z,xe=>{if(xe){const Ae=xe.geometry.coordinates[0],Le=xe.geometry.coordinates[1],Ee=Ag(he,Ae,Le,{method:E});Ee<H&&(H=Ee)}}),$d(H,"degrees",c)}function Ag(R,z,L,j){if(j.method==="geodesic")return Zu(Mr([z,L]).geometry,R,{units:"degrees"}).properties.dist;const Z=[L[0]-z[0],L[1]-z[1]],E=rp([R[0]-z[0],R[1]-z[1]],Z);if(E<=0)return Hu(R,z,{units:"degrees"});const c=rp(Z,Z);if(c<=E)return Hu(R,L,{units:"degrees"});const H=E/c;return Hu(R,[z[0]+H*Z[0],z[1]+H*Z[1]],{units:"degrees"})}function rp(R,z){return R[0]*z[0]+R[1]*z[1]}
800var Dg=Cg,kg=class extends EventTarget{popup=null;map;constructor(R){super(),this.map=R}async show(R,z){this.remove(),window.innerWidth>992?(await this.preloadImages(R),this.popup=new Nn.Popup({closeButton:!1,closeOnClick:!1,className:"popup"}),this.popup.setDOMContent(R).setLngLat(z).addTo(this.map)):(this.popup=R,document.body.appendChild(R)),Drupal.attachBehaviors(jQuery(".popup-fvt-carte").parent().get(0),null),R.querySelector(".popup-fvt-carte .close")?.addEventListener("click",L=>{L.preventDefault(),L.stopPropagation(),this.popup?.remove()})}async preloadImages(R){const z=Array.from(R.querySelectorAll("img")).filter(L=>L.loading=="auto");if(z.length===0)return Promise.resolve();await Promise.all(z.map(L=>new Promise(j=>{L.complete?j():(L.onload=()=>j(),L.onerror=()=>j())})))}onClose(R){this.addEventListener("close",(()=>{R()}))}remove(){this.popup?.remove(),this.popup=null,this.dispatchEvent(new CustomEvent("close",{bubbles:!0}))}},{NavigationControl:zg,AttributionControl:Lg}=Nn.default,Fg=class zm{tooltip;popup;map;color="#007AA8";sources=["gares","poi","boucle-cluster","ideeparcours","directions","transport","signalements","markers","incontournables","hover-point-profil"];layersHover=["itineraire-hover","itineraire-line-border-hover","etape-hover","itineraire-connexe-hover"];direction=null;localisationForm=!1;elmPopupCarte=document.querySelector(".popup-options-carte");boucles=[];boucle=null;constructor(){}static async init(z,L){const j=new zm,Z={container:z,minZoom:0,maxZoom:20,maxPitch:0,pitchWithRotate:!1,style:"https://tiles.loopi-velo.fr/styles/fvt-v3/style.json",doubleClickZoom:!1,attributionControl:!1,bounds:L?.bbox??[[-14.53491210937679,39.76632525654654],[19.41284179687281,52.5429550664222]],fitBoundsOptions:L?.bbox?{padding:100}:null,maxBounds:[[-14.53491210937679,39.76632525654654],[19.41284179687281,52.5429550664222]]};L?.center&&(Z.center=L.center,Z.zoom=L.zoom,delete Z.bounds,delete Z.fitBoundsOptions),j.tooltip=new Nn.Popup({closeButton:!1,closeOnClick:!1,className:"tooltip-carte"}),j.map=new Nn.Map(Z),j.popup=new kg(j.map);const E="bottom-right";j.map.addControl(new Nn.ScaleControl({maxWidth:80,unit:"metric"}),E),j.map.addControl(new Lg({compact:!0}),E),j.map.addControl(new zg,E),j.map.addControl(new Nn.GeolocateControl({trackUserLocation:!0}),E),window.innerWidth>992&&j.map.addControl(new Nn.FullscreenControl,E),await new Promise(c=>{j?.map&&j.map.on("load",()=>(document.querySelector(".maplibregl-compact-show")?.classList.remove("maplibregl-compact-show"),c(!0)))}),j.map.addSource("satellite",{type:"raster",tiles:["https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&FORMAT=image/jpeg&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}"],tileSize:256,attribution:"IGN"}),j.map.addLayer({id:"satellite-layer",type:"raster",source:"satellite"},"building-top"),j.map.setLayoutProperty("satellite-layer","visibility","none");for(const c of j.sources){const H={type:"geojson",data:{type:"FeatureCollection",features:[]}};(c==="poi"||c==="boucle-cluster"||c==="gares")&&(H.cluster=!0,H.clusterMaxZoom=14,H.clusterRadius=50),j.map.addSource(c,H)}await new Promise(c=>{j?.map&&j.map.on("sourcedata",()=>c(!0))});for(const c of Nm)j.map.addLayer(c);return j.map.resize(),j.map.on("mousemove",c=>{j.onMouseMove(c)}),j.map.on("click","clusters-boucle",c=>{j.onClickCluster(c)}),j.map.on("click","clusters-poi",c=>{j.onClickCluster(c)}),j.map.on("click","clusters-gare",c=>{j.onClickCluster(c)}),j.map.on("click",c=>{j.onClickMarker(c)}),j.elmPopupCarte?.querySelectorAll(".form-item-fond input").forEach(c=>{c.addEventListener("change",async H=>{const he=H.target;j.map.setLayoutProperty("satellite-layer","visibility",he.value==="satellite"?"visible":"none"),he.value==="satellite"&&Drupal.matomo.push("poi","options carte","satelitte")})}),j.elmPopupCarte?.querySelector(".close")?.addEventListener("click",()=>{j.elmPopupCarte?.classList.remove("open")}),document.getElementById("bouton-open-options")?.addEventListener("click",()=>{j.elmPopupCarte?.classList.toggle("open"),Drupal.matomo.push("poi","options carte","open")}),j}
800afficherEtapes(z){const L=[],j=["match",["get","id_etape"]],Z=["match",["get","id_etape"]];for(const E of z)L.push(E.id),j.push(E.id),j.push(E.color??this.color),Z.push(E.id),Z.push(hc(E.color??this.color));j.push(this.color),Z.push(this.color),this.map?.setFilter("etape-line-border",["in",["get","id_etape"],["literal",L]]),this.map?.setFilter("etape",["in",["get","id_etape"],["literal",L]]),this.map?.setPaintProperty("etape","line-color",j),this.map?.setPaintProperty("etape-hover","line-color",Z)}afficherItineraire(z){const{id:L,etape:j,color:Z,connexe:E}=z,c=j?typeof j=="string"?[j]:j:null,H=typeof z.aller=="boolean"?z.aller:!0;let he=Z??this.color;const xe=hc(Z??this.color),Ae=H?"first":"last",Le=H?"last":"first";c?(this.map?.setFilter("etape-line-border",["all",["==",["get","id"],L],["==",["get","direction"],H?"aller":"retour"]]),this.map?.setFilter("etape",["all",["==",["get","id"],L],["==",["get","direction"],H?"aller":"retour"]]),c.length===1&&this.map?.setFilter("segment",["in",c[0],["get",H?"aller":"retour"]]),he=["case",["in",["get","id_etape"],["literal",c]],he,"#a7a9ac"],this.map?.setFilter("etape-marker-debut",["all",["==",["get","id"],L],["==",["get","depart"],H],["any",["==",["get","etape"],Ae],["in",["get","id_etape"],["literal",c]]]]),this.map?.setFilter("etape-marker-fin",["all",["==",["get","id"],L],["==",["get","depart"],!H],["any",["==",["get","etape"],Le],["in",["get","id_etape"],["literal",c]]]]),this.map?.setFilter("liaison",["all",["in",["get","id_etape"],["literal",c]]]),this.map?.setFilter("provisoire",["all",["in",["get","id_etape"],["literal",c]]]),this.map?.setFilter("alternative",["all",["in",["get","id_etape"],["literal",c]]])):(this.map?.setFilter("etape-line-border",["all",["==",["get","id"],L],["==",["get","direction"],H?"aller":"retour"]]),this.map?.setFilter("etape",["all",["==",["get","id"],L],["==",["get","direction"],H?"aller":"retour"]]),this.map?.setFilter("etape-marker-debut",["all",["==",["get","etape"],Ae],["==",["get","depart"],H],["==",["get","id"],L]]),this.map?.setFilter("etape-marker-fin",["all",["==",["get","etape"],Le],["==",["get","depart"],!H],["==",["get","id"],L]])),E&&(this.map?.setFilter("itineraire-connexe-line-border",["in",["get","id"],["literal",E]]),this.map?.setFilter("itineraire-connexe",["in",["get","id"],["literal",E]])),this.map?.setPaintProperty("etape","line-color",he),this.map?.setPaintProperty("etape-hover","line-color",xe),this.map?.setFilter("etape-marker",["all",["==",["get","etape"],"etape"],["==",["get","id"],L]]),this.map?.setPaintProperty("etape-marker","circle-stroke-color",he)}afficherItinerairesDashed(z){this.map?.setFilter("itineraire-line-border",["in",["get","id"],["literal",z]]),this.map?.setFilter("itineraire-calculateur",["in",["get","id"],["literal",z]]),this.map?.setFilter("itineraire-etape",["all",["in",["get","id"],["literal",z]],["any",["==",["get","depart"],!0],["all",["==",["get","etape"],"last"],["==",["get","depart"],!1]]]])}clearItineraires(){this.map?.setFilter("itineraire-line-border",["all",!1]),this.map?.setFilter("itineraire",["all",!1])}afficherItineraires(z){const L=[],j=["match",["get","id"]],Z=["match",["get","id"]];for(const E of z){const c=E.color??this.color;L.push(E.id),j.push(E.id),j.push(c),Z.push(E.id),Z.push(hc(c))}j.push(this.color),Z.push(this.color),this.map?.setFilter("itineraire-line-border",["in",["get","id"],["literal",L]]),this.map?.setFilter("itineraire",["in",["get","id"],["literal",L]]),this.map?.setPaintProperty("itineraire","line-color",j),this.map?.setPaintProperty("itineraire-hover","line-color",Z)}clearTraceBoucle(){this.map?.setFilter("boucle",["all",!1])}afficherTraceBoucle(z){const L=["case",["==",["get","id"],z.id],z.color??this.color,"#a7a9ac"];this.map?.setFilter("boucle",["in",["get","id"],z.id]),this.map?.setPaintProperty("boucle","line-color",L)}async afficherBoucle(z){const L=await this.addImageMarkerBoucle(z.color??this.color),j=["case",["==",["get","id"],z.id],z.color??this.color,"#a7a9ac"];this.map?.setFilter("boucle",["in",["get","id"],z.id]),this.map?.setFilter("poi-boucle",["in",["get","id"],z.id]),this.map?.setPaintProperty("boucle","line-color",j),this.map?.setLayoutProperty("poi-boucle","icon-image",L)}clearBoucles(){this.map?.setFilter("poi-boucle",["all",!1])}async afficherBoucles(z){this.boucles=z;const L=z.map(c=>c.id),j=new Map;for(const c of z)j.has(c.color)||j.set(c.color,[]),j.get(c.color)?.push(c.id);if(j.size===0){this.map?.setFilter("poi-boucle",["all",!1]);return}const Z=["case"];let E=null;for(const[c,H]of j){const he=await this.addImageMarkerBoucle(c);Z.push(["in",["get","id"],["literal",H]]),Z.push(he),E=he}Z.push(E),this.map?.setLayoutProperty("poi-boucle","icon-image",Z),this.map?.setFilter("poi-boucle",["in",["get","id"],["literal",L]])}clearStyles(){for(const z of["etape-line-border","etape","etape-marker-debut","etape-marker-fin","etape-marker","segment","liaison","provisoire","alternative","
800itineraire-line-border","itineraire","itineraire-connexe-line-border","itineraire-connexe","boucle","poi-boucle","cluster-boucle"])this.map?.setFilter(z,["all",!1])}onMouseMove(z){if(this.map&&this.tooltip){const L=["etape","liaison","provisoire","alternative","itineraire","itineraire-connexe","cluster-boucle","itineraire-calculateur"];window.matchMedia("(min-width: 992px)").matches&&L.push("incontournable-marker");const j=this.map.queryRenderedFeatures(z.point,{layers:L});if(j.length>0){const Z=j[0];let E=Z.properties?.titre??Z.properties?.title??null;switch(Z.layer.id==="etape"&&(E=Z.properties.titre_etape),E&&(this.tooltip.setLngLat(z.lngLat).setHTML(E).addTo(this.map),this.map.getCanvas().style.cursor="pointer"),Z.layer.id){case"itineraire":this.map.setFilter("itineraire-line-border-hover",["all",["==",["get","id"],Z.properties.id],["==",["get","direction"],Z.properties.direction]]),this.map.setFilter("itineraire-hover",["all",["==",["get","id"],Z.properties.id],["==",["get","direction"],Z.properties.direction]]);break;case"etape":this.map.setFilter("etape-hover",["all",["==",["get","id_etape"],Z.properties.id_etape],["==",["get","direction"],Z.properties.direction]]);break;case"itineraire-connexe":this.map.setFilter("itineraire-connexe-hover",["all",["==",["get","id"],Z.properties.id],["==",["get","direction"],"aller"]]);break;case"cluster-boucle":this.map.setFilter("boucle",["==",["get","id"],Z.properties.id]);break;default:break}}else{this.map.getCanvas().style.cursor="",this.tooltip.remove();for(const Z of this.layersHover)this.map.setFilter(Z,["all",!1])}}}async waitForSource(z){const L=this.map;return new Promise(j=>{function Z(E){E.sourceId===z&&E.isSourceLoaded&&(L?.off("sourcedata",Z),j(!0))}this.map?.on("sourcedata",Z)})}async onClickMarker(z){if(!z.defaultPrevented&&this.map&&this.popup&&!this.localisationForm){z.preventDefault();let L=null,j=this.direction?"direction":"teaser";const Z=this.map.queryRenderedFeatures(z.point,{layers:["gare-marker","poi-marker","direction-poi-marker","marker","incontournable-marker"]}),E=this.map.queryRenderedFeatures(z.point,{layers:["itineraire-etape"]}),c=this.map.queryRenderedFeatures(z.point,{layers:["poi-ideeparcours"]}),H=this.map.queryRenderedFeatures(z.point,{layers:["poi-signalements-cours","poi-signalements-resolu","poi-signalements-signale"]}),he=this.map.queryRenderedFeatures(z.point,{layers:["itineraire","itineraire-connexe","itineraire-calculateur"],filter:["==",["get","direction"],"aller"]}),xe=this.map.queryRenderedFeatures(z.point,{layers:["poi-boucle"]}),Ae=this.map.queryRenderedFeatures(z.point,{layers:["etape"]});if(Z.length>0)L=Z[0];else if(E.length>0)E.length>1&&E.filter(Ee=>Ee.properties.depart===!0),E.length>0&&(L=E[0]);else if(H.length>0)L=H[0];else if(c.length>0)L=c[0];else if(Ae.length>0)L=Ae[0];else if(he.length>0){if(L=he[0],j="teaser",he.length>1){const Ee=Array.from(new Set(he.map(ze=>ze.properties.id)));L.properties.id=Ee.join(",")}}else if(xe.length>0){L=xe[0];const Ee=this.boucles.find(ze=>ze.id===L.properties.id);Ee&&(this.boucle=Ee,this.afficherTraceBoucle(Ee))}let Le=!0;if(L){const Ee=await this.getInfosView(L,j);Ee&&(Le=!1,await this.popup.show(Ee,z.lngLat))}Le&&(this.popup.remove(),this.boucle&&this.clearTraceBoucle())}}onClickCluster(z){if(!z.defaultPrevented&&this.map){z.preventDefault();const L=this.map.queryRenderedFeatures(z.point,{layers:["clusters-poi","cluster-boucle"]});if(L&&L.length>0){const j=L[0].properties.cluster_id,Z=L[0].source;this.map.getSource(Z).getClusterExpansionZoom(j).then(E=>{this.map?.easeTo({center:z.lngLat.toArray(),zoom:E})})}}}async getInfosView(z,L){let j=null;if(z?.properties?.type&&!z?.properties?.etape?j=z?.properties.type:z?.properties?.etape?(j="etape",z.properties.id=z.properties.id_etape):z.source==="ideeparcours"?j="node":z.sourceLayer==="boucle-point"?j="boucle":z.layer.id==="etape"?(j="etape",z.properties.id=z.properties.id_etape):(z.layer.id==="itineraire"||z.layer.id==="itineraire-connexe"||z.layer.id==="itineraire-calculateur")&&(j="itineraire"),!j)return null;const Z=await hg(j,z.properties?.id,L),E=document.createElement("div");return E.innerHTML=Z,this.direction&&this.popup&&this.direction.addEventPopup(E,this.popup,z),E}async addImageMarkerBoucle(z){const L=`boucle-${z.replace("#","")}`,j=`<svg xmlns="http://www.w3.org/2000/svg" width="29" height="32" viewBox="0 0 29 32"><path d="M21 0H8C3.58 0 0 3.58 0 8v12.44c0 4.42 3.58 8 8 8h2.88L14.5 32l3.62-3.56H21c4.42 0 8-3.58 8-8V8c0-4.42-3.58-8-8-8Zm0 26.44h-3.69l-.58.57-2.22 2.18-2.22-2.18-.58-.57H8.02c-3.31 0-6-2.69-6-6V8c0-3.31 2.69-6 6-6h13c3.31 0 6 2.69 6 6v12.44c0 3.31-2.69 6-6 6Z" style="fill:#fbfcf8"/><path d="M2 8v12.44c0 3.31 2.69 6 6 6h3.69l.58.57 2.22 2.18 2.22-2.18.58-.57h3.69c3.31 0 6-2.69 6-6V8c0-3.31-2.69-6-6-6h-13c-3.31 0-6 2.69-6 6Z" style="fill:${z}"/><path d="M6.02 13.53c0-1.57.55-2.91 1.65-4 1.1-1.1 2.43-1.65 4-1.65h5.65c1.57 0 2.91.55 4 1.65 1.1 1.1 1.65 2.43 1.65 4 0 1.46-.48 2.72-1.45 3.79-.96 1.07-2.17 1.68-3.61 1.84-.16.02-.3 0-.42-.09-.12-.08-.18-.2-.18-.34s.06-.26.18-.35c.12-.09.26-.14.42-.17 1.19-.15 2.17-.67 2.94-1.56s1.16-1.93 1.16-3.12c0-1.3-.46-2.41-1.38-3.33-.92-.92-2.03-1.38-3.33-1.38h-5.65c-1.3 0-2.41.46-3.33 1.38-.92.92-1.38 2.03-1.38 3.33s.46 2.43 1.37 3.35c.91.92 2.03 1.38 3.34 1.38h1.29l-1.63-1.64c-.09-.09-.13
800-.2-.13-.32s.05-.24.14-.33c.1-.1.21-.15.33-.15s.23.05.33.15l2.23 2.23c.15.15.23.33.23.53s-.08.38-.23.53l-2.25 2.25c-.09.09-.2.13-.32.13s-.24-.04-.33-.13a.463.463 0 0 1 0-.68l1.64-1.64h-1.31c-1.57 0-2.91-.55-4-1.66-1.1-1.1-1.65-2.44-1.65-4.01Z" style="fill:#1a171b"/></svg>`;return await this.loadSVG(L,j),L}async addImageMarkerIdeeParcours(z){const L=`idee-parcours-${z.replace("#","")}`,j=`<svg width="31" height="32" viewBox="0 0 31 32" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="a" fill="#fff"><path d="M22 0a8 8 0 0 1 8 8v12.444a8 8 0 0 1-8 8h-2.786l-2.23 2.163a2.075 2.075 0 0 1-2.872 0l-2.231-2.163H9a8 8 0 0 1-8-8V8a8 8 0 0 1 8-8z"/></mask><path d="M22 0a8 8 0 0 1 8 8v12.444a8 8 0 0 1-8 8h-2.786l-2.23 2.163a2.075 2.075 0 0 1-2.872 0l-2.231-2.163H9a8 8 0 0 1-8-8V8a8 8 0 0 1 8-8z" fill="${z}"/><path d="M30 8h2zM19.214 28.444v-2h-.81l-.582.565zm-2.23 2.163 1.392 1.436zm-2.872 0 1.393-1.435zm-2.231-2.163 1.392-1.436-.582-.564h-.81zm-2.881 0v2zM9 0v-2zm13 0v2a6 6 0 0 1 6 6h4c0-5.523-4.477-10-10-10zm8 8h-2v12.444h4V8zm0 12.444h-2a6 6 0 0 1-6 6v4c5.523 0 10-4.477 10-10zm-8 8v-2h-2.786v4H22zm-2.786 0-1.392-1.435-2.231 2.163 1.392 1.435 1.393 1.436 2.23-2.163zm-2.23 2.163-1.393-1.435-.011.007a.1.1 0 0 1-.032.005.1.1 0 0 1-.032-.005l-.011-.007-1.393 1.435-1.392 1.436a4.075 4.075 0 0 0 5.656 0zm-2.872 0 1.392-1.436-2.231-2.163-1.392 1.436-1.392 1.436 2.231 2.164zm-2.231-2.163v-2H9v4h2.88zm-2.881 0v-2a6 6 0 0 1-6-6h-4c0 5.523 4.477 10 10 10zm-8-8h2V8h-4v12.444zM1 8h2a6 6 0 0 1 6-6v-4C3.477-2-1 2.477-1 8zm8-8v2h13v-4H9z" fill="#fbfcf8" mask="url(#a)"/><path d="M15.667 22.13q-.196 0-.391-.064a1 1 0 0 1-.361-.209 29 29 0 0 1-1.803-1.82 20 20 0 0 1-1.66-2.078 12.3 12.3 0 0 1-1.222-2.194q-.477-1.119-.477-2.185 0-2.644 1.722-4.362T15.667 7.5t4.191 1.718 1.722 4.362q0 1.065-.477 2.177a13 13 0 0 1-1.215 2.194 18 18 0 0 1-1.651 2.078 30 30 0 0 1-1.803 1.812 1.1 1.1 0 0 1-.362.217q-.203.072-.405.072m.002-7.354q.557 0 .95-.397.394-.396.394-.952a1.3 1.3 0 0 0-.397-.95 1.3 1.3 0 0 0-.952-.394 1.3 1.3 0 0 0-.95.397 1.3 1.3 0 0 0-.394.952q0 .557.397.95.396.394.952.394" fill="#1a171b"/></svg>`;return await this.loadSVG(L,j),L}async loadSVG(z,L){if(this.map&&!this.map.hasImage(z)){const j="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(L),Z=new Image,E=new Promise(c=>{Z.onload=c});Z.src=j,await E,this.map.addImage(z,Z)}}clearMarkersIdeeParcours(){this.setSource("ideeparcours",{type:"FeatureCollection",features:[]})}async afficherMarkersIdeeParcours(z){const L={type:"FeatureCollection",features:[]};for(const j of z){const Z=await this.addImageMarkerIdeeParcours(j.color);L.features.push({type:"Feature",geometry:j.geometry,properties:{id:j.id,title:j.title,icon:Z}})}this.setSource("ideeparcours",L)}setSource(z,L){this.map&&this.map.getSource(z).setData(L)}async profilCarnet(z){const L=await cg(z);document.querySelector(".informations-techniques")?.insertAdjacentHTML("afterbegin",L.view),this.afficherProfilAltimetrique(L.profil.geometry,L.id)}async afficherProfilAltimetrique(z,L="profil"){const j=z.hasOwnProperty("type")?Ym(Km(z)):z;let Z=0,E=0,c=0,H=0;for(const be of j){const le=Math.round(be[2]*10)/10;le<c&&(c=Math.round(le)),le>H&&(H=Math.round(le))}H-100<c&&(Z=H-100),Z<=0&&(Z=-5),E=H+5;const he=this.map;function xe(be){const le=he.getSource("hover-point-profil");if(!be){he.setLayoutProperty("hover-point-profil","visibility","none");return}const[Be,Ne]=be;he.setLayoutProperty("hover-point-profil","visibility","visible"),le.setData({type:"Feature",geometry:{type:"Point",coordinates:[Be,Ne]},properties:{}})}const Ae={id:"xHover",afterInit(be){let le=null;be.canvas.addEventListener("mousemove",Be=>{const Ne=be.canvas.getBoundingClientRect(),ht=Be.clientX-Ne.left,dt=be.scales.x;if(ht>=dt.left&&ht<=dt.right){le=ht,be.render();const Vt=Math.round((ht-dt.left)/(dt.right-dt.left)*(j.length-1));Vt>=0&&Vt<j.length&&xe(j[Vt])}else le=null,be.render(),xe(null)}),be.canvas.addEventListener("mouseleave",()=>{le=null,be.render(),xe(null)}),be._hoverX=null,Object.defineProperty(be,"_hoverX",{get:()=>le})},afterDraw(be){const le=be._hoverX;if(le===null)return;const Be=be.ctx,Ne=be.scales.y.top,ht=be.scales.y.bottom;Be.save(),Be.beginPath(),Be.moveTo(le,Ne),Be.lineTo(le,ht),Be.lineWidth=1,Be.strokeStyle="#1A171B",Be.setLineDash([4,4]),Be.stroke(),Be.restore(
800)}},Le={labels:j.map(be=>`Altitude ${Math.round(be[2])} m`),datasets:[{tension:.4,pointRadius:0,fill:"start",backgroundColor:"#93D11E40",borderWidth:1,borderColor:"#93D11E",cubicInterpolationMode:"monotone",data:j.map(be=>be[2])}]},Ee={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{mode:"index",intersect:!1,displayColors:!1,callbacks:{label:()=>""}}},scales:{x:{display:!1},y:{stacked:!0,offset:!1,ticks:{count:5,color:"#1A171B",callback:be=>Math.round(be)+" m"},suggestedMax:E,suggestedMin:Z,afterBuildTicks(be){be.ticks=be.ticks.filter(le=>le.value>=0)}}}},ze=document.querySelector(`#${L}`);if(ze){const be=await ig(),le=be.getChart(ze);le&&le.destroy();const Be=ze.getContext("2d");Be&&new be(Be,{type:"line",data:Le,options:Ee,plugins:[Ae]})}}fitBounds(z,L){this.map?.fitBounds(z,{linear:!0,padding:L})}getCenter(){return this.map?this.map.getCenter().toArray():null}zoomIn(z){this.map?.easeTo({zoom:14,center:z,padding:100})}getMap(){return this.map??null}setDirection(z){this.direction=z}async showmarkers(z,L){const j=[];for(const Z of z){if(L)for(const E of Z.markers.features)j.push(E.geometry.coordinates);Z.source==="incontournables"?await this.showIncontournables(Z.markers):this.setSource(Z.source,Z.markers)}L&&this.fitBounds(Yd(j),100)}async addImageIncontournable(z,L){const j=`incontournable-${z}`,Z=`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="46" height="50" viewBox="0 0 46 50" fill="none"><mask id="b" fill="#fff"><path fill-rule="evenodd" clip-rule="evenodd" d="M8 0a8 8 0 0 0-8 8v28.444a8 8 0 0 0 8 8h9.188l4.293 4.164a2.076 2.076 0 0 0 2.871 0l4.294-4.164h9.187a8 8 0 0 0 8-8V8a8 8 0 0 0-8-8z"/></mask><path fill-rule="evenodd" clip-rule="evenodd" d="M8 0a8 8 0 0 0-8 8v28.444a8 8 0 0 0 8 8h9.188l4.293 4.164a2.076 2.076 0 0 0 2.871 0l4.294-4.164h9.187a8 8 0 0 0 8-8V8a8 8 0 0 0-8-8z" fill="url(#a)"/><path d="m17.188 44.444 1.392-1.435-.582-.565h-.81zm4.293 4.164-1.392 1.436zm2.871 0 1.393 1.436zm4.294-4.164v-2h-.81l-.582.565zM0 8h2a6 6 0 0 1 6-6v-4C2.477-2-2 2.477-2 8zm0 28.444h2V8h-4v28.444zm8 8v-2a6 6 0 0 1-6-6h-4c0 5.523 4.477 10 10 10zm9.188 0v-2H8v4h9.188zm4.293 4.164 1.392-1.436-4.293-4.163-1.392 1.435-1.393 1.436 4.294 4.163zm2.871 0-1.392-1.436-.011.007a.1.1 0 0 1-.032.005.1.1 0 0 1-.033-.005l-.01-.007-1.393 1.436-1.392 1.436a4.076 4.076 0 0 0 5.656 0zm4.294-4.164-1.393-1.435-4.293 4.163 1.392 1.436 1.393 1.436 4.293-4.164zm9.187 0v-2h-9.187v4h9.187zm8-8h-2a6 6 0 0 1-6 6v4c5.523 0 10-4.477 10-10zm0-28.444h-2v28.444h4V8zm-8-8v2a6 6 0 0 1 6 6h4c0-5.523-4.477-10-10-10zM8 0v2h29.833v-4H8z" fill="#fbfcf8" mask="url(#b)"/><defs><pattern id="a" patternContentUnits="objectBoundingBox" width="1" height="1"><use xlink:href="#c" transform="scale(.02)"/></pattern><image id="c" width="50" height="50" preserveAspectRatio="none" xlink:href="data:image/webp;base64,${L}"/></defs></svg>`;return await this.loadSVG(j,Z),j}masquerIncontournables(){this.setSource("incontournables",{type:"FeatureCollection",features:[]})}async showIncontournables(z){for(const L of z.features){const j=L.properties;j.image=await this.addImageIncontournable(j.id,j.image)}this.setSource("incontournables",z)}getBox(){if(this.map){const z=this.map.getBounds();
800return z.getSouthWest().lng+","+z.getSouthWest().lat+","+z.getNorthEast().lng+","+z.getNorthEast().lat}}setLocalisationForm(){this.localisationForm=!0,this.map&&this.map.on("click",j=>{const Z=this.map.queryRenderedFeatures(j.point,{layers:["itineraire"]}),E=document.getElementById("edit-coordonnees");if(Z.length>0&&E){let c=tn([j.lngLat.lng,j.lngLat.lat]);if(this.map.getZoom()<14){this.map.jumpTo({center:c.geometry.coordinates,zoom:Math.min(this.map.getZoom()+4,14)});return}E.value="";const H=Z[0];let he=[];if(H.geometry.type==="LineString"){he=H.geometry.coordinates;const xe=Mr(he),Ae=Dg(c,xe,{units:"kilometres"})*1e3;if(Ae>100){this.setSource("markers",{type:"FeatureCollection",features:[]});return}Ae>2&&(c=Mg(xe,c)),E.value=`${c.geometry.coordinates[1]}, ${c.geometry.coordinates[0]}`;const Le={type:"FeatureCollection",features:[{type:"Feature",geometry:c.geometry,properties:null}]};this.setSource("markers",Le)}}})}afficherRoutes(z,L,j=!1,Z="directions",E){const c={type:"FeatureCollection",features:[]};let H=[],he=0;for(const xe of z){let Ae=0,Le=1;if(xe.pointsEtapes){let ze=1;for(const be of xe.pointsEtapes){const le={type:"Feature",geometry:{type:"Point",coordinates:be},properties:{state:"etape",etape:ze}};c.features.push(le),ze++}}for(const ze of xe.points){let be=ze.type??"point";if(Ae===0?be="depart":Ae===xe.points.length-1&&be!==ze&&(be="arrivee"),be==="arrivee"&&E>xe.points.length&&(be="point"),ze.adresse){const le=ze.poi;if(le&&(le?.type==="sit"||le?.type==="aire-de-service")&&be==="point"){const Be={...le};delete Be.geometry;const Ne={type:"Feature",geometry:le.geometry,properties:Be};c.features.push(Ne)}else{const Be=ze.adresse;if(Be){const Ne={type:"Feature",geometry:Be.geometry,properties:{state:be,pointIndex:Ae}};be==="etape"&&(Ne.properties.etape=Le,Le++),c.features.push(Ne)}}}Ae++}const Ee=xe.routes??[xe.route];for(const ze of Ee){if(ze.geometry){const be=wo(ze.geometry);H=[...H,...be];const le={type:"Feature",geometry:{type:"LineString",coordinates:be},properties:{routeIndex:he,selected:L===void 0||he===L,cursor:"pointer",dashed:!1}};c.features.push(le)}else{let be=0;for(const le of ze.legs){if(le.geometry){const Be=wo(le.geometry);H=[...H,...Be];const Ne={type:"Feature",geometry:{type:"LineString",coordinates:Be},properties:{routeIndex:he,selected:L===void 0||he===L,cursor:"pointer",dashed:!1}};c.features.push(Ne)}Z==="transport"&&be<ze.legs.length-1&&(L===void 0||he===L)&&c.features.push({type:"Feature",geometry:le.to.geometry,properties:{state:"etape",etape:be+1}}),be++}}if(!xe.boucle&&(L===void 0||he===L))for(let be=0;be<2;be++){const le=be===0?xe.points[0]:xe.points[xe.points.length-1],Be=be===0?H[0]:H[H.length-1],Ne=le.adresse;Ne&&c.features.push({type:"Feature",geometry:{type:"LineString",coordinates:[Ne.geometry.coordinates,Be]},properties:{dashed:!0}})}he++}}this.setSource(Z,c),j&&(H.length>1?this.fitBounds(Yd(H),100):H.length===1&&this.zoomIn(H[0]))}afficherPlanificateur(z,L=!0){const j=[],Z=[];let E=[],c=[];const H=[],he=[],xe=[],Ae=[];let Le=[],Ee=[];for(const Tt of z)Tt.aller?(j.push(Tt.id),E=E.concat(Tt.etapes),Le=Le.concat(Tt.etapes.slice(0,-1)),H.push(Tt.etapes[0]),xe.push(Tt.etapes[Tt.etapes.length-1])):(Z.push(Tt.id),c=c.concat(Tt.etapes),Ee=Ee.concat(Tt.etapes.slice(0,-1)),he.push(Tt.etapes[0]),Ae.push(Tt.etapes[Tt.etapes.length-1]));const ze="#E68701",be=["case",["in",["get","id_etape"],["literal",[...E,...c]]],ze,"#a7a9ac"],le=hc(ze),Be=[],Ne=(Tt,nt,J)=>L?["all",["in",["get","id"],["literal",Tt]],["==",["get","direction"],J?"aller":"retour"]]:["all",["in",["get","id_etape"],["literal",nt]],["==",["get","direction"],J?"aller":"retour"]],ht=(Tt,nt)=>["all",["==",["get","depart"],nt],["in",["get","id_etape"],["literal",Tt]]];j.length>0&&Be.push(Ne(j,E,!0)),Z.length>0&&Be.push(Ne(Z,c,!1)),Be.length>0&&(this.map.setFilter("etape-line-border",["any",...Be]),this.map.setFilter("etape",["any",...Be])),this.map.setPaintProperty("etape","line-color",be),this.map.setPaintProperty("etape-hover","line-color",le);const dt=[],Vt=[],Ut=[];H.length&&dt.push(ht(H,!0)),he.length&&dt.push(ht(he,!1)),xe.length&&Vt.push(ht(xe,!1)),Ae.length&&Vt.push(ht(Ae,!0)),Le.length&&Ut.push(ht(Le,!1)),Ee.length&&Ut.push(ht(Ee,!1)),this.map.setFilter("planifier-marker-depart",["any",...dt]),this.map.setFilter("planifier-marker-arrivee",["any",...Vt]),this.map.setFilter("planifier-marker-etape",["any",...Ut])}},Xu=null,np=async()=>{let R=!!(typeof navigator<"u"&&navigator.geolocation);if(R&&!Xu)try{const z=await new Promise((L,j)=>{navigator.geolocation.getCurrentPosition(Z=>{L(Z)},Z=>{j(Z)})});Xu=await To([z.coords.longitude,z.coords.latitude])}catch{R=!1}return{autoriserLocalisation:R,adresse:Xu}},Yu=(function(R){return R.balade="balade",R.osm="osm",R.poi="poi",R})({}
800),sp=class extends EventTarget{input;adresse=null;items=[];item=null;popup=null;selectedIndex=0;constructor(R){super(),this.input=R,this.addHandlerInput()}removePopup(){document.removeEventListener("pointerdown",this.onOutsidePointerDown),this.popup?.remove(),this.popup=null,this.input.parentElement?.classList.remove("open-full-screen")}addHandlerInput(){this.input.addEventListener("input",()=>{this.callAutocomplete()}),this.input.addEventListener("focus",()=>{this.addPopup()}),this.input.addEventListener("click",()=>{this.input.value&&this.input.setSelectionRange(0,this.input.value.length)}),this.input.addEventListener("keydown",R=>{switch(R.key){case"Tab":case"Escape":this.close();break;case"Enter":this.enter();break}})}onOutsidePointerDown=R=>{const z=this.input?.parentElement,L=R.target;!z||!L||z.contains(L)||this.close()};enter(){this.select()}async searchAddress(R,z){return ag(R,z)}async autocomplet(){if(this.input.value&&this.input.value!==this.adresse?.label&&this.input.value.length>=3){let R=[],z=null;Drupal?.carteloopi?.carte&&(z=Drupal.carteloopi.carte.getCenter()),R=await this.searchAddress(this.input.value,z),this.items=R.map(L=>{let j=null,Z=!1;if(L.document===Yu.poi)j=eg(L),j&&(Z=!0);else if(L.document===Yu.osm){const c=[{types:["college","university"],icon:"school"},{types:["station"],icon:"directions_bus"},{types:["theatre"],icon:"explore"},{types:["post_office"],icon:"local_post_office"},{types:["hospital"],icon:"local_hospital"},{types:["garden","park"],icon:"nature_people"},{types:["peak"],icon:"landscape"},{types:["winter_sports"],icon:"downhill_skiing"},{types:["parking","bicycle_parking"],icon:"local_parking"},{types:["bicycle_rental"],icon:"directions_bike"},{types:["townhall"],icon:"info"},{types:["city"],icon:"location_city"}];if(L?.poi_types)for(const H of L.poi_types){const he=H.id.split(":")[2],xe=c.find(Ae=>Ae.types.includes(he));xe&&(j=xe.icon)}else if(L?.zone_type){const H=c.find(he=>he.types.includes(L?.zone_type));H&&(j=H.icon)}}let E=L?.label??L?.titre;return L.document===Yu.poi&&(E+=` (${L.ville.code_postal})`),{adresse:{label:E,geometry:L.geometry,ville:L.ville},item:L,icon:j,iconFvt:Z}})}}addHistorique(R,z){const L=this.getHistorique(R);L.some(j=>JSON.stringify(j)===JSON.stringify(z))||L.unshift(z),localStorage.setItem(R,JSON.stringify(L.slice(0,5)))}getHistorique(R){const z=localStorage.getItem(R);return z?JSON.parse(z):[]}callAutocomplete=Jm(async()=>{await this.autocomplet(),this.updateListItems()});updateListItems(){if(!this.popup){this.addPopup();return}if(this.popup?.querySelector(".list")?.setHTMLUnsafe(""),this.items.length>0){const R=document.createElement("ul");for(const[z,L]of this.items.entries()){const j=document.createElement("li");j.dataset.index=z.toString(),L.icon&&(L.iconFvt?j.dataset.iconFvt=L.icon:j.dataset.icon=L.icon),j.innerHTML=`<span>${this.formatDisplay(L.adresse)}</span>`,R.appendChild(j),j.addEventListener("click",()=>{this.selectedIndex=z,this.select()})}this.popup?.querySelector(".list")?.appendChild(R)}}formatDisplay(R){const z=R.label,L=this.input.value.trim().split(" ").map(j=>new RegExp(j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi"));return z.split(" ").map(j=>{let Z=j;for(const E of L)Z.length>1&&!Z.includes("<strong>")&&(Z=Z.replace(E,"<strong>$&</strong>"));return Z}).join(" ")}select(){const R=this.items[this.selectedIndex];this.item=R.item,this.adresse=R.adresse,this.input.value=this.adresse?.label??"",this.popup?.remove(),this.dispatchEvent(new CustomEvent("adresseChange",{bubbles:!0})),this.close()}onAdresseChange(R){this.addEventListener("adresseChange",(()=>{R(this)}))}onSelectInput(R){this.addEventListener("selectInput",(()=>{R(this)}))}getAdresse(){return this.adresse??null}setAdresse(R){this.adresse=R,this.input.value=R.label}getCoordinates(){return this.adresse?.geometry?.coordinates??null}isNull(){return this.input===null}remove(){this.input.parentNode?.remove(),this.input=null}clear(){this.adresse=null,this.input.value="",this.item=null}popupTemplate(){return`<div class="adresse-popup"> 801 <a href="#" class="close-input" data-icon="close"></a> 802 <div class="list"></div> 803 </div>`}addPopup(){if(this.popup)return;window.matchMedia("(min-width: 992px)").matches||this.input.parentElement.classList.add("open-full-screen");const R=document.createElement("div");R.innerHTML=this.popupTemplate(),this.popup=R?.firstElementChild?.cloneNode(!0),this.input.after(this.popup),Drupal.attachBehaviors(this.popup),this.updateListItems(),document.addEventListener("pointerdown",this.onOutsidePointerDown),this.popup.querySelector(".close-input")?.addEventListener("click",async z=>{this.close()})}close(){this.removePopup(),this.selectedIndex=0,this.items=[],this.adresse?this.input.value=this.adresse.label:this.input.value=""}
803getItem(){return this.item}},op=class Fd extends sp{type=null;poi=null;constructor(z,L=null){super(z),L&&(this.type=L)}static HISTORIQUE_KEY="adresse-historique";addHistoriqueAdresses(z){this.addHistorique(Fd.HISTORIQUE_KEY,z)}getHistoriqueAdresses(){return this.getHistorique(Fd.HISTORIQUE_KEY)}popupTemplate(){const z=Drupal.carteloopi?.carte?`<a href="#" class="bouton white vertical choixcarte" data-icon="map">${Drupal.t("Choisir sur la carte")}</a>`:"";return`<div class="adresse-popup"> 804 <a href="#" class="close-input" data-icon="close"></a> 805 <div class="actions"> 806 <a href="#" class="bouton white vertical maposition" data-icon="my_location">${Drupal.t("Utiliser ma position")}</a> 807 <a href="#" class="bouton white vertical fill d-none btfavoris" data-icon="favorite">${Drupal.t("Adresses enregistrées")}</a> 808 ${z} 809 </div> 810 <div class="list"></div> 811 </div>`}addPopup(){super.addPopup(),this.items.length===0&&(this.items=this.getHistoriqueAdresses().map(z=>({adresse:z,icon:"history"})),this.updateListItems()),this.popup?.querySelector(".maposition")?.addEventListener("click",async z=>{const L=await np();L.autoriserLocalisation&&(this.adresse=L.adresse,this.dispatchEvent(new CustomEvent("adresseChange",{bubbles:!0})),this.close())}),this.popup?.querySelector(".choixcarte")?.addEventListener("click",async z=>{this.dispatchEvent(new CustomEvent("selectInput",{bubbles:!0})),this.close()}),this.popup?.querySelector(".btfavoris")?.addEventListener("click",async z=>{const L=await gg(),j=document.createElement("div");j.innerHTML=L,document.body.appendChild(j),Drupal.attachBehaviors(j),j.querySelectorAll(".bt-add-etape-favoris").forEach(Z=>{Z.addEventListener("click",async E=>{E.preventDefault();const c=JSON.parse(Z.dataset.objet);this.setPoi(c),this.close(),document.querySelector('.modal[data-id="modal-add-epate-favoris"]')?.remove(),this.dispatchEvent(new CustomEvent("adresseChange",{bubbles:!0}))})})})}select(){super.select(),this.items[this.selectedIndex]?.icon!=="history"&&this.adresse&&this.addHistoriqueAdresses(this.adresse)}clear(){super.clear(),this.poi=null}getType(){return this.type&&this.type!==""?this.type:null}getPoi(){return this.poi}setPoi(z){this.poi=z;let L=z?.title;z?.titre_etape&&(L=z?.ville??z?.titre_etape),this.setAdresse({label:L,geometry:z.geometry,ville:z.ville})}},ap=class Lm{mode=null;elmProgress=null;carte;routes=[];routeSelected=0;elmFormDirection=null;static CALCUL_DEBOUNCE_MS=300;calculTimer=null;calculFitBounds=!1;calculPending=[];constructor(z,L){this.mode=L,this.carte=z,this.elmFormDirection=document.querySelector(`.form-direction[data-mode="${this.mode}"]`),this.elmFormDirection?.querySelector(".switch")?.addEventListener("click",async j=>{j.preventDefault(),await this.reverse()})}selectRoute(z){Drupal.carteloopi.onglet(this.mode),this.routeSelected!==z&&(this.routeSelected=z,this.afficherCalculIitineraire(),document.querySelectorAll(".route-direction").forEach(L=>{const j=L,Z=j.dataset?.index?+j.dataset.index:0;j.dataset.selected=String(Z===this.routeSelected)}))}handleAdresseChange(){this.calculerItineraire(!0)}showProgress(){this.elmProgress||(this.elmProgress=jQuery(Drupal.theme("ajaxProgressThrobber")),jQuery("body").after(this.elmProgress))}hideProgress(){this.elmProgress?.remove(),this.elmProgress=null}async setupResultsWrapper(z){const L=document.getElementById("directions-results");L&&(L.querySelector(".help")?.remove(),L.querySelector(`.directions-result-wrapper[data-mode="${this.mode}"]`)?.remove(),L.insertAdjacentHTML("beforeend",z),L.querySelectorAll(".route-teaser").forEach(j=>{j.addEventListener("click",Z=>{const E=Z.currentTarget?.parentElement;if(E){const c=E.dataset.index?+E.dataset.index:0;this.selectRoute(c)}})}),L.querySelectorAll(".afficher-detail").forEach(j=>{j.addEventListener("click",()=>{this.affichierDetail()})}),L.querySelectorAll(".back").forEach(j=>{j.addEventListener("click",()=>{document.querySelector("#page-planifier")?.classList.remove("detail")})}),Drupal.attachBehaviors(jQuery(`.directions-result-wrapper[data-mode="${this.mode}"]`).get(0)),this.routes.length===1&&await this.affichierDetail())}onClickMap(z){const L=this.carte?.getMap()?.queryRenderedFeatures(z.point,{filter:["all",["has","routeIndex"]]});L&&L.length>0&&this.selectRoute(+L[0].properties.routeIndex)}calculerItineraire(z){return this.calculFitBounds=this.calculFitBounds||!!z,this.calculTimer&&clearTimeout(this.calculTimer),new Promise((L,j)=>{this.calculPending.push({resolve:L,reject:j}),this.calculTimer=setTimeout(()=>{const Z=this.calculPending,E=this.calculFitBounds;this.calculPending=[],this.calculFitBounds=!1,this.calculTimer=null,this.executerCalculItineraire(E).then(()=>
811Z.forEach(c=>c.resolve()),c=>Z.forEach(H=>H.reject(c)))},Lm.CALCUL_DEBOUNCE_MS)})}},Rg=class extends ap{inputs=[];isDragging=!1;isLoading=!1;pointDrag=null;selectedInput=null;sortable=null;sortableLoading=!1;isBoucle=!1;decoupageNbEtape=0;carnet=null;elmDecouper=null;elmBtReduire=null;elmBtCreerBoucle=null;profil=null;abortController=null;pointsEtapes=[];constructor(R){super(R,"velo"),this.elmFormDirection&&(this.elmBtReduire=this.elmFormDirection?.querySelector("#reduire")),this.elmFormDirection&&(this.elmBtCreerBoucle=this.elmFormDirection?.querySelector("#creer-boucle"));const z=this.elmFormDirection?.querySelectorAll(".input-autocomplete input");for(const H of z)this.inputs.push(this.newInput(H));const L=new URLSearchParams(window.location.search),j=L.get("points"),Z=L.get("line"),E=L.get("arrivee");let c=[];if(E){const H=E.split(",");To([+H[0],+H[1]]).then(he=>this.inputs[this.inputs.length-1].setAdresse(he))}else Z?c=wo(Z):j&&(c=j.split(";").map(H=>{const he=H.split(",");return[+he[0],+he[1]]}));if(c.length>0&&(c.length>2&&this.toggleEtapes(!0),this.loadRoute(c).then()),R){const H=this.carte?.getMap();H&&(H.on("dblclick",this.onDblClickMap.bind(this)),H.on("mousedown",this.onMouseDown.bind(this)),H.on("mousemove",this.onMouseMove.bind(this)),H.on("click","direction-route-line",this.onClickMap.bind(this)))}np().then(H=>{H.autoriserLocalisation||document.querySelector("#template-adresse-popup .maposition")?.remove()}),this.elmFormDirection?.querySelector("#ajouter-une-etape")?.addEventListener("click",H=>{this.addInput("point"),this.toggleEtapes(!1)}),this.elmBtCreerBoucle?.addEventListener("click",async H=>{this.toogleBoucle(),await this.calculerItineraire()}),this.elmFormDirection?.querySelector("#afficher-etapes")?.addEventListener("click",H=>{this.toggleEtapes(!1)}),this.elmBtReduire?.addEventListener("click",H=>{this.toggleEtapes(!0)}),this.elmFormDirection?.querySelector("#clear-planifier")?.addEventListener("click",async H=>{await this.clear()})}async editCarnet(R){this.carnet=R.carnet,R.boucle&&this.toogleBoucle(!0);let z=0;for(const L of R.points)R.points.length>2&&z>0&&z<R.points.length-1?this.addInput(L.type??"point",L.adresse,L.poi??null):(this.inputs[z].setAdresse(L.adresse),L.poi&&this.inputs[z].setPoi(L.poi)),z++;R.points.length>2&&this.toggleEtapes(!0),await this.calculerItineraire(!0)}async loadRoute(R){const z=await Promise.all(R.map(j=>To([j[0],j[1]])));let L=0;for(const j of z)z.length>2&&L>0&&L<z.length-1?this.addInput("point",j):this.inputs[L].setAdresse(j),L++;await this.calculerItineraire(!0)}toggleEtapes(R){R?this.elmFormDirection?.classList.add("reduire"):this.elmFormDirection?.classList.remove("reduire")}findInsertIndex(R){const z=this.routes[this.routeSelected];if(!z?.legs?.length)return this.inputs.length-1;const L=this.inputs.map((H,he)=>({input:H,idx:he})).filter(({input:H})=>H.getAdresse()!==null);if(L.length<2)return this.inputs.length-1;const j=tn(R);let Z=1/0,E=0,c=!1;for(let H=0;H<z.legs.length;H++){const he=z.legs[H].steps.filter(Le=>Le.geometry).flatMap(Le=>wo(Le.geometry));if(he.length<2)continue;const xe=Zu(Mr(he),j),Ae=xe.properties.dist??1/0;if(Ae<Z){Z=Ae,E=H;const Le=he[he.length-1],Ee=xe.geometry.coordinates;c=Math.abs(Ee[0]-Le[0])<1e-6&&Math.abs(Ee[1]-Le[1])<1e-6}}return this.inputs[this.inputs.length-1]?.getAdresse()===null&&E===z.legs.length-1&&c?L[L.length-1].idx+1:L[E].idx+1}addInput(R,z,L,j){const Z=`<div class="input-etape-autocomplete"> 812 <a href="#" class="remove" data-icon="close"></a> 813 <input type="text" autocomplete="off" placeholder="${Drupal.t("Etape")}"> 814 </div>`,E=document.createElement("div");E.innerHTML=Z;const c=E?.firstElementChild?.cloneNode(!0),H=this.newInput(c.querySelector("input"),R),he=this.elmFormDirection?.querySelector(".etapes-inputs"),xe=j!==void 0?j:this.inputs.length-1,Ae=xe-1,Le=he?.querySelectorAll(":scope > .input-etape-autocomplete");return Le&&Ae<Le.length?he?.insertBefore(c,Le[Ae]):he?.append(c),this.inputs.splice(xe,0,H),c.querySelector(".remove")?.addEventListener("click",async Ee=>{Ee.preventDefault(),H.remove(),this.clean(),await this.calculerItineraire(!0)}),this.dragAndDrop(),z&&H.setAdresse(z),L&&H.setPoi(L),this.updateNbreEtapes(),H}newInput(R,z=null){const L=new op(R,z);return L.onAdresseChange(()=>{this.handleAdresseChange()}),L.onSelectInput(j=>{this.selectedInput=j}),L}async dragAndDrop(){if(!this.sortable&&!this.sortableLoading){const R=this.elmFormDirection?.querySelector(".etapes-inputs");this.sortableLoading=!0,this.sortable=(await rg().finally(()=>this.sortableLoading=!1)).create(R,{onEnd:async z=>{const L=this.inputs.splice(z.oldIndex+1,1)[0];this.inputs.splice(z.newIndex+1,0,L),await this.calculerItineraire(!1)}})}}async executerCalculItineraire(R){const z=this.pointsEtapes.length>0;if(this.pointsEtapes=[],Drupal.carteloopi.onglet("velo"),document.querySelector("#page-planifier")?.classList.remove("detail"),!this.carte)return;this.abortController&&(this.abortController.abort(),this.abortController=null);const L=this.inputs.map(j=>j.getAdresse()).filter(j=>j!==null);if(L.length<3&&this.toogleBoucle(!1),L.length>0&&(this.routes=[],L.length>1)){this.isBoucle&&L.push(L[0]),Drupal.matomo.push("calculateur","click","calculer itineraire");const j=new AbortController;this.abortController=j,this.showProgress();try{const Z=await ng(L,this.carnet,j.signal);this.routes=Z.routes,await this.setupResultsWrapper(Z.view)}catch(Z){if(Z?.name==="AbortError")return;throw Z}finally{this.abortController===j&&(this.abortController=null,this.hideProgress())}}this.abortController||this.hideProgress(),z&&this.decouper(),this.afficherCalculIitineraire(R)}afficherCalculIitineraire(R){const z=this.toPoints();this.toggleBoutonClear(this.inputs.length>0),this.carte&&this.carte.afficherRoutes([{routes:this.routes,points:z,boucle:this.isBoucle,pointsEtapes:this.pointsEtapes}],this.routeSelected,R,"directions",this.inputs.length)}async onDblClickMap(R){if(!this.isLoading){this.isLoading=!0;try{let z=this.selectedInput;if(z===null){let j=0;for(;z===null&&this.inputs.length>j;)this.inputs[j].getAdresse()===null&&(z=this.inputs[j]),j++}const L=[R.lngLat.lng,R.lngLat.lat];if(z){const j=await To(L);z.setAdresse(j),await this.calculerItineraire(!1)}else if(this.routes.length>0){const j=this.findInsertIndex(L),Z=this.addInput("point",void 0,void 0,j),E=await To(L);Z.setAdresse(E),this.toggleEtapes(!1),await this.calculerItineraire(!1)}this.selectedInput=null}finally{this.isLoading=!1}}}onMouseDown(){this.pointDrag===null||this.isLoading||(this.isDragging=!0,this.carte?.getMap()?.on("mousemove",this.onMove.bind(this)),this.carte?.getMap()?.once("mouseup",this.onUp.bind(this)))}onMove(R){this.isDragging&&this.pointDrag!==null&&this.afficherCalculIitineraireOnMove(this.pointDrag,[R.lngLat.lng,R.lngLat.lat])}async onUp(R){if(!(!this.isDragging&&this.pointDrag===null)){this.isDragging=!1,this.carte?.getMap()?.off("mousemove",this.onMove.bind(this)),this.isLoading=!0;try{this.showProgress();const z=await To([R.lngLat.lng,R.lngLat.lat]);this.hideProgress(),this.inputs[this.pointDrag??0].setAdresse(z),await this.calculerItineraire(!1)}finally{this.isLoading=!1}}}onMouseMove(R){if(!this.isDragging&&!this.isLoading&&this.carte){const z=this.carte.getMap();if(z){const L=z.queryRenderedFeatures(R.point,{filter:["all",["has","pointIndex"]]});L.length?(this.pointDrag=+L[0].properties.pointIndex,z.dragPan.disable()):(this.pointDrag=null,z.dragPan.enable())}}}
814afficherCalculIitineraireOnMove(R,z){const L=this.inputs.filter(j=>j.getAdresse());if(L.length>1){const j=[],Z={type:"FeatureCollection",features:[]};let E=0;for(const c of L){let H=c.getType()??"point";E===0?H="depart":E===L.length-1&&(H="arrivee",this.isBoucle&&(H="point"));const he=E===R?z:c.getAdresse().geometry.coordinates;j.push(he);const xe={type:"Feature",geometry:{type:"Point",coordinates:he},properties:{state:H,pointIndex:E,id:"marker"}};Z.features.push(xe),E++}Z.features.push({type:"Feature",geometry:{type:"LineString",coordinates:j},properties:{dashed:!0}}),this.carte?.setSource("directions",Z)}}async reverse(){this.inputs.reverse();const R=this.elmFormDirection?.querySelector(".inputs");R&&[...R.children].reverse().forEach(L=>R?.append(L));const z=this.elmFormDirection?.querySelector(".inputs .etapes-inputs");z&&[...z.children].reverse().forEach(L=>z?.append(L)),await this.calculerItineraire()}async affichierDetail(){const R=this.routes[this.routeSelected];this.routes.length>1&&document.querySelector("#page-planifier")?.classList.add("detail");const z=document.querySelector(`.route-direction[data-mode="velo"][data-index="${this.routeSelected}"]`);z&&(z.querySelector(".profil-altimetrique")||(this.profil=null,lg(R.geometry).then(L=>{this.profil=L,z.querySelector(".informations-techniques")?.insertAdjacentHTML("afterbegin",L.view),this.carte?.afficherProfilAltimetrique(L.profil.geometry,L.id)})),this.elmDecouper=z.querySelector(".decouper-etapes"),this.elmDecouper&&(this.decoupageNbEtape=Math.ceil(R.distance/6e4),this.decoupageUpdate(),this.elmDecouper.querySelector(".btdec")?.addEventListener("click",L=>{L.preventDefault(),this.decoupageNbEtape--,this.decoupageUpdate()}),this.elmDecouper.querySelector(".btinc")?.addEventListener("click",L=>{L.preventDefault(),this.decoupageNbEtape++,this.decoupageUpdate()}),this.elmDecouper.querySelector(".btdecouper")?.addEventListener("click",L=>{L.preventDefault(),this.decouper()})),document.querySelector(".download-gpx")?.addEventListener("click",async L=>{L.preventDefault();const j=this.routes[this.routeSelected];await this.downloadGpx(j)}),document.querySelector(".add-favoris")?.addEventListener("click",async L=>{L.preventDefault(),await this.addCarnetFavoris(L.currentTarget,!1)}),document.querySelector(".creer-carnet")?.addEventListener("click",async L=>{L.preventDefault(),await this.addCarnetFavoris(L.currentTarget,!0)}),document.querySelector(".save-carnet")?.addEventListener("click",async L=>{L.preventDefault(),await this.addCarnetFavoris(L.currentTarget,!0,this.carnet)}))}async addCarnetFavoris(R,z,L){const j=this.routes[this.routeSelected];await mg(R,j,this.toPoints(),this.isBoucle,z,L,this.profil?.profil,this.pointsEtapes)}toPoints(){return this.inputs.filter(R=>R.getAdresse()).map(R=>({adresse:R.getAdresse(),type:R.getType(),poi:R.getPoi()}))}decoupageUpdate(){if(this.elmDecouper){const R=this.routes[this.routeSelected],z=this.elmDecouper.querySelector(".nbetapes"),L=this.elmDecouper.querySelector(".kmjour"),j=this.elmDecouper.querySelector(".btdec"),Z=this.elmDecouper.querySelector(".btinc");if(L&&z&&j&&Z&&R){const E=Math.round(R.distance/this.decoupageNbEtape/1e3);z.innerHTML=String(this.decoupageNbEtape),L.innerHTML=String(E),this.decoupageNbEtape<=2?j.classList.add("none"):j.classList.remove("none"),R.distance/(this.decoupageNbEtape+1)<=2e4?Z.classList.add("none"):Z.classList.remove("none")}}}decouper(){this.elmProgress=jQuery(Drupal.theme("ajaxProgressThrobber")),jQuery("body").after(this.elmProgress);const R=this.routes[this.routeSelected],z=Math.round(R.distance/this.decoupageNbEtape);this.pointsEtapes=tg(R.geometry,z),this.elmProgress?.remove(),this.afficherCalculIitineraire(),window.matchMedia("(min-width: 992px)").matches||window.scrollTo({top:0,behavior:"smooth"})}clean(){this.inputs=this.inputs.filter(R=>!R.isNull()),this.updateNbreEtapes()}updateNbreEtapes(){const R=this.elmFormDirection?.querySelector("#afficher-etapes span");R&&(R.innerHTML=String(this.inputs.length-2)),this.inputs.length>=3?(this.elmBtReduire?.classList.add("show"),this.elmBtCreerBoucle?.classList.add("show")):(this.elmBtReduire?.classList.remove("show"),this.elmBtCreerBoucle?.classList.remove("show"))}addEventPopup(R,z,L){this.inputs.slice(1,this.inputs.length-1).filter(j=>j.getPoi()).map(j=>j.getPoi()?.id).includes(L.properties?.id)?R.querySelector(".bt-add-etape")?.remove():R.querySelector(".bt-remove")?.remove(),R.querySelector(".bt-add-depart")?.addEventListener("click",async j=>{j.preventDefault();const Z={...L.properties};Z.geometry=L.geometry,this.inputs[0].setPoi(Z),z.remove(),await this.calculerItineraire()}),R.querySelector(".bt-add-arrivee")?.addEventListener("click",async j=>{j.preventDefault();const Z={...L.properties};Z.geometry=L.geometry,this.inputs[this.inputs.length-1].setPoi(Z),z.remove(),await this.calculerItineraire()}),R.querySelector(".bt-remove")?.addEventListener("click",async j=>{j.preventDefault();const Z=this.inputs.findIndex(E=>E.getPoi()?.id===L.properties?.id);Z&&Z>0&&Z<this.inputs.length-1&&(this.inputs[Z].remove(),this.clean(),z.remove(),await this.calculerItineraire())}),R.querySelector(".bt-add-etape")?.addEventListener("click",async j=>{j.preventDefault();const Z=L.geometry.coordinates,E=this.findInsertIndex(Z),c=this.addInput("point",void 0,void 0,E),H={...L.properties};H.geometry=L.geometry,c.setPoi(H),z.remove(),await this.calculerItineraire(!1)})}toggleBoutonClear(R){const z=document.querySelector(".form-direction #clear-planifier");R?z.classList.remove("hide"):z.classList.add("hide")}async clear(){this.toogleBoucle(!1),this.routeSelected=0,this.routes=[];for(const R of this.inputs.slice(1,this.inputs.length-1))R.remove();this.inputs=[this.inputs[0],this.inputs[this.inputs.length-1]];for(const R of this.inputs)R.clear();this.clean(),this.afficherCalculIitineraire(),this.toggleBoutonClear(!1)}toogleBoucle(R){this.isBoucle=R??!this.isBoucle,this.isBoucle?this.elmBtCreerBoucle?.classList.add("on"):this.elmBtCreerBoucle?.classList.remove("on")}async downloadGpx(R){const z=this.toPoints(),L=await fg(R.geometry,z),j=new Blob([L],{type:"application/gpx+xml"}),Z=document.createElement("a");Z.style.display="none",Z.href=window.URL.createObjectURL(j),Z.download="route.gpx",document.body.appendChild(Z),Z.click()}},Bg=class Rd extends sp{static HISTORIQUE_KEY="gare-historique";gare=null;constructor(z){super(z)}async searchAddress(z,L){return og(z)}getStopId(){return this.gare}setStopId(z){this.gare=z}saveToHistorique(){this.adresse&&this.gare&&this.addHistorique(Rd.HISTORIQUE_KEY,{adresse:this.adresse,stopId:this.gare})}addPopup(){if(super.addPopup(),this.items.length===0){const z=this.getHistorique(Rd.HISTORIQUE_KEY);z.length>0&&(this.items=z.map(L=>({adresse:L.adresse,item:{id:L.stopId},icon:"history"})),this.updateListItems())}}select(){const z=this.items[this.selectedIndex];this.gare=z.item.id,super.select(),z?.icon!=="history"&&this.adresse&&this.saveToHistorique()}},Og=class extends ap{inputs=[];velo=!0;date=null;abortController=null;constructor(R){super(R,"train");const z=this.elmFormDirection?.querySelectorAll(".input-autocomplete input");for(const E of z){const c=new Bg(E);if(c.onAdresseChange(()=>{this.handleAdresseChange()}),this.inputs.push(c),R){const H=this.carte?.getMap();H&&H.on("click","transport-route-line",this.onClickMap.bind(this))}}const L=new URLSearchParams(window.location.search),j=L.get("garefrom"),Z=L.get("gareto");this.initDate(L.get("date")),j&&Z&&(this.velo=L.get("velo")==="1",this.loadGares(j,Z).then(()=>this.calculerItineraire().then())),this.elmFormDirection?.querySelector("#transport-en-velo")?.addEventListener("change",async E=>{this.velo=E.currentTarget.checked,await this.calculerItineraire()}),this.elmFormDirection?.querySelector("#date-transport")?.addEventListener("change",async E=>{this.date=new Date(E.currentTarget.value),await this.calculerItineraire()})}initDate(R){if(!R)return;const z=new Date(R.replace(" ","T"));if(isNaN(z.getTime()))return;this.date=z;const L=this.elmFormDirection?.querySelector("#date-transport");if(L){const j=Z=>String(Z).padStart(2,"0");L.value=`${z.getFullYear()}-${j(z.getMonth()+1)}-${j(z.getDate())}T${j(z.getHours())}:${j(z.getMinutes())}`}}async loadGares(R,z){const L=await Promise.all([Qd(R),Qd(z)]);this.inputs[0].setAdresse({label:L[0].titre,geometry:L[0].geometry,ville:L[0].ville}),this.inputs[0].setStopId(R),this.inputs[0].saveToHistorique(),this.inputs[1].setAdresse({label:L[1].titre,geometry:L[1].geometry,ville:L[1].ville}),this.inputs[1].setStopId(z),this.inputs[1].saveToHistorique()}async executerCalculItineraire(){if(!this.carte)return;this.abortController&&(this.abortController.abort(),this.abortController=null);const R=this.inputs.map(z=>z.getAdresse()).filter(z=>z!==null);if(R.length>0&&(this.routes=[],R.length===2)){const z=this.inputs.map(j=>j.getStopId()),L=new AbortController;this.abortController=L,this.showProgress();try{const j=await sg(R,z,this.date,this.velo,L.signal);this.routes=j.routes,await this.setupResultsWrapper(j.view)}catch(j){if(j?.name==="AbortError")return;throw j}finally{this.abortController===L&&(this.abortController=null,this.hideProgress())}}this.abortController||this.hideProgress(),this.afficherCalculIitineraire()}afficherCalculIitineraire(){const R=this.toPoints();this.carte&&this.carte.afficherRoutes([{routes:this.routes,points:R,boucle:!1}],this.routeSelected,!0,"transport")}async affichierDetail(){this.routes.length>1&&document.querySelector("#page-planifier")?.classList.add("detail")}toPoints(){return this.inputs.filter(R=>R.getAdresse()).map(R=>({adresse:R.getAdresse()}))}async reverse(){this.inputs.reverse();const R=this.elmFormDirection?.querySelector(".inputs");
814R&&[...R.children].reverse().forEach(z=>R?.append(z)),await this.calculerItineraire()}},Vg=class{carte;filtres=[];options=new Map;itineraire=null;abortController;afficherSignalement=!1;markers={type:"FeatureCollection",features:[]};markersSignalements;elmFiltrePoi=document.getElementById("filtres-poi");elmPopupFiltres=document.querySelector("#filtres-poi .popup-filtre-poi");elmProgress;currentCategorie=null;constructor(R,z){this.itineraire=z,this.carte=R,this.options.set("accueilvelo",!0),this.elmFiltrePoi?.querySelectorAll(".categories a").forEach(L=>{L.addEventListener("click",async j=>{j.preventDefault(),j.stopPropagation(),this.elmPopupFiltres?.classList.remove("open");const Z=L.dataset.id;Z&&(Z==="signalement"?await this.toggleSignalements():this.currentCategorie===Z?(this.currentCategorie=null,this.elmPopupFiltres?.classList.remove("open")):(this.elmPopupFiltres?.querySelectorAll(".categories-data.show").forEach(E=>{E.classList.remove("show")}),this.elmPopupFiltres?.querySelectorAll(`.categories-data[data-id="${Z}"]`).forEach(E=>{Drupal.matomo.push("poi","open",Z),E.classList.add("show")}),this.elmPopupFiltres?.classList.add("open"),this.currentCategorie=Z))})}),this.elmFiltrePoi?.querySelectorAll(".form-item-categories .form-checkboxes input").forEach(L=>{L.addEventListener("change",async j=>{const Z=j.target,E=this.getFiltre(this.currentCategorie);if(Z.checked)E.categories.push(Z.value),Drupal.matomo.push("poi","afficher",Z.value);else{const c=E.categories.indexOf(Z.value);E.categories.splice(c,1)}await this.search()})}),this.elmFiltrePoi?.querySelectorAll(".form-item-categories .options input").forEach(L=>{L.addEventListener("change",async j=>{const Z=j.target;Z.type==="checkbox"?this.options.set(Z.name,Z.checked):this.options.set(Z.name,Z.value),Z.name==="accueilvelo"?Drupal.matomo.push("poi","uniquement accueil velo"):Z.name==="nuitee"&&Z.checked?Drupal.matomo.push("poi","Disponible à la nuitée"):Z.name==="forfait"&&Z.checked?Drupal.matomo.push("poi","Forfait cycliste"):Z.name==="hebergement_legers"&&Z.checked&&Drupal.matomo.push("poi","Hébergements légers"),await this.search()})}),this.elmFiltrePoi?.querySelectorAll(".checkall").forEach(L=>{L.addEventListener("click",async j=>{if(j.preventDefault(),this.currentCategorie){const Z=[];this.elmFiltrePoi?.querySelectorAll(`.form-item-categories .form-checkboxes input[data-parent="${this.currentCategorie}"]`).forEach(c=>{const H=c;H.checked=!0,Z.push(H.value)});const E=this.getFiltre(this.currentCategorie);E.categories=Z,await this.search()}})}),this.elmFiltrePoi?.querySelectorAll(".uncheckall").forEach(L=>{L.addEventListener("click",async j=>{if(j.preventDefault(),this.currentCategorie){this.elmFiltrePoi?.querySelectorAll(`.form-item-categories .form-checkboxes input[data-parent="${this.currentCategorie}"]`).forEach(E=>{const c=E;c.checked=!1});const Z=this.getFiltre(this.currentCategorie);Z.categories=[],await this.search()}})}),this.elmFiltrePoi?.querySelectorAll(".close").forEach(L=>{L.addEventListener("click",j=>{j.preventDefault(),this.elmPopupFiltres?.classList.remove("open")})}),document.addEventListener("click",L=>{const j=document.querySelector("#filtres-poi .popup-filtre-poi");!this.elmPopupFiltres||!this.elmPopupFiltres.classList.contains("open")||j.contains(L.target)||this.elmPopupFiltres?.classList.remove("open")})}getFiltre(R){let z=this.filtres.find(L=>L.code===R);return z||(z={code:R,categories:[]},this.filtres.push(z)),z}async search(){this.elmProgress||(this.elmProgress=jQuery(Drupal.theme("ajaxProgressThrobber")),jQuery("body").after(this.elmProgress)),this.abortController&&this.abortController.abort(),this.abortController=new AbortController;const R=this.abortController.signal;for(const L of this.filtres){const j=this.elmFiltrePoi?.querySelector(`.categories a[data-id="${L.code}"]`);j&&(L.categories.length===0?(j.classList.remove("selected"),j.querySelector("span")?.remove()):(j.classList.add("selected"),j.dataset.iconAfter&&(j.querySelector("span")?.remove(),j.insertAdjacentHTML("beforeend",`<span>${L.categories.length}</span>`))))}const z=this.filtres.filter(L=>L.categories.length>0);if(z.length>0)try{this.markers=await ug({filtres:z,options:Object.fromEntries(this.options),itineraire:this.itineraire},R)}catch{}else this.markers={type:"FeatureCollection",features:[]};this.carte.setSource("poi",this.markers),this.elmProgress?.remove(),this.elmProgress=null}async toggleSignalements(){this.afficherSignalement=!this.afficherSignalement;const R=document.querySelector('#filtres-poi .categories a[data-id="signalement"]');R&&(this.afficherSignalement?(R.classList.add("selected"),this.markersSignalements||(this.markersSignalements=await dg(this.itineraire)),this.markersSignalements&&this.carte.setSource("signalements",this.markersSignalements)):(R.classList.remove("selected"),this.carte.setSource("signalements",{type:"FeatureCollection",features:[]})))}toogleCategorie(R){const z=this.elmFiltrePoi?.querySelector(`.form-item-categories .form-checkboxes input[value="${R}"]`);z&&(z.checked=!z.checked,z.dispatchEvent(new Event("change",{bubbles:!0})))}}
814,lp=class extends EventTarget{input;planificateur;depart;selectedIndex;constructor(R,z,L){super(),this.input=R,this.planificateur=z,this.depart=L,this.updateListItems(),this.input.addEventListener("change",()=>{this.select()}),this.updateValue()}updateValue(){const R=this.depart?this.planificateur.from:this.planificateur.to,z=[...this.input.options].findIndex(L=>L.value===R.entity.toString());z!==-1&&(this.input.selectedIndex=z)}getValue(R){return this.depart?this.planificateur.aller?R.depart:R.arrivee:this.planificateur.aller?R.arrivee:R.depart}callAutocomplete(){}reload(){this.updateListItems(),this.updateValue()}updateListItems(){let R=[];if(this.depart){const z=this.planificateur.etapes.findIndex(L=>L.id===this.planificateur.to.id);R=[...this.planificateur.etapes.slice(0,z+1)]}else{const z=this.planificateur.etapes.findIndex(L=>L.id===this.planificateur.from.id);R=[...this.planificateur.etapes.slice(z)]}this.input.innerHTML="";for(const z of R){const L=document.createElement("option");L.value=z.entity,L.textContent=this.getValue(z),this.input.appendChild(L)}}select(){const R=this.planificateur.etapes.find(z=>z.entity.toString()===this.input.value);R&&(this.depart?this.planificateur.from=R:this.planificateur.to=R,this.dispatchEvent(new CustomEvent("etapeChange",{bubbles:!0})))}onEtapeChange(R){this.addEventListener("etapeChange",(()=>{R(this)}))}},jg=class{depart;arrivee;planificateur;carte;constructor(R,z){const L=document.querySelectorAll("select.planifier-etape");this.planificateur=z,this.carte=R,this.carte&&this.showTrace(),this.depart=new lp(L[0],this.planificateur,!0),this.depart.onEtapeChange(async()=>{await this.handleEtapeChange()}),this.arrivee=new lp(L[1],this.planificateur,!1),this.arrivee.onEtapeChange(async()=>{await this.handleEtapeChange()}),document.querySelectorAll(".switch-planifier-etape").forEach(j=>{j.addEventListener("click",async Z=>{Z.preventDefault(),await this.reverse()})})}showTrace(){if(this.carte){const{uuidItineraire:R,etapesSelected:z,aller:L}=this.planificateur;this.carte.afficherPlanificateur([{id:R,etapes:z,aller:L}])}}async handleEtapeChange(){this.depart.reload(),this.arrivee.reload(),await this.planifier()}async planifier(){if(this.carte){const R=jQuery(Drupal.theme("ajaxProgressThrobber"));jQuery("body").after(R);const z=await pg(this.planificateur.itineraire,this.planificateur.from.entity,this.planificateur.to.entity),L=document.getElementById("planificateur-results");L&&(L.innerHTML=z.html,Drupal.attachBehaviors(L,z.settings),await Drupal.carteloopi.actions(z.settings.carte.actions,z.settings.carte),this.planificateur.etapesSelected=z.settings.carte.planifier.etapesSelected),document.getElementById("etapes-count").innerHTML=z.settings.carte.planifier.nbEtapes,document.getElementById("etapes-distance").innerHTML=z.settings.carte.planifier.distance,this.showTrace(),R?.remove()}}async reverse(){const R={...this.planificateur.from};this.planificateur.from={...this.planificateur.to},this.planificateur.to=R,this.planificateur.etapes=this.planificateur.etapes.reverse(),this.planificateur.aller=!this.planificateur.aller,this.depart.reload(),this.arrivee.reload(),await this.planifier()}},Ng={carte:Fg,direction:Rg,poi:Vg,inputAdresse:op,planifier:jg,transport:Og};return Ng});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.